aboutsummaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-01 16:29:44 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-01 16:29:44 -0700
commit28cb50503b2f9428de34dee0d62f2e46f1c0fa59 (patch)
tree2e6d0f770ac5892b66368c2fa2a6310a57b71fda /Setup.hs
parent958a615b759aaa45333bac7f12a2a35b2d8c8b34 (diff)
downloadpandoc-28cb50503b2f9428de34dee0d62f2e46f1c0fa59.tar.gz
Generate man page in cabal build process and include in data/.
The pandoc.1 man page is generated automatically after the cabal build process. It goes in `data/pandoc.1`. It can be obtained by the user who installs pandoc via cabal thus: pandoc --print-default-data-file pandoc.1 > pandoc.1
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Setup.hs b/Setup.hs
index 6db3b1aec..03e3248ef 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -31,6 +31,8 @@ main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks {
-- enable hsb2hs preprocessor for .hsb files
hookedPreProcessors = [ppBlobSuffixHandler]
+ , postBuild = \args bf pkgdescr lbi ->
+ makeManPages args bf pkgdescr lbi
}
ppBlobSuffixHandler :: PPSuffixHandler
@@ -45,3 +47,18 @@ ppBlobSuffixHandler = ("hsb", \_ _ ->
Nothing -> error "hsb2hs is needed to build this program: cabal install hsb2hs"
return ()
})
+
+makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo
+ -> IO ()
+makeManPages _ bf _ LocalBuildInfo{buildDir=buildDir}
+ = do info verbosity "Creating data/pandoc.1"
+ rawSystemExit verbosity progPath args
+ where verbosity = fromFlagOrDefault normal $ buildVerbosity bf
+ progPath = buildDir </> "pandoc" </> "pandoc"
+ args = ["README", "-t", "man", "-s",
+ "--template", "man/pandoc.1.template",
+ "--filter", "man/capitalizeHeaders.hs",
+ "--filter", "man/removeNotes.hs",
+ "--filter", "man/removeLinks.hs",
+ "-o", "data/pandoc.1"]
+