|
@@ -2,8 +2,13 @@
|
|
|
|
|
|
MDFILE=$1
|
|
|
PDFFILE=$(basename $MDFILE .md).pdf
|
|
|
-
|
|
|
FILE=$(mktemp XXXXXXXXXX-${MDFILE})
|
|
|
+HAS_METADATA=0
|
|
|
+
|
|
|
+if head -n 1 ${MDFILE} | grep -- '---' > /dev/null ; then
|
|
|
+ echo "Metadata Block Found"
|
|
|
+ HAS_METADATA=1
|
|
|
+fi
|
|
|
|
|
|
cat <<EOF >> $FILE
|
|
|
---
|
|
@@ -24,14 +29,27 @@ monofontoptions:
|
|
|
csquotes: true
|
|
|
highlight-style: monochrome
|
|
|
citemethod: biblatex
|
|
|
+pdfa: true
|
|
|
hyperrefoptions:
|
|
|
- breaklinks=true
|
|
|
- bookmarks=true
|
|
|
-...
|
|
|
EOF
|
|
|
|
|
|
-cat $MDFILE >> $FILE
|
|
|
+if [ $HAS_METADATA -eq 1 ] ; then
|
|
|
+ cat $MDFILE | sed '1 d' >> $FILE
|
|
|
+else
|
|
|
+ echo "..." >> $FILE
|
|
|
+ cat $MDFILE >> $FILE
|
|
|
+fi
|
|
|
+
|
|
|
+echo "Processing file to PDF."
|
|
|
+pandoc -f markdown \
|
|
|
+ -s -t pdf \
|
|
|
+ --highlight-style monochrome \
|
|
|
+ --pdf-engine='lualatex' \
|
|
|
+ -o $PDFFILE \
|
|
|
+ $FILE
|
|
|
|
|
|
-pandoc -f markdown -t pdf --highlight-style monochrome --pdf-engine='lualatex' -o $PDFFILE $FILE
|
|
|
+echo "Done."
|
|
|
|
|
|
rm $FILE
|