diff options
| author | John MacFarlane <[email protected]> | 2023-12-08 13:34:33 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-12-08 13:34:33 -0800 |
| commit | fb4cea44b91e5c858c45ca67599ca7925bf159c8 (patch) | |
| tree | 826a134dcdf7e792edfd9a595f90ec8833cbebae | |
| parent | 901359bf460246861418ae1b96aa912920c86d35 (diff) | |
Docx writer: Use different style for block quotes in notes.
Using "Footnote Block Text" for the style name, so it can be
given a different font size if footnotes are.
Closes #9243.
39 files changed, 25 insertions, 5 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 0d104a545..b262fc8d4 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1187,7 +1187,8 @@ header when requesting a document from a URL: - Heading 7 - Heading 8 - Heading 9 - - Block Text + - Block Text [for block quotes] + - Footnote Block Text [for block quotes in footnotes] - Source Code - Footnote Text - Definition Term diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml index 578c3ba5d..f219042b6 100644 --- a/data/docx/word/styles.xml +++ b/data/docx/word/styles.xml @@ -348,6 +348,18 @@ <w:unhideWhenUsed /> <w:qFormat /> </w:style> + <w:style w:type="paragraph" w:styleId="FootnoteBlockText"> + <w:name w:val="Footnote Block Text" /> + <w:basedOn w:val="Footnote Text" /> + <w:next w:val="Footnote Text" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:pPr> + <w:spacing w:before="100" w:after="100" /> + <w:ind w:firstLine="0" w:left="480" w:right="480" /> + </w:pPr> + </w:style> <w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"> <w:name w:val="Default Paragraph Font" /> <w:semiHidden /> diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 0178cec17..989518004 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -940,7 +940,11 @@ blockToOpenXML' _ b@(RawBlock format str) report $ BlockNotRendered b return [] blockToOpenXML' opts (BlockQuote blocks) = do - p <- withParaPropM (pStyleM "Block Text") + inNote <- asks envInNote + p <- withParaPropM (pStyleM + (if inNote + then "Footnote Block Text" + else "Block Text")) $ blocksToOpenXML opts blocks setFirstPara return p @@ -1361,9 +1365,10 @@ inlineToOpenXML' opts (Note bs) = do contents <- local (\env -> env{ envListLevel = -1 , envParaProperties = mempty - , envTextProperties = mempty }) - (withParaPropM (pStyleM "Footnote Text") $ blocksToOpenXML opts - $ insertNoteRef bs) + , envTextProperties = mempty + , envInNote = True }) + (withParaPropM (pStyleM "Footnote Text") $ + blocksToOpenXML opts $ insertNoteRef bs) let newnote = mknode "w:footnote" [("w:id", notenum)] contents modify $ \s -> s{ stFootnotes = newnote : notes } return [ Elem $ mknode "w:r" [] diff --git a/src/Text/Pandoc/Writers/Docx/Types.hs b/src/Text/Pandoc/Writers/Docx/Types.hs index 8dc6f08b2..b453745db 100644 --- a/src/Text/Pandoc/Writers/Docx/Types.hs +++ b/src/Text/Pandoc/Writers/Docx/Types.hs @@ -81,6 +81,7 @@ data WriterEnv = WriterEnv , envListLevel :: Int , envListNumId :: Int , envInDel :: Bool + , envInNote :: Bool , envChangesAuthor :: Text , envChangesDate :: Text , envPrintWidth :: Integer @@ -95,6 +96,7 @@ defaultWriterEnv = WriterEnv , envListLevel = -1 , envListNumId = 1 , envInDel = False + , envInNote = False , envChangesAuthor = "unknown" , envChangesDate = "1969-12-31T19:00:00Z" , envPrintWidth = 1 diff --git a/test/docx/golden/block_quotes.docx b/test/docx/golden/block_quotes.docx Binary files differindex 29bf27d91..65738a83a 100644 --- a/test/docx/golden/block_quotes.docx +++ b/test/docx/golden/block_quotes.docx diff --git a/test/docx/golden/codeblock.docx b/test/docx/golden/codeblock.docx Binary files differindex 30262ffea..ffd8ea42d 100644 --- a/test/docx/golden/codeblock.docx +++ b/test/docx/golden/codeblock.docx diff --git a/test/docx/golden/comments.docx b/test/docx/golden/comments.docx Binary files differindex 51c3cba34..4be1a68b8 100644 --- a/test/docx/golden/comments.docx +++ b/test/docx/golden/comments.docx diff --git a/test/docx/golden/custom_style_no_reference.docx b/test/docx/golden/custom_style_no_reference.docx Binary files differindex be41860cd..7356735ba 100644 --- a/test/docx/golden/custom_style_no_reference.docx +++ b/test/docx/golden/custom_style_no_reference.docx diff --git a/test/docx/golden/custom_style_preserve.docx b/test/docx/golden/custom_style_preserve.docx Binary files differindex 8bb277cd0..6dd987864 100644 --- a/test/docx/golden/custom_style_preserve.docx +++ b/test/docx/golden/custom_style_preserve.docx diff --git a/test/docx/golden/definition_list.docx b/test/docx/golden/definition_list.docx Binary files differindex e77b1b780..089e5f614 100644 --- a/test/docx/golden/definition_list.docx +++ b/test/docx/golden/definition_list.docx diff --git a/test/docx/golden/document-properties-short-desc.docx b/test/docx/golden/document-properties-short-desc.docx Binary files differindex 72f0f83b9..060fb52c6 100644 --- a/test/docx/golden/document-properties-short-desc.docx +++ b/test/docx/golden/document-properties-short-desc.docx diff --git a/test/docx/golden/document-properties.docx b/test/docx/golden/document-properties.docx Binary files differindex 2c611e160..423d5c63f 100644 --- a/test/docx/golden/document-properties.docx +++ b/test/docx/golden/document-properties.docx diff --git a/test/docx/golden/headers.docx b/test/docx/golden/headers.docx Binary files differindex 8369364c8..520bf945e 100644 --- a/test/docx/golden/headers.docx +++ b/test/docx/golden/headers.docx diff --git a/test/docx/golden/image.docx b/test/docx/golden/image.docx Binary files differindex 9e0ac7b42..97d09cd02 100644 --- a/test/docx/golden/image.docx +++ b/test/docx/golden/image.docx diff --git a/test/docx/golden/inline_code.docx b/test/docx/golden/inline_code.docx Binary files differindex 3edef3049..add99b900 100644 --- a/test/docx/golden/inline_code.docx +++ b/test/docx/golden/inline_code.docx diff --git a/test/docx/golden/inline_formatting.docx b/test/docx/golden/inline_formatting.docx Binary files differindex 6c8440441..227fa049a 100644 --- a/test/docx/golden/inline_formatting.docx +++ b/test/docx/golden/inline_formatting.docx diff --git a/test/docx/golden/inline_images.docx b/test/docx/golden/inline_images.docx Binary files differindex 7976632d7..78a3f636d 100644 --- a/test/docx/golden/inline_images.docx +++ b/test/docx/golden/inline_images.docx diff --git a/test/docx/golden/link_in_notes.docx b/test/docx/golden/link_in_notes.docx Binary files differindex 7e511bf88..491401807 100644 --- a/test/docx/golden/link_in_notes.docx +++ b/test/docx/golden/link_in_notes.docx diff --git a/test/docx/golden/links.docx b/test/docx/golden/links.docx Binary files differindex 1cd265d9e..7df58de3d 100644 --- a/test/docx/golden/links.docx +++ b/test/docx/golden/links.docx diff --git a/test/docx/golden/lists.docx b/test/docx/golden/lists.docx Binary files differindex f872965d5..4da1d55b6 100644 --- a/test/docx/golden/lists.docx +++ b/test/docx/golden/lists.docx diff --git a/test/docx/golden/lists_continuing.docx b/test/docx/golden/lists_continuing.docx Binary files differindex 23e881342..6363a2189 100644 --- a/test/docx/golden/lists_continuing.docx +++ b/test/docx/golden/lists_continuing.docx diff --git a/test/docx/golden/lists_div_bullets.docx b/test/docx/golden/lists_div_bullets.docx Binary files differindex 1b21303b0..5582c0ec0 100644 --- a/test/docx/golden/lists_div_bullets.docx +++ b/test/docx/golden/lists_div_bullets.docx diff --git a/test/docx/golden/lists_multiple_initial.docx b/test/docx/golden/lists_multiple_initial.docx Binary files differindex 4bdc1ec85..1c9677787 100644 --- a/test/docx/golden/lists_multiple_initial.docx +++ b/test/docx/golden/lists_multiple_initial.docx diff --git a/test/docx/golden/lists_restarting.docx b/test/docx/golden/lists_restarting.docx Binary files differindex 6d9a67ad3..d1ee87ea0 100644 --- a/test/docx/golden/lists_restarting.docx +++ b/test/docx/golden/lists_restarting.docx diff --git a/test/docx/golden/nested_anchors_in_header.docx b/test/docx/golden/nested_anchors_in_header.docx Binary files differindex d95ebd303..98b0384b9 100644 --- a/test/docx/golden/nested_anchors_in_header.docx +++ b/test/docx/golden/nested_anchors_in_header.docx diff --git a/test/docx/golden/notes.docx b/test/docx/golden/notes.docx Binary files differindex e933eeeeb..10bf564bd 100644 --- a/test/docx/golden/notes.docx +++ b/test/docx/golden/notes.docx diff --git a/test/docx/golden/raw-blocks.docx b/test/docx/golden/raw-blocks.docx Binary files differindex 829b83635..a3feca911 100644 --- a/test/docx/golden/raw-blocks.docx +++ b/test/docx/golden/raw-blocks.docx diff --git a/test/docx/golden/raw-bookmarks.docx b/test/docx/golden/raw-bookmarks.docx Binary files differindex 447dcbec7..166f3678c 100644 --- a/test/docx/golden/raw-bookmarks.docx +++ b/test/docx/golden/raw-bookmarks.docx diff --git a/test/docx/golden/table_one_row.docx b/test/docx/golden/table_one_row.docx Binary files differindex b135a99b1..64d2d4dbe 100644 --- a/test/docx/golden/table_one_row.docx +++ b/test/docx/golden/table_one_row.docx diff --git a/test/docx/golden/table_with_list_cell.docx b/test/docx/golden/table_with_list_cell.docx Binary files differindex f1b9c59a0..c0f0b8d95 100644 --- a/test/docx/golden/table_with_list_cell.docx +++ b/test/docx/golden/table_with_list_cell.docx diff --git a/test/docx/golden/tables-default-widths.docx b/test/docx/golden/tables-default-widths.docx Binary files differindex 02a0c21ab..87103557d 100644 --- a/test/docx/golden/tables-default-widths.docx +++ b/test/docx/golden/tables-default-widths.docx diff --git a/test/docx/golden/tables.docx b/test/docx/golden/tables.docx Binary files differindex fa96b80d1..591d6a4d7 100644 --- a/test/docx/golden/tables.docx +++ b/test/docx/golden/tables.docx diff --git a/test/docx/golden/tables_separated_with_rawblock.docx b/test/docx/golden/tables_separated_with_rawblock.docx Binary files differindex cd289cdcb..097c37cbf 100644 --- a/test/docx/golden/tables_separated_with_rawblock.docx +++ b/test/docx/golden/tables_separated_with_rawblock.docx diff --git a/test/docx/golden/track_changes_deletion.docx b/test/docx/golden/track_changes_deletion.docx Binary files differindex 94ec7705c..c5ac0333e 100644 --- a/test/docx/golden/track_changes_deletion.docx +++ b/test/docx/golden/track_changes_deletion.docx diff --git a/test/docx/golden/track_changes_insertion.docx b/test/docx/golden/track_changes_insertion.docx Binary files differindex c3535ce2b..1e2654cf5 100644 --- a/test/docx/golden/track_changes_insertion.docx +++ b/test/docx/golden/track_changes_insertion.docx diff --git a/test/docx/golden/track_changes_move.docx b/test/docx/golden/track_changes_move.docx Binary files differindex b1866a375..1bf776712 100644 --- a/test/docx/golden/track_changes_move.docx +++ b/test/docx/golden/track_changes_move.docx diff --git a/test/docx/golden/track_changes_scrubbed_metadata.docx b/test/docx/golden/track_changes_scrubbed_metadata.docx Binary files differindex bf742b5c5..03c974254 100644 --- a/test/docx/golden/track_changes_scrubbed_metadata.docx +++ b/test/docx/golden/track_changes_scrubbed_metadata.docx diff --git a/test/docx/golden/unicode.docx b/test/docx/golden/unicode.docx Binary files differindex bf6cd1bc5..cebeac834 100644 --- a/test/docx/golden/unicode.docx +++ b/test/docx/golden/unicode.docx diff --git a/test/docx/golden/verbatim_subsuper.docx b/test/docx/golden/verbatim_subsuper.docx Binary files differindex 8996d8491..07d6126c1 100644 --- a/test/docx/golden/verbatim_subsuper.docx +++ b/test/docx/golden/verbatim_subsuper.docx |
