git.iko.soy/typeable/pandoc
on master help sign in
Simplified reference-docx/reference-odt to reference-doc.
ce1664cJohn MacFarlane
MANUAL.txt+37−37
@@ -794,35 +794,20 @@ Options affecting specific writers
794: Link to a CSS style sheet. This option can be used repeatedly to
794: Link to a CSS style sheet. This option can be used repeatedly to
795 include multiple files. They will be included in the order specified.
795 include multiple files. They will be included in the order specified.
796
796
797−`--reference-odt=`*FILE*
797+`--reference-doc=`*FILE*
798
798
799−: Use the specified file as a style reference in producing an ODT.
799+: Use the specified file as a style reference in producing a
800− For best results, the reference ODT should be a modified version
800+ docx or ODT file.
801− of an ODT produced using pandoc. The contents of the reference ODT
802− are ignored, but its stylesheets are used in the new ODT. If no
803− reference ODT is specified on the command line, pandoc will look
804− for a file `reference.odt` in the user data directory (see
805− `--data-dir`). If this is not found either, sensible defaults will be
806− used.
807
801
808− To produce a custom `reference.odt`, first get a copy of
809− the default `reference.odt`: `pandoc
810− --print-default-data-file reference.odt >
811− custom-reference.odt`. Then open `custom-reference.docx` in
812− LibreOffice, modify the styles as you wish, and save the
813− file.
814−
815−`--reference-docx=`*FILE*
816−
817−: Use the specified file as a style reference in producing a docx file.
818− For best results, the reference docx should be a modified version
802+ Docx: For best results, the reference docx should be a modified
819− of a docx file produced using pandoc. The contents of the reference docx
803+ version of a docx file produced using pandoc. The contents
820− are ignored, but its stylesheets and document properties (including
804+ of the reference docx are ignored, but its stylesheets and
805+ document properties (including margins, page size, header,
821− margins, page size, header, and footer) are used in the new docx. If no
806+ and footer) are used in the new docx. If no reference docx
822− reference docx is specified on the command line, pandoc will look
807+ is specified on the command line, pandoc will look for a
823− for a file `reference.docx` in the user data directory (see
808+ file `reference.docx` in the user data directory (see
824− `--data-dir`). If this is not found either, sensible defaults will be
809+ `--data-dir`). If this is not found either, sensible
825− used.
810+ defaults will be used.
826
811
827 To produce a custom `reference.docx`, first get a copy of
812 To produce a custom `reference.docx`, first get a copy of
828 the default `reference.docx`: `pandoc
813 the default `reference.docx`: `pandoc
@@ -830,15 +815,30 @@ Options affecting specific writers
830 custom-reference.docx`. Then open `custom-reference.docx`
815 custom-reference.docx`. Then open `custom-reference.docx`
831 in Word, modify the styles as you wish, and save the file.
816 in Word, modify the styles as you wish, and save the file.
832 For best results, do not make changes to this file other
817 For best results, do not make changes to this file other
833− than modifying the styles used by pandoc: [paragraph] Normal,
818+ than modifying the styles used by pandoc: [paragraph]
834− Body Text, First Paragraph, Compact, Title, Subtitle,
819+ Normal, Body Text, First Paragraph, Compact, Title,
835− Author, Date, Abstract, Bibliography, Heading 1, Heading 2,
820+ Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
836− Heading 3, Heading 4, Heading 5, Heading 6, Block Text,
821+ Heading 2, Heading 3, Heading 4, Heading 5, Heading 6, Block
837− Footnote Text, Definition Term, Definition, Caption, Table
822+ Text, Footnote Text, Definition Term, Definition, Caption,
838− Caption, Image Caption, Figure, Figure With Caption, TOC
823+ Table Caption, Image Caption, Figure, Figure With Caption,
839− Heading; [character] Default Paragraph Font, Body Text Char,
824+ TOC Heading; [character] Default Paragraph Font, Body Text
840− Verbatim Char, Footnote Reference, Hyperlink; [table] Normal
825+ Char, Verbatim Char, Footnote Reference, Hyperlink; [table]
841− Table.
826+ Normal Table.
827+
828+ ODT: For best results, the reference ODT should be a modified
829+ version of an ODT produced using pandoc. The contents of
830+ the reference ODT are ignored, but its stylesheets are used
831+ in the new ODT. If no reference ODT is specified on the
832+ command line, pandoc will look for a file `reference.odt` in
833+ the user data directory (see `--data-dir`). If this is not
834+ found either, sensible defaults will be used.
835+
836+ To produce a custom `reference.odt`, first get a copy of
837+ the default `reference.odt`: `pandoc
838+ --print-default-data-file reference.odt >
839+ custom-reference.odt`. Then open `custom-reference.docx` in
840+ LibreOffice, modify the styles as you wish, and save the
841+ file.
842
842
843`--epub-stylesheet=`*FILE*
843`--epub-stylesheet=`*FILE*
844
844
@@ -1099,7 +1099,7 @@ directory (see `--data-dir`, above). *Exceptions:*
1099 (or the `default.beamer` template, if you use `-t beamer`,
1099 (or the `default.beamer` template, if you use `-t beamer`,
1100 or the `default.context` template, if you use `-t context`).
1100 or the `default.context` template, if you use `-t context`).
1101- `docx` has no template (however, you can use
1101- `docx` has no template (however, you can use
1102− `--reference-docx` to customize the output).
1102+ `--reference-doc` to customize the output).
1103
1103
1104Templates contain *variables*, which allow for the inclusion of
1104Templates contain *variables*, which allow for the inclusion of
1105arbitrary information at any point in the file. Variables may be set
1105arbitrary information at any point in the file. Variables may be set
pandoc.hs+7−18
@@ -185,8 +185,7 @@ data Opt = Opt
185 , optHighlightStyle :: Style -- ^ Style to use for highlighted code
185 , optHighlightStyle :: Style -- ^ Style to use for highlighted code
186 , optTopLevelDivision :: TopLevelDivision -- ^ Type of the top-level divisions
186 , optTopLevelDivision :: TopLevelDivision -- ^ Type of the top-level divisions
187 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
187 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
188− , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
188+ , optReferenceDoc :: Maybe FilePath -- ^ Path of reference doc
189− , optReferenceDocx :: Maybe FilePath -- ^ Path of reference.docx
190 , optEpubStylesheet :: Maybe String -- ^ EPUB stylesheet
189 , optEpubStylesheet :: Maybe String -- ^ EPUB stylesheet
191 , optEpubMetadata :: String -- ^ EPUB metadata
190 , optEpubMetadata :: String -- ^ EPUB metadata
192 , optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
191 , optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed
@@ -252,8 +251,7 @@ defaultOpts = Opt
252 , optHighlightStyle = pygments
251 , optHighlightStyle = pygments
253 , optTopLevelDivision = TopLevelDefault
252 , optTopLevelDivision = TopLevelDefault
254 , optHTMLMathMethod = PlainMath
253 , optHTMLMathMethod = PlainMath
255− , optReferenceODT = Nothing
254+ , optReferenceDoc = Nothing
256− , optReferenceDocx = Nothing
257 , optEpubStylesheet = Nothing
255 , optEpubStylesheet = Nothing
258 , optEpubMetadata = ""
256 , optEpubMetadata = ""
259 , optEpubFonts = []
257 , optEpubFonts = []
@@ -708,19 +706,12 @@ options =
708 "URL")
706 "URL")
709 "" -- "Link to CSS style sheet"
707 "" -- "Link to CSS style sheet"
710
708
711− , Option "" ["reference-odt"]
709+ , Option "" ["reference-doc"]
712 (ReqArg
710 (ReqArg
713 (\arg opt ->
711 (\arg opt ->
714− return opt { optReferenceODT = Just arg })
712+ return opt { optReferenceDoc = Just arg })
715 "FILENAME")
713 "FILENAME")
716− "" -- "Path of custom reference.odt"
714+ "" -- "Path of custom reference doc"
717−
718− , Option "" ["reference-docx"]
719− (ReqArg
720− (\arg opt ->
721− return opt { optReferenceDocx = Just arg })
722− "FILENAME")
723− "" -- "Path of custom reference.docx"
724
715
725 , Option "" ["epub-stylesheet"]
716 , Option "" ["epub-stylesheet"]
726 (ReqArg
717 (ReqArg
@@ -1190,8 +1181,7 @@ convertWithOpts opts args = do
1190 , optHighlightStyle = highlightStyle
1181 , optHighlightStyle = highlightStyle
1191 , optTopLevelDivision = topLevelDivision
1182 , optTopLevelDivision = topLevelDivision
1192 , optHTMLMathMethod = mathMethod'
1183 , optHTMLMathMethod = mathMethod'
1193− , optReferenceODT = referenceODT
1184+ , optReferenceDoc = referenceDoc
1194− , optReferenceDocx = referenceDocx
1195 , optEpubStylesheet = epubStylesheet
1185 , optEpubStylesheet = epubStylesheet
1196 , optEpubMetadata = epubMetadata
1186 , optEpubMetadata = epubMetadata
1197 , optEpubFonts = epubFonts
1187 , optEpubFonts = epubFonts
@@ -1485,8 +1475,7 @@ convertWithOpts opts args = do
1485 writerEpubFonts = epubFonts,
1475 writerEpubFonts = epubFonts,
1486 writerEpubChapterLevel = epubChapterLevel,
1476 writerEpubChapterLevel = epubChapterLevel,
1487 writerTOCDepth = epubTOCDepth,
1477 writerTOCDepth = epubTOCDepth,
1488− writerReferenceODT = referenceODT,
1478+ writerReferenceDoc = referenceDoc,
1489− writerReferenceDocx = referenceDocx,
1490 writerMediaBag = media,
1479 writerMediaBag = media,
1491 writerVerbose = verbose,
1480 writerVerbose = verbose,
1492 writerLaTeXArgs = latexEngineArgs
1481 writerLaTeXArgs = latexEngineArgs
src/Text/Pandoc/Options.hs+2−4
@@ -395,8 +395,7 @@ data WriterOptions = WriterOptions
395 , writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
395 , writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed
396 , writerEpubChapterLevel :: Int -- ^ Header level for chapters (separate files)
396 , writerEpubChapterLevel :: Int -- ^ Header level for chapters (separate files)
397 , writerTOCDepth :: Int -- ^ Number of levels to include in TOC
397 , writerTOCDepth :: Int -- ^ Number of levels to include in TOC
398− , writerReferenceODT :: Maybe FilePath -- ^ Path to reference ODT if specified
398+ , writerReferenceDoc :: Maybe FilePath -- ^ Path to reference document if specified
399− , writerReferenceDocx :: Maybe FilePath -- ^ Path to reference DOCX if specified
400 , writerMediaBag :: MediaBag -- ^ Media collected by docx or epub reader
399 , writerMediaBag :: MediaBag -- ^ Media collected by docx or epub reader
401 , writerVerbose :: Bool -- ^ Verbose debugging output
400 , writerVerbose :: Bool -- ^ Verbose debugging output
402 , writerLaTeXArgs :: [String] -- ^ Flags to pass to latex-engine
401 , writerLaTeXArgs :: [String] -- ^ Flags to pass to latex-engine
@@ -442,8 +441,7 @@ instance Default WriterOptions where
442 , writerEpubFonts = []
441 , writerEpubFonts = []
443 , writerEpubChapterLevel = 1
442 , writerEpubChapterLevel = 1
444 , writerTOCDepth = 3
443 , writerTOCDepth = 3
445− , writerReferenceODT = Nothing
444+ , writerReferenceDoc = Nothing
446− , writerReferenceDocx = Nothing
447 , writerMediaBag = mempty
445 , writerMediaBag = mempty
448 , writerVerbose = False
446 , writerVerbose = False
449 , writerLaTeXArgs = []
447 , writerLaTeXArgs = []
src/Text/Pandoc/Writers/Docx.hs+1−1
@@ -225,7 +225,7 @@ writeDocx opts doc@(Pandoc meta _) = do
225 username <- P.lookupEnv "USERNAME"
225 username <- P.lookupEnv "USERNAME"
226 utctime <- P.getCurrentTime
226 utctime <- P.getCurrentTime
227 distArchive <- P.getDefaultReferenceDocx datadir
227 distArchive <- P.getDefaultReferenceDocx datadir
228− refArchive <- case writerReferenceDocx opts of
228+ refArchive <- case writerReferenceDoc opts of
229 Just f -> toArchive <$> P.readFileLazy f
229 Just f -> toArchive <$> P.readFileLazy f
230 Nothing -> P.getDefaultReferenceDocx datadir
230 Nothing -> P.getDefaultReferenceDocx datadir
231
231
src/Text/Pandoc/Writers/ODT.hs+1−1
@@ -77,7 +77,7 @@ pandocToODT opts doc@(Pandoc meta _) = do
77 let datadir = writerUserDataDir opts
77 let datadir = writerUserDataDir opts
78 let title = docTitle meta
78 let title = docTitle meta
79 refArchive <-
79 refArchive <-
80− case writerReferenceODT opts of
80+ case writerReferenceDoc opts of
81 Just f -> liftM toArchive $ lift $ P.readFileLazy f
81 Just f -> liftM toArchive $ lift $ P.readFileLazy f
82 Nothing -> lift $ P.getDefaultReferenceODT datadir
82 Nothing -> lift $ P.getDefaultReferenceODT datadir
83 -- handle formulas and pictures
83 -- handle formulas and pictures
tests/Tests/Writers/Docx.hs+1−1
@@ -141,7 +141,7 @@ tests = [ testGroup "inlines"
141 ]
141 ]
142 , testGroup "customized styles"
142 , testGroup "customized styles"
143 [ testCompareWithOpts
143 [ testCompareWithOpts
144− ( def{writerReferenceDocx=Just "docx/custom-style-reference.docx"}
144+ ( def{writerReferenceDoc=Just "docx/custom-style-reference.docx"}
145 , def)
145 , def)
146 "simple customized blocks and inlines"
146 "simple customized blocks and inlines"
147 "docx/custom-style-roundtrip-start.native"
147 "docx/custom-style-roundtrip-start.native"