aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANUAL.txt74
-rw-r--r--pandoc.hs25
-rw-r--r--src/Text/Pandoc/Options.hs6
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs2
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs2
-rw-r--r--tests/Tests/Writers/Docx.hs2
6 files changed, 49 insertions, 62 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index c9b6c0fb1..5d53c192d 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -794,35 +794,20 @@ Options affecting specific writers
: Link to a CSS style sheet. This option can be used repeatedly to
include multiple files. They will be included in the order specified.
-`--reference-odt=`*FILE*
+`--reference-doc=`*FILE*
-: Use the specified file as a style reference in producing an ODT.
- For best results, the reference ODT should be a modified version
- of an ODT produced using pandoc. The contents of the reference ODT
- are ignored, but its stylesheets are used in the new ODT. If no
- reference ODT is specified on the command line, pandoc will look
- for a file `reference.odt` in the user data directory (see
- `--data-dir`). If this is not found either, sensible defaults will be
- used.
+: Use the specified file as a style reference in producing a
+ docx or ODT file.
- To produce a custom `reference.odt`, first get a copy of
- the default `reference.odt`: `pandoc
- --print-default-data-file reference.odt >
- custom-reference.odt`. Then open `custom-reference.docx` in
- LibreOffice, modify the styles as you wish, and save the
- file.
-
-`--reference-docx=`*FILE*
-
-: Use the specified file as a style reference in producing a docx file.
- For best results, the reference docx should be a modified version
- of a docx file produced using pandoc. The contents of the reference docx
- are ignored, but its stylesheets and document properties (including
- margins, page size, header, and footer) are used in the new docx. If no
- reference docx is specified on the command line, pandoc will look
- for a file `reference.docx` in the user data directory (see
- `--data-dir`). If this is not found either, sensible defaults will be
- used.
+ Docx: For best results, the reference docx should be a modified
+ version of a docx file produced using pandoc. The contents
+ of the reference docx are ignored, but its stylesheets and
+ document properties (including margins, page size, header,
+ and footer) are used in the new docx. If no reference docx
+ is specified on the command line, pandoc will look for a
+ file `reference.docx` in the user data directory (see
+ `--data-dir`). If this is not found either, sensible
+ defaults will be used.
To produce a custom `reference.docx`, first get a copy of
the default `reference.docx`: `pandoc
@@ -830,15 +815,30 @@ Options affecting specific writers
custom-reference.docx`. Then open `custom-reference.docx`
in Word, modify the styles as you wish, and save the file.
For best results, do not make changes to this file other
- than modifying the styles used by pandoc: [paragraph] Normal,
- Body Text, First Paragraph, Compact, Title, Subtitle,
- Author, Date, Abstract, Bibliography, Heading 1, Heading 2,
- Heading 3, Heading 4, Heading 5, Heading 6, Block Text,
- Footnote Text, Definition Term, Definition, Caption, Table
- Caption, Image Caption, Figure, Figure With Caption, TOC
- Heading; [character] Default Paragraph Font, Body Text Char,
- Verbatim Char, Footnote Reference, Hyperlink; [table] Normal
- Table.
+ than modifying the styles used by pandoc: [paragraph]
+ Normal, Body Text, First Paragraph, Compact, Title,
+ Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
+ Heading 2, Heading 3, Heading 4, Heading 5, Heading 6, Block
+ Text, Footnote Text, Definition Term, Definition, Caption,
+ Table Caption, Image Caption, Figure, Figure With Caption,
+ TOC Heading; [character] Default Paragraph Font, Body Text
+ Char, Verbatim Char, Footnote Reference, Hyperlink; [table]
+ Normal Table.
+
+ ODT: For best results, the reference ODT should be a modified
+ version of an ODT produced using pandoc. The contents of
+ the reference ODT are ignored, but its stylesheets are used
+ in the new ODT. If no reference ODT is specified on the
+ command line, pandoc will look for a file `reference.odt` in
+ the user data directory (see `--data-dir`). If this is not
+ found either, sensible defaults will be used.
+
+ To produce a custom `reference.odt`, first get a copy of
+ the default `reference.odt`: `pandoc
+ --print-default-data-file reference.odt >
+ custom-reference.odt`. Then open `custom-reference.docx` in
+ LibreOffice, modify the styles as you wish, and save the
+ file.
`--epub-stylesheet=`*FILE*
@@ -1099,7 +1099,7 @@ directory (see `--data-dir`, above). *Exceptions:*
(or the `default.beamer` template, if you use `-t beamer`,
or the `default.context` template, if you use `-t context`).
- `docx` has no template (however, you can use
- `--reference-docx` to customize the output).
+ `--reference-doc` to customize the output).
Templates contain *variables*, which allow for the inclusion of
arbitrary information at any point in the file. Variables may be set
diff --git a/pandoc.hs b/pandoc.hs
index f1a9aac05..f5d5e0da6 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -185,8 +185,7 @@ data Opt = Opt
, optHighlightStyle :: Style -- ^ Style to use for highlighted code
, optTopLevelDivision :: TopLevelDivision -- ^ Type of the top-level divisions
, optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
- , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
- , optReferenceDocx :: Maybe FilePath -- ^ Path of reference.docx
+ , optReferenceDoc :: Maybe FilePath -- ^ Path of reference doc
, optEpubStylesheet :: Maybe String -- ^ EPUB stylesheet
, optEpubMetadata :: String -- ^ EPUB metadata
, optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
@@ -252,8 +251,7 @@ defaultOpts = Opt
, optHighlightStyle = pygments
, optTopLevelDivision = TopLevelDefault
, optHTMLMathMethod = PlainMath
- , optReferenceODT = Nothing
- , optReferenceDocx = Nothing
+ , optReferenceDoc = Nothing
, optEpubStylesheet = Nothing
, optEpubMetadata = ""
, optEpubFonts = []
@@ -708,19 +706,12 @@ options =
"URL")
"" -- "Link to CSS style sheet"
- , Option "" ["reference-odt"]
+ , Option "" ["reference-doc"]
(ReqArg
(\arg opt ->
- return opt { optReferenceODT = Just arg })
+ return opt { optReferenceDoc = Just arg })
"FILENAME")
- "" -- "Path of custom reference.odt"
-
- , Option "" ["reference-docx"]
- (ReqArg
- (\arg opt ->
- return opt { optReferenceDocx = Just arg })
- "FILENAME")
- "" -- "Path of custom reference.docx"
+ "" -- "Path of custom reference doc"
, Option "" ["epub-stylesheet"]
(ReqArg
@@ -1190,8 +1181,7 @@ convertWithOpts opts args = do
, optHighlightStyle = highlightStyle
, optTopLevelDivision = topLevelDivision
, optHTMLMathMethod = mathMethod'
- , optReferenceODT = referenceODT
- , optReferenceDocx = referenceDocx
+ , optReferenceDoc = referenceDoc
, optEpubStylesheet = epubStylesheet
, optEpubMetadata = epubMetadata
, optEpubFonts = epubFonts
@@ -1485,8 +1475,7 @@ convertWithOpts opts args = do
writerEpubFonts = epubFonts,
writerEpubChapterLevel = epubChapterLevel,
writerTOCDepth = epubTOCDepth,
- writerReferenceODT = referenceODT,
- writerReferenceDocx = referenceDocx,
+ writerReferenceDoc = referenceDoc,
writerMediaBag = media,
writerVerbose = verbose,
writerLaTeXArgs = latexEngineArgs
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 48bc5f4eb..4fee577e7 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -395,8 +395,7 @@ data WriterOptions = WriterOptions
, writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
, writerEpubChapterLevel :: Int -- ^ Header level for chapters (separate files)
, writerTOCDepth :: Int -- ^ Number of levels to include in TOC
- , writerReferenceODT :: Maybe FilePath -- ^ Path to reference ODT if specified
- , writerReferenceDocx :: Maybe FilePath -- ^ Path to reference DOCX if specified
+ , writerReferenceDoc :: Maybe FilePath -- ^ Path to reference document if specified
, writerMediaBag :: MediaBag -- ^ Media collected by docx or epub reader
, writerVerbose :: Bool -- ^ Verbose debugging output
, writerLaTeXArgs :: [String] -- ^ Flags to pass to latex-engine
@@ -442,8 +441,7 @@ instance Default WriterOptions where
, writerEpubFonts = []
, writerEpubChapterLevel = 1
, writerTOCDepth = 3
- , writerReferenceODT = Nothing
- , writerReferenceDocx = Nothing
+ , writerReferenceDoc = Nothing
, writerMediaBag = mempty
, writerVerbose = False
, writerLaTeXArgs = []
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 0f040d19b..20320907e 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -225,7 +225,7 @@ writeDocx opts doc@(Pandoc meta _) = do
username <- P.lookupEnv "USERNAME"
utctime <- P.getCurrentTime
distArchive <- P.getDefaultReferenceDocx datadir
- refArchive <- case writerReferenceDocx opts of
+ refArchive <- case writerReferenceDoc opts of
Just f -> toArchive <$> P.readFileLazy f
Nothing -> P.getDefaultReferenceDocx datadir
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index b17b18a21..a1a1c4f62 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -77,7 +77,7 @@ pandocToODT opts doc@(Pandoc meta _) = do
let datadir = writerUserDataDir opts
let title = docTitle meta
refArchive <-
- case writerReferenceODT opts of
+ case writerReferenceDoc opts of
Just f -> liftM toArchive $ lift $ P.readFileLazy f
Nothing -> lift $ P.getDefaultReferenceODT datadir
-- handle formulas and pictures
diff --git a/tests/Tests/Writers/Docx.hs b/tests/Tests/Writers/Docx.hs
index 548e9ddcf..44095925f 100644
--- a/tests/Tests/Writers/Docx.hs
+++ b/tests/Tests/Writers/Docx.hs
@@ -141,7 +141,7 @@ tests = [ testGroup "inlines"
]
, testGroup "customized styles"
[ testCompareWithOpts
- ( def{writerReferenceDocx=Just "docx/custom-style-reference.docx"}
+ ( def{writerReferenceDoc=Just "docx/custom-style-reference.docx"}
, def)
"simple customized blocks and inlines"
"docx/custom-style-roundtrip-start.native"