import Control.Arrow
import Control.Arrow.ArrowList
-import Control.Arrow.ArrowTree
import Data.Char
import Data.List
import Data.Maybe
= proc (baseURI, blocks)
-> do block <- arrL id -< blocks
tree <- formatBlock -< (baseURI, block)
- attachXHtmlNs -< tree
+ returnA -< tree
formatElement :: (ArrowXml a, ArrowChoice a) => a (URI, Element) XmlTree
formatImage :: (ArrowXml a) => a (URI, InlineElement) XmlTree
-formatImage = proc (baseURI, Image name alt)
- -> let uri = mkObjectURI baseURI name
+formatImage = proc (baseURI, Image src alt)
+ -> let uri = mkObjectURI baseURI src
href = uriToString id uri ""
in
( eelem "img"
mkAnchor = eelem "a"
+= attr "href" (arr fst >>> mkText)
+= (arr snd >>> mkText)
-
-
-attachXHtmlNs :: ArrowXml a => a XmlTree XmlTree
-attachXHtmlNs = processBottomUp (changeQName attach')
- where
- attach' :: QName -> QName
- attach' qn = qn {
- namePrefix = "xhtml"
- , namespaceUri = "http://www.w3.org/1999/xhtml"
- }