aboutsummaryrefslogtreecommitdiff
path: root/test/docx/golden/codeblock.docx
AgeCommit message (Collapse)Author
2025-08-04reference.docx: don't left-align table header rown.west
See #11019. Previously, centering tables in `reference.docx` would leave the header row left-aligned. Why the OOXML 'standard' would allow table elements to be aligned differently from the rest of the table in the first place is anyone's guess.
2025-06-10Fix docx golden tests for East Asian default style changes.John MacFarlane
2025-04-05Docx writer: preserve Relationships for images from reference docx.John MacFarlane
This should allow one to include an image in a reference.docx and reference it in an openxml template. Closes #10759.
2025-01-31Docx writer: repeat reference doc's sectPr for each new section.John MacFarlane
Previously we were only carrying over the reference doc's sectPr at the end of the document, so it wouldn't affect the intermediate sections that are now added if `--top-level-division` is `chapter` or `part`. This could lead to bad results (e.g. page numbering starting only on the last chapter). Closes #10577.
2025-01-31Update docx golden tests for reference doc changes.John MacFarlane
2024-12-22Docx writer: restart footnotes by section by default.John MacFarlane
This can be overridden by a final sectPr element in the body of the reference.docx. It will only change things for `--top-level-division=chapter`, since only top-level chapters are put in separate sections. For that use it will mean that footnote numbers start over with each chapter, which is usually what is wanted. Closes #2773.
2024-05-31Fix metadata in docx writer.John MacFarlane
The new OpenXML template had spaces for metadata that need to be filled with OpenXML fragments with the proper shape. This patch ensures that everything is the right shape. Closes #9828.
2024-05-19Allow OpenXML templates to be used with `docx`.John MacFarlane
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.
2024-05-18Cleaned up Abstract Title and Subtitle in default reference docx.John MacFarlane
Center Subtitle, remove color.
2024-04-13reference.docx: use current standard Word theme.John MacFarlane
This includes using the sans-serif font Aptos instead of the serif font Cambria. See #7280.
2024-04-13reference.docx: stay closer to Word's current defaults.John MacFarlane
We use the default styles for headings and the title instead of what pandoc was using. See #7280.
2024-04-13Use conventional styles/indents for Word bullet lists.John MacFarlane
See #7280.
2024-02-28Docx writer: don't copy over footnotePr in settings.xml...John MacFarlane
rom reference.docx. Closes #9522.
2023-12-18fix(docx): fix OOXMLValidator error on KeywordTok outputEdwin Török
xmllint doesn't warn about this (maybe because the tag is empty?), but the order doesn't match wml.xsd: ``` <w:rPr> <w:color w:val="007020"/> <w:b/> </w:rPr> ``` And OOXMLValidatorCLI does warn about it: ``` { "Description": "The element has unexpected child element 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:b'.", "Path": { "NamespacesDefinitions": [ "xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"" ], "Namespaces": { }, "XPath": "/w:styles[1]/w:style[40]/w:rPr[1]", "PartUri": "/word/styles.xml" }, "Id": "Sch_UnexpectedElementContentExpectingComplex", "ErrorType": "Schema" } ``` Signed-off-by: Edwin Török <[email protected]>
2023-12-18fix(docx): fix validation error in w:nsidEdwin Török
The length here seems to refer to length in bytes (so twice as long in hex): ``` ./tmp/numbering-pretty.xml:4: element nsid: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}nsid', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}val': [facet 'length'] The value 'A990' has a length of '2'; this differs from the allowed length of '4'. ``` [This](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.nsid?view=openxml-2.8.1) also documents the longer values. Signed-off-by: Edwin Török <[email protected]>
2023-12-17Docx writer: ensure that elements in settings are ordered correctly.John MacFarlane
The elements must occur in a specific order. This was being messed up when integrating a custom reference.docx. Closes #9264.
2023-12-17test/docx/golden: regenerateEdwin Török
Using `make test TESTARGS=--accept` Signed-off-by: Edwin Török <[email protected]>
2023-12-08Docx writer: Use different style for block quotes in notes.John MacFarlane
Using "Footnote Block Text" for the style name, so it can be given a different font size if footnotes are. Closes #9243.
2023-12-08Docx writer: allow embedded fonts to be used in reference.docx.John MacFarlane
Closes #6728.
2023-03-17Update docx golden tests for style changes.John MacFarlane
2021-05-15Docx writer: copy over more settings from referenc.odcx.John MacFarlane
From settings.xml in the reference-doc, we now include: `zoom`, `embedSystemFonts`, `doNotTrackMoves`, `defaultTabStop`, `drawingGridHorizontalSpacing`, `drawingGridVerticalSpacing`, `displayHorizontalDrawingGridEvery`, `displayVerticalDrawingGridEvery`, `characterSpacingControl`, `savePreviewPicture`, `mathPr`, `themeFontLang`, `decimalSymbol`, `listSeparator`, `autoHyphenation`, `compat`. Closes #7240.
2021-05-15docx writer: Remove rsids from settings.docx.John MacFarlane
Word will add these when revisions are made. But it's pointless to start out with a set of them.
2021-05-11Improve integration of settings from reference.docx.John MacFarlane
The settings we can carry over from a reference.docx are autoHyphenation, consecutiveHyphenLimit, hyphenationZone, doNotHyphenateCap, evenAndOddHeaders, and proofState. Previously this was implemented in a buggy way, so that the reference doc's values AND the new values were included. This change allows users to create a reference.docx that sets w:proofState for spelling or grammar to "dirty," so that spell/grammar checking will be triggered on the generated docx. Closes #1209.
2021-03-17Docx writer: make nsid in abstractNum deterministic.John MacFarlane
Previously we assigned a random number (though in a deterministic way). But changes in the random package mean we get different results now on different architectures, even with the same random seed. We don't need random values; so now we just assign a value based on the list number id, which is guaranteed to be unique to the list marker.
2021-02-16Rename Text.Pandoc.XMLParser -> Text.Pandoc.XML.Light...John MacFarlane
..and add new definitions isomorphic to xml-light's, but with Text instead of String. This allows us to keep most of the code in existing readers that use xml-light, but avoid lots of unnecessary allocation. We also add versions of the functions from xml-light's Text.XML.Light.Output and Text.XML.Light.Proc that operate on our modified XML types, and functions that convert xml-light types to our types (since some of our dependencies, like texmath, use xml-light). Update golden tests for docx and pptx. OOXML test: Use `showContent` instead of `ppContent` in `displayDiff`. Docx: Do a manual traversal to unwrap sdt and smartTag. This is faster, and needed to pass the tests. Benchmarks: A = prior to 8ca191604dcd13af27c11d2da225da646ebce6fc (Feb 8) B = as of 8ca191604dcd13af27c11d2da225da646ebce6fc (Feb 8) C = this commit | Reader | A | B | C | | ------- | ----- | ------ | ----- | | docbook | 18 ms | 12 ms | 10 ms | | opml | 65 ms | 62 ms | 35 ms | | jats | 15 ms | 11 ms | 9 ms | | docx | 72 ms | 69 ms | 44 ms | | odt | 78 ms | 41 ms | 28 ms | | epub | 64 ms | 61 ms | 56 ms | | fb2 | 14 ms | 5 ms | 4 ms |
2021-02-10Add new unexported module T.P.XMLParser.John MacFarlane
This exports functions that uses xml-conduit's parser to produce an xml-light Element or [Content]. This allows existing pandoc code to use a better parser without much modification. The new parser is used in all places where xml-light's parser was previously used. Benchmarks show a significant performance improvement in parsing XML-based formats (especially ODT and FB2). Note that the xml-light types use String, so the conversion from xml-conduit types involves a lot of extra allocation. It would be desirable to avoid that in the future by gradually switching to using xml-conduit directly. This can be done module by module. The new parser also reports errors, which we report when possible. A new constructor PandocXMLError has been added to PandocError in T.P.Error [API change]. Closes #7091, which was the main stimulus. These changes revealed the need for some changes in the tests. The docbook-reader.docbook test lacked definitions for the entities it used; these have been added. And the docx golden tests have been updated, because the new parser does not preserve the order of attributes. Add entity defs to docbook-reader.docbook. Update golden tests for docx.
2021-01-12Docx writer: handle table header using styles.John MacFarlane
Instead of hard-coding the border and header cell vertical alignment, we now let this be determined by the Table style, making use of Word's "conditional formatting" for the table's first row. For headerless tables, we use the tblLook element to tell Word not to apply conditional first-row formatting. Closes #7008.
2020-11-26Docx writer: Fix bullets/lists indentationcholonam
Fix appearance of bullets/numbered lists (the first level is slightly indented to the right instead of right on the margin). New golden files have been tested using Word 2010 on Windows 10.
2020-07-22Docx writer: support --number-sections.John MacFarlane
Closes #1413.
2020-05-16Docx writer: enable column and row bands for tables.John MacFarlane
This change will not have any effect with the default style. However, it enables users to use a style (via a reference.docx) that turns on row and/or column bands. Closes #6371.
2019-11-16Change styles in reference.docx.John MacFarlane
All headings now have a uniform color. Level-1 headings no longer set `w:themeShade="B5"`. Level-2 headings are now 14 point rather than 16 point. Level-3 headings are now 12 point rather than 14 point. Level-4 headings are italic rather than bold. Closes #5820.
2019-11-14Change reference.docx to use more normal block quotes.John MacFarlane
Indented left and right, same font and size. Previously it was unindented, smaller font and different typeface. See #5820.
2019-03-21Docx writer: Use w:br without attributes for line breaks.John MacFarlane
We previously added the attribute `type="textWrapping"`, but this causes problems on Word Online. Closes #5377.
2019-03-11docx writer: avoid extra copy of abstractNum and num elements...John MacFarlane
...in numbering.xml. This caused pandoc-produced docx files to be uneditable using Word Online. The problem was that recent versions of reference.docx include samples of various kinds of text, including lists. The numering elements for these were getting copied over to the new docx, where they clashed with the autogenerated elements produced by pandoc. This didn't confuse Desktop Word, but it did confuse Word Online. Closes #5358.
2018-10-09Docx writer: added framework for custom properties.John MacFarlane
So far, we don't actually write any custom properties, but we have the infrastructure to add this. See #3034.
2018-01-27Docx writer tests: Use new golden frameworkJesse Rosenthal
These are based off the reader tests, with some removed (where the reader output was identical, based on different docx inputs). There are still more to be added. In particular, tests for custom-styles need to be added. All golden docx files have been checked in MS Word 2013 (windows). There is no corruption. There is questionable output in the `tables` test: the three tables seemed to be joined. This will be addressed in a future commit, and the golden docx file will be changed.