JATS writer: fix illegal use of p inside p.

Closes #11809.
This commit is contained in:
John MacFarlane
2026-08-16 10:44:18 -07:00
parent 6e1836ef11
commit 6107a26945
2 changed files with 39 additions and 3 deletions
+4 -3
View File
@@ -366,12 +366,13 @@ blockToJATS opts (Div (ident,_,kvs) bs) = do
[(k,v) | (k,v) <- kvs, k `elem` ["specific-use",
"content-type"]]
let boxed_attr = [(k,v) | (k,v) <- kvs, k `elem` ["orientation", "position"]]
let attr = generic_attr <> boxed_attr
let isPlain Plain{} = True
isPlain _ = False
return $
if null attr
if null generic_attr && null boxed_attr
then contents
else -- The contents must be wrapped in an appropriate element.
let element = if null boxed_attr
let element = if null boxed_attr && all isPlain bs
then "p"
else "boxed-text"
in inTags True element (generic_attr <> boxed_attr) contents
+35
View File
@@ -0,0 +1,35 @@
```
% pandoc -f markdown -t jats
::: {#d .warn}
hi
:::
^D
<boxed-text id="d">
<p>hi</p>
</boxed-text>
```
```
% pandoc -f html -t jats
<div id="d">
hi
</div>
^D
<p id="d">
<p>hi</p>
</p>
```
```
% pandoc -f html -t jats
<div class="foo">
hi
</div>
^D
<p>hi</p>
```