-
Notifications
You must be signed in to change notification settings - Fork 2
/
convert.sh
executable file
·29 lines (22 loc) · 1008 Bytes
/
convert.sh
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
28
29
#!/bin/bash
# -- 1. Convert content files from Latex progect to manubot content folder
for filename in stthesis_latex/content/*.tex; do
echo "Processing ${filename##*/} "
pandoc -s $filename -o content/${filename##*/}.md
done
# # -- 2. Copy bibliography
pandoc-citeproc --bib2json stthesis_latex/content/bibliography.bib > content/manual-references.json
# jq -r 'values | .[].id="raw:"+.[].id' content/bibliography.json > content/manual-references.json
# # -- 3. Change reference prefix to md files
for f in $(pandoc-citeproc --bib2json stthesis_latex/content/bibliography.bib | jq 'values | .[].id'); do
f="${f%\"}"
f="${f#\"}"
sed -i -- 's/'${f}'/raw:'${f}'/g' content/*.md
sed -i -- 's/'${f}'/raw:'${f}'/g' content/manual-references.json
done
# 4. Copy folder with images
# cp -avr stthesis_latex/content/images content
# for filename in stthesis_latex/content/*.tex; do
# echo "Processing ${filename##*/} "
# pandoc -s $filename -o content/${filename##*/}.md
# done