1
0
mirror of https://github.com/funkypenguin/geek-cookbook/ synced 2025-12-13 17:56:26 +00:00

Iterate on markua-cleaning script

This commit is contained in:
David Young
2020-06-03 13:04:03 +12:00
parent bb66bdcf61
commit 2d586be6ad

View File

@@ -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