diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index a5e99f827..da6c1a3af 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -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 diff --git a/src/pandoc.hs b/src/pandoc.hs index 892409871..36c6b2cda 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -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",