diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-01-19 20:39:58 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-01-19 20:39:58 -0800 |
commit | 5f98ac62e3f91a3301c13f17d9081b6ecb39e5a9 (patch) | |
tree | 9ed2e37a60225fd656b10b76c1db5deab0b12798 | |
parent | 1c4d14cdcc60c1bfcc579a5b5ab154e8e62e54c7 (diff) | |
download | pandoc-5f98ac62e3f91a3301c13f17d9081b6ecb39e5a9.tar.gz |
JATS writer: Ensure that disp-quote is always wrapped in p.
Closes #7041.
-rw-r--r-- | src/Text/Pandoc/Writers/JATS.hs | 4 | ||||
-rw-r--r-- | test/writer.jats_archiving | 68 | ||||
-rw-r--r-- | test/writer.jats_articleauthoring | 88 | ||||
-rw-r--r-- | 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.</p> <sec id="block-quotes"> <title>Block Quotes</title> <p>E-mail style:</p> - <disp-quote> - <p>This is a block quote. It is pretty short.</p> - </disp-quote> - <disp-quote> - <p>Code in a block quote:</p> - <preformat>sub status { - print "working"; -}</preformat> - <p>A list:</p> - <list list-type="order"> - <list-item> - <p>item one</p> - </list-item> - <list-item> - <p>item two</p> - </list-item> - </list> - <p>Nested block quotes:</p> + <p specific-use="wrapper"> <disp-quote> - <p>nested</p> + <p>This is a block quote. It is pretty short.</p> </disp-quote> + </p> + <p specific-use="wrapper"> <disp-quote> - <p>nested</p> + <p>Code in a block quote:</p> + <preformat>sub status { + print "working"; +}</preformat> + <p>A list:</p> + <list list-type="order"> + <list-item> + <p>item one</p> + </list-item> + <list-item> + <p>item two</p> + </list-item> + </list> + <p>Nested block quotes:</p> + <p specific-use="wrapper"> + <disp-quote> + <p>nested</p> + </disp-quote> + </p> + <p specific-use="wrapper"> + <disp-quote> + <p>nested</p> + </disp-quote> + </p> </disp-quote> - </disp-quote> + </p> <p>This should not be a block quote: 2 > 1.</p> <p>And a following paragraph.</p> </sec> @@ -829,10 +837,12 @@ These should not be escaped: \$ \\ \> \[ \{</preformat> </list-item> </list> <p>An e-mail address: <email>nobody@nowhere.net</email></p> - <disp-quote> - <p>Blockquoted: - <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p> - </disp-quote> + <p specific-use="wrapper"> + <disp-quote> + <p>Blockquoted: + <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p> + </disp-quote> + </p> <p>Auto-links should not occur here: <monospace><http://example.com/></monospace></p> <preformat>or here: <http://example.com/></preformat> @@ -856,9 +866,11 @@ These should not be escaped: \$ \\ \> \[ \{</preformat> <italic>not</italic> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<xref ref-type="fn" rid="fn3">3</xref></p> - <disp-quote> - <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p> - </disp-quote> + <p specific-use="wrapper"> + <disp-quote> + <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p> + </disp-quote> + </p> <list list-type="order"> <list-item> <p>And in list items.<xref ref-type="fn" rid="fn5">5</xref></p> 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.</p> <sec id="block-quotes"> <title>Block Quotes</title> <p>E-mail style:</p> - <disp-quote> - <p>This is a block quote. It is pretty short.</p> - </disp-quote> - <disp-quote> - <p>Code in a block quote:</p> - <p specific-use="wrapper"> - <preformat>sub status { + <p specific-use="wrapper"> + <disp-quote> + <p>This is a block quote. It is pretty short.</p> + </disp-quote> + </p> + <p specific-use="wrapper"> + <disp-quote> + <p>Code in a block quote:</p> + <p specific-use="wrapper"> + <preformat>sub status { print "working"; }</preformat> - </p> - <p>A list:</p> - <p specific-use="wrapper"> - <list list-type="order"> - <list-item> - <p>item one</p> - </list-item> - <list-item> - <p>item two</p> - </list-item> - </list> - </p> - <p>Nested block quotes:</p> - <p specific-use="wrapper"> - <disp-quote> - <p>nested</p> - </disp-quote> - </p> - <p specific-use="wrapper"> - <disp-quote> - <p>nested</p> - </disp-quote> - </p> - </disp-quote> + </p> + <p>A list:</p> + <p specific-use="wrapper"> + <list list-type="order"> + <list-item> + <p>item one</p> + </list-item> + <list-item> + <p>item two</p> + </list-item> + </list> + </p> + <p>Nested block quotes:</p> + <p specific-use="wrapper"> + <disp-quote> + <p>nested</p> + </disp-quote> + </p> + <p specific-use="wrapper"> + <disp-quote> + <p>nested</p> + </disp-quote> + </p> + </disp-quote> + </p> <p>This should not be a block quote: 2 > 1.</p> <p>And a following paragraph.</p> </sec> @@ -813,10 +817,12 @@ These should not be escaped: \$ \\ \> \[ \{</preformat> </list-item> </list> <p>An e-mail address: <email>nobody@nowhere.net</email></p> - <disp-quote> - <p>Blockquoted: - <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p> - </disp-quote> + <p specific-use="wrapper"> + <disp-quote> + <p>Blockquoted: + <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p> + </disp-quote> + </p> <p>Auto-links should not occur here: <monospace><http://example.com/></monospace></p> <preformat>or here: <http://example.com/></preformat> @@ -854,11 +860,13 @@ These should not be escaped: \$ \\ \> \[ \{</preformat> and <monospace>]</monospace> verbatim characters, as well as [bracketed text].</p> </fn></p> - <disp-quote> - <p>Notes can go in quotes.<fn> - <p>In quote.</p> - </fn></p> - </disp-quote> + <p specific-use="wrapper"> + <disp-quote> + <p>Notes can go in quotes.<fn> + <p>In quote.</p> + </fn></p> + </disp-quote> + </p> <list list-type="order"> <list-item> <p>And in list items.<fn> 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.</p> <sec id="block-quotes"> <title>Block Quotes</title> <p>E-mail style:</p> - <disp-quote> - <p>This is a block quote. It is pretty short.</p> - </disp-quote> - <disp-quote> - <p>Code in a block quote:</p> - <preformat>sub status { - print "working"; -}</preformat> - <p>A list:</p> - <list list-type="order"> - <list-item> - <p>item one</p> - </list-item> - <list-item> - <p>item two</p> - </list-item> - </list> - <p>Nested block quotes:</p> + <p specific-use="wrapper"> <disp-quote> - <p>nested</p> + <p>This is a block quote. It is pretty short.</p> </disp-quote> + </p> + <p specific-use="wrapper"> <disp-quote> - <p>nested</p> + <p>Code in a block quote:</p> + <preformat>sub status { + print "working"; +}</preformat> + <p>A list:</p> + <list list-type="order"> + <list-item> + <p>item one</p> + </list-item> + <list-item> + <p>item two</p> + </list-item> + </list> + <p>Nested block quotes:</p> + <p specific-use="wrapper"> + <disp-quote> + <p>nested</p> + </disp-quote> + </p> + <p specific-use="wrapper"> + <disp-quote> + <p>nested</p> + </disp-quote> + </p> </disp-quote> - </disp-quote> + </p> <p>This should not be a block quote: 2 > 1.</p> <p>And a following paragraph.</p> </sec> @@ -829,10 +837,12 @@ These should not be escaped: \$ \\ \> \[ \{</preformat> </list-item> </list> <p>An e-mail address: <email>nobody@nowhere.net</email></p> - <disp-quote> - <p>Blockquoted: - <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p> - </disp-quote> + <p specific-use="wrapper"> + <disp-quote> + <p>Blockquoted: + <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p> + </disp-quote> + </p> <p>Auto-links should not occur here: <monospace><http://example.com/></monospace></p> <preformat>or here: <http://example.com/></preformat> @@ -856,9 +866,11 @@ These should not be escaped: \$ \\ \> \[ \{</preformat> <italic>not</italic> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<xref ref-type="fn" rid="fn3">3</xref></p> - <disp-quote> - <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p> - </disp-quote> + <p specific-use="wrapper"> + <disp-quote> + <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p> + </disp-quote> + </p> <list list-type="order"> <list-item> <p>And in list items.<xref ref-type="fn" rid="fn5">5</xref></p> |