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: script:
# Leave detached git HEAD # Leave detached git HEAD
- git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
# Create stageable file and stage it # compile every markdown in this folder to pdf
- cd activiteiten/2020-2021/04_hacktoberfest/ - cd activiteiten/2020-2021/
- sh ../../../scripts/md_to_pdf.sh - sh ../../scripts/md_to_pdf.sh
- git add -A - git add -A
# Commit (note the [skip ci] to avoid loop) # Commit (note the [skip ci] to avoid loop)
- 'git commit -m "chore: render activities [skip ci]"' - '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 #!/bin/sh
echo "Converting to HTML…" echo "Converting to PDF…"
for file in *.md */*.md for file in *.md */*.md
do
echo " converting $file" 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/') output_path=$(echo "$file" | sed '$s/\.md$/.pdf/')
end 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