From 0f98cbff4b61b8e79f386f77d18b3218f1214b25 Mon Sep 17 00:00:00 2001
From: Milan Bracke <mbracke@antidot.net>
Date: Fri, 1 Oct 2021 11:34:14 +0200
Subject: Avoid blockquote when parent style has more indent

When a paragraph has an indentation different from the parent (named)
style, it used to be considered a blockquote. But this only makes sense
when the paragraph has more indentation. So this commit adds a check
for the indentation of the parent style.
---
 test/Tests/Readers/Docx.hs                        |   4 ++++
 test/docx/image_vml.native                        |   5 ++---
 test/docx/relative_indentation_blockquotes.docx   | Bin 0 -> 12492 bytes
 test/docx/relative_indentation_blockquotes.native |   4 ++++
 4 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100644 test/docx/relative_indentation_blockquotes.docx
 create mode 100644 test/docx/relative_indentation_blockquotes.native

(limited to 'test')

diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs
index 220c7d9c5..2f28af317 100644
--- a/test/Tests/Readers/Docx.hs
+++ b/test/Tests/Readers/Docx.hs
@@ -305,6 +305,10 @@ tests = [ testGroup "document"
             "blockquotes (parsing indent as blockquote)"
             "docx/block_quotes.docx"
             "docx/block_quotes_parse_indent.native"
+          , testCompare
+            "blockquotes (parsing indent relative to the indent of the parent style as blockquote)"
+            "docx/relative_indentation_blockquotes.docx"
+            "docx/relative_indentation_blockquotes.native"
           , testCompare
             "hanging indents"
             "docx/hanging_indent.docx"
diff --git a/test/docx/image_vml.native b/test/docx/image_vml.native
index e9fded614..5991f333c 100644
--- a/test/docx/image_vml.native
+++ b/test/docx/image_vml.native
@@ -1,4 +1,3 @@
 [Header 1 ("vml-image",[],[]) [Strong [Str "VML",Space,Str "Image"]]
-,BlockQuote
- [Para [Str "It",Space,Str "should",Space,Str "follow",Space,Str "below:"]
- ,Para [Image ("",[],[]) [] ("media/image4.jpeg","")]]]
+,Para [Str "It",Space,Str "should",Space,Str "follow",Space,Str "below:"]
+,Para [Image ("",[],[]) [] ("media/image4.jpeg","")]]
diff --git a/test/docx/relative_indentation_blockquotes.docx b/test/docx/relative_indentation_blockquotes.docx
new file mode 100644
index 000000000..f318a8509
Binary files /dev/null and b/test/docx/relative_indentation_blockquotes.docx differ
diff --git a/test/docx/relative_indentation_blockquotes.native b/test/docx/relative_indentation_blockquotes.native
new file mode 100644
index 000000000..37806f289
--- /dev/null
+++ b/test/docx/relative_indentation_blockquotes.native
@@ -0,0 +1,4 @@
+[Header 1 ("indentation-blockquotes",[],[]) [Str "Indentation",Space,Str "blockquotes"]
+,Para [Str "Normal",Space,Str "list",Space,Str "paragraph"]
+,Para [Str "List",Space,Str "paragraph",Space,Str "with",Space,Str "less",Space,Str "indent"]
+,BlockQuote [Para [Str "List",Space,Str "paragraph",Space,Str "with",Space,Str "more",Space,Str "indent"]]]
-- 
cgit v1.2.3