X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FFormatter.hs;h=a08fe304ff74385cfe66f19cdd8e73d6edece596;hb=b3c3f333cd48bc74eb33f0f21d56a9d1bc65e0ea;hp=7a7efce40bd4e8c010d308cae1ab2e9617e61da8;hpb=dcfffa578c5dd6647a5be7d2074488a520dfcf2d;p=Rakka.git diff --git a/Rakka/Wiki/Formatter.hs b/Rakka/Wiki/Formatter.hs index 7a7efce..a08fe30 100644 --- a/Rakka/Wiki/Formatter.hs +++ b/Rakka/Wiki/Formatter.hs @@ -164,6 +164,9 @@ formatInline link@(PageLink _ _ _) -> formatPageLink -< (baseURI, link) + link@(ExternalLink _ _) + -> formatExternalLink -< link + LineBreak attrs -> formatElem "br" -< (baseURI, attrs, []) @@ -214,3 +217,15 @@ formatPageLink += attr "href" (arr fst >>> mkText) += (arr snd >>> mkText) ) -< (href, label) + + +formatExternalLink :: (ArrowXml a) => a InlineElement XmlTree +formatExternalLink + = proc (ExternalLink uri text) + -> let href = uriToString id uri "" + label = fromMaybe href text + in + ( eelem "a" + += attr "href" (arr fst >>> mkText) + += (arr snd >>> mkText) + ) -< (href, label)