@@ -138,6 +138,8 @@ data Opt = Opt
138 , optTableOfContents :: Bool -- ^ Include table of contents
138 , optTableOfContents :: Bool -- ^ Include table of contents
139 , optTemplate :: String -- ^ Custom template
139 , optTemplate :: String -- ^ Custom template
140 , optVariables :: [(String,String)] -- ^ Template variables to set
140 , optVariables :: [(String,String)] -- ^ Template variables to set
141+ , optBefore :: [String] -- ^ Texts to include before body
142+ , optAfter :: [String] -- ^ Texts to include after body
141 , optOutputFile :: String -- ^ Name of output file
143 , optOutputFile :: String -- ^ Name of output file
142 , optNumberSections :: Bool -- ^ Number sections in LaTeX
144 , optNumberSections :: Bool -- ^ Number sections in LaTeX
143 , optIncremental :: Bool -- ^ Use incremental lists in S5
145 , optIncremental :: Bool -- ^ Use incremental lists in S5
@@ -172,6 +174,8 @@ defaultOpts = Opt
172 , optTableOfContents = False
174 , optTableOfContents = False
173 , optTemplate = ""
175 , optTemplate = ""
174 , optVariables = []
176 , optVariables = []
175 , optOutputFile = "-" -- "-" means stdout
179 , optOutputFile = "-" -- "-" means stdout
176 , optNumberSections = False
180 , optNumberSections = False
177 , optIncremental = False
181 , optIncremental = False
@@ -383,13 +387,8 @@ options =
384 (\arg opt -> do
388 (\arg opt -> do
385 text <- readFile arg
389 text <- readFile arg
386− let oldvars = optVariables opt
390+ let oldBefore = optBefore opt
387− let newvars = case lookup "before" oldvars of
391+ return opt { optBefore = text : oldBefore })
388− Nothing -> ("before", text) : oldvars
389− Just b -> ("before", b ++ text) :
390− filter ((/= "before") . fst)
392− return opt { optVariables = newvars })
393 "FILENAME")
392 "FILENAME")
394 "" -- "File to include before document body"
393 "" -- "File to include before document body"
@@ -397,13 +396,8 @@ options =
398 (\arg opt -> do
397 (\arg opt -> do
399 text <- readFile arg
398 text <- readFile arg
400− let oldvars = optVariables opt
399+ let oldAfter = optAfter opt
401− let newvars = case lookup "after" oldvars of
400+ return opt { optAfter = text : oldAfter })
402− Nothing -> ("after", text) : oldvars
403− Just a -> ("after", a ++ text) :
404− filter ((/= "after") . fst)
406− return opt { optVariables = newvars })
407 "FILENAME")
401 "FILENAME")
408 "" -- "File to include after document body"
402 "" -- "File to include after document body"
@@ -572,6 +566,8 @@ main = do
572 , optWriter = writerName
566 , optWriter = writerName
573 , optParseRaw = parseRaw
567 , optParseRaw = parseRaw
574 , optVariables = variables
568 , optVariables = variables
569+ , optBefore = befores
575 , optTableOfContents = toc
571 , optTableOfContents = toc
576 , optTemplate = template
572 , optTemplate = template
577 , optOutputFile = outputFile
573 , optOutputFile = outputFile
@@ -665,6 +661,8 @@ main = do
665 then defaultTemplate
661 then defaultTemplate
666 else template,
662 else template,
667 writerVariables = variables',
663 writerVariables = variables',
664+ writerIncludeBefore = concat befores,
665+ writerIncludeAfter = concat afters,
668 writerTabStop = tabStop,
666 writerTabStop = tabStop,
669 writerTableOfContents = toc &&
667 writerTableOfContents = toc &&
670 writerName' /= "s5",
668 writerName' /= "s5",