-
Notifications
You must be signed in to change notification settings - Fork 6
/
convert_to_pdf.sh
executable file
·54 lines (42 loc) · 1.22 KB
/
convert_to_pdf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# This bash script loops through PLEPs and converts the
# ReStructuredText (.rst) files into PDF files with a consistent
# style.
#
# The author metadata right now must be implemented manually in order
# for middle initials to be included.
#
# This script may be run using:
#
# bash convert_to_pdf.sh
#
# This script requires that pandoc and pdflatex be installed.
pdf_engine=pdflatex
options="-V papersize:letter -V geometry:margin=1in -V fontsize=12pt -V linestretch=1.07 -V colorlinks"
# Enter pdf metadata manually
authors=( \
[0000]="PlasmaPy Community" \
[0001]="Nicholas A. Murphy" \
[0002]="Nicholas A. Murphy" \
[0003]="PlasmaPy Community" \
[0004]="Nicholas A. Murphy" \
[0005]="Nicholas A. Murphy and Stuart J. Mumford" \
[0006]="Andrew J. Leonard" \
[0007]="Erik T. Everson" \
)
for rstfile in PLEP-????.rst; do
base=${rstfile%.rst}
number=${base//PLEP-/}
pdffile=${base}.pdf
author=${authors[${number}]:-""}
echo "Converting ${rstfile} to ${pdffile}"
echo "Author = ${author}"
pandoc \
${rstfile} \
-o ${pdffile} \
--pdf-engine=${pdf_engine} \
${options} \
-M author="${author}" \
-M subject="PlasmaPy Enhancement Proposal"
echo ""
done