aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-12-08 13:34:33 -0800
committerJohn MacFarlane <[email protected]>2023-12-08 13:34:33 -0800
commitfb4cea44b91e5c858c45ca67599ca7925bf159c8 (patch)
tree826a134dcdf7e792edfd9a595f90ec8833cbebae
parent901359bf460246861418ae1b96aa912920c86d35 (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.
-rw-r--r--MANUAL.txt3
-rw-r--r--data/docx/word/styles.xml12
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs13
-rw-r--r--src/Text/Pandoc/Writers/Docx/Types.hs2
-rw-r--r--test/docx/golden/block_quotes.docxbin10082 -> 10096 bytes
-rw-r--r--test/docx/golden/codeblock.docxbin9897 -> 9911 bytes
-rw-r--r--test/docx/golden/comments.docxbin10235 -> 10249 bytes
-rw-r--r--test/docx/golden/custom_style_no_reference.docxbin9996 -> 10014 bytes
-rw-r--r--test/docx/golden/custom_style_preserve.docxbin10625 -> 10643 bytes
-rw-r--r--test/docx/golden/definition_list.docxbin9897 -> 9911 bytes
-rw-r--r--test/docx/golden/document-properties-short-desc.docxbin9904 -> 9917 bytes
-rw-r--r--test/docx/golden/document-properties.docxbin10389 -> 10402 bytes
-rw-r--r--test/docx/golden/headers.docxbin10036 -> 10050 bytes
-rw-r--r--test/docx/golden/image.docxbin26778 -> 26792 bytes
-rw-r--r--test/docx/golden/inline_code.docxbin9836 -> 9850 bytes
-rw-r--r--test/docx/golden/inline_formatting.docxbin10016 -> 10030 bytes
-rw-r--r--test/docx/golden/inline_images.docxbin26776 -> 26790 bytes
-rw-r--r--test/docx/golden/link_in_notes.docxbin10058 -> 10072 bytes
-rw-r--r--test/docx/golden/links.docxbin10229 -> 10243 bytes
-rw-r--r--test/docx/golden/lists.docxbin10295 -> 10309 bytes
-rw-r--r--test/docx/golden/lists_continuing.docxbin10091 -> 10105 bytes
-rw-r--r--test/docx/golden/lists_div_bullets.docxbin9944 -> 9958 bytes
-rw-r--r--test/docx/golden/lists_multiple_initial.docxbin10173 -> 10187 bytes
-rw-r--r--test/docx/golden/lists_restarting.docxbin10089 -> 10103 bytes
-rw-r--r--test/docx/golden/nested_anchors_in_header.docxbin10229 -> 10243 bytes
-rw-r--r--test/docx/golden/notes.docxbin10005 -> 10019 bytes
-rw-r--r--test/docx/golden/raw-blocks.docxbin9937 -> 9951 bytes
-rw-r--r--test/docx/golden/raw-bookmarks.docxbin10071 -> 10085 bytes
-rw-r--r--test/docx/golden/table_one_row.docxbin9926 -> 9940 bytes
-rw-r--r--test/docx/golden/table_with_list_cell.docxbin10245 -> 10259 bytes
-rw-r--r--test/docx/golden/tables-default-widths.docxbin10272 -> 10286 bytes
-rw-r--r--test/docx/golden/tables.docxbin10287 -> 10301 bytes
-rw-r--r--test/docx/golden/tables_separated_with_rawblock.docxbin9922 -> 9936 bytes
-rw-r--r--test/docx/golden/track_changes_deletion.docxbin9880 -> 9894 bytes
-rw-r--r--test/docx/golden/track_changes_insertion.docxbin9863 -> 9877 bytes
-rw-r--r--test/docx/golden/track_changes_move.docxbin9897 -> 9911 bytes
-rw-r--r--test/docx/golden/track_changes_scrubbed_metadata.docxbin10009 -> 10023 bytes
-rw-r--r--test/docx/golden/unicode.docxbin9822 -> 9836 bytes
-rw-r--r--test/docx/golden/verbatim_subsuper.docxbin9869 -> 9883 bytes
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
index 29bf27d91..65738a83a 100644
--- a/test/docx/golden/block_quotes.docx
+++ b/test/docx/golden/block_quotes.docx
Binary files differ
diff --git a/test/docx/golden/codeblock.docx b/test/docx/golden/codeblock.docx
index 30262ffea..ffd8ea42d 100644
--- a/test/docx/golden/codeblock.docx
+++ b/test/docx/golden/codeblock.docx
Binary files differ
diff --git a/test/docx/golden/comments.docx b/test/docx/golden/comments.docx
index 51c3cba34..4be1a68b8 100644
--- a/test/docx/golden/comments.docx
+++ b/test/docx/golden/comments.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_no_reference.docx b/test/docx/golden/custom_style_no_reference.docx
index be41860cd..7356735ba 100644
--- a/test/docx/golden/custom_style_no_reference.docx
+++ b/test/docx/golden/custom_style_no_reference.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_preserve.docx b/test/docx/golden/custom_style_preserve.docx
index 8bb277cd0..6dd987864 100644
--- a/test/docx/golden/custom_style_preserve.docx
+++ b/test/docx/golden/custom_style_preserve.docx
Binary files differ
diff --git a/test/docx/golden/definition_list.docx b/test/docx/golden/definition_list.docx
index e77b1b780..089e5f614 100644
--- a/test/docx/golden/definition_list.docx
+++ b/test/docx/golden/definition_list.docx
Binary files differ
diff --git a/test/docx/golden/document-properties-short-desc.docx b/test/docx/golden/document-properties-short-desc.docx
index 72f0f83b9..060fb52c6 100644
--- a/test/docx/golden/document-properties-short-desc.docx
+++ b/test/docx/golden/document-properties-short-desc.docx
Binary files differ
diff --git a/test/docx/golden/document-properties.docx b/test/docx/golden/document-properties.docx
index 2c611e160..423d5c63f 100644
--- a/test/docx/golden/document-properties.docx
+++ b/test/docx/golden/document-properties.docx
Binary files differ
diff --git a/test/docx/golden/headers.docx b/test/docx/golden/headers.docx
index 8369364c8..520bf945e 100644
--- a/test/docx/golden/headers.docx
+++ b/test/docx/golden/headers.docx
Binary files differ
diff --git a/test/docx/golden/image.docx b/test/docx/golden/image.docx
index 9e0ac7b42..97d09cd02 100644
--- a/test/docx/golden/image.docx
+++ b/test/docx/golden/image.docx
Binary files differ
diff --git a/test/docx/golden/inline_code.docx b/test/docx/golden/inline_code.docx
index 3edef3049..add99b900 100644
--- a/test/docx/golden/inline_code.docx
+++ b/test/docx/golden/inline_code.docx
Binary files differ
diff --git a/test/docx/golden/inline_formatting.docx b/test/docx/golden/inline_formatting.docx
index 6c8440441..227fa049a 100644
--- a/test/docx/golden/inline_formatting.docx
+++ b/test/docx/golden/inline_formatting.docx
Binary files differ
diff --git a/test/docx/golden/inline_images.docx b/test/docx/golden/inline_images.docx
index 7976632d7..78a3f636d 100644
--- a/test/docx/golden/inline_images.docx
+++ b/test/docx/golden/inline_images.docx
Binary files differ
diff --git a/test/docx/golden/link_in_notes.docx b/test/docx/golden/link_in_notes.docx
index 7e511bf88..491401807 100644
--- a/test/docx/golden/link_in_notes.docx
+++ b/test/docx/golden/link_in_notes.docx
Binary files differ
diff --git a/test/docx/golden/links.docx b/test/docx/golden/links.docx
index 1cd265d9e..7df58de3d 100644
--- a/test/docx/golden/links.docx
+++ b/test/docx/golden/links.docx
Binary files differ
diff --git a/test/docx/golden/lists.docx b/test/docx/golden/lists.docx
index f872965d5..4da1d55b6 100644
--- a/test/docx/golden/lists.docx
+++ b/test/docx/golden/lists.docx
Binary files differ
diff --git a/test/docx/golden/lists_continuing.docx b/test/docx/golden/lists_continuing.docx
index 23e881342..6363a2189 100644
--- a/test/docx/golden/lists_continuing.docx
+++ b/test/docx/golden/lists_continuing.docx
Binary files differ
diff --git a/test/docx/golden/lists_div_bullets.docx b/test/docx/golden/lists_div_bullets.docx
index 1b21303b0..5582c0ec0 100644
--- a/test/docx/golden/lists_div_bullets.docx
+++ b/test/docx/golden/lists_div_bullets.docx
Binary files differ
diff --git a/test/docx/golden/lists_multiple_initial.docx b/test/docx/golden/lists_multiple_initial.docx
index 4bdc1ec85..1c9677787 100644
--- a/test/docx/golden/lists_multiple_initial.docx
+++ b/test/docx/golden/lists_multiple_initial.docx
Binary files differ
diff --git a/test/docx/golden/lists_restarting.docx b/test/docx/golden/lists_restarting.docx
index 6d9a67ad3..d1ee87ea0 100644
--- a/test/docx/golden/lists_restarting.docx
+++ b/test/docx/golden/lists_restarting.docx
Binary files differ
diff --git a/test/docx/golden/nested_anchors_in_header.docx b/test/docx/golden/nested_anchors_in_header.docx
index d95ebd303..98b0384b9 100644
--- a/test/docx/golden/nested_anchors_in_header.docx
+++ b/test/docx/golden/nested_anchors_in_header.docx
Binary files differ
diff --git a/test/docx/golden/notes.docx b/test/docx/golden/notes.docx
index e933eeeeb..10bf564bd 100644
--- a/test/docx/golden/notes.docx
+++ b/test/docx/golden/notes.docx
Binary files differ
diff --git a/test/docx/golden/raw-blocks.docx b/test/docx/golden/raw-blocks.docx
index 829b83635..a3feca911 100644
--- a/test/docx/golden/raw-blocks.docx
+++ b/test/docx/golden/raw-blocks.docx
Binary files differ
diff --git a/test/docx/golden/raw-bookmarks.docx b/test/docx/golden/raw-bookmarks.docx
index 447dcbec7..166f3678c 100644
--- a/test/docx/golden/raw-bookmarks.docx
+++ b/test/docx/golden/raw-bookmarks.docx
Binary files differ
diff --git a/test/docx/golden/table_one_row.docx b/test/docx/golden/table_one_row.docx
index b135a99b1..64d2d4dbe 100644
--- a/test/docx/golden/table_one_row.docx
+++ b/test/docx/golden/table_one_row.docx
Binary files differ
diff --git a/test/docx/golden/table_with_list_cell.docx b/test/docx/golden/table_with_list_cell.docx
index f1b9c59a0..c0f0b8d95 100644
--- a/test/docx/golden/table_with_list_cell.docx
+++ b/test/docx/golden/table_with_list_cell.docx
Binary files differ
diff --git a/test/docx/golden/tables-default-widths.docx b/test/docx/golden/tables-default-widths.docx
index 02a0c21ab..87103557d 100644
--- a/test/docx/golden/tables-default-widths.docx
+++ b/test/docx/golden/tables-default-widths.docx
Binary files differ
diff --git a/test/docx/golden/tables.docx b/test/docx/golden/tables.docx
index fa96b80d1..591d6a4d7 100644
--- a/test/docx/golden/tables.docx
+++ b/test/docx/golden/tables.docx
Binary files differ
diff --git a/test/docx/golden/tables_separated_with_rawblock.docx b/test/docx/golden/tables_separated_with_rawblock.docx
index cd289cdcb..097c37cbf 100644
--- a/test/docx/golden/tables_separated_with_rawblock.docx
+++ b/test/docx/golden/tables_separated_with_rawblock.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_deletion.docx b/test/docx/golden/track_changes_deletion.docx
index 94ec7705c..c5ac0333e 100644
--- a/test/docx/golden/track_changes_deletion.docx
+++ b/test/docx/golden/track_changes_deletion.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_insertion.docx b/test/docx/golden/track_changes_insertion.docx
index c3535ce2b..1e2654cf5 100644
--- a/test/docx/golden/track_changes_insertion.docx
+++ b/test/docx/golden/track_changes_insertion.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_move.docx b/test/docx/golden/track_changes_move.docx
index b1866a375..1bf776712 100644
--- a/test/docx/golden/track_changes_move.docx
+++ b/test/docx/golden/track_changes_move.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_scrubbed_metadata.docx b/test/docx/golden/track_changes_scrubbed_metadata.docx
index bf742b5c5..03c974254 100644
--- a/test/docx/golden/track_changes_scrubbed_metadata.docx
+++ b/test/docx/golden/track_changes_scrubbed_metadata.docx
Binary files differ
diff --git a/test/docx/golden/unicode.docx b/test/docx/golden/unicode.docx
index bf6cd1bc5..cebeac834 100644
--- a/test/docx/golden/unicode.docx
+++ b/test/docx/golden/unicode.docx
Binary files differ
diff --git a/test/docx/golden/verbatim_subsuper.docx b/test/docx/golden/verbatim_subsuper.docx
index 8996d8491..07d6126c1 100644
--- a/test/docx/golden/verbatim_subsuper.docx
+++ b/test/docx/golden/verbatim_subsuper.docx
Binary files differ