@@ -135,6 +135,7 @@ data Opt = Opt
135 , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX
135 , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX
136 , optCSS :: [String] -- ^ CSS file to link to
136 , optCSS :: [String] -- ^ CSS file to link to
137 , optTableOfContents :: Bool -- ^ Include table of contents
137 , optTableOfContents :: Bool -- ^ Include table of contents
138+ , optTemplate :: String -- ^ Custom template
138 , optVariables :: [(String,String)] -- ^ Template variables to set
139 , optVariables :: [(String,String)] -- ^ Template variables to set
139 , optIncludeInHeader :: String -- ^ File to include in header
140 , optIncludeInHeader :: String -- ^ File to include in header
140 , optIncludeBeforeBody :: String -- ^ File to include at top of body
141 , optIncludeBeforeBody :: String -- ^ File to include at top of body
@@ -173,6 +174,7 @@ defaultOpts = Opt
173 , optParseRaw = False
174 , optParseRaw = False
174 , optCSS = []
175 , optCSS = []
175 , optTableOfContents = False
176 , optTableOfContents = False
176 , optVariables = []
178 , optVariables = []
177 , optIncludeInHeader = ""
179 , optIncludeInHeader = ""
178 , optIncludeBeforeBody = ""
180 , optIncludeBeforeBody = ""
@@ -334,13 +336,22 @@ options =
334 (\opt -> return opt { optTableOfContents = True }))
336 (\opt -> return opt { optTableOfContents = True }))
335 "" -- "Include table of contents"
337 "" -- "Include table of contents"
339+ , Option "" ["template"]
342+ text <- readFile arg
343+ return opt{ optTemplate = text,
344+ optStandalone = True })
346+ "" -- "Use custom template"
337 , Option "c" ["css"]
348 , Option "c" ["css"]
339 (\arg opt -> do
350 (\arg opt -> do
340 let old = optCSS opt
351 let old = optCSS opt
341 return opt { optCSS = old ++ [arg],
352 return opt { optCSS = old ++ [arg],
342 optStandalone = True })
353 optStandalone = True })
344 "" -- "Link to CSS style sheet"
355 "" -- "Link to CSS style sheet"
346 , Option "H" ["include-in-header"]
357 , Option "H" ["include-in-header"]
@@ -536,6 +547,7 @@ main = do
536 , optCSS = css
547 , optCSS = css
537 , optVariables = variables
548 , optVariables = variables
538 , optTableOfContents = toc
549 , optTableOfContents = toc
550+ , optTemplate = template
539 , optIncludeInHeader = includeHeader
551 , optIncludeInHeader = includeHeader
540 , optIncludeBeforeBody = includeBefore
552 , optIncludeBeforeBody = includeBefore
541 , optIncludeAfterBody = includeAfter
553 , optIncludeAfterBody = includeAfter
@@ -623,7 +635,9 @@ main = do
623 let writerOptions = WriterOptions { writerStandalone = standalone',
635 let writerOptions = WriterOptions { writerStandalone = standalone',
624 writerTemplate = defaultTemplate,
636 writerTemplate = defaultTemplate,
625 writerVariables = variables',
637 writerVariables = variables',
638+ writerHeader = if null template
626− writerHeader = defaultTemplate, -- TODO remove
639+ then defaultTemplate
627 writerTitlePrefix = titlePrefix,
641 writerTitlePrefix = titlePrefix,
628 writerTabStop = tabStop,
642 writerTabStop = tabStop,
629 writerTableOfContents = toc &&
643 writerTableOfContents = toc &&