@@ -133,11 +133,9 @@ data Opt = Opt
133 , optReader :: String -- ^ Reader format
133 , optReader :: String -- ^ Reader format
134 , optWriter :: String -- ^ Writer format
134 , optWriter :: String -- ^ Writer format
135 , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX
135 , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX
136− , optCSS :: [String] -- ^ CSS file to link to
137 , optTableOfContents :: Bool -- ^ Include table of contents
136 , optTableOfContents :: Bool -- ^ Include table of contents
138 , optTemplate :: String -- ^ Custom template
137 , optTemplate :: String -- ^ Custom template
139 , optVariables :: [(String,String)] -- ^ Template variables to set
138 , optVariables :: [(String,String)] -- ^ Template variables to set
140− , optIncludeInHeader :: String -- ^ File to include in header
141 , optOutputFile :: String -- ^ Name of output file
139 , optOutputFile :: String -- ^ Name of output file
142 , optNumberSections :: Bool -- ^ Number sections in LaTeX
140 , optNumberSections :: Bool -- ^ Number sections in LaTeX
143 , optIncremental :: Bool -- ^ Use incremental lists in S5
141 , optIncremental :: Bool -- ^ Use incremental lists in S5
@@ -169,11 +167,9 @@ defaultOpts = Opt
169 , optReader = "" -- null for default reader
167 , optReader = "" -- null for default reader
170 , optWriter = "" -- null for default writer
168 , optWriter = "" -- null for default writer
171 , optParseRaw = False
169 , optParseRaw = False
173 , optTableOfContents = False
170 , optTableOfContents = False
174 , optTemplate = ""
171 , optTemplate = ""
175 , optVariables = []
172 , optVariables = []
176− , optIncludeInHeader = ""
177 , optOutputFile = "-" -- "-" means stdout
173 , optOutputFile = "-" -- "-" means stdout
178 , optNumberSections = False
174 , optNumberSections = False
179 , optIncremental = False
175 , optIncremental = False
@@ -355,8 +351,15 @@ options =
355 , Option "c" ["css"]
351 , Option "c" ["css"]
357 (\arg opt -> do
353 (\arg opt -> do
358− let old = optCSS opt
354+ let text' = "<link rel=\"stylesheet\" href=\"" ++ arg ++
359− return opt { optCSS = old ++ [arg],
355+ "\" type=\"text/css\" />\n"
356+ let oldvars = optVariables opt
357+ let newvars = case lookup "css" oldvars of
358+ Nothing -> ("css", text') : oldvars
359+ Just b -> ("css", b ++ text') :
360+ filter ((/= "css") . fst)
362+ return opt { optVariables = newvars,
360 optStandalone = True })
363 optStandalone = True })
362 "" -- "Link to CSS style sheet"
365 "" -- "Link to CSS style sheet"
@@ -364,9 +367,9 @@ options =
364 , Option "H" ["include-in-header"]
367 , Option "H" ["include-in-header"]
366 (\arg opt -> do
369 (\arg opt -> do
367− let old = optIncludeInHeader opt
368 text <- readFile arg
370 text <- readFile arg
369− return opt { optIncludeInHeader = old ++ text,
371+ let newvars = ("header-includes",text) : optVariables opt
372+ return opt { optVariables = newvars,
370 optStandalone = True })
373 optStandalone = True })
371 "FILENAME")
374 "FILENAME")
372 "" -- "File to include at end of header (implies -s)"
375 "" -- "File to include at end of header (implies -s)"
@@ -563,11 +566,9 @@ main = do
563 , optReader = readerName
566 , optReader = readerName
564 , optWriter = writerName
567 , optWriter = writerName
565 , optParseRaw = parseRaw
568 , optParseRaw = parseRaw
567 , optVariables = variables
569 , optVariables = variables
568 , optTableOfContents = toc
570 , optTableOfContents = toc
569 , optTemplate = template
571 , optTemplate = template
570− , optIncludeInHeader = includeHeader
571 , optOutputFile = outputFile
572 , optOutputFile = outputFile
572 , optNumberSections = numberSections
573 , optNumberSections = numberSections
573 , optIncremental = incremental
574 , optIncremental = incremental
@@ -639,20 +640,11 @@ main = do
639 stateColumns = columns,
640 stateColumns = columns,
640 stateStrict = strict,
641 stateStrict = strict,
641 stateIndentedCodeClasses = codeBlockClasses }
642 stateIndentedCodeClasses = codeBlockClasses }
642− let csslink = if null css
645− (\f -> "<link rel=\"stylesheet\" href=\"" ++
646− f ++ "\" type=\"text/css\" media=\"all\" />\n")
648− let variables' = [("css", csslink) | not (null css)] ++
649− [("header-includes", includeHeader)] ++
651 let writerOptions = WriterOptions { writerStandalone = standalone',
643 let writerOptions = WriterOptions { writerStandalone = standalone',
652 writerTemplate = if null template
644 writerTemplate = if null template
653 then defaultTemplate
645 then defaultTemplate
654 else template,
646 else template,
655− writerVariables = variables',
647+ writerVariables = variables,
656 writerTabStop = tabStop,
648 writerTabStop = tabStop,
657 writerTableOfContents = toc &&
649 writerTableOfContents = toc &&
658 writerName' /= "s5",
650 writerName' /= "s5",