Skip to content
Browse files

Steps towards getting gitit working with pandoc 1.9.

Added fromEntities to Types, since decodeCharacterReferences
is no longer exported from Pandoc.  Added dependency on tagsoup.
Bumped upper bounds on versions for time, happstack-server,
json, pandoc-types, pandoc, highlighting-kate.
  • Loading branch information...
1 parent cb06884 commit 70887e840a8f5986107e285180a200f932d8686a John MacFarlane committed
Showing with 25 additions and 10 deletions.
  1. +15 −2 Network/Gitit/Types.hs
  2. +10 −8 gitit.cabal
View
17 Network/Gitit/Types.hs
@@ -35,7 +35,7 @@ import Data.Time (parseTime)
import System.Locale (defaultTimeLocale)
import Data.FileStore.Types
import Network.Gitit.Server
-import Text.Pandoc.CharacterReferences (decodeCharacterReferences)
+import Text.HTML.TagSoup.Entity (lookupEntity)
data PageType = Markdown | RST | LaTeX | HTML | Textile
deriving (Read, Show, Eq)
@@ -291,7 +291,7 @@ data Params = Params { pUsername :: String
instance FromData Params where
fromData = do
- let look' = liftM decodeCharacterReferences . look
+ let look' = liftM fromEntities . look
un <- look' "username" `mplus` return ""
pw <- look' "password" `mplus` return ""
p2 <- look' "password2" `mplus` return ""
@@ -384,3 +384,16 @@ data WikiState = WikiState {
type GititServerPart = ServerPartT (ReaderT WikiState IO)
type Handler = GititServerPart Response
+
+-- Unescapes XML entities
+fromEntities :: String -> String
+fromEntities ('&':xs) =
+ case lookupEntity ent of
+ Just c -> c : fromEntities rest
+ Nothing -> '&' : fromEntities rest
+ where (ent, rest) = case break (==';') xs of
+ (zs,';':ys) -> (zs,ys)
+ _ -> ("",xs)
+fromEntities (x:xs) = x : fromEntities xs
+fromEntities [] = []
+
View
18 gitit.cabal
@@ -117,7 +117,8 @@ Library
exposed-modules: Network.Gitit.Interface
build-depends: ghc, ghc-paths
cpp-options: -D_PLUGINS
- build-depends: base >= 3, pandoc >= 1.9, pandoc-types >= 1.8.2, filepath, safe
+ build-depends: base >= 3, pandoc >= 1.9.0.5 && < 1.10,
+ pandoc-types >= 1.9.0.2 && < 1.10, filepath, safe
extensions: CPP
if impl(ghc >= 6.12)
ghc-options: -Wall -fno-warn-unused-do-bind
@@ -133,37 +134,38 @@ Executable gitit
pretty,
xhtml,
containers,
- pandoc >= 1.9,
- pandoc-types >= 1.8.2,
+ pandoc >= 1.9.0.5 && < 1.10,
+ pandoc-types >= 1.9.0.2 && < 1.10,
process,
filepath,
directory,
mtl,
cgi,
old-time,
- highlighting-kate >= 0.2.7.1,
+ highlighting-kate >= 0.5.0.1 && < 0.6,
bytestring,
text,
random,
network >= 2.1.0.0 && < 2.4,
utf8-string >= 0.3 && < 0.4,
SHA > 1 && < 1.6,
- HTTP >= 4000.0 && < 4000.2,
+ HTTP >= 4000.0 && < 4000.3,
HStringTemplate >= 0.6 && < 0.7,
old-locale >= 1,
- time >= 1.1 && < 1.3,
+ time >= 1.1 && < 1.5,
recaptcha >= 0.1,
filestore >= 0.4.0.2 && < 0.5,
zlib >= 0.5 && < 0.6,
url >= 2.1 && < 2.2,
- happstack-server >= 6.0 && < 6.4,
+ happstack-server >= 6.5 && < 6.6,
happstack-util >= 6.0 && < 6.1,
xml >= 1.3.5,
hslogger >= 1 && < 1.2,
ConfigFile >= 1 && < 1.2,
feed >= 0.3.6 && < 0.4,
xss-sanitize >= 0.3 && < 0.4,
- json >= 0.4 && < 0.5
+ tagsoup >= 0.12 && < 0.13,
+ json >= 0.4 && < 0.6
if impl(ghc >= 6.10)
build-depends: base >= 4, syb
if impl(ghc >= 7.0.3)

0 comments on commit 70887e8

Please sign in to comment.
Something went wrong with that request. Please try again.