X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FFormatter.hs;h=4a3531ce55a8035dfbad67dfd5f9eecc1a44c184;hb=71f2db55513679098869de2122b5d5989dbc2be2;hp=0dfe02e4e66c606592abefa1d9ae93097a2fb669;hpb=cca878677e130779e4af0f595435d0567f94af8e;p=Rakka.git diff --git a/Rakka/Wiki/Formatter.hs b/Rakka/Wiki/Formatter.hs index 0dfe02e..4a3531c 100644 --- a/Rakka/Wiki/Formatter.hs +++ b/Rakka/Wiki/Formatter.hs @@ -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" + }