gitit 0.7.3.4 → 0.7.3.5
raw patch · 3 files changed
+22/−40 lines, 3 filesdep −texmathdep ~pandocPVP ok
version bump matches the API change (PVP)
Dependencies removed: texmath
Dependency ranges changed: pandoc
API changes (from Hackage documentation)
Files
- CHANGES +10/−2
- Network/Gitit/ContentTransformer.hs +9/−35
- gitit.cabal +3/−3
CHANGES view
@@ -1,3 +1,8 @@+Version 0.7.3.5 released 21 Mar 2010++* Returned to using pandoc's MathML writer option.+ This is fixed in pandoc 1.5.0.1. Depend on pandoc >= 1.5.0.1.+ Version 0.7.3.4 released 21 Mar 2010 * Use custom readFileUTF8 (exported in Network.Gitit.Util) instead of@@ -37,7 +42,10 @@ (Based on a patch by gwern.) * Added markdown export.- ++* Use pandoc's new MathML math mode for more efficient+ MathML.+ * Improved multi-wiki example code in haddocks. * Added session-timeout config setting.@@ -56,7 +64,7 @@ * Added pandoc-user-data config option, allowing the user to specify a directory with e.g. templates that override the defaults used for exported pages.- + * Fix filesToClean GHC panic when loading plugins on GHC HEAD * Fixed problem with doubled // in updir links.
Network/Gitit/ContentTransformer.hs view
@@ -80,6 +80,7 @@ import qualified Data.FileStore as FS import Data.Maybe (mapMaybe) import Text.Pandoc hiding (MathML)+import qualified Text.Pandoc as Pandoc import Text.Pandoc.Shared (ObfuscationMethod(..)) import Text.XHtml hiding ( (</>), dir, method, password, rev ) import Text.Highlighting.Kate@@ -89,8 +90,6 @@ import Control.Exception (throwIO, catch) import qualified Data.ByteString as S (concat) import qualified Data.ByteString.Lazy as L (toChunks, fromChunks)-import Text.XML.Light-import Text.TeXMath -- -- ContentTransformer runners@@ -335,11 +334,15 @@ base' <- lift getWikiBase toc <- liftM ctxTOC get bird <- liftM ctxBirdTracks get+ cfg <- lift getConfig return $ writeHtml defaultWriterOptions{ writerStandalone = True , writerTemplate = "$if(toc)$\n$toc$\n$endif$\n$body$"- , writerHTMLMathMethod = JsMath- (Just $ base' ++ "/js/jsMath/easy/load.js")+ , writerHTMLMathMethod =+ case mathMethod cfg of+ MathML -> Pandoc.MathML Nothing+ _ -> JsMath (Just $ base' +++ "/js/jsMath/easy/load.js") , writerTableOfContents = toc , writerLiterateHaskell = bird -- note: javascript obfuscation gives problems on preview@@ -399,12 +402,7 @@ applyPageTransforms :: Pandoc -> ContentTransformer Pandoc applyPageTransforms c = do xforms <- getPageTransforms- cfg <- lift getConfig- params <- getParams- let xforms' = case mathMethod cfg of- MathML -> mathMLTransform (pFormat params) : xforms- _ -> xforms- foldM applyTransform c (wikiLinksTransform : xforms')+ foldM applyTransform c (wikiLinksTransform : xforms) -- | Applies all the pre-parse transform plugins to a Page object. applyPreParseTransforms :: Page -> ContentTransformer Page@@ -446,9 +444,7 @@ updateLayout $ \l -> case mathMethod conf of JsMathScript -> addScripts l ["jsMath/easy/load.js"]- -- for MathML, the script is added by mathMLTransform, only- -- if the page contains math:- MathML -> l+ MathML -> addScripts l ["MathMLinHTML.js"] RawTeX -> l return c @@ -506,28 +502,6 @@ convertWikiLinks (Link ref ("", "")) = Link ref (inlinesToURL ref, "Go to wiki page") convertWikiLinks x = x--mathMLTransform :: String -> Pandoc -> PluginM Pandoc-mathMLTransform format inp | format `elem` ["","S5"] = do- let (Pandoc m blks, mathUsed) = runState (processWithM convertTeXMathToMathML inp) False- let scriptLink = RawHtml "<script type=\"text/javascript\" src=\"/js/MathMLinHTML.js\"></script>"- let blks' = if mathUsed- then blks ++ [scriptLink]- else blks- return $ Pandoc m blks'-mathMLTransform _ inp = return inp---- | Convert math to MathML. We put this in a Writer monad--- to keep track of whether we've actually got any MathML; if not,--- we can avoid linking a script.-convertTeXMathToMathML :: Inline -> State Bool Inline-convertTeXMathToMathML (Math t x) = do- case texMathToMathML t' x of- Left _ -> return $ Math t x- Right v -> put True >> return (HtmlInline $ showXml v)- where t' = if t == DisplayMath then DisplayBlock else DisplayInline- showXml = ppcElement (useShortEmptyTags (const False) defaultConfigPP)-convertTeXMathToMathML x = return x -- | Derives a URL from a list of Pandoc Inline elements. inlinesToURL :: [Inline] -> String
gitit.cabal view
@@ -1,5 +1,5 @@ name: gitit-version: 0.7.3.4+version: 0.7.3.5 Cabal-version: >= 1.2 build-type: Simple synopsis: Wiki using happstack, git or darcs, and pandoc.@@ -100,7 +100,7 @@ exposed-modules: Network.Gitit.Interface build-depends: ghc, ghc-paths cpp-options: -D_PLUGINS- build-depends: base >= 3, pandoc >= 1.5, filepath, safe+ build-depends: base >= 3, pandoc >= 1.5.0.1, filepath, safe extensions: CPP if impl(ghc >= 6.12) ghc-options: -Wall -fno-warn-unused-do-bind@@ -125,7 +125,7 @@ happstack-util >= 0.3.2 && < 0.5, xml >= 1.3.5, hslogger >= 1 && < 1.1, ConfigFile >= 1 && < 1.1, feed >= 0.3.6 && < 0.4,- cautious-file >= 0.1.5 && < 0.2, texmath+ cautious-file >= 0.1.5 && < 0.2 if impl(ghc >= 6.10) build-depends: base >= 4, syb if flag(plugins)