diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-12 05:21:16 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-12 05:21:16 +0000 |
commit | fe17c720081798175c9936d1624f428b565e310f (patch) | |
tree | 8cb2b9520f90a21e54e5b6dac4588ef4ed6e3a9c /bbcode/src/Text/BBCode | |
parent | a5d285a8b74d2278e8549909d29c01b62dc84424 (diff) | |
download | thermoprint-fe17c720081798175c9936d1624f428b565e310f.tar thermoprint-fe17c720081798175c9936d1624f428b565e310f.tar.gz thermoprint-fe17c720081798175c9936d1624f428b565e310f.tar.bz2 thermoprint-fe17c720081798175c9936d1624f428b565e310f.tar.xz thermoprint-fe17c720081798175c9936d1624f428b565e310f.zip |
Rose-Tree labels now carry attributes
Diffstat (limited to 'bbcode/src/Text/BBCode')
-rw-r--r-- | bbcode/src/Text/BBCode/Lexer.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bbcode/src/Text/BBCode/Lexer.hs b/bbcode/src/Text/BBCode/Lexer.hs index ad26113..2eb0022 100644 --- a/bbcode/src/Text/BBCode/Lexer.hs +++ b/bbcode/src/Text/BBCode/Lexer.hs | |||
@@ -29,9 +29,12 @@ data BBToken = BBOpen Text [(Text, Maybe Text)] -- ^ Tag open with attributes | |||
29 | token :: Parser BBToken | 29 | token :: Parser BBToken |
30 | -- ^ Tokenizer | 30 | -- ^ Tokenizer |
31 | token = BBClose <$> ("[/" *> escapedText' [']'] <* "]") | 31 | token = BBClose <$> ("[/" *> escapedText' [']'] <* "]") |
32 | <|> BBOpen <$> ("[" *> escapedText' [']', ' ']) <*> (option [] attrs <* "]") | 32 | <|> uncurry BBOpen <$> openTag |
33 | <|> BBStr <$> escapedText ['['] | 33 | <|> BBStr <$> escapedText ['['] |
34 | 34 | ||
35 | openTag :: Parser (Text, [(Text, Maybe Text)]) | ||
36 | openTag = (,) <$> ("[" *> escapedText' [']', ' ']) <*> (option [] attrs <* "]") | ||
37 | |||
35 | attrs :: Parser [(Text, Maybe Text)] | 38 | attrs :: Parser [(Text, Maybe Text)] |
36 | attrs = (:) <$> (attrs' <* takeWhile isSpace) <*> (option [] $ attrs) | 39 | attrs = (:) <$> (attrs' <* takeWhile isSpace) <*> (option [] $ attrs) |
37 | where | 40 | where |