summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorCharlotte Koch <charlotte@magentastripe.com>2024-09-13 17:19:10 -0700
committerCharlotte Koch <charlotte@magentastripe.com>2024-09-13 17:19:10 -0700
commit8c0342ffd57527cc649737c258ceb9485c45d36c (patch)
treee487d2e1f8aff3ba9de244ad5c73c0d838a7b4eb /script
parenta93f17d27527a946338cf005a98d3e9d0ab40ebd (diff)
New approach for dealing with unmatched double quotes.
The old solution had a subtle, unwanted side-effect which didn't account for closed double quotes butted against a nonword character (e.g. em-dash or ellipsis). This approach is much better. It delegates the handling of curly double quotes to Asciidoctor as much as possible *except for* the singular times where we need to make an exception.
Diffstat (limited to 'script')
-rw-r--r--script/unicodify.sed13
1 files changed, 10 insertions, 3 deletions
diff --git a/script/unicodify.sed b/script/unicodify.sed
index 358586a..ae33151 100644
--- a/script/unicodify.sed
+++ b/script/unicodify.sed
@@ -1,9 +1,16 @@
# Remove spaces on either end of an em-dash.
s,[[:space:]]--[[:space:]],\&\#8212;,g
-# Explicitly handle double-quotes before single-quotes.
-s,"`,\&\#8220;,g
-s,`",\&\#8221;,g
+# WilloraPDF extension: explicit "unmatched" double-quote shortcuts.
+#
+# This is to work around a shortcoming in Asciidoctor when a double-quote is
+# right up against a non-word character -- em-dashes, ellipses, etc. TL;DR
+# it's better to let Asciidoctor handle ("`) and (`") automatically by
+# default EXCEPT FOR the times we need to wrangle it ourselves.
+s,\&_OPENDOUBLEQUOTE;,\&\#8220;,g
+s,\&_CLOSEDOUBLEQUOTE;,\&\#8221;,g
+
+# Curly single quotes.
s,'`,\&\#8216;,g
s,`',\&\#8217;,g