]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Formatter.hs
Wrote many...
[Rakka.git] / Rakka / Wiki / Formatter.hs
index cc51feff644c86a6f3d714adb1bdb27955b098e7..3f0960604887663d1a479719339d0d8a480339bb 100644 (file)
@@ -24,6 +24,14 @@ formatWikiBlocks
           attachXHtmlNs -< tree
 
 
+formatElement :: (ArrowXml a, ArrowChoice a) => a (URI, Element) XmlTree
+formatElement 
+    = proc (baseURI, elem)
+    -> case elem of
+         Block  b -> formatBlock  -< (baseURI, b)
+         Inline i -> formatInline -< (baseURI, i)
+
+
 formatBlock :: (ArrowXml a, ArrowChoice a) => a (URI, BlockElement) XmlTree
 formatBlock 
     = proc (baseURI, block)
@@ -34,7 +42,7 @@ formatBlock
          HorizontalLine
              -> eelem "hr" -< ()
 
-         List list
+         list@(List _ _)
              -> formatListElement -< (baseURI, list)
 
          DefinitionList list
@@ -54,7 +62,7 @@ formatBlock
     where
       formatElem :: (ArrowXml a, ArrowChoice a) =>
                     String
-                 -> a (URI, [Attribute], [BlockElement]) XmlTree
+                 -> a (URI, [Attribute], [Element]) XmlTree
       formatElem name
           = proc (baseURI, attrs, contents)
           -> ( eelem name
@@ -64,7 +72,7 @@ formatBlock
                   )
                += ( (arr fst &&& arrL (snd . snd))
                     >>>
-                    formatBlock
+                    formatElement
                   )
              ) -< (baseURI, (attrs, contents))
 
@@ -77,7 +85,7 @@ formatHeading
        [ txt text        ] -<< ()
 
 
-formatListElement :: (ArrowXml a, ArrowChoice a) => a (URI, ListElement) XmlTree
+formatListElement :: (ArrowXml a, ArrowChoice a) => a (URI, BlockElement) XmlTree
 formatListElement 
     = proc (baseURI, list)
     -> let tag = case listType list of
@@ -97,16 +105,9 @@ formatListElement
             -> eelem "li"
                += ( (arr fst &&& arrL snd)
                     >>>
-                    formatListItem'
+                    formatElement
                   ) -< (baseURI, item)
 
-        formatListItem' :: (ArrowXml a, ArrowChoice a) => a (URI, Either ListElement InlineElement) XmlTree
-        formatListItem' 
-            = proc (baseURI, x)
-            -> case x of
-                 Left  nestedList -> formatListElement -< (baseURI, nestedList)
-                 Right inline     -> formatInline      -< (baseURI, inline    )
-
 
 formatDefinitionList :: (ArrowXml a, ArrowChoice a) => a (URI, [Definition]) XmlTree
 formatDefinitionList