Skip to content

Commit

Permalink
debug smart quotes around a single XML tag: #911
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Aug 8, 2024
1 parent c49f691 commit c6f20b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/metanorma/standoc/cleanup_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def uninterrupt_quotes_around_xml1(elem)
prev = elem.at(".//preceding::text()[1]") or return
/\S\Z/.match?(prev.text) or return
foll = elem.at(".//following::text()[1]")
/"$/.match?(prev.text) and /^"/.match?(foll&.text) and return # "<tag/>"
m = /\A(["'][[:punct:]]*)(\s|\Z)/
.match(@c.decode(foll&.text)) or return
foll.content = foll.text.sub(/\A(["'][[:punct:]]*)/, "")
Expand Down
15 changes: 14 additions & 1 deletion spec/metanorma/cleanup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@
"((ppm))"&#xa0;
"_x_"
"stem:[3]".
footnote:[The mole]
Expand All @@ -182,6 +184,7 @@
<p id="_">“ppt”,<index><primary>ppt</primary></index></p>
<p id="_">“ppm”,<index><primary>ppm</primary></index> “ppt”<index><primary>ppt</primary></index></p>
<p id="_">“ppm<index><primary>ppm</primary></index>” </p>
<p id="_">“<em>x</em>”</p>
<p id="_">“<stem type="MathML" block="false"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="false"><mn>3</mn></mstyle></math><asciimath>3</asciimath></stem>”.<fn reference="1"><p id="_">The mole</p></fn></p>
<figure id="_">
<pre id="_">((ppm))",</pre>
Expand Down Expand Up @@ -614,7 +617,7 @@
====
INPUT
output = <<~OUTPUT
#{BLANK_HDR}
#{BLANK_HDR}
<preface>
<note id="_2cfe95f6-7ad6-aa57-8207-6f7d7928aa8e">
<p id="_76d95913-a379-c60f-5144-1f09655cafa6">
Expand Down Expand Up @@ -791,6 +794,12 @@
++http://www.example.com++
"http://www.example.com/...abc"
_http://www.example.com/...abc_
"_http://www.example.com/...abc_"
https://isotc.iso.org/livelink/livelink/fetch/-15620806/15620808/15623592/15768654/TMB_resolutions_-_2012_%28Resolution_1-148%29.pdf?nodeid=15768229&vernum=-2
https://isotc.iso.org/livelink/livelink/fetch/-15620806/15620808/15623592/15768654/TMB_resolutions_-_2012_%28Resolution_1-148%29.pdf?nodeid=15768229&vernum=-2[TMB Resolution 8/2012]
Expand Down Expand Up @@ -873,6 +882,10 @@
<link target="http://www.example.com/...abc">\\link:http://www.example.com/…abc[]</link>
</p>
<p id="_">http://www.example.com</p>
<p id="_">“<link target="http://www.example.com/...abc"/>”</p>
<p id="_"><em><link target="http://www.example.com/…​abc"/></em></p>
<p id="_">“<em><link target="http://www.example.com/…​abc"/></em>”
</p>
<p id="_">
<link target="https://isotc.iso.org/livelink/livelink/fetch/-15620806/15620808/15623592/15768654/TMB_resolutions_-_2012_%28Resolution_1-148%29.pdf?nodeid=15768229&amp;vernum=-2"/>
</p>
Expand Down

0 comments on commit c6f20b9

Please sign in to comment.