[scripts] Add some of the legacy scripts

This commit is contained in:
Alyxia Sother 2022-02-07 00:32:28 +01:00
parent aeeda91fe7
commit bb53d01244
No known key found for this signature in database
GPG key ID: 355968D14144B739
4 changed files with 94 additions and 0 deletions

26
scripts/mkgist Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env zsh
FILE="$1"
DEST="$2"
command_exists () {
whence -- "$@" &> /dev/null
}
if ( ! command_exists markdown2htmldoc ); then
echo "md2htmldoc not found. Exiting."
exit 1
fi
filename=$(basename -- "$FILE")
extension="${filename##*.}"
filename="${filename%.*}"
content=$(cat "$FILE")
md_content="# \`$filename.$extension\`\n\n\`\`\`$extension\n$content\n\`\`\`"
echo "$md_content" > temp.md
markdown2htmldoc temp.md "$DEST/$filename.$extension.html"
rm -rf temp.md