-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_README.sh
executable file
·47 lines (45 loc) · 1.47 KB
/
generate_README.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
#!/bin/zsh
# Shell script to convert source files into a MS-Word
# document. Most of the heavy lifting done by pandoc:
# https://pandoc.org
# Last tested with v3.1.
#
# Equation, Figure, and Table numbering/cross references
# handled by pandoc-crossref:
# https://lierdakil.github.io/pandoc-crossref/#citeproc-and-pandoc-crossref
# Last tested with v0.3.15.1.
# Cleanup markdown before passing to pandoc
# - missing italics for genes and QS systems
# - unicode glyphs to markdown subscripts
# - remove HTML line breaks (used in table headings)
cat paper.md | sed \
-e 's/ lasB/ _lasB_/g' \
-e 's/ lasI/ _lasI_/g' \
-e 's/ lasR/ _lasR_/g' \
-e 's/ rhlI/ _rhlI_/g' \
-e 's/ rhlR/ _rhlR_/g' \
-e 's/ las/ _las_/g' \
-e 's/ rhl/ _rhl_/g' \
-e 's/C₄‑HSL/C~4~‑HSL/g' \
-e 's/3‑oxo‑C₁₂‑HSL/3‑oxo‑C~12~‑HSL/g' \
-e 's/ / /g' \
| pandoc \
--from markdown \
--to gfm \
--wrap=preserve \
--filter pandoc-crossref \
--citeproc \
--bibliography "Bibliography (BibTeX).bib" \
| sed -E "s/\<\/{0,1}figure.*\>//" \
| sed -E "s/\<\/{0,1}p.*\>//" \
| sed -E "s/\<\/{0,1}span.*\>//" \
| sed -E "s/\<\/{0,1}div.*\>//" \
| sed -E "s/^Table [0-9]?:.*//" \
| sed -E "s/\\\$\\\$/\n\$\$/" \
| sed -E "s/^\<div.*//" \
| sed -E "s/^entry-spacing=\"0\"\>//" \
| sed -E "s/^([0-9]*)\. /\1\\\. /" \
| sed -E "s/^([0-9]*)\) /\1\\\) /" \
| sed -e "/./b" -e :n -e "N;s/\n$//;tn" \
| sed -E "s/\<figcaption\>.*\>//" \
> README.md