= InlineCommandInterpreter {
iciName = "img"
, iciInterpret
- = \ ctx (InlineCommand _ attrs inside) ->
+ = \ ctx (InlineCommand _ attrs _) ->
do BaseURI baseURI <- getSysConf (ctxSysConf ctx)
- let pageName = case lookup "src" attrs of
+ let name = case lookup "src" attrs of
Just x -> x
Nothing -> error "\"src\" attribute is missing"
- hrefAttr = ("href", uriToString id (mkPageURI baseURI pageName) "")
+ hrefAttr = ("href", uriToString id (mkPageURI baseURI name) "")
alt = lookup "alt" attrs
classAttr = case lookup "float" attrs of
Nothing -> ("class", "inlineImage")
Just others -> error ("unknown \"float\" attribute: " ++ others)
anchorAttrs = [hrefAttr, classAttr]
- return (Anchor anchorAttrs [Image pageName alt])
+ return (Anchor anchorAttrs [Image (Right name) alt])
}
-- <div class="imageFrame ...">
-- <div class="imageData">
--- <p>
--- <a href="...">
--- <img src="..." />
--- </a>
--- </p>
+-- <a href="...">
+-- <img src="..." />
+-- </a>
-- </div>
-- <div class="imageCaption">
-- ...
= \ ctx (BlockCommand _ attrs inside) ->
do BaseURI baseURI <- getSysConf (ctxSysConf ctx)
- let pageName = case lookup "src" attrs of
+ let name = case lookup "src" attrs of
Just x -> x
Nothing -> error "\"src\" attribute is missing"
- hrefAttr = ("href", uriToString id (mkPageURI baseURI pageName) "")
+ hrefAttr = ("href", uriToString id (mkPageURI baseURI name) "")
classAttr = case lookup "float" attrs of
Nothing -> ("class", "imageFrame")
Just "left" -> ("class", "imageFrame leftFloat")
Just others -> error ("unknown \"float\" attribute: " ++ others)
return (Div [classAttr]
- [ Div [("class", "imageData")]
- [ Paragraph [ Anchor [hrefAttr]
- [ Image pageName Nothing ] ]
- ]
- , Div [("class", "imageCaption")] inside
+ [ Block (Div [("class", "imageData")]
+ [ Inline (Anchor [hrefAttr]
+ [ Image (Right name) Nothing ]) ])
+ , Block (Div [("class", "imageCaption")]
+ [ Block x | x <- inside ])
]
)
}