Commit fef440ab authored by Clint Adams's avatar Clint Adams

xmonad: untested patch to build with pandoc 2.x

parent f998fe06
xmonad (0.13-11) unstable; urgency=medium
* Untested patch to build with pandoc 2.x.
-- Clint Adams <clint@debian.org> Tue, 24 Apr 2018 20:30:54 -0400
xmonad (0.13-10) unstable; urgency=medium
* Untested patch to build with pandoc 2.x.
......
--- a/util/GenerateManpage.hs
+++ b/util/GenerateManpage.hs
@@ -27,6 +27,7 @@
@@ -27,6 +27,8 @@
import Text.Regex.Posix
import Data.Char
import Data.List
+import qualified Data.Text as T
+import Control.Monad.IO.Class (liftIO)
import Distribution.PackageDescription.Parse
import Distribution.Verbosity
@@ -35,7 +36,7 @@
@@ -35,7 +37,7 @@
import Text.PrettyPrint.HughesPJ
import Distribution.Text
......@@ -17,49 +18,67 @@
releaseDate = "31 December 2012"
@@ -68,31 +69,35 @@
@@ -68,31 +70,32 @@
keybindings <- (intercalate "\n\n" . map markdownDefn . allBindings)
`liftM` readFile "./src/XMonad/Config.hs"
- let manHeader = unwords [".TH xmonad 1","\""++releaseDate++"\"",releaseName,"\"xmonad manual\""]
+ let manHeader = T.pack .
+ unwords
+ $ [".TH xmonad 1","\""++releaseDate++"\"",releaseName,"\"xmonad manual\""]
Right parsed <- readMarkdown def
+ . T.pack
. unlines
. replace "___KEYBINDINGS___" keybindings
. lines
<$> readFile "./man/xmonad.1.markdown"
-
- Right parsed <- readMarkdown def
- . unlines
- . replace "___KEYBINDINGS___" keybindings
- . lines
- <$> readFile "./man/xmonad.1.markdown"
-
- Right template <- getDefaultTemplate Nothing "man"
+ let Right mantemplate = runPure getDefaultTemplate "man"
+ Right htmltemplate = runPure getDefaultTemplate "html"
+
writeFile "./man/xmonad.1"
- writeFile "./man/xmonad.1"
- . (manHeader ++)
- . writeMan def{ writerTemplate = Just template }
+ . T.append manHeader
+ . writeMan def{ writerTemplate = Just mantemplate }
$ parsed
putStrLn "Documentation created: man/xmonad.1"
- $ parsed
- putStrLn "Documentation created: man/xmonad.1"
-
- Right template <- getDefaultTemplate Nothing "html"
writeFile "./man/xmonad.1.html"
- writeFile "./man/xmonad.1.html"
- . writeHtmlString def
+ . writeHtml5String def
{ writerVariables =
[("include-before"
,"<h1>"++releaseName++"</h1>"++
"<p>Section: xmonad manual (1)<br/>"++
"Updated: "++releaseDate++"</p>"++
"<hr/>")]
- { writerVariables =
- [("include-before"
- ,"<h1>"++releaseName++"</h1>"++
- "<p>Section: xmonad manual (1)<br/>"++
- "Updated: "++releaseDate++"</p>"++
- "<hr/>")]
- , writerTemplate = Just template
+ , writerTemplate = Just htmltemplate
, writerTableOfContents = True }
$ parsed
putStrLn "Documentation created: man/xmonad.1.html"
- , writerTableOfContents = True }
- $ parsed
- putStrLn "Documentation created: man/xmonad.1.html"
+ let manHeader = T.pack .
+ unwords
+ $ [".TH xmonad 1","\""++releaseDate++"\"",releaseName,"\"xmonad manual\""]
+
+ runIOorExplode $ do
+ parsed <- readMarkdown def
+ . T.pack
+ . unlines
+ . replace "___KEYBINDINGS___" keybindings
+ . lines
+ <$> readFile "./man/xmonad.1.markdown"
+
+ manTemplate <- getDefaultTemplate "man"
+ manBody <- writeMan def { writerTemplate = Just manTemplate } parsed
+ liftIO $ writeFile "./man/xmonad.1" $ T.append manHeader manBody
+ liftIO $ putStrLn "Documentation created: man/xmonad.1"
+
+ htmltemplate <- getDefaultTemplate "html"
+ htmlBody <- writeHtml5String def
+ { writerVariables = map T.pack
+ [("include-before"
+ ,"<h1>"++releaseName++"</h1>"++
+ "<p>Section: xmonad manual (1)<br/>"++
+ "Updated: "++releaseDate++"</p>"++
+ "<hr/>")]
+ , writerTemplate = Just htmltemplate
+ , writerTableOfContents = True } parsed
+ liftIO $ writeFile "./man/xmonad.1.html" htmlBody
+ liftIO $ putStrLn "Documentation created: man/xmonad.1.html"
--- a/xmonad.cabal
+++ b/xmonad.cabal
@@ -113,7 +113,7 @@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment