@@ -138,9 +138,6 @@ data Opt = Opt
138 , optTemplate :: String -- ^ Custom template
138 , optTemplate :: String -- ^ Custom template
139 , optVariables :: [(String,String)] -- ^ Template variables to set
139 , optVariables :: [(String,String)] -- ^ Template variables to set
140 , optIncludeInHeader :: String -- ^ File to include in header
140 , 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
144 , optOutputFile :: String -- ^ Name of output file
141 , optOutputFile :: String -- ^ Name of output file
145 , optNumberSections :: Bool -- ^ Number sections in LaTeX
142 , optNumberSections :: Bool -- ^ Number sections in LaTeX
146 , optIncremental :: Bool -- ^ Use incremental lists in S5
143 , optIncremental :: Bool -- ^ Use incremental lists in S5
@@ -177,9 +174,6 @@ defaultOpts = Opt
177 , optTemplate = ""
174 , optTemplate = ""
178 , optVariables = []
175 , optVariables = []
179 , optIncludeInHeader = ""
176 , optIncludeInHeader = ""
180− , optIncludeBeforeBody = ""
181− , optIncludeAfterBody = ""
182− , optTitlePrefix = ""
183 , optOutputFile = "-" -- "-" means stdout
177 , optOutputFile = "-" -- "-" means stdout
184 , optNumberSections = False
178 , optNumberSections = False
185 , optIncremental = False
179 , optIncremental = False
@@ -367,18 +361,28 @@ options =
367 , Option "B" ["include-before-body"]
361 , Option "B" ["include-before-body"]
369 (\arg opt -> do
363 (\arg opt -> do
370− let old = optIncludeBeforeBody opt
371 text <- readFile arg
364 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)
371+ return opt { optVariables = newvars })
373 "FILENAME")
372 "FILENAME")
374 "" -- "File to include before document body"
373 "" -- "File to include before document body"
376 , Option "A" ["include-after-body"]
375 , Option "A" ["include-after-body"]
378 (\arg opt -> do
377 (\arg opt -> do
379− let old = optIncludeAfterBody opt
380 text <- readFile arg
378 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)
385+ return opt { optVariables = newvars })
382 "FILENAME")
386 "FILENAME")
383 "" -- "File to include after document body"
387 "" -- "File to include after document body"
@@ -397,8 +401,10 @@ options =
398 , Option "T" ["title-prefix"]
402 , Option "T" ["title-prefix"]
400− (\arg opt -> return opt { optTitlePrefix = arg,
404+ (\arg opt -> do
405+ let newvars = ("title-prefix", arg) : optVariables opt
406+ return opt { optVariables = newvars,
401− optStandalone = True })
407+ optStandalone = True })
402 "STRING")
408 "STRING")
403 "" -- "String to prefix to HTML window title"
409 "" -- "String to prefix to HTML window title"
@@ -549,9 +555,6 @@ main = do
549 , optTableOfContents = toc
555 , optTableOfContents = toc
550 , optTemplate = template
556 , optTemplate = template
551 , optIncludeInHeader = includeHeader
557 , optIncludeInHeader = includeHeader
552− , optIncludeBeforeBody = includeBefore
553− , optIncludeAfterBody = includeAfter
554− , optTitlePrefix = titlePrefix
555 , optOutputFile = outputFile
558 , optOutputFile = outputFile
556 , optNumberSections = numberSections
559 , optNumberSections = numberSections
557 , optIncremental = incremental
560 , optIncremental = incremental
@@ -633,12 +636,10 @@ main = do
633 [("header-includes", includeHeader)] ++
636 [("header-includes", includeHeader)] ++
634 variables
637 variables
635 let writerOptions = WriterOptions { writerStandalone = standalone',
638 let writerOptions = WriterOptions { writerStandalone = standalone',
636− writerTemplate = defaultTemplate,
637− writerVariables = variables',
638− writerHeader = if null template
639+ writerTemplate = if null template
639 then defaultTemplate
640 then defaultTemplate
640 else template,
641 else template,
641− writerTitlePrefix = titlePrefix,
642+ writerVariables = variables',
642 writerTabStop = tabStop,
643 writerTabStop = tabStop,
643 writerTableOfContents = toc &&
644 writerTableOfContents = toc &&
644 writerName' /= "s5",
645 writerName' /= "s5",
@@ -647,8 +648,6 @@ main = do
647 writerIgnoreNotes = False,
648 writerIgnoreNotes = False,
648 writerIncremental = incremental,
649 writerIncremental = incremental,
649 writerNumberSections = numberSections,
650 writerNumberSections = numberSections,
650− writerIncludeBefore = includeBefore,
651− writerIncludeAfter = includeAfter,
652 writerStrictMarkdown = strict,
651 writerStrictMarkdown = strict,
653 writerReferenceLinks = referenceLinks,
652 writerReferenceLinks = referenceLinks,
654 writerWrapText = wrap,
653 writerWrapText = wrap,