Remove python script with bash script

This commit is contained in:
askiiart 2023-09-11 20:10:21 -05:00
parent 14d2c27b96
commit 9305040da4
No known key found for this signature in database
GPG key ID: C89CBC4F981EE719
2 changed files with 11 additions and 13 deletions

View file

@ -1,13 +0,0 @@
import os
from pathlib import Path
dir = os.path.dirname(__file__)
print(dir)
os.chdir(dir)
files = [str(item)[:-3] for item in Path(dir).rglob('*.md')]
for item in files:
os.system(f'pandoc -f markdown-smart --data-dir . --template {dir}/template.html -t html -o {item}.html {item}.md --metadata title=\"$(grep -m 1 -oP \'(?<=^# ).*\' {item}.md | cat)\"')
# Replace 'language-' with 'language-' recursively
os.system("find . \( ! -regex './md2html.py' \) -type f | xargs sed -i 's/sourceCode /language-/g'")

11
md2html.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
set -e
dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
find . -name "*.md" | while read -r item ; do
item="${item%.*}"
echo "Currently processing ${item}"
pandoc -f markdown-smart --data-dir . --template ${dir}/template.html -t html -o ${item}.html ${item}.md --metadata title="$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat)"
done
find . \( ! -regex './md2html.sh' \) -type f | xargs sed -i 's/sourceCode /language-/g'