aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2024-05-19 10:47:46 -0700
committerJohn MacFarlane <[email protected]>2024-05-19 13:09:21 -0700
commitdb559e100c02ca1f95953f3eeeca005fdc01b595 (patch)
tree3eaad4d8b4449deaa54b29c3eed1f8da870e1a95 /data
parente8f44a854310a134249d89e8e6cfa5245afbc84e (diff)
Allow OpenXML templates to be used with `docx`.
The `--reference-doc` option allows customization of styles in docx output, but it does not allow one to adjust the content of the output (e.g., changing the order in which metadata, the table of contents, and the body of the document are displayed), or adding boilerplate text before or after the document body. For these changes, one can now use `--template` with an OpenXML template. (See the default `openxml` template for a sample.) This patch also allows `--include-before-body` and `--include-after-body` to be used with `docx` output. The included files must be OpenXML fragments suitable for inclusion in the document body. Closes #8338 (`--include-before-body`, `--include-after-body`). Closes #9069 (a custom template can be used to omit the title page). Closes #7256. Closes #2928.
Diffstat (limited to 'data')
-rw-r--r--data/templates/default.openxml69
1 files changed, 69 insertions, 0 deletions
diff --git a/data/templates/default.openxml b/data/templates/default.openxml
new file mode 100644
index 000000000..b002e3496
--- /dev/null
+++ b/data/templates/default.openxml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
+<w:body>
+$if(title)$
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val="Title" />
+ </w:pPr>
+ $title$
+ </w:p>
+$endif$
+$if(subtitle)$
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val="Subtitle" />
+ </w:pPr>
+ $subtitle$
+ </w:p>
+$endif$
+$for(author)$
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val="Author" />
+ </w:pPr>
+ $author$
+ </w:p>
+$endfor$
+$if(date)$
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val="Date" />
+ </w:pPr>
+ $date$
+ </w:p>
+$endif$
+$if(abstract)$
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val="AbstractTitle" />
+ </w:pPr>
+ $if(abstract-title)$
+ $abstract-title$
+ $else$
+ <w:r>
+ <w:t xml:space="preserve">Abstract
+ </w:t>
+ </w:r>
+ $endif$
+ </w:p>
+ $abstract$
+$endif$
+$for(include-before)$
+ $include-before$
+$endfor$
+$if(toc)$
+ $toc$
+$endif$
+ $body$
+$for(include-after)$
+ $include-after$
+$endfor$
+$-- sectpr will be set to the last sectpr in a reference.docx, if present
+$if(sectpr)$
+ $sectpr$
+$else$
+ <w:sectPr />
+$endif$
+ </w:body>
+</w:document>