X-Git-Url: https://ruin.nu/git/?p=yawbih.git;a=blobdiff_plain;f=Wiki.hs;fp=Wiki.hs;h=3d1eed2b309b09e5cc5385ddc3c8852be47e7a1d;hp=2d394b8243d273dcd3fac82abe0c1b51e9e3d1f2;hb=fd788a2053b4f32bd80d002329d64272af23759d;hpb=85eacfb829b94b0e1d7a6ca77f39546f6285fb4c diff --git a/Wiki.hs b/Wiki.hs index 2d394b8..3d1eed2 100644 --- a/Wiki.hs +++ b/Wiki.hs @@ -2,7 +2,7 @@ module Wiki ( Backend (getCurrent,getList,get,setCurrent,update,listKeys) ,PGB ,createPGB - ,Markup (Text, Paragraph, Link, Bold, Emph, Heading, Url, Underline, Strike, Pre,List) + ,Markup (Text, Paragraph, Link, Bold, Emph, Mono, Heading, Url, Underline, Strike, Pre,List) ,Document ,wikiParser ,htmlOutput @@ -37,6 +37,7 @@ data Markup = Text String | Link String String | Bold [Markup] | Emph [Markup] + | Mono [Markup] | Heading Int [Markup] | Url String | Underline [Markup] @@ -106,6 +107,7 @@ pBold = pS "**" (\s -> Bold s) pEmph = pS "//" (\s -> Emph s) pUnderline = pS "__" (\s -> Underline s) pStrike = pS "--" (\s -> Strike s) +pMono = pS "||" (\s -> Mono s) pS s f = string s >> do s <- pStopAt s return (f s) @@ -156,6 +158,7 @@ pMain = choice [ ,try(pEmph) ,try(pUnderline) ,try(pStrike) + ,try(pMono) ,try (pLink) ,try (pURL) ,try (pMail) @@ -169,6 +172,7 @@ pOneLine = choice [ ,try pEmph ,try pUnderline ,try pStrike + ,try pMono ,try pLink ,try pURL ,try pMail @@ -240,6 +244,7 @@ toHtml ((Text s):xs) = s++toHtml xs toHtml ((Link l d):xs) = ""++toHtml xs toHtml ((Bold d):xs) = ""++toHtml d++""++toHtml xs toHtml ((Emph d):xs) = ""++toHtml d++""++toHtml xs +toHtml ((Mono d):xs) = ""++toHtml d++""++toHtml xs toHtml ((Underline d):xs) = ""++toHtml d++""++toHtml xs toHtml ((Strike d):xs) = ""++toHtml d++""++toHtml xs toHtml ((Heading n d):xs) = "\n"++toHtml d++"\n"++toHtml xs