squeeze

A static site generator that can put the toothpaste back in the tube.
git clone https://git.mulligrubs.me/squeeze
Log | Files | Refs | README | LICENSE

commit 78f9b91c18052d590a1e28acd974b63925916e05
parent e4d2b12103a771278c0c32af30fd5221c83ac29e
Author: St John Karp <contact@stjo.hn>
Date:   Sun, 22 Aug 2021 03:13:09 -0400

Move unsmarten logic into main loop in unsqueeze.sh

Got rid of a faulty loop that unsmartened the punctuation in the
Markdown files. Now that the call to Prolog is in unsqueeze.sh
there isn't any reason for this to be a separate loop, so I moved
the unsmarten code into the main loop. This fixed a bug where some
Markdown files would be left empty by the unsmarten logic.

Diffstat:
Munsqueeze.sh | 35+++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/unsqueeze.sh b/unsqueeze.sh @@ -22,28 +22,23 @@ find "$OUTPUT_PATH" -type f -name "*.html" | while IFS= read -r file; do echo "$file" - swipl --traditional --quiet -l parse_entry.pl -g "consult('$SITE_PATH/site.pl'), parse_entry('$SITE_PATH/output/$file')." \ + swipl --traditional --quiet -l parse_entry.pl -g "consult('$SITE_PATH/site.pl'), parse_entry('$SITE_PATH/output/$file')." | + # Unsmarten the punctuation. + sed 's/&nbsp;/ /g' | + # Replace single quotes. + sed "s/&#39;/'/g" | + sed "s/&#8216;/'/g" | + sed "s/&#8217;/'/g" | + sed "s/&rsquo;/'/g" | + sed "s/&lsquo;/'/g" | + # Replace double quotes. + sed 's/&#8220;/"/g' | + sed 's/&#8221;/"/g' | + sed 's/&rdquo;/"/g' | + sed 's/&ldquo;/"/g' | + sed 's/&quot;/"/g' \ > "$SITE_PATH/source/${file%%.html}.md" & done # Wait until all jobs have completed. wait - -# Unsmarten the punctuation. -MARKDOWN_FILES="$(find "$SOURCE_PATH" -type f -name "*.md")" -for markdown_file in $MARKDOWN_FILES; do - sed "s/&nbsp;/ /g" "$markdown_file" | - # Replace single quotes. - sed "s/&#39;/'/g" | - sed "s/&#8216;/'/g" | - sed "s/&#8217;/'/g" | - sed "s/&rsquo;/'/g" | - sed "s/&lsquo;/'/g" | - # Replace double quotes. - sed "s/&#8220;/\"/g" | - sed "s/&#8221;/\"/g" | - sed "s/&rdquo;/\"/g" | - sed "s/&ldquo;/\"/g" | - sed "s/&quot;/\"/g" \ - > "$markdown_file" -done