From: Michael Andreen Date: Mon, 13 Dec 2004 17:10:22 +0000 (+0000) Subject: More cleanup X-Git-Url: https://ruin.nu/git/?p=yawbih.git;a=commitdiff_plain;h=6bb9a6da06d8911d0fc2dd821705323fa3beb0dc More cleanup --- diff --git a/Wiki.hs b/Wiki.hs index 83b14b6..a2d2ff2 100644 --- a/Wiki.hs +++ b/Wiki.hs @@ -46,10 +46,7 @@ data Markup = Text String type Document = [Markup] wikiParser :: GenParser Char st Document -wikiParser = do - s <- pMain - ss <- (wikiParser <|> return []) - return (s:ss) +wikiParser = many1 pMain pPara = do pEol @@ -57,8 +54,8 @@ pPara = do return (Paragraph) pSpace = do - space - return (Text " ") + c <- space + return (Text (c:[])) pEol = char '\n' <|> do char '\r' @@ -113,18 +110,20 @@ pPre = do s <- pString "" return (Pre s) -pMain = try (pHeading) - <|> (try (pPara) - <|> pSpace - <|> try(pPre) - <|> try(pBold) - <|> try(pEmph) - <|> try(pUnderline) - <|> try(pStrike) - <|> try (pLink) - <|> try (pURL) - <|> pOtherChar - <|> pText) +pMain = choice [ + try (pHeading) + ,try (pPara) + ,pSpace + ,try(pPre) + ,try(pBold) + ,try(pEmph) + ,try(pUnderline) + ,try(pStrike) + ,try (pLink) + ,try (pURL) + ,pOtherChar + ,pText + ] pOtherChar = do c <- oneOf "*,;.:!?[]()'\"=-%$£<>/\\|" @@ -183,7 +182,7 @@ instance Backend PGB where return id listKeys (PGB db) = do - list <- selectReturnTuples db $ "SELECT keyword FROM fulltexts GROUP BY keyword ORDER BY lower(keyword)" + list <- selectReturnTuples db $ "SELECT keyword FROM current keyword ORDER BY lower(keyword)" case list of [[]] -> return [] _ -> mapM (\[key] -> return key) list