|
@@ -2,8 +2,13 @@
|
|
|
|
|
|
MDFILE=$1
|
|
MDFILE=$1
|
|
PDFFILE=$(basename $MDFILE .md).pdf
|
|
PDFFILE=$(basename $MDFILE .md).pdf
|
|
-
|
|
|
|
FILE=$(mktemp XXXXXXXXXX-${MDFILE})
|
|
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
|
|
cat <<EOF >> $FILE
|
|
---
|
|
---
|
|
@@ -24,14 +29,27 @@ monofontoptions:
|
|
csquotes: true
|
|
csquotes: true
|
|
highlight-style: monochrome
|
|
highlight-style: monochrome
|
|
citemethod: biblatex
|
|
citemethod: biblatex
|
|
|
|
+pdfa: true
|
|
hyperrefoptions:
|
|
hyperrefoptions:
|
|
- breaklinks=true
|
|
- breaklinks=true
|
|
- bookmarks=true
|
|
- bookmarks=true
|
|
-...
|
|
|
|
EOF
|
|
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
|
|
rm $FILE
|