OpenDocument/ODT writer: use predefined styles.#11672
Merged
Merged
Conversation
Previously the OpenDocument writer emitted a fresh automatic style (L1..Ln, P1..Pn, T1..Tn) for nearly every list, list-item paragraph, block quote, preformatted block, and inline text style. This produced large ODT files, made `--reference-doc` customization ineffective (the user's predefined styles were never referenced), and gave each list its own indentation independent of any containing block quote. This commit teaches the writer to reference the predefined styles that LibreOffice ships and that pandoc's reference.odt now exports: - Bullet lists use `List_20_1`; ordered lists with default start and decimal format use `Numbering_20_1`. Non-default ordered lists generate a single named override style (`Pandoc_Numbering_N`) memoised by (ListNumberStyle, ListNumberDelim); a non-default start value with the default format is expressed via `text:start-value` on the `text:list` element instead of a new style. - List-item paragraphs use `List_20_Bullet[_Tight]` and `List_20_Number[_Tight]`. The Tight variants are pandoc-specific (zero top/bottom margin) and are injected into the user's reference.odt if missing, just like the Skylighting token styles. - Block quotes use the predefined `Quotations` paragraph style directly. Nested block quotes use a single automatic style that inherits from Quotations and only adds extra margin-left, so a list inside a block quote now inherits its container's indent (#2747). - Preformatted blocks use `Preformatted_20_Text` directly. - Emphasis, Strong, Strikeout, Subscript, Superscript and Code spans use the predefined `Emphasis`, `Strong_20_Emphasis`, `Strikeout`, `Subscript`, `Superscript` and `Source_20_Text` text styles. - `paraStyle`/`paraStyleFromParent` no longer emit a wrapper automatic style when its only attribute would be `parent-style-name`; the parent name is returned directly. Closes #9136. Closes #5086. Closes #2747. Closes #3426. Closes #7336. Co-authored by: Claude Opus 4.7.
smc181002
pushed a commit
to smc181002/pandoc
that referenced
this pull request
May 29, 2026
Previously the OpenDocument writer emitted a fresh automatic style (L1..Ln, P1..Pn, T1..Tn) for nearly every list, list-item paragraph, block quote, preformatted block, and inline text style. This produced large ODT files, made `--reference-doc` customization ineffective (the user's predefined styles were never referenced), and gave each list its own indentation independent of any containing block quote. This commit teaches the writer to reference the predefined styles that LibreOffice ships and that pandoc's reference.odt now exports: - Bullet lists use `List_20_1`; ordered lists with default start and decimal format use `Numbering_20_1`. Non-default ordered lists generate a single named override style (`Pandoc_Numbering_N`) memoised by (ListNumberStyle, ListNumberDelim); a non-default start value with the default format is expressed via `text:start-value` on the `text:list` element instead of a new style. - List-item paragraphs use `List_20_Bullet[_Tight]` and `List_20_Number[_Tight]`. The Tight variants are pandoc-specific (zero top/bottom margin) and are injected into the user's reference.odt if missing, just like the Skylighting token styles. - Block quotes use the predefined `Quotations` paragraph style directly. Nested block quotes use a single automatic style that inherits from Quotations and only adds extra margin-left, so a list inside a block quote now inherits its container's indent (jgm#2747). - Preformatted blocks use `Preformatted_20_Text` directly. - Emphasis, Strong, Strikeout, Subscript, Superscript and Code spans use the predefined `Emphasis`, `Strong_20_Emphasis`, `Strikeout`, `Subscript`, `Superscript` and `Source_20_Text` text styles. - `paraStyle`/`paraStyleFromParent` no longer emit a wrapper automatic style when its only attribute would be `parent-style-name`; the parent name is returned directly. Closes jgm#9136. Closes jgm#5086. Closes jgm#2747. Closes jgm#3426. Closes jgm#7336. Co-authored by: Claude Opus 4.7.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the OpenDocument writer emitted a fresh automatic style (L1..Ln, P1..Pn, T1..Tn) for nearly every list, list-item paragraph, block quote, preformatted block, and inline text style. This produced large ODT files, made
--reference-doccustomization ineffective (the user's predefined styles were never referenced), and gave each list its own indentation independent of any containing block quote.This commit teaches the writer to reference the predefined styles that LibreOffice ships and that pandoc's reference.odt now exports:
List_20_1; ordered lists with default start and decimal format useNumbering_20_1. Non-default ordered lists generate a single named override style (Pandoc_Numbering_N) memoised by (ListNumberStyle, ListNumberDelim); a non-default start value with the default format is expressed viatext:start-valueon thetext:listelement instead of a new style.List_20_Bullet[_Tight]andList_20_Number[_Tight]. The Tight variants are pandoc-specific (zero top/bottom margin) and are injected into the user's reference.odt if missing, just like the Skylighting token styles.Quotationsparagraph style directly. Nested block quotes use a single automatic style that inherits from Quotations and only adds extra margin-left, so a list inside a block quote now inherits its container's indent (ODF output Blockquotes should not have a non-style indent applied #2747).Preformatted_20_Textdirectly.Emphasis,Strong_20_Emphasis,Strikeout,Subscript,SuperscriptandSource_20_Texttext styles.paraStyle/paraStyleFromParentno longer emit a wrapper automatic style when its only attribute would beparent-style-name; the parent name is returned directly.Closes #9136.
Closes #5086.
Closes #2747.
Closes #3426.
Closes #7336.
Co-authored by: Claude Opus 4.7.