Skip to content

Commit

Permalink
Merge pull request #180 from j---/pdf-update
Browse files Browse the repository at this point in the history
Pdf update
  • Loading branch information
sei-vsarvepalli authored May 30, 2022
2 parents 472f7f5 + e05534d commit 2f5905c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/compile-html-citeproc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
src="./md_src_files"

pandoc --self-contained \
--from=markdown_github+citations+table_captions+implicit_figures+link_attributes \
--to=html \
--citeproc \
--bibliography="$src/sources_ssvc.bib" \
-M title="Prioritizing vulnerability response: A stakeholder-specific vulnerability categorization (DRAFT version 2.0)" \
-T "SSVC" \
-M author="Jonathan M. Spring; Eric Hatleback; Allen D. Householder; Art Manion; Madison Oliver; Vijay Sarvapalli; Deana Shick; Laurie Tyzenhaus" \
-M date="Compiled `date -u`" \
-o ssvc_v2-0.html \
$src/*md

# --from should use gfm, but gfm+citations is not supported
# so this method should perhaps be considered slightly unstable.
# This citation syntax won't render on github
# but the @ citation syntax shouldn't interfere with @ mentions
# GFM only allows @ mentions in issues and pull requests
# https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown
# documentation for citation processing:
# https://pandoc.org/MANUAL.html#citations

35 changes: 35 additions & 0 deletions doc/compile-pdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
src="./md_src_files"

# HTML can handle emojis and not LaTeX commands, so the markdown files have emoji
# However, it is really hard to embed emoji into PDFs in a platform-independent way
# Apple Emoji font and Noto Emoji font are the two options, basically, and as of Apr 2022
# most devices seem to have one or the other.
# In general, LaTeX is bad at emojis, but the twemojis package might make it OK.
# However, twemojis is not a default package yet, so avoiding that for now.
# So the best available option is to temporarily replace them with LaTeX commands
# Pandoc will read from stdin if no input files are provided, so sed works inline.

sed -f emoji-replacements.sed $src/*md | \
pandoc --standalone \
--from=markdown_github+citations+yaml_metadata_block+tex_math_dollars \
--to=pdf \
--citeproc \
--pdf-engine=xelatex \
--bibliography="$src/sources_ssvc.bib" \
--table-of-contents \
-M title="Prioritizing vulnerability response: A stakeholder-specific vulnerability categorization (Version 2.0)" \
-T "SSVC" \
-M date="Compiled `date -u`" \
--metadata-file=pdf-styling.yaml \
-o "ssvc_v2-0_`date -u +"%Y-%m-%d"`.pdf" \

# --from should use gfm, but gfm+citations is not supported
# so this method should perhaps be considered slightly unstable.
# This citation syntax won't render on github
# but the @ citation syntax shouldn't interfere with @ mentions
# GFM only allows @ mentions in issues and pull requests
# https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown
# documentation for citation processing:
# https://pandoc.org/MANUAL.html#citations

2 changes: 2 additions & 0 deletions doc/emoji-replacements.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
s/:white_check_mark:/$\\checkmark$/g
s/:x:/$\\times$/g
24 changes: 24 additions & 0 deletions doc/pdf-styling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
author:
- Jonathan M. Spring
- Eric Hatleback
- Allen D. Householder
- Art Manion
- Madison Oliver
- Vijay Sarvapalli
- Deana Shick
- Laurie Tyzenhaus
documentclass: scrreprt
classoption:
- 10pt
- letterpaper
- onecolumn
- notitlepage
pagestyle: headings
numbersections: true
secnumdepth: 4
geometry:
- top=1in
- bottom=1in
mainfont: Times
...

0 comments on commit 2f5905c

Please sign in to comment.