Skip to content

Commit 406a9ca

Browse files
committed
rename / add preprocessors
1 parent bfbf61e commit 406a9ca

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ phonR.Rproj
1818
README.md
1919
TODO.txt
2020
vignette_mathjax_resizer.py
21-
vignette_postprocessing.py
21+
vignette_postprocessing_html.py
22+
vignette_preprocessing_latex.py
2223
vignette_template.tex
2324
vignette_template.html
2425
.gitignore
File renamed without changes.

vignette_preprocessing_latex.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# /usr/bin/python
2+
header = '''<!-- pandoc
3+
output:
4+
pdf_document:
5+
s:
6+
t: latex
7+
o: phonR.pdf
8+
latex-engine: xelatex
9+
template: vignette_template.tex
10+
V: geometry:margin=1in
11+
bibliography: phonR.bib
12+
csl: phonR.csl
13+
no-tex-ligatures:
14+
'''
15+
16+
with open('phonR.Rmd', 'r') as f:
17+
with open('phonR_tex.Rmd', 'w') as g:
18+
pandoc_header = False
19+
header_written = False
20+
for line in f:
21+
if '<!--pandoc' in line:
22+
pandoc_header = True
23+
if pandoc_header and '-->' in line:
24+
pandoc_header = False
25+
if pandoc_header:
26+
if not header_written:
27+
g.write(header)
28+
header_written = True
29+
else:
30+
g.write(line)

0 commit comments

Comments
 (0)