From 3d629cdefb6253bceba5387664a0a2c3d8cf77fc Mon Sep 17 00:00:00 2001 From: Weijia Cheng Date: Wed, 8 Mar 2023 20:08:51 -0800 Subject: [PATCH] Transplant all-caps xpath command to step-by-step guide --- www/contribute/producing-an-ebook-step-by-step.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/contribute/producing-an-ebook-step-by-step.php b/www/contribute/producing-an-ebook-step-by-step.php index b362fd64..de3e0063 100644 --- a/www/contribute/producing-an-ebook-step-by-step.php +++ b/www/contribute/producing-an-ebook-step-by-step.php @@ -233,7 +233,8 @@ proceed to seal up my confession, I bring the life of that unhappy Henry Jekyll
  • Text in all caps. Text in all caps is almost never correct, and should either be converted to lowercase with the <em> element (for spoken emphasis), <strong> (for extreme spoken emphasis), or <b> (for unsemantic small caps, like in storefront signs).

    -

    Use this case-sensitive regex to find text in all caps: (?<!en-)(?<!z3998:roman">)(?<![A-Z])[A-Z]{2,}(?!")

    +

    Use the following command to check for instance of all caps:

    + se xpath "//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')])]" src/epub/text/*.xhtml
  • Sometimes se typogrify doesn’t close quotation marks near em-dashes correctly.