Skip to content

Commit

Permalink
Fixed bug in fromEntities.
Browse files Browse the repository at this point in the history
This was causing text to be lost after semicolons.
Thanks to Perry Wagle for reporting the bug.
  • Loading branch information
John MacFarlane committed Apr 15, 2012
1 parent 8609002 commit 5e8132c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Network/Gitit/Types.hs
Expand Up @@ -36,6 +36,7 @@ import System.Locale (defaultTimeLocale)
import Data.FileStore.Types
import Network.Gitit.Server
import Text.HTML.TagSoup.Entity (lookupEntity)
import Data.Char (isSpace)

data PageType = Markdown | RST | LaTeX | HTML | Textile
deriving (Read, Show, Eq)
Expand Down Expand Up @@ -398,8 +399,8 @@ fromEntities :: String -> String
fromEntities ('&':xs) =
case lookupEntity ent of
Just c -> c : fromEntities rest
Nothing -> '&' : fromEntities rest
where (ent, rest) = case break (==';') xs of
Nothing -> '&' : fromEntities xs
where (ent, rest) = case break (\c -> isSpace c || c == ';') xs of
(zs,';':ys) -> (zs,ys)
_ -> ("",xs)
fromEntities (x:xs) = x : fromEntities xs
Expand Down

0 comments on commit 5e8132c

Please sign in to comment.