git @ Cat's Eye Technologies Falderal / 7422114
Output of formatter comes /pretty/ close to the original, now. catseye 10 years ago
1 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
5555
5656 formatLines formatter lines = foldl (++) "" (map (formatter) lines)
5757
58 -- TODO: find out what's stripping out empty lines and stop it!
59
5860 formatLine (TestInput text) =
5961 (prefixEachLine "| " text)
6062 formatLine (ExpectedResult text) =
61 (prefixEachLine "= " text) ++ "\n"
63 (prefixEachLine "= " text)
6264 formatLine (ExpectedError text) =
63 (prefixEachLine "? " text) ++ "\n"
65 (prefixEachLine "? " text)
6466 formatLine (LiteralText text) =
6567 (prefixEachLine "" text) ++ "\n"
6668 formatLine (QuotedCode text) =
67 (prefixEachLine "> " text) ++ "\n"
69 (prefixEachLine "> " text)
6870 formatLine (SectionHeading text) =
69 (prefixEachLine "# " text) ++ "\n" -- atx-style for now
71 text ++ "\n" ++ (take (length text) (repeat '-')) ++ "\n"
7072
7173 prefixEachLine prefix text =
7274 foldl (++) "" (map (\x -> prefix ++ x ++ "\n") (lines text))