]> ruin.nu Git - yawbih.git/blobdiff - Wiki.hs
Monospace fonts
[yawbih.git] / Wiki.hs
diff --git a/Wiki.hs b/Wiki.hs
index 2d394b8243d273dcd3fac82abe0c1b51e9e3d1f2..3d1eed2b309b09e5cc5385ddc3c8852be47e7a1d 100644 (file)
--- 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) = "<link: "++l++" desc: "++d++">"++toHtml xs
 toHtml ((Bold d):xs) = "<b>"++toHtml d++"</b>"++toHtml xs
 toHtml ((Emph d):xs) = "<em>"++toHtml d++"</em>"++toHtml xs
+toHtml ((Mono d):xs) = "<tt>"++toHtml d++"</tt>"++toHtml xs
 toHtml ((Underline d):xs) = "<u>"++toHtml d++"</u>"++toHtml xs
 toHtml ((Strike d):xs) = "<strike>"++toHtml d++"</strike>"++toHtml xs
 toHtml ((Heading n d):xs) = "\n<h"++show n++">"++toHtml d++"</h"++show n++">\n"++toHtml xs