From 2d586be6ada710ee588e34cb8472995ecf8bcbfb Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 3 Jun 2020 13:04:03 +1200 Subject: [PATCH] Iterate on markua-cleaning script --- scripts/markdown-to-markua.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/markdown-to-markua.sh b/scripts/markdown-to-markua.sh index 12e9a86..5a8479e 100755 --- a/scripts/markdown-to-markua.sh +++ b/scripts/markdown-to-markua.sh @@ -1,14 +1,16 @@ #!/bin/bash -# Markua doesn't know what to do with 4 backticks (````), so convert to 3: -find manuscript -type f -name "*.md" -print0 | xargs -0 sed -i "s/\`\`\`\`/\`\`\`/g" - -# Can't use relative paths in a book, so make all paths static -find manuscript -type f -name "*.md" -print0 | xargs -0 sed -i "s/(\//(https:\/\/geek-cookbook.funkypenguin.co.nz\/)/g" - -# strip emojis -for file in `find manuscript -type f -name "*.md" -print0` +for file in `find manuscript -type f -name "*.md"` do + echo "Processing $file..." + + # Markua doesn't know what to do with 4 backticks (````), so convert to 3: + sed -ie "s/\`\`\`\`/\`\`\`/g" $file + + # Can't use relative paths in a book, so make all paths static + sed -ie 's/(\//(https:\/\/geek-cookbook.funkypenguin.co.nz\/)/g' $file + + # strip emojis tr -cd '\11\12\15\40-\176' < $file > $file-clean mv $file-clean $file done \ No newline at end of file