git.iko.soy/typeable/pandoc
on master help sign in
Added writerEPUBMetadata field and --epub-metadata option.
e3dcf8eJohn MacFarlane
src/Text/Pandoc/Shared.hs+2
@@ -462,6 +462,7 @@ data WriterOptions = WriterOptions
462 { writerStandalone :: Bool -- ^ Include header and footer
462 { writerStandalone :: Bool -- ^ Include header and footer
463 , writerTemplate :: String -- ^ Template to use in standalone mode
463 , writerTemplate :: String -- ^ Template to use in standalone mode
464 , writerVariables :: [(String, String)] -- ^ Variables to set in template
464 , writerVariables :: [(String, String)] -- ^ Variables to set in template
465+ , writerEPUBMetadata :: String -- ^ Metadata to include in EPUB
465 , writerTabStop :: Int -- ^ Tabstop for conversion btw spaces and tabs
466 , writerTabStop :: Int -- ^ Tabstop for conversion btw spaces and tabs
466 , writerTableOfContents :: Bool -- ^ Include table of contents
467 , writerTableOfContents :: Bool -- ^ Include table of contents
467 , writerS5 :: Bool -- ^ We're writing S5
468 , writerS5 :: Bool -- ^ We're writing S5
@@ -484,6 +485,7 @@ defaultWriterOptions =
484 WriterOptions { writerStandalone = False
485 WriterOptions { writerStandalone = False
485 , writerTemplate = ""
486 , writerTemplate = ""
486 , writerVariables = []
487 , writerVariables = []
488+ , writerEPUBMetadata = ""
487 , writerTabStop = 4
489 , writerTabStop = 4
488 , writerTableOfContents = False
490 , writerTableOfContents = False
489 , writerS5 = False
491 , writerS5 = False
src/pandoc.hs+12
@@ -153,6 +153,7 @@ data Opt = Opt
153 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
153 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
154 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
154 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
155 , optEPUBStylesheet :: Maybe String -- ^ EPUB stylesheet
155 , optEPUBStylesheet :: Maybe String -- ^ EPUB stylesheet
156+ , optEPUBMetadata :: String -- ^ EPUB metadata
156 , optDumpArgs :: Bool -- ^ Output command-line arguments
157 , optDumpArgs :: Bool -- ^ Output command-line arguments
157 , optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
158 , optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
158 , optStrict :: Bool -- ^ Use strict markdown syntax
159 , optStrict :: Bool -- ^ Use strict markdown syntax
@@ -192,6 +193,7 @@ defaultOpts = Opt
192 , optHTMLMathMethod = PlainMath
193 , optHTMLMathMethod = PlainMath
193 , optReferenceODT = Nothing
194 , optReferenceODT = Nothing
194 , optEPUBStylesheet = Nothing
195 , optEPUBStylesheet = Nothing
196+ , optEPUBMetadata = ""
195 , optDumpArgs = False
197 , optDumpArgs = False
196 , optIgnoreArgs = False
198 , optIgnoreArgs = False
197 , optStrict = False
199 , optStrict = False
@@ -470,6 +472,14 @@ options =
470 "FILENAME")
472 "FILENAME")
471 "" -- "Path of epub.css"
473 "" -- "Path of epub.css"
472
474
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+
473 , Option "D" ["print-default-template"]
483 , Option "D" ["print-default-template"]
474 (ReqArg
484 (ReqArg
475 (\arg _ -> do
485 (\arg _ -> do
@@ -631,6 +641,7 @@ main = do
631 , optHTMLMathMethod = mathMethod
641 , optHTMLMathMethod = mathMethod
632 , optReferenceODT = referenceODT
642 , optReferenceODT = referenceODT
633 , optEPUBStylesheet = epubStylesheet
643 , optEPUBStylesheet = epubStylesheet
644+ , optEPUBMetadata = epubMetadata
634 , optDumpArgs = dumpArgs
645 , optDumpArgs = dumpArgs
635 , optIgnoreArgs = ignoreArgs
646 , optIgnoreArgs = ignoreArgs
636 , optStrict = strict
647 , optStrict = strict
@@ -751,6 +762,7 @@ main = do
751 then defaultTemplate
762 then defaultTemplate
752 else template,
763 else template,
753 writerVariables = variables'',
764 writerVariables = variables'',
765+ writerEPUBMetadata = epubMetadata,
754 writerTabStop = tabStop,
766 writerTabStop = tabStop,
755 writerTableOfContents = toc &&
767 writerTableOfContents = toc &&
756 writerName' /= "s5",
768 writerName' /= "s5",