X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FInterpreter%2FImage.hs;h=9b6ff747f63b1f4d0d8886a3a5d3f9abc6b7455f;hb=7a4f13a3d483c950743e1ced001ade4406d239d3;hp=12ea6d662de735ee33a5b1203599b8dd6feb2c40;hpb=ddf0b4d7ab2f1e141edbc7ef75d39853c0846f8c;p=Rakka.git diff --git a/Rakka/Wiki/Interpreter/Image.hs b/Rakka/Wiki/Interpreter/Image.hs index 12ea6d6..9b6ff74 100644 --- a/Rakka/Wiki/Interpreter/Image.hs +++ b/Rakka/Wiki/Interpreter/Image.hs @@ -26,13 +26,13 @@ imageInterp = 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") @@ -41,17 +41,15 @@ imageInterp Just others -> error ("unknown \"float\" attribute: " ++ others) anchorAttrs = [hrefAttr, classAttr] - return (Anchor anchorAttrs [Image pageName alt]) + return (Anchor anchorAttrs [Image (Right name) alt]) } --
--
---

--- --- --- ---

+-- +-- +-- --
--
-- ... @@ -65,10 +63,10 @@ imgFrameInterp = \ 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") @@ -76,11 +74,11 @@ imgFrameInterp 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 ]) ] ) }