diff options
-rw-r--r-- | bbcode/src/Text/BBCode.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bbcode/src/Text/BBCode.hs b/bbcode/src/Text/BBCode.hs index 4b2ee6e..1e9960a 100644 --- a/bbcode/src/Text/BBCode.hs +++ b/bbcode/src/Text/BBCode.hs | |||
@@ -38,7 +38,7 @@ data TreeError = MismatchedTags Text Text -- ^ Closing tags does not match openi | |||
38 | instance Exception TreeError | 38 | instance Exception TreeError |
39 | 39 | ||
40 | -- | The label of our rose-tree nodes carries the tag name and a map of attributes | 40 | -- | The label of our rose-tree nodes carries the tag name and a map of attributes |
41 | type BBLabel = (Text, Map Text (Maybe Text)) | 41 | type BBLabel = (Text, Maybe (Map Text (Maybe Text))) |
42 | 42 | ||
43 | matches :: Text -> Text -> Bool | 43 | matches :: Text -> Text -> Bool |
44 | -- ^ @`matches` "open" "close"@ should be 'True' iff @[/close]@ is a valid closing tag for @[open]@ | 44 | -- ^ @`matches` "open" "close"@ should be 'True' iff @[/close]@ is a valid closing tag for @[open]@ |
@@ -54,8 +54,8 @@ rose = fmap Z.toForest . flip rose' (Z.fromForest []) | |||
54 | rose' [] = return | 54 | rose' [] = return |
55 | rose' (x:xs) = (>>= rose' xs) . rose'' x | 55 | rose' (x:xs) = (>>= rose' xs) . rose'' x |
56 | 56 | ||
57 | rose'' (BBStr t) = return . Z.nextSpace . Z.insert (Node (t, Map.empty) []) | 57 | rose'' (BBStr t) = return . Z.nextSpace . Z.insert (Node (t, Nothing) []) |
58 | rose'' (BBOpen t attrs) = return . Z.children . Z.insert (Node (t, Map.fromList attrs) []) | 58 | rose'' (BBOpen t attrs) = return . Z.children . Z.insert (Node (t, Just $ Map.fromList attrs) []) |
59 | rose'' (BBClose t) = close t -- for more pointless | 59 | rose'' (BBClose t) = close t -- for more pointless |
60 | 60 | ||
61 | close :: Text -> TreePos Empty BBLabel -> Either TreeError (TreePos Empty BBLabel) | 61 | close :: Text -> TreePos Empty BBLabel -> Either TreeError (TreePos Empty BBLabel) |