diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-02-09 03:21:19 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-02-09 03:21:19 +0000 |
commit | 04b32451be96cc64e3c8ee37a4b099ffe6236146 (patch) | |
tree | 197c78f2332f728ea63238aa972ab01e7d1ab4ed /Setup.hs | |
parent | 427c2e484ded241d073e80b3a90be0005509a085 (diff) |
Added build option for syntax highlighting, with *optional* dependency on highlighting-kate.
+ pandoc.cabal includes a flag, 'highlighting', that causes a dependency
on highlighting-kate.
+ if Setup.hs detects this dependency, it copies templates/Highlighting.yes.hs
to Text/Pandoc/Highlighting.hs. Otherwise, it copies templates/Highlighting.no.hs.
+ The HTML writer imports this new module instead of Text.Highlighting.Kate.
The new module exports highlightHtml, which either uses highlighting-kate to
perform syntax highlighting or automatically returns a failure code, depending
on whether highlighting support was selected.
+ --version now prints information about whether syntax highlighting support is compiled in.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1221 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Setup.hs')
-rw-r--r-- | Setup.hs | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -3,7 +3,7 @@ import Distribution.Simple.Setup import Distribution.PackageDescription import Distribution.Simple.LocalBuildInfo import System.FilePath (combine, joinPath, takeFileName) -import System.Directory (getDirectoryContents, removeFile) +import System.Directory (getDirectoryContents, removeFile, copyFile) import System.IO (readFile, writeFile) import Control.Monad (foldM) import Data.List (isPrefixOf) @@ -22,6 +22,14 @@ myPostConf _ configFlags pkgDescription buildInfo = do fillAsciiMathMLTemplate fillS5WriterTemplate fillDefaultHeadersTemplate + let deps = packageDeps buildInfo + let highlighting = any (\id -> pkgName id == "highlighting-kate") deps + let highlightingModule = if highlighting + then combine "templates" "Highlighting.yes.hs" + else combine "templates" "Highlighting.no.hs" + copyFile highlightingModule $ joinPath ["Text", "Pandoc", "Highlighting.hs"] + putStrLn $ " Text/Pandoc/Highlighting.hs [" ++ + (if highlighting then "with" else "without") ++ " syntax highlighting support]" -- Fill templateFile with data in dataFiles and write to outputFile. fillTemplate :: [FilePath] -> FilePath -> FilePath -> IO () @@ -53,6 +61,7 @@ myPostClean _ _ _ _ = do putStrLn "Removing source files generated from templates:" removeGeneratedFile $ joinPath [pandocPath, "ASCIIMathML.hs"] removeGeneratedFile $ joinPath [pandocPath, "DefaultHeaders.hs"] + removeGeneratedFile $ joinPath [pandocPath, "Highlighting.hs"] removeGeneratedFile $ joinPath [pandocPath, "Writers", "S5.hs"] -- Remove file and print message. |