diff options
author | Milan Bracke <mbracke@antidot.net> | 2021-06-14 15:00:36 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-10-18 19:15:40 -0700 |
commit | 193f6bfebaa43d0d6749d10a4e7ca78a0d31361d (patch) | |
tree | d7d84ad824082520b1bb7878864d67cd904a7a57 /test | |
parent | 8de261ba4e1e03f9dd5f78297d7299e9d78bbcfd (diff) | |
download | pandoc-193f6bfebaa43d0d6749d10a4e7ca78a0d31361d.tar.gz |
Docx reader: fix handling of nested fields
Fields delimited by fldChar elements can contain other fields. Before,
the nested fields would be ignored, except for the end, which would be
considered the end of the parent field.
To fix this issue, fields needed to be considered containing ParParts
instead of Runs, since a Run can't represent complex enough structures.
This also impacted Hyperlinks since they can originate from a field.
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Readers/Docx.hs | 4 | ||||
-rw-r--r-- | test/docx/nested_instrText.docx | bin | 0 -> 14112 bytes | |||
-rw-r--r-- | test/docx/nested_instrText.native | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs index 2f28af317..af6023836 100644 --- a/test/Tests/Readers/Docx.hs +++ b/test/Tests/Readers/Docx.hs @@ -148,6 +148,10 @@ tests = [ testGroup "document" "docx/instrText_hyperlink.docx" "docx/instrText_hyperlink.native" , testCompare + "nested fields with <w:instrText> tag" + "docx/nested_instrText.docx" + "docx/nested_instrText.native" + , testCompare "inline image" "docx/image.docx" "docx/image_no_embed.native" diff --git a/test/docx/nested_instrText.docx b/test/docx/nested_instrText.docx Binary files differnew file mode 100644 index 000000000..532584193 --- /dev/null +++ b/test/docx/nested_instrText.docx diff --git a/test/docx/nested_instrText.native b/test/docx/nested_instrText.native new file mode 100644 index 000000000..730b041f5 --- /dev/null +++ b/test/docx/nested_instrText.native @@ -0,0 +1,5 @@ +[Para [Str "\24076\26395\28145\20837\20102\35299\30340\35835\32773\21487\20197\21435\30475David",Space,Str "French",Space,Str "Belding\21644Kevin",Space,Str "J.",Space,Str "Mitchell\30340" + ,Link ("",[],[]) [Str "Foundations",Space,Str "of",Space,Str "Analysis,",Space,Str "1/16/18",Space,Str "8:40:00",Space,Str "AM,",Space,Str "2nd",Space,Str "Edition"] ("https://books.google.com/books?id=sp_Zcb9ot90C&lpg=PR4&hl=zh-CN&pg=PA19#v=onepage&q&f=true","") + ,Str ",\21487\20174\&19\39029\30475\36215\65292\25110D.C.",Space,Str "Goldrei\30340",Space + ,Link ("",[],[]) [Str "Classic",Space,Str "Set",Space,Str "Theory:",Space,Str "For",Space,Str "Guided",Space,Str "Independent",Space,Str "Study"] ("https://books.google.ae/books?id=dlc0DwAAQBAJ&lpg=PT29&hl=zh-CN&pg=PT26#v=onepage&q&f=true","") + ,Str "\65292\20174\31532\20108\31456\30475\36215\65292\38405\35835\26102\35201\27880\24847\26412\25991\19982\36825\20123\20070\25152\19981\21516\30340\26159\24182\27809\26377\25226\23454\25968\30475\20316\26159\26377\29702\25968\38598\30340\20998\21106\12290"]] |