1
0
Fork 0
forked from ZeusWPI/drive

Fix md to pdf script

This commit is contained in:
mcbloch 2020-10-11 20:32:45 +02:00
parent 090574a169
commit d995cf69cb
2 changed files with 11 additions and 6 deletions

View file

@ -17,9 +17,9 @@ install:
script:
# Leave detached git HEAD
- git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
# Create stageable file and stage it
- cd activiteiten/2020-2021/04_hacktoberfest/
- sh ../../../scripts/md_to_pdf.sh
# compile every markdown in this folder to pdf
- cd activiteiten/2020-2021/
- sh ../../scripts/md_to_pdf.sh
- git add -A
# Commit (note the [skip ci] to avoid loop)
- 'git commit -m "chore: render activities [skip ci]"'

11
scripts/md_to_pdf.sh Normal file → Executable file
View file

@ -1,8 +1,13 @@
#!/bin/sh
echo "Converting to HTML…"
echo "Converting to PDF…"
for file in *.md */*.md
do
echo " converting $file"
pandoc $file -f markdown -t pdf -o (echo "../$file" | sed '$s/\.md$/.pdf/') -s --data-dir=./ --variable=file:(echo "$file" | sed '$s/\.md$/.pdf/')
end
output_path=$(echo "$file" | sed '$s/\.md$/.pdf/')
echo " $output_path"
output_name=$(echo "$file" | sed '$s/\.md$/.pdf/')
echo " $output_name"
pandoc "$file" -f markdown -t pdf -o "$output_path" -s --data-dir=./
done