Bump make-man script

This commit is contained in:
Jasper Van der Jeugt 2016-12-01 14:43:22 +01:00
parent 7f479559b8
commit ded1d743bc
2 changed files with 11 additions and 18 deletions

View File

@ -4,7 +4,7 @@ extra/patat.1: README.md extra/make-man
./extra/make-man >$@
extra/make-man: extra/make-man.hs
ghc -DPANDOC_MINOR_VERSION=${PANDOC_MINOR_VERSION} -o $@ $<
ghc -DPANDOC_MINOR_VERSION=${PANDOC_MINOR_VERSION} -Wall -o $@ $<
man: extra/patat.1

View File

@ -1,13 +1,15 @@
-- | This script generates a man page for patat.
{-# LANGUAGE CPP #-}
import Control.Monad (guard)
import Data.Char (isSpace, toLower)
import Data.List (isPrefixOf)
import Data.Maybe (isJust)
import qualified System.IO as IO
import qualified System.Process as Process
import qualified Text.Pandoc as Pandoc
import qualified Text.Pandoc.Walk as Pandoc
import Control.Applicative ((<$>))
import Control.Monad (guard)
import Data.Char (isSpace, toLower)
import Data.List (isPrefixOf)
import Data.Maybe (isJust)
import qualified System.IO as IO
import qualified System.Process as Process
import qualified Text.Pandoc as Pandoc
import qualified Text.Pandoc.Walk as Pandoc
import Prelude
getVersion :: IO String
getVersion =
@ -20,11 +22,6 @@ removeLinks = Pandoc.walk $ \inline -> case inline of
Pandoc.Link _ inlines _ -> Pandoc.Emph inlines
_ -> inline
promoteHeaders :: Pandoc.Pandoc -> Pandoc.Pandoc
promoteHeaders = Pandoc.walk $ \block -> case block of
Pandoc.Header n attr inlines -> Pandoc.Header (max 1 $ n - 1) attr inlines
_ -> block
type Sections = [(Int, String, [Pandoc.Block])]
toSections :: Int -> [Pandoc.Block] -> Sections
@ -81,10 +78,6 @@ reorganizeSections (Pandoc.Pandoc meta0 blocks0) =
lookupSection name sections =
[section | section@(_, n, _) <- sections, name == n]
withBlocks
:: Pandoc.Pandoc -> ([Pandoc.Block] -> [Pandoc.Block]) -> Pandoc.Pandoc
withBlocks (Pandoc.Pandoc meta bs) f = Pandoc.Pandoc meta (f bs)
main :: IO ()
main = do
Right pandoc0 <- Pandoc.readMarkdown Pandoc.def <$> readFile "README.md"