Grab the xmonad.cabal version for putting into the manpage

This commit is contained in:
Adam Vogt 2009-10-24 20:09:20 +00:00
parent 17c89e327e
commit b4bf8de874
2 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,8 @@
./" man page created by David Lazar on April 24, 2007 ./" man page created by David Lazar on April 24, 2007
./" uses ``tmac.an'' macro set ./" uses ``tmac.an'' macro set
.TH xmonad 1 "18 April 07" xmonad\-1.0 "xmonad manual" .TH xmonad 1 "8 September 09"\
___RELEASE___\
"xmonad manual"
.SH NAME .SH NAME
xmonad \- a tiling window manager xmonad \- a tiling window manager
.SH DESCRIPTION .SH DESCRIPTION

View File

@ -20,6 +20,13 @@ import Text.Regex.Posix
import Data.Char import Data.Char
import Data.List import Data.List
import Distribution.PackageDescription.Parse
import Distribution.Verbosity
import Distribution.Package
import Distribution.PackageDescription
import Text.PrettyPrint.HughesPJ
import Distribution.Text
trim :: String -> String trim :: String -> String
trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace
@ -42,6 +49,9 @@ replace :: Eq a => a -> a -> [a] -> [a]
replace x y = map (\a -> if a == x then y else a) replace x y = map (\a -> if a == x then y else a)
main = do main = do
releaseName <- ((' ':) . (++" \\") . show . disp . package . packageDescription) `liftM` readPackageDescription normal "xmonad.cabal"
troffBindings <- (concatMap troff . allBindings) `liftM` readFile "./XMonad/Config.hs" troffBindings <- (concatMap troff . allBindings) `liftM` readFile "./XMonad/Config.hs"
let sed = unlines . replace "___KEYBINDINGS___" troffBindings . lines
let sed = unlines . replace "___RELEASE___\\" releaseName . replace "___KEYBINDINGS___" troffBindings . lines
readFile "./man/xmonad.1.in" >>= return . sed >>= writeFile "./man/xmonad.1" readFile "./man/xmonad.1.in" >>= return . sed >>= writeFile "./man/xmonad.1"