]> ruin.nu Git - yawbih.git/commitdiff
More cleanup
authorMichael Andreen <harv@ruin.nu>
Mon, 13 Dec 2004 17:10:22 +0000 (17:10 +0000)
committerMichael Andreen <harv@ruin.nu>
Sat, 26 Jan 2008 11:33:18 +0000 (12:33 +0100)
Wiki.hs

diff --git a/Wiki.hs b/Wiki.hs
index 83b14b6223ceb7d7e7e59d7c6db4f6592d1bdbf2..a2d2ff220b019e2b2b02d791da408f1300938a50 100644 (file)
--- 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 "</pre>"
        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