Transplant all-caps xpath command to step-by-step guide

This commit is contained in:
Weijia Cheng 2023-03-08 20:08:51 -08:00 committed by Alex Cabal
parent 35ec084682
commit 3d629cdefb

View file

@ -233,7 +233,8 @@ proceed to seal up my confession, I bring the life of that unhappy Henry Jekyll
</li>
<li>
<p><a href="/manual/latest/8-typography#8.3.3">Text in all caps</a>. Text in all caps is almost never correct, and should either be converted to lowercase with the <code class="html"><span class="p">&lt;</span><span class="nt">em</span><span class="p">&gt;</span></code> element (for spoken emphasis), <code class="html"><span class="p">&lt;</span><span class="nt">strong</span><span class="p">&gt;</span></code> (for extreme spoken emphasis), or <code class="html"><span class="p">&lt;</span><span class="nt">b</span><span class="p">&gt;</span></code> (for unsemantic small caps, like in storefront signs).</p>
<p>Use this <strong>case-sensitive</strong> regex to find text in all caps: <code class="regex">(?<span class="p">&lt;</span>!en-)(?<span class="p">&lt;</span>!z3998:roman">)(?<span class="p">&lt;</span>![A-Z])[A-Z]{2,}(?!")</code></p>
<p>Use the following command to check for instance of all caps:</p>
<code class="terminal"><b>se</b> xpath <i>"//p//text()[re:test(., '[A-Z]{2,}') and not(contains(., 'OK') or contains(., 'SOS')) and not(parent::abbr or parent::var or parent::a or parent::*[contains(@epub:type, 'z3998:roman')])]"</i> <u>src/epub/text/<i class="glob">*</i>.xhtml</u></code>
</li>
<li>
<p>Sometimes <code class="bash"><b>se</b> typogrify</code> doesnt close quotation marks near em-dashes correctly.</p>