packages feed

gitit 0.7.3.6 → 0.7.3.7

raw patch · 10 files changed

+111/−74 lines, 10 filesdep ~happstack-serverdep ~happstack-utildep ~highlighting-katePVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: happstack-server, happstack-util, highlighting-kate, pandoc

API changes (from Hackage documentation)

+ Network.Gitit.Types: WebTeX :: String -> MathMethod

Files

CHANGES view
@@ -1,3 +1,21 @@+Version 0.7.3.7 released 24 July 2010++* Depend on pandoc >= 1.6, highlighting-kate >= 0.2.7.1++* Added epub and slidy export formats.++* Require happstack >= 0.5.++* Added google math option (uses google charts api).+  Slightly modified from a patch by lpeterse.++* Made WebArchiver plugin more parallel (gwern).++* Fixed Dot plugin to work with GHC 6.12.+  We were having string encoding issues reading the output+  of dot with readProcess. Solution is to pass dot an output+  filename so we don't have to read its output.+ Version 0.7.3.6 released 05 May 2010  * Fixed ODT/PDF export for files in subdirectories.  Resolves Issue #81.
Network/Gitit/Config.hs view
@@ -38,7 +38,7 @@ import Data.Char (toLower, toUpper, isDigit) import Paths_gitit (getDataFileName) import System.FilePath ((</>))-import Text.Pandoc hiding (MathML)+import Text.Pandoc hiding (MathML, WebTeX)  forceEither :: Show e => Either e a -> a forceEither = either (error . show) id@@ -123,6 +123,7 @@         , mathMethod           = case map toLower cfMathMethod of                                       "jsmath"   -> JsMathScript                                       "mathml"   -> MathML+                                      "google"   -> WebTeX "http://chart.apis.google.com/chart?cht=tx&chl="                                       _          -> RawTeX         , defaultLHS           = lhs         , showLHSBirdTracks    = cfShowLHSBirdTracks
Network/Gitit/ContentTransformer.hs view
@@ -79,7 +79,7 @@ import Network.Gitit.Cache (lookupCache, cacheContents) import qualified Data.FileStore as FS import Data.Maybe (mapMaybe)-import Text.Pandoc hiding (MathML)+import Text.Pandoc hiding (MathML, WebTeX) import qualified Text.Pandoc as Pandoc import Text.Pandoc.Shared (ObfuscationMethod(..)) import Text.XHtml hiding ( (</>), dir, method, password, rev )@@ -343,6 +343,7 @@                       , writerHTMLMathMethod =                             case mathMethod cfg of                                  MathML -> Pandoc.MathML Nothing+                                 WebTeX u -> Pandoc.WebTeX u                                  _      -> JsMath (Just $ base' ++                                                       "/js/jsMath/easy/load.js")                       , writerTableOfContents = toc@@ -447,6 +448,7 @@     case mathMethod conf of          JsMathScript -> addScripts l ["jsMath/easy/load.js"]          MathML       -> addScripts l ["MathMLinHTML.js"]+         WebTeX _     -> l          RawTeX       -> l   return c 
Network/Gitit/Export.hs view
@@ -21,8 +21,7 @@  module Network.Gitit.Export ( exportFormats ) where import Text.Pandoc-import Text.Pandoc.Writers.S5 (s5HeaderIncludes)-import Text.Pandoc.ODT (saveOpenDocumentAsODT)+import Text.Pandoc.S5 (s5HeaderIncludes) import Text.Pandoc.Shared (escapeStringUsing) import Network.Gitit.Server import Network.Gitit.Framework (pathForPage)@@ -35,6 +34,7 @@ import Text.XHtml (noHtml) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L+import Data.ByteString.Lazy.UTF8 (fromString) import System.FilePath ((<.>), (</>)) import Control.Exception (throwIO) import System.Environment (getEnvironment)@@ -49,15 +49,17 @@  respond :: String         -> String-        -> (Pandoc -> String)+        -> (Pandoc -> IO L.ByteString)         -> String         -> Pandoc         -> Handler-respond mimetype ext fn page = ok . setContentType mimetype .+respond mimetype ext fn page doc = liftIO (fn doc) >>=+  ok . setContentType mimetype .   (if null ext then id else setFilename (page ++ "." ++ ext)) .-  toResponse . fn+  toResponseBS (B.empty) -respondX :: String -> String -> String -> (WriterOptions -> Pandoc -> String)+respondX :: String -> String -> String+          -> (WriterOptions -> Pandoc -> IO L.ByteString)           -> WriterOptions -> String -> Pandoc -> Handler respondX templ mimetype ext fn opts page doc = do   cfg <- getConfig@@ -65,76 +67,87 @@   template <- case template' of                   Right t  -> return t                   Left e   -> liftIO $ throwIO e-  respond mimetype ext (fn opts{writerTemplate = template}) page doc +  doc' <- if ext `elem` ["odt","pdf","epub"]+             then fixURLs doc+             else return doc+  respond mimetype ext (fn opts{writerTemplate = template+                               ,writerSourceDirectory = repositoryPath cfg+                               ,writerUserDataDir = pandocUserData cfg})+          page doc' +respondS :: String -> String -> String -> (WriterOptions -> Pandoc -> String)+          -> WriterOptions -> String -> Pandoc -> Handler+respondS templ mimetype ext fn =+  respondX templ mimetype ext (\o d -> return $ fromString $ fn o d)+ respondLaTeX :: String -> Pandoc -> Handler-respondLaTeX = respondX "latex" "application/x-latex" "tex"+respondLaTeX = respondS "latex" "application/x-latex" "tex"   writeLaTeX defaultRespOptions  respondConTeXt :: String -> Pandoc -> Handler-respondConTeXt = respondX "context" "application/x-context" "tex"+respondConTeXt = respondS "context" "application/x-context" "tex"   writeConTeXt defaultRespOptions   respondRTF :: String -> Pandoc -> Handler-respondRTF = respondX "rtf" "application/rtf" "rtf"+respondRTF = respondS "rtf" "application/rtf" "rtf"   writeRTF defaultRespOptions  respondRST :: String -> Pandoc -> Handler-respondRST = respondX "rst" "text/plain; charset=utf-8" ""+respondRST = respondS "rst" "text/plain; charset=utf-8" ""   writeRST defaultRespOptions{writerReferenceLinks = True}  respondMarkdown :: String -> Pandoc -> Handler-respondMarkdown = respondX "markdown" "text/plain; charset=utf-8" ""+respondMarkdown = respondS "markdown" "text/plain; charset=utf-8" ""   writeMarkdown defaultRespOptions{writerReferenceLinks = True}  respondPlain :: String -> Pandoc -> Handler-respondPlain = respondX "plain" "text/plain; charset=utf-8" ""+respondPlain = respondS "plain" "text/plain; charset=utf-8" ""   writePlain defaultRespOptions  respondMan :: String -> Pandoc -> Handler-respondMan = respondX "man" "text/plain; charset=utf-8" ""+respondMan = respondS "man" "text/plain; charset=utf-8" ""   writeMan defaultRespOptions -respondS5 :: Config -> String -> Pandoc -> Handler-respondS5 cfg pg doc = do+respondS5 :: String -> Pandoc -> Handler+respondS5 pg doc = do+  cfg <- getConfig   inc <- liftIO $ s5HeaderIncludes (pandocUserData cfg)-  respondX "s5" "text/html; charset=utf-8" ""-    writeS5String-    defaultRespOptions{writerS5 = True, writerIncremental = True,-                       writerVariables = [("header-includes",inc)]}+  respondS "s5" "text/html; charset=utf-8" ""+    writeHtmlString+    defaultRespOptions{writerSlideVariant = S5Slides+                      ,writerIncremental = True,+                       writerVariables = [("s5includes",inc)]}     pg doc +respondSlidy :: String -> Pandoc -> Handler+respondSlidy pg doc = do+  respondS "slidy" "text/html; charset=utf-8" ""+    writeHtmlString+    defaultRespOptions{writerSlideVariant = SlidySlides+                      ,writerIncremental = True}+    pg doc+ respondTexinfo :: String -> Pandoc -> Handler-respondTexinfo = respondX "texinfo" "application/x-texinfo" "texi"+respondTexinfo = respondS "texinfo" "application/x-texinfo" "texi"   writeTexinfo defaultRespOptions  respondDocbook :: String -> Pandoc -> Handler-respondDocbook = respondX "docbook" "application/docbook+xml" "xml"+respondDocbook = respondS "docbook" "application/docbook+xml" "xml"   writeDocbook defaultRespOptions  respondMediaWiki :: String -> Pandoc -> Handler-respondMediaWiki = respondX "mediawiki" "text/plain; charset=utf-8" ""+respondMediaWiki = respondS "mediawiki" "text/plain; charset=utf-8" ""   writeMediaWiki defaultRespOptions -respondODT :: Config -> String -> Pandoc -> Handler-respondODT cfg page old_doc = fixURLs old_doc >>= \doc -> do-  template' <- liftIO $ getDefaultTemplate (pandocUserData cfg)  "odt"-  template <-  case template' of-                  Right t  -> return t-                  Left e   -> liftIO $ throwIO e-  let openDoc = writeOpenDocument-                defaultRespOptions{writerTemplate = template}-                doc-  conf <- getConfig-  contents <- liftIO $ withTempDir "gitit-temp-odt" $ \tempdir -> do-                let tempfile = tempdir </> "export" <.> "odt"-                saveOpenDocumentAsODT (pandocUserData cfg) -                   tempfile (repositoryPath conf) Nothing openDoc-                L.readFile tempfile-  ok $ setContentType "application/vnd.oasis.opendocument.text" $-       setFilename (page ++ ".odt") $ (toResponse noHtml) {rsBody = contents}+respondODT :: String -> Pandoc -> Handler+respondODT = respondX "opendocument" "application/vnd.oasis.opendocument.text"+              "odt" (writeODT Nothing) defaultRespOptions +respondEPUB :: String -> Pandoc -> Handler+respondEPUB = respondX "html" "application/epub+zip" "epub" (writeEPUB Nothing)+               defaultRespOptions+ -- | Run shell command and return error status.  Assumes -- UTF-8 locale. Note that this does not actually go through \/bin\/sh! runShellCommand :: FilePath                     -- ^ Working directory@@ -227,6 +240,8 @@                 , ("MediaWiki", respondMediaWiki)                 , ("man",       respondMan)                 , ("DocBook",   respondDocbook)-                , ("S5",        respondS5 cfg)-                , ("ODT",       respondODT cfg )+                , ("Slidy",     respondSlidy)+                , ("S5",        respondS5)+                , ("ODT",       respondODT)+                , ("EPUB",      respondEPUB)                 , ("RTF",       respondRTF) ]
Network/Gitit/Types.hs view
@@ -44,7 +44,7 @@  data FileStoreType = Git | Darcs | Mercurial deriving Show -data MathMethod = MathML | JsMathScript | RawTeX+data MathMethod = MathML | JsMathScript | WebTeX String | RawTeX                   deriving (Read, Show, Eq)  -- | Data structure for information read from config file.
data/default.conf view
@@ -52,7 +52,7 @@  math: MathML # specifies how LaTeX math is to be displayed.  Possible values-# are MathML, raw, and jsMath.  If mathml is selected, gitit will+# are MathML, raw, jsMath, and google.  If mathml is selected, gitit will # convert LaTeX math to MathML and link in a script, MathMLinHTML.js, # that allows the MathML to be seen in Gecko browsers, IE + # mathplayer, and Opera.  In other browsers you may get a jumble@@ -60,7 +60,9 @@ # as raw LaTeX math. If jsMath is selected, gitit will link to # the script /js/jsMath/easy/load.js, and will assume that jsMath # has been installed into the js/jsMath directory. This is the most-# portable solution.+# portable solution.  If google is selected, the google chart API is+# called to render the formula as an image. This requires a connection+# to google, and might raise a technical or a privacy problem.  show-lhs-bird-tracks: no # specifies whether to show Haskell code blocks in "bird style",
data/static/css/hk-pyg.css view
@@ -4,17 +4,16 @@ td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }  td.sourceCode { padding-left: 5px; } pre.sourceCode { }-pre.sourceCode span.Normal { }-pre.sourceCode span.Keyword { color: #007020; font-weight: bold; } -pre.sourceCode span.DataType { color: #902000; }-pre.sourceCode span.DecVal { color: #40a070; }-pre.sourceCode span.BaseN { color: #40a070; }-pre.sourceCode span.Float { color: #40a070; }-pre.sourceCode span.Char { color: #4070a0; }-pre.sourceCode span.String { color: #4070a0; }-pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }-pre.sourceCode span.Others { color: #007020; }-pre.sourceCode span.Alert { color: red; font-weight: bold; }-pre.sourceCode span.Function { color: #06287e; }-pre.sourceCode span.RegionMarker { }-pre.sourceCode span.Error { color: red; font-weight: bold; }+pre.sourceCode span.kw { color: #007020; font-weight: bold; } +pre.sourceCode span.dt { color: #902000; }+pre.sourceCode span.dv { color: #40a070; }+pre.sourceCode span.bn { color: #40a070; }+pre.sourceCode span.fl { color: #40a070; }+pre.sourceCode span.ch { color: #4070a0; }+pre.sourceCode span.st { color: #4070a0; }+pre.sourceCode span.co { color: #60a0b0; font-style: italic; }+pre.sourceCode span.ot { color: #007020; }+pre.sourceCode span.al { color: red; font-weight: bold; }+pre.sourceCode span.fu { color: #06287e; }+pre.sourceCode span.re { }+pre.sourceCode span.er { color: red; font-weight: bold; }
gitit.cabal view
@@ -1,5 +1,5 @@ name:                gitit-version:             0.7.3.6+version:             0.7.3.7 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.0.1, filepath, safe+  build-depends:     base >= 3, pandoc >= 1.6, filepath, safe   extensions:        CPP   if impl(ghc >= 6.12)     ghc-options:     -Wall -fno-warn-unused-do-bind@@ -112,8 +112,8 @@   hs-source-dirs:    .   main-is:           gitit.hs   build-depends:     base >=3 && < 5, parsec, pretty, xhtml, containers,-                     pandoc >= 1.5.1, process, filepath, directory, mtl, cgi,-                     network, old-time, highlighting-kate >= 0.2.6, bytestring,+                     pandoc >= 1.6, process, filepath, directory, mtl, cgi,+                     network, old-time, highlighting-kate >= 0.2.7.1, bytestring,                      utf8-string >= 0.3 && < 0.4,                      SHA > 1 && < 1.5, HTTP >= 4000.0 && < 4000.1,                      HStringTemplate >= 0.6 && < 0.7, random,@@ -121,8 +121,8 @@                      recaptcha >= 0.1, filestore >= 0.3.4,                      datetime >= 0.1 && < 0.3, zlib >= 0.5 && < 0.6,                      url >= 2.1 && < 2.2,-                     happstack-server >= 0.3.3 && < 0.6,-                     happstack-util >= 0.3.2 && < 0.6, xml >= 1.3.5,+                     happstack-server >= 0.5 && < 0.6,+                     happstack-util >= 0.5 && < 0.6, 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
plugins/Dot.hs view
@@ -32,11 +32,11 @@                                 Just fn   -> ([Str fn], fn ++ ".png")                                 Nothing   -> ([], uniqueName contents ++ ".png")   liftIO $ do-    (ec, out, err) <- readProcessWithExitCode "dot" ["-Tpng"] contents+    (ec, _out, err) <- readProcessWithExitCode "dot" ["-Tpng", "-o",+                         staticDir cfg </> "img" </> outfile] contents     if ec == ExitSuccess-       then writeFile (staticDir cfg </> "img" </> outfile) out+       then return $ Para [Image name ("/img" </> outfile, "")]        else error $ "dot returned an error status: " ++ err-  return $ Para [Image name ("/img" </> outfile, "")] transformBlock x = return x  -- | Generate a unique filename given the file's contents.
plugins/WebArchiver.hs view
@@ -11,7 +11,7 @@  module WebArchiver (plugin) where -import Control.Concurrent (forkIO, ThreadId)+import Control.Concurrent (forkIO) import Control.Monad (when) import Control.Monad.Trans (MonadIO) import Data.Maybe (fromJust)@@ -36,15 +36,15 @@                    return x -- note: this is read-only - don't actually change page!  archiveLinks :: String -> Inline -> IO Inline-archiveLinks e x@(Link _ (uln, _)) = checkArchive e uln >> return x+archiveLinks e x@(Link _ (uln, _)) = forkIO (checkArchive e uln) >> return x archiveLinks _ x                   = return x  -- | Error check the URL and then archive it both ways checkArchive :: (MonadIO m) => String -> String -> m () checkArchive email url = when (isURI url) $ liftIO (webciteArchive email url >> alexaArchive url) -webciteArchive :: String -> String -> IO ThreadId-webciteArchive email url = forkIO (ignore $ openURL ("http://www.webcitation.org/archive?url=" ++ url ++ "&email=" ++ email))+webciteArchive :: String -> String -> IO ()+webciteArchive email url = ignore $ openURL ("http://www.webcitation.org/archive?url=" ++ url ++ "&email=" ++ email)    where openURL = simpleHTTP . getRequest          ignore = fmap $ const ()