-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from DILCISBoard/feat/pdf-publication
FEAT - PDF publication for v2.0.1
- Loading branch information
Showing
3 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
!INCLUDE "spec-publisher/res/md/common-intro.md" | ||
!INCLUDE "specification/metadata.md" | ||
|
||
!INCLUDE "specification/index.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,79 @@ | ||
#!/usr/bin/env bash | ||
#!/usr/bin/env bash | ||
echo "Generating PDF document from markdown" | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd "$SCRIPT_DIR" || exit | ||
|
||
if [ ! -d ~/.pandoc/templates ] | ||
then | ||
mkdir -p ~/.pandoc/templates | ||
fi | ||
cp spec-publisher/pandoc/templates/eisvogel.latex ~/.pandoc/templates/eisvogel.latex | ||
cd "./specification/postface/" | ||
bash "$SCRIPT_DIR/spec-publisher/utils/create-venv.sh" | ||
command -v markdown-pp >/dev/null 2>&1 || { | ||
tmpdir=$(dirname $(mktemp -u)) | ||
source "$tmpdir/.venv-markdown/bin/activate" | ||
} | ||
echo " - MARKDOWN-PP: Processing postface markdown" | ||
markdown-pp postface.md -o "$SCRIPT_DIR/docs/postface.md" -e tableofcontents | ||
|
||
cd "$SCRIPT_DIR/docs" || exit | ||
|
||
echo " - PANDOC: Generating Preface from markdown" | ||
pandoc --from gfm \ | ||
--to latex \ | ||
--metadata-file "../spec-publisher/pandoc/metadata.yaml" \ | ||
"../spec-publisher/res/md/common-intro.md" \ | ||
-o ./preface.tex | ||
echo " - PANDOC: Finished" | ||
sed -i 's%fig_1_dip.svg%fig_1_dip.png%' ./preface.tex | ||
sed -i 's%section{%section*{%' ./preface.tex | ||
|
||
echo " - PANDOC: Generating Postface from markdown" | ||
pandoc --from gfm \ | ||
--to latex \ | ||
--metadata-file "../spec-publisher/pandoc/metadata.yaml" \ | ||
"$SCRIPT_DIR/docs/postface.md" \ | ||
-o ./postface.tex | ||
sed -i 's%section{%section*{%' ./postface.tex | ||
rm "$SCRIPT_DIR/docs/postface.md" | ||
|
||
if [ ! -d "$SCRIPT_DIR/docs/pdf" ] | ||
then | ||
mkdir -p "$SCRIPT_DIR/docs/pdf/" | ||
fi | ||
|
||
bash "$SCRIPT_DIR/spec-publisher/utils/create-venv.sh" | ||
source "$SCRIPT_DIR/.venv/markdown/bin/activate" | ||
cd "$SCRIPT_DIR" || exit | ||
|
||
echo " - MARKDOWN-PP: Preparing PDF markdown" | ||
command -v markdown-pp >/dev/null 2>&1 || { | ||
tmpdir=$(dirname $(mktemp -u)) | ||
source "$tmpdir/.venv-markdown/bin/activate" | ||
} | ||
markdown-pp PDF.md -o docs/eark-dip-pdf.md -e tableofcontents | ||
deactivate | ||
|
||
cp -R specification/media docs/ | ||
cp -R spec-publisher/res/md/figs docs/ | ||
|
||
cd docs || exit | ||
pandoc --from gfm \ | ||
--template eisvogel \ | ||
|
||
### | ||
# Pandoc options: | ||
# --from markdown \ # Source fromat Markdown | ||
# --template ../pandoc/templates/eisvogel.latex \ # Use this latex template | ||
# --listings \ # Use listings package for code blocks | ||
# --table-of-contents \ # Generate table of contents | ||
# --metadata-file ../pandoc/metadata.yaml \ # Additional Pandoc metadata | ||
# --include-before-body "../spec-publisher/res/md/common-intro.md" \ | ||
# --include-after-body "../specification/postface/postface.md" \ | ||
# --number-sections \ # Generate Heading Numbers | ||
# eark-sip-pdf.md \ # Input Markdown file | ||
# -o ./pdf/eark-dip.pdf # PDF Destinaton | ||
echo " - PANDOC: Generating PDF document from markdown" | ||
pandoc --from markdown \ | ||
--template "../spec-publisher/pandoc/templates/eisvogel.latex" \ | ||
--listings \ | ||
--toc \ | ||
--table-of-contents \ | ||
--metadata-file "../spec-publisher/pandoc/metadata.yaml" \ | ||
--include-before-body "./preface.tex" \ | ||
--include-after-body "./postface.tex" \ | ||
--number-sections \ | ||
eark-dip-pdf.md \ | ||
--metadata-file ../pandoc/metadata.yaml \ | ||
-o pdf/eark-dip.pdf | ||
|
||
-o "./pdf/eark-dip.pdf" | ||
echo "PANDOC: Finished" | ||
rm "$SCRIPT_DIR/docs/preface.tex" "$SCRIPT_DIR/docs/postface.tex" "$SCRIPT_DIR/docs/eark-dip-pdf.md" | ||
cd "$SCRIPT_DIR" || exit |