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:
M | unsqueeze.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/ / /g' | + # Replace single quotes. + sed "s/'/'/g" | + sed "s/‘/'/g" | + sed "s/’/'/g" | + sed "s/’/'/g" | + sed "s/‘/'/g" | + # Replace double quotes. + sed 's/“/"/g' | + sed 's/”/"/g' | + sed 's/”/"/g' | + sed 's/“/"/g' | + sed 's/"/"/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/ / /g" "$markdown_file" | - # Replace single quotes. - sed "s/'/'/g" | - sed "s/‘/'/g" | - sed "s/’/'/g" | - sed "s/’/'/g" | - sed "s/‘/'/g" | - # Replace double quotes. - sed "s/“/\"/g" | - sed "s/”/\"/g" | - sed "s/”/\"/g" | - sed "s/“/\"/g" | - sed "s/"/\"/g" \ - > "$markdown_file" -done