]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Parser.hs
Wrote many...
[Rakka.git] / Rakka / Wiki / Parser.hs
index 7e0c1a90b8517037a10db00011bf630cb9be5d72..6e4edeb4bc5c604aab1f6e97c0080471c1ebeff4 100644 (file)
@@ -73,16 +73,15 @@ horizontalLine = try ( do count 4 (char '-')
 
 
 listElement :: CommandTypeOf -> Parser BlockElement
-listElement cmdTypeOf = listElement' [] >>= return . List
+listElement cmdTypeOf = listElement' []
     where
-      listElement' :: [Char] -> Parser ListElement
+      listElement' :: [Char] -> Parser BlockElement
       listElement' stack
           = do t  <- oneOf "*#"
                ws
                xs <- items (stack ++ [t])
-               return (ListElement (toType t) xs)
+               return (List (toType t) xs)
 
-      -- ListItem の終了條件は、
       items :: [Char] -> Parser [ListItem]
       items stack = do xs     <- many1 $ inlineElement cmdTypeOf
                        nested <- option Nothing
@@ -91,7 +90,7 @@ listElement cmdTypeOf = listElement' [] >>= return . List
                                             string stack
                                             listElement' stack >>= return . Just
                        rest <- items stack
-                       return $ (map Right xs ++ map Left (catMaybes [nested])) : rest
+                       return $ (map Inline xs ++ map Block (catMaybes [nested])) : rest
                     <|>
                     (try $ do skipMany comment
                               newline
@@ -271,9 +270,9 @@ blockCmd cmdTypeOf
       undefinedCmdErr :: String -> BlockElement
       undefinedCmdErr name
           = Div [("class", "error")]
-            [ Paragraph [Text ("The command `" ++ name ++ "' is not defined. " ++
-                               "Make sure you haven't mistyped.")
-                        ]
+            [ Block (Paragraph [Text ("The command `" ++ name ++ "' is not defined. " ++
+                                      "Make sure you haven't mistyped.")
+                               ])
             ]