Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug in fromEntities.

This was causing text to be lost after semicolons.
Thanks to Perry Wagle for reporting the bug.
  • Loading branch information...
commit 5e8132c9ccaa7adebbc7cdf261916301e32dbc67 1 parent 8609002
@jgm authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 Network/Gitit/Types.hs
View
5 Network/Gitit/Types.hs
@@ -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)
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.