From 2cff46a8899973832a411d5cc15a2dd64dbdcd85 Mon Sep 17 00:00:00 2001 From: Charlotte Koch Date: Tue, 24 Sep 2024 17:34:26 -0700 Subject: Need another post-processing step to "unconvert" double quotes --- mk/willora.mk | 5 +++-- script/unicodify.sed | 9 --------- script/unicodify2.sed | 8 ++++++++ 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 script/unicodify2.sed diff --git a/mk/willora.mk b/mk/willora.mk index d0073c9..5955f6c 100644 --- a/mk/willora.mk +++ b/mk/willora.mk @@ -68,6 +68,7 @@ BIOGRAPHY_OUT?= biography.pdf CUSTOM_PDF_CONVERTER= ${WILLORABASE}/lib/${THEME}_pdf_converter.rb ERBBER_SCRIPT= script/erbber.rb UNICODE_TABLE= script/unicodify.sed +UNICODE_TABLE_2= script/unicodify2.sed DOCX_FIXUP= script/docx_fixup.sed DOCX_MANUSCRIPT_REF= lib/WilloraPDF_Manuscript_Reference.docx @@ -322,13 +323,13 @@ ${ODT_OUT}: ${DOCBOOK_OUT} ${DOCX_FIXUP} ${ODT_MANUSCRIPT_REF} # ===== COMMON ===== CLEANFILES+= ${BASE_ERB} -${BASE_ERB}: ${FRONTMATTER_TEMPLATE} ${CHAPTERS} ${UNICODE_TABLE} +${BASE_ERB}: ${FRONTMATTER_TEMPLATE} ${CHAPTERS} ${UNICODE_TABLE} ${UNICODE_TABLE_2} rm -f ${.TARGET} echo "// vim: filetype=asciidoc" >> ${.TARGET} cat ${FRONTMATTER_TEMPLATE} >> ${.TARGET} .for chapter in ${CHAPTERS} echo >> ${.TARGET}; echo >> ${.TARGET} - dos2unix < ${chapter} | sed -E -f ${UNICODE_TABLE} >> ${.TARGET} + dos2unix < ${chapter} | sed -E -f ${UNICODE_TABLE} | sed -E -f ${UNICODE_TABLE_2}>> ${.TARGET} .endfor ########## ########## ########## diff --git a/script/unicodify.sed b/script/unicodify.sed index a95fec0..4668732 100644 --- a/script/unicodify.sed +++ b/script/unicodify.sed @@ -2,15 +2,6 @@ s,[[:space:]]--[[:space:]],\&\#8212;,g s,[[:space:]]\.\.\.[[:space:]],\&\#8230;,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 - # Explicitly handle curly double quotes before curly single quotes. s,"`,\&\#8220;,g s,`",\&\#8221;,g diff --git a/script/unicodify2.sed b/script/unicodify2.sed new file mode 100644 index 0000000..f78c65e --- /dev/null +++ b/script/unicodify2.sed @@ -0,0 +1,8 @@ +# 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;,\"\`,g +s,\&_CLOSEDOUBLEQUOTE;,\`\",g -- cgit v1.2.3