diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-15 01:22:56 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-15 01:22:56 +0000 |
commit | ca9d7f5b760cb3d56d7785b357590f54ede5b469 (patch) | |
tree | 2eb2e60e196c80b227320dbbda8fe0aa7815296d /bbcode/test/Text/BBCode | |
parent | 848d2a3df2d555cf10eeff275cba2091f6b5b64c (diff) | |
download | thermoprint-ca9d7f5b760cb3d56d7785b357590f54ede5b469.tar thermoprint-ca9d7f5b760cb3d56d7785b357590f54ede5b469.tar.gz thermoprint-ca9d7f5b760cb3d56d7785b357590f54ede5b469.tar.bz2 thermoprint-ca9d7f5b760cb3d56d7785b357590f54ede5b469.tar.xz thermoprint-ca9d7f5b760cb3d56d7785b357590f54ede5b469.zip |
BBCode now understands paragraphs
Diffstat (limited to 'bbcode/test/Text/BBCode')
-rw-r--r-- | bbcode/test/Text/BBCode/LexerSpec.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bbcode/test/Text/BBCode/LexerSpec.hs b/bbcode/test/Text/BBCode/LexerSpec.hs index e225fab..117006c 100644 --- a/bbcode/test/Text/BBCode/LexerSpec.hs +++ b/bbcode/test/Text/BBCode/LexerSpec.hs | |||
@@ -32,6 +32,7 @@ coToken (BBOpen t xs) = "[" <> escape [']'] t <> " " <> attrs <> " ]" | |||
32 | coToken (BBContained t xs) = (<> "/]") . T.init . coToken $ BBOpen t xs | 32 | coToken (BBContained t xs) = (<> "/]") . T.init . coToken $ BBOpen t xs |
33 | coToken (BBClose t) = "[/" <> escape [']'] t <> "]" | 33 | coToken (BBClose t) = "[/" <> escape [']'] t <> "]" |
34 | coToken (BBStr t) = escape ['['] t | 34 | coToken (BBStr t) = escape ['['] t |
35 | coToken BBNewPar = "\n\n" | ||
35 | 36 | ||
36 | escape :: [Char] -> Text -> Text | 37 | escape :: [Char] -> Text -> Text |
37 | -- ^ Inverse of `escapedText` | 38 | -- ^ Inverse of `escapedText` |
@@ -108,4 +109,10 @@ examples = [ ("[t]test[/t]" | |||
108 | , [BBContained "br" [("attr", "val"), ("val2", "")]]) | 109 | , [BBContained "br" [("attr", "val"), ("val2", "")]]) |
109 | , ("[foo\\/bar]" | 110 | , ("[foo\\/bar]" |
110 | , [BBOpen "foo/bar" []]) | 111 | , [BBOpen "foo/bar" []]) |
112 | , ("foo\nbar" | ||
113 | , [BBStr "foo\nbar"]) | ||
114 | , ("foo\n\nbar" | ||
115 | , [BBStr "foo", BBNewPar, BBStr "bar"]) | ||
116 | , ("foo\n\n\r\n\r\nbar" | ||
117 | , [BBStr "foo", BBNewPar, BBStr "bar"]) | ||
111 | ] | 118 | ] |