git.iko.soy/typeable/pandoc
on master help sign in
Added writerEPUBMetadata field and --epub-metadata option.
commite3dcf8e3bf438371961b6cc18e98f1637c30c97f authorJohn MacFarlane <jgm@berkeley.edu> dateSun 4 Jul 2010, 16:56 (16 years ago) parent15cc99c
2 files changed+14
src/Text/Pandoc/Shared.hs+2 src/pandoc.hs+12
src/Text/Pandoc/Shared.hs+2
@@ -462,6 +462,7 @@ data WriterOptions = WriterOptions
462462 { writerStandalone :: Bool -- ^ Include header and footer
463463 , writerTemplate :: String -- ^ Template to use in standalone mode
464464 , writerVariables :: [(String, String)] -- ^ Variables to set in template
465+ , writerEPUBMetadata :: String -- ^ Metadata to include in EPUB
465466 , writerTabStop :: Int -- ^ Tabstop for conversion btw spaces and tabs
466467 , writerTableOfContents :: Bool -- ^ Include table of contents
467468 , writerS5 :: Bool -- ^ We're writing S5
@@ -484,6 +485,7 @@ defaultWriterOptions =
484485 WriterOptions { writerStandalone = False
485486 , writerTemplate = ""
486487 , writerVariables = []
488+ , writerEPUBMetadata = ""
487489 , writerTabStop = 4
488490 , writerTableOfContents = False
489491 , writerS5 = False
src/pandoc.hs+12
@@ -153,6 +153,7 @@ data Opt = Opt
153153 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
154154 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
155155 , optEPUBStylesheet :: Maybe String -- ^ EPUB stylesheet
156+ , optEPUBMetadata :: String -- ^ EPUB metadata
156157 , optDumpArgs :: Bool -- ^ Output command-line arguments
157158 , optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
158159 , optStrict :: Bool -- ^ Use strict markdown syntax
@@ -192,6 +193,7 @@ defaultOpts = Opt
192193 , optHTMLMathMethod = PlainMath
193194 , optReferenceODT = Nothing
194195 , optEPUBStylesheet = Nothing
196+ , optEPUBMetadata = ""
195197 , optDumpArgs = False
196198 , optIgnoreArgs = False
197199 , optStrict = False
@@ -470,6 +472,14 @@ options =
470472 "FILENAME")
471473 "" -- "Path of epub.css"
472474
475+ , Option "" ["epub-metadata"]
476+ (ReqArg
477+ (\arg opt -> do
478+ text <- UTF8.readFile arg
479+ return opt { optEPUBMetadata = text })
480+ "FILENAME")
481+ "" -- "Path of epub metadata file"
482+
473483 , Option "D" ["print-default-template"]
474484 (ReqArg
475485 (\arg _ -> do
@@ -631,6 +641,7 @@ main = do
631641 , optHTMLMathMethod = mathMethod
632642 , optReferenceODT = referenceODT
633643 , optEPUBStylesheet = epubStylesheet
644+ , optEPUBMetadata = epubMetadata
634645 , optDumpArgs = dumpArgs
635646 , optIgnoreArgs = ignoreArgs
636647 , optStrict = strict
@@ -751,6 +762,7 @@ main = do
751762 then defaultTemplate
752763 else template,
753764 writerVariables = variables'',
765+ writerEPUBMetadata = epubMetadata,
754766 writerTabStop = tabStop,
755767 writerTableOfContents = toc &&
756768 writerName' /= "s5",