From 5f98ac62e3f91a3301c13f17d9081b6ecb39e5a9 Mon Sep 17 00:00:00 2001
From: John MacFarlane
Date: Tue, 19 Jan 2021 20:39:58 -0800
Subject: JATS writer: Ensure that disp-quote is always wrapped in p.
Closes #7041.
---
src/Text/Pandoc/Writers/JATS.hs | 4 +-
test/writer.jats_archiving | 68 +++++++++++++++++-------------
test/writer.jats_articleauthoring | 88 +++++++++++++++++++++------------------
test/writer.jats_publishing | 68 +++++++++++++++++-------------
4 files changed, 131 insertions(+), 97 deletions(-)
diff --git a/src/Text/Pandoc/Writers/JATS.hs b/src/Text/Pandoc/Writers/JATS.hs
index b2266d179..c75d40745 100644
--- a/src/Text/Pandoc/Writers/JATS.hs
+++ b/src/Text/Pandoc/Writers/JATS.hs
@@ -156,9 +156,11 @@ wrappedBlocksToJATS needsWrap opts =
wrappedBlockToJATS b = do
inner <- blockToJATS opts b
return $
- if needsWrap b
+ if needsWrap b || isBlockQuote b -- see #7041
then inTags True "p" [("specific-use","wrapper")] inner
else inner
+ isBlockQuote (BlockQuote _) = True
+ isBlockQuote _ = False
-- | Auxiliary function to convert Plain block to Para.
plainToPara :: Block -> Block
diff --git a/test/writer.jats_archiving b/test/writer.jats_archiving
index a708e0367..2d06c5cab 100644
--- a/test/writer.jats_archiving
+++ b/test/writer.jats_archiving
@@ -78,31 +78,39 @@ Gruber’s markdown test suite.
Block Quotes
E-mail style:
-
- This is a block quote. It is pretty short.
-
-
- Code in a block quote:
- sub status {
- print "working";
-}
- A list:
-
-
- item one
-
-
- item two
-
-
- Nested block quotes:
+
- nested
+ This is a block quote. It is pretty short.
+
+
- nested
+ Code in a block quote:
+ sub status {
+ print "working";
+}
+ A list:
+
+
+ item one
+
+
+ item two
+
+
+ Nested block quotes:
+
+
+ nested
+
+
+
+
+ nested
+
+
-
+
This should not be a block quote: 2 > 1.
And a following paragraph.
@@ -829,10 +837,12 @@ These should not be escaped: \$ \\ \> \[ \{
An e-mail address: nobody@nowhere.net
-
- Blockquoted:
- http://example.com/
-
+
+
+ Blockquoted:
+ http://example.com/
+
+
Auto-links should not occur here:
<http://example.com/>
or here: <http://example.com/>
@@ -856,9 +866,11 @@ These should not be escaped: \$ \\ \> \[ \{
not be a footnote reference, because it contains a
space.[^my note] Here is an inline
note.3
-
- Notes can go in quotes.4
-
+
+
+ Notes can go in quotes.4
+
+
And in list items.5
diff --git a/test/writer.jats_articleauthoring b/test/writer.jats_articleauthoring
index 90437992e..65ad5e37c 100644
--- a/test/writer.jats_articleauthoring
+++ b/test/writer.jats_articleauthoring
@@ -67,39 +67,43 @@ Gruber’s markdown test suite.
Block Quotes
E-mail style:
-
- This is a block quote. It is pretty short.
-
-
- Code in a block quote:
-
- sub status {
+
+
+ This is a block quote. It is pretty short.
+
+
+
+
+ Code in a block quote:
+
+ sub status {
print "working";
}
-
- A list:
-
-
-
- item one
-
-
- item two
-
-
-
- Nested block quotes:
-
-
- nested
-
-
-
-
- nested
-
-
-
+
+ A list:
+
+
+
+ item one
+
+
+ item two
+
+
+
+ Nested block quotes:
+
+
+ nested
+
+
+
+
+ nested
+
+
+
+
This should not be a block quote: 2 > 1.
And a following paragraph.
@@ -813,10 +817,12 @@ These should not be escaped: \$ \\ \> \[ \{
An e-mail address: nobody@nowhere.net
-
- Blockquoted:
- http://example.com/
-
+
+
+ Blockquoted:
+ http://example.com/
+
+
Auto-links should not occur here:
<http://example.com/>
or here: <http://example.com/>
@@ -854,11 +860,13 @@ These should not be escaped: \$ \\ \> \[ \{
and ] verbatim characters, as well as [bracketed
text].
-
- Notes can go in quotes.
- In quote.
-
-
+
+
+ Notes can go in quotes.
+ In quote.
+
+
+
And in list items.
diff --git a/test/writer.jats_publishing b/test/writer.jats_publishing
index 6d5a04057..915471576 100644
--- a/test/writer.jats_publishing
+++ b/test/writer.jats_publishing
@@ -78,31 +78,39 @@ Gruber’s markdown test suite.
Block Quotes
E-mail style:
-
- This is a block quote. It is pretty short.
-
-
- Code in a block quote:
- sub status {
- print "working";
-}
- A list:
-
-
- item one
-
-
- item two
-
-
- Nested block quotes:
+
- nested
+ This is a block quote. It is pretty short.
+
+
- nested
+ Code in a block quote:
+ sub status {
+ print "working";
+}
+ A list:
+
+
+ item one
+
+
+ item two
+
+
+ Nested block quotes:
+
+
+ nested
+
+
+
+
+ nested
+
+
-
+
This should not be a block quote: 2 > 1.
And a following paragraph.
@@ -829,10 +837,12 @@ These should not be escaped: \$ \\ \> \[ \{
An e-mail address: nobody@nowhere.net
-
- Blockquoted:
- http://example.com/
-
+
+
+ Blockquoted:
+ http://example.com/
+
+
Auto-links should not occur here:
<http://example.com/>
or here: <http://example.com/>
@@ -856,9 +866,11 @@ These should not be escaped: \$ \\ \> \[ \{
not be a footnote reference, because it contains a
space.[^my note] Here is an inline
note.3
-
- Notes can go in quotes.4
-
+
+
+ Notes can go in quotes.4
+
+
And in list items.5
--
cgit v1.2.3