]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Formatter.hs
previewer backend now partly works
[Rakka.git] / Rakka / Wiki / Formatter.hs
index 0dfe02e4e66c606592abefa1d9ae93097a2fb669..4a3531ce55a8035dfbad67dfd5f9eecc1a44c184 100644 (file)
@@ -4,7 +4,9 @@ module Rakka.Wiki.Formatter
     where
 
 import           Control.Arrow
+import           Control.Arrow.ArrowIf
 import           Control.Arrow.ArrowList
+import           Control.Arrow.ArrowTree
 import           Data.Char
 import           Data.List
 import           Data.Maybe
@@ -20,7 +22,7 @@ formatWikiBlocks
     = proc (baseURI, blocks)
     -> do block   <- arrL id     -< blocks
           tree    <- formatBlock -< (baseURI, block)
-          returnA -< tree
+          attachXHtmlNS -< tree
 
 
 formatElement :: (ArrowXml a, ArrowChoice a) => a (URI, Element) XmlTree
@@ -273,3 +275,13 @@ mkAnchor :: (ArrowXml a) => a (String, String) XmlTree
 mkAnchor = eelem "a"
            += attr "href" (arr fst >>> mkText)
            += (arr snd >>> mkText)
+
+
+attachXHtmlNS :: (ArrowXml a) => a XmlTree XmlTree
+attachXHtmlNS = processTopDown (changeQName attach `when` isElem)
+    where
+      attach :: QName -> QName
+      attach qn = qn {
+                    namePrefix   = "xhtml"
+                  , namespaceUri = "http://www.w3.org/1999/xhtml"
+                  }