@@ -138,9 +138,6 @@ data Opt = Opt
138138 , optTemplate :: String -- ^ Custom template
139139 , optVariables :: [(String,String)] -- ^ Template variables to set
140140 , optIncludeInHeader :: String -- ^ File to include in header
141− , optIncludeBeforeBody :: String -- ^ File to include at top of body
142− , optIncludeAfterBody :: String -- ^ File to include at end of body
143− , optTitlePrefix :: String -- ^ Optional prefix for HTML title
144141 , optOutputFile :: String -- ^ Name of output file
145142 , optNumberSections :: Bool -- ^ Number sections in LaTeX
146143 , optIncremental :: Bool -- ^ Use incremental lists in S5
@@ -177,9 +174,6 @@ defaultOpts = Opt
177174 , optTemplate = ""
178175 , optVariables = []
179176 , optIncludeInHeader = ""
180− , optIncludeBeforeBody = ""
181− , optIncludeAfterBody = ""
182− , optTitlePrefix = ""
183177 , optOutputFile = "-" -- "-" means stdout
184178 , optNumberSections = False
185179 , optIncremental = False
@@ -367,18 +361,28 @@ options =
367361 , Option "B" ["include-before-body"]
368362 (ReqArg
369363 (\arg opt -> do
370− let old = optIncludeBeforeBody opt
371364 text <- readFile arg
372− return opt { optIncludeBeforeBody = old ++ text })
365+ let oldvars = optVariables opt
366+ let newvars = case lookup "before" oldvars of
367+ Nothing -> ("before", text) : oldvars
368+ Just b -> ("before", b ++ text) :
369+ filter ((/= "before") . fst)
370+ oldvars
371+ return opt { optVariables = newvars })
373372 "FILENAME")
374373 "" -- "File to include before document body"
375374
376375 , Option "A" ["include-after-body"]
377376 (ReqArg
378377 (\arg opt -> do
379− let old = optIncludeAfterBody opt
380378 text <- readFile arg
381− return opt { optIncludeAfterBody = old ++ text })
379+ let oldvars = optVariables opt
380+ let newvars = case lookup "after" oldvars of
381+ Nothing -> ("after", text) : oldvars
382+ Just a -> ("after", a ++ text) :
383+ filter ((/= "after") . fst)
384+ oldvars
385+ return opt { optVariables = newvars })
382386 "FILENAME")
383387 "" -- "File to include after document body"
384388
@@ -397,8 +401,10 @@ options =
397401
398402 , Option "T" ["title-prefix"]
399403 (ReqArg
400− (\arg opt -> return opt { optTitlePrefix = arg,
401− optStandalone = True })
404+ (\arg opt -> do
405+ let newvars = ("title-prefix", arg) : optVariables opt
406+ return opt { optVariables = newvars,
407+ optStandalone = True })
402408 "STRING")
403409 "" -- "String to prefix to HTML window title"
404410
@@ -549,9 +555,6 @@ main = do
549555 , optTableOfContents = toc
550556 , optTemplate = template
551557 , optIncludeInHeader = includeHeader
552− , optIncludeBeforeBody = includeBefore
553− , optIncludeAfterBody = includeAfter
554− , optTitlePrefix = titlePrefix
555558 , optOutputFile = outputFile
556559 , optNumberSections = numberSections
557560 , optIncremental = incremental
@@ -633,12 +636,10 @@ main = do
633636 [("header-includes", includeHeader)] ++
634637 variables
635638 let writerOptions = WriterOptions { writerStandalone = standalone',
636− writerTemplate = defaultTemplate,
637− writerVariables = variables',
638− writerHeader = if null template
639+ writerTemplate = if null template
639640 then defaultTemplate
640641 else template,
641− writerTitlePrefix = titlePrefix,
642+ writerVariables = variables',
642643 writerTabStop = tabStop,
643644 writerTableOfContents = toc &&
644645 writerName' /= "s5",
@@ -647,8 +648,6 @@ main = do
647648 writerIgnoreNotes = False,
648649 writerIncremental = incremental,
649650 writerNumberSections = numberSections,
650− writerIncludeBefore = includeBefore,
651− writerIncludeAfter = includeAfter,
652651 writerStrictMarkdown = strict,
653652 writerReferenceLinks = referenceLinks,
654653 writerWrapText = wrap,