-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtupd
executable file
·27 lines (24 loc) · 882 Bytes
/
tupd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /bin/bash
#
# Converts markdown files in directory `whatwhyhow` to html and updates the
# content of the corresponding templates in directory `templates`.
#
# Naming conventions:
# Mardown files: {name}.md
# Templates: thify_{name}.html
#
# Will replace all content in div.what-why-how-wrapper (which must be the
# last part of the template file)
#
template_dir=templates
md_dir=wwh
for line in $(ls -d $md_dir/*.md)
do
md_fname=${line##*/}
ht_file=$template_dir/thify_${md_fname%.md}.html
sed -i.bak '/<div class="what-why-how-wrapper">/,$d' $ht_file
echo '<div class="what-why-how-wrapper">' >> $ht_file
pandoc -S -t html $line | sed 's/\<Thify\>/<span class="thify-font-face">&<\/span>/g' >> $ht_file
echo '</div>' >> $ht_file
echo '<!-- DO NOT ADD CONTENT BELOW THIS LINE - WILL BE DELETED DURING MARKDOWN UPDATE -->' >> $ht_file
done