diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-15 03:48:40 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-15 03:48:40 +0000 |
commit | ad3c28c1687d4a0a43a34d496c312baf05b85ca8 (patch) | |
tree | 13221e6b6ce50311943db988e64393ebea92dda3 | |
parent | a39c0ae45bf3485fbcb080576f8089ead05a94af (diff) | |
download | thermoprint-ad3c28c1687d4a0a43a34d496c312baf05b85ca8.tar thermoprint-ad3c28c1687d4a0a43a34d496c312baf05b85ca8.tar.gz thermoprint-ad3c28c1687d4a0a43a34d496c312baf05b85ca8.tar.bz2 thermoprint-ad3c28c1687d4a0a43a34d496c312baf05b85ca8.tar.xz thermoprint-ad3c28c1687d4a0a43a34d496c312baf05b85ca8.zip |
case insensitive tags & attributes
-rw-r--r-- | bbcode/src/Text/BBCode.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bbcode/src/Text/BBCode.hs b/bbcode/src/Text/BBCode.hs index 2fdf3dc..fbd8a33 100644 --- a/bbcode/src/Text/BBCode.hs +++ b/bbcode/src/Text/BBCode.hs | |||
@@ -39,7 +39,7 @@ import qualified Data.CaseInsensitive as CI | |||
39 | import Data.Bifunctor (Bifunctor(first)) | 39 | import Data.Bifunctor (Bifunctor(first)) |
40 | 40 | ||
41 | -- | Our target structure -- a rose tree with an explicit terminal constructor | 41 | -- | Our target structure -- a rose tree with an explicit terminal constructor |
42 | data DomTree = Element Text (Map Text Text) [DomTree] | 42 | data DomTree = Element (CI Text) (Map (CI Text) Text) [DomTree] |
43 | | Paragraph [DomTree] | 43 | | Paragraph [DomTree] |
44 | | Content Text | 44 | | Content Text |
45 | deriving (Show, Eq) | 45 | deriving (Show, Eq) |
@@ -51,7 +51,7 @@ dom :: Forest BBLabel -> [DomTree] | |||
51 | dom = map dom' | 51 | dom = map dom' |
52 | where | 52 | where |
53 | dom' (Node (BBPlain t) _) = Content t | 53 | dom' (Node (BBPlain t) _) = Content t |
54 | dom' (Node (BBTag t attrs) ts) = Element t attrs $ map dom' ts | 54 | dom' (Node (BBTag t attrs) ts) = Element (CI.mk t) (Map.mapKeys CI.mk attrs) $ map dom' ts |
55 | dom' (Node BBPar ts) = Paragraph $ map dom' ts | 55 | dom' (Node BBPar ts) = Paragraph $ map dom' ts |
56 | 56 | ||
57 | -- | Errors encountered during parsing | 57 | -- | Errors encountered during parsing |