X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Wiki.hs;h=337d715eb9160b83cd94e2fa2549de67e09fd6da;hb=411547157fb221f10c8620e2a92efe8e5219e82d;hp=64c46028bdcd8dd51d204037457e5bba4302866b;hpb=d18786bdb428f24b6a5aea32c1b1e64339591708;p=yawbih.git diff --git a/Wiki.hs b/Wiki.hs index 64c4602..337d715 100644 --- a/Wiki.hs +++ b/Wiki.hs @@ -37,9 +37,10 @@ type Document = [Markup] wikiParser :: GenParser Char st Document wikiParser = do s <- (try (pPara) - <|> pOneEol + <|> pSpace <|> try (pLinkLong) - <|> pLink + <|> try (pLink) + <|> pOtherChar <|> pText) ss <- (wikiParser <|> return []) return (s:ss) @@ -49,8 +50,9 @@ pPara = do pEol return (Paragraph) -pOneEol = do - pEol + +pSpace = do + space return (Text " ") pEol = char '\n' <|> do @@ -59,21 +61,25 @@ pEol = char '\n' <|> do pLinkLong = do string "[[" - l <- many1 $ noneOf ['|','[',']'] + l <- many1 $ noneOf ['|'] char '|' - d <- many1 $ noneOf ['|','[',']'] + d <- many1 $ noneOf "]" string "]]" return (Link l d) pLink = do string "[[" - l <- many1 $ noneOf ['|','[',']'] + l <- many1 $ noneOf "]" string "]]" return (Link l l) +pOtherChar = do + c <- oneOf ",;.:!?[]()\'\"=-%$£<>/\\|" + return (Text (c:[])) pText = do - t <- many1 (noneOf ['\n','\r','[',']']) + t <- many1 alphaNum--(noneOf ['\n','\r','[',']']) return (Text t) + newtype PGB = PGB DBService createPGB :: String -> String -> String -> String -> IO PGB