Added writerEPUBMetadata field and --epub-metadata option.

This commit is contained in:
John MacFarlane 2010-07-04 16:56:17 -07:00
parent 15cc99c617
commit e3dcf8e3bf
2 changed files with 14 additions and 0 deletions

View file

@ -462,6 +462,7 @@ data WriterOptions = WriterOptions
{ writerStandalone :: Bool -- ^ Include header and footer
, writerTemplate :: String -- ^ Template to use in standalone mode
, writerVariables :: [(String, String)] -- ^ Variables to set in template
, writerEPUBMetadata :: String -- ^ Metadata to include in EPUB
, writerTabStop :: Int -- ^ Tabstop for conversion btw spaces and tabs
, writerTableOfContents :: Bool -- ^ Include table of contents
, writerS5 :: Bool -- ^ We're writing S5
@ -484,6 +485,7 @@ defaultWriterOptions =
WriterOptions { writerStandalone = False
, writerTemplate = ""
, writerVariables = []
, writerEPUBMetadata = ""
, writerTabStop = 4
, writerTableOfContents = False
, writerS5 = False

View file

@ -153,6 +153,7 @@ data Opt = Opt
, optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
, optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
, optEPUBStylesheet :: Maybe String -- ^ EPUB stylesheet
, optEPUBMetadata :: String -- ^ EPUB metadata
, optDumpArgs :: Bool -- ^ Output command-line arguments
, optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
, optStrict :: Bool -- ^ Use strict markdown syntax
@ -192,6 +193,7 @@ defaultOpts = Opt
, optHTMLMathMethod = PlainMath
, optReferenceODT = Nothing
, optEPUBStylesheet = Nothing
, optEPUBMetadata = ""
, optDumpArgs = False
, optIgnoreArgs = False
, optStrict = False
@ -470,6 +472,14 @@ options =
"FILENAME")
"" -- "Path of epub.css"
, Option "" ["epub-metadata"]
(ReqArg
(\arg opt -> do
text <- UTF8.readFile arg
return opt { optEPUBMetadata = text })
"FILENAME")
"" -- "Path of epub metadata file"
, Option "D" ["print-default-template"]
(ReqArg
(\arg _ -> do
@ -631,6 +641,7 @@ main = do
, optHTMLMathMethod = mathMethod
, optReferenceODT = referenceODT
, optEPUBStylesheet = epubStylesheet
, optEPUBMetadata = epubMetadata
, optDumpArgs = dumpArgs
, optIgnoreArgs = ignoreArgs
, optStrict = strict
@ -751,6 +762,7 @@ main = do
then defaultTemplate
else template,
writerVariables = variables'',
writerEPUBMetadata = epubMetadata,
writerTabStop = tabStop,
writerTableOfContents = toc &&
writerName' /= "s5",