Skip to content

Commit 78b8327

Browse files
committed
use biber to convert bibliography to bibtex
1 parent fe993fa commit 78b8327

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@ all: plots paper.pdf
22

33
clean:
44
latexmk -c
5-
rm paper.pdf
5+
rm -f paper.pdf plos.bib norm.bib
66

7-
paper.pdf: paper.tex positionpaper.bib contributors.tex
7+
paper.pdf: paper.tex positionpaper.bib contributors.tex plos.bib
88
latexmk -pdflatex paper.tex
99

1010
contributors.tex: contributors.yml contributors.tex.j2
1111
python3 contributors.py $< -t contributors.tex.j2 -o $@
1212

13+
# this step is to convert the input files to proper biblatex files
14+
# so we can turn them into bibtex files later on
15+
norm.bib: positionpaper.bib bibliography.bib
16+
biber --tool $^ --output-file $@
17+
18+
plos.bib: norm.bib
19+
biber --tool $< --output-file $@ \
20+
--configfile=biberconf.xml \
21+
--output-field-replace=location:address,journaltitle:journal
22+
1323
plots::
1424
$(MAKE) -C group_composition_plot

biberconf.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Got the date from https://gist.githubusercontent.com/mkouhia/f00fea7fc8d4effd9dfd/raw/500e9dbc6aa43a47e39c45ba230738ff4544709f/biblatex-to-bibtex.conf -->
3+
<config>
4+
<output_fieldcase>lower</output_fieldcase>
5+
<output_resolve>1</output_resolve>
6+
<output_safechars>1</output_safechars>
7+
<output_format>bibtex</output_format>
8+
<sourcemap>
9+
<maps datatype="bibtex">
10+
<!-- Easy type conversions -->
11+
<map>
12+
<map_step map_type_source="report" map_type_target="techreport"/>
13+
<map_step map_type_source="online" map_type_target="misc"/>
14+
<map_step map_type_source="dataset" map_type_target="misc"/>
15+
</map>
16+
<!-- Date to year, month -->
17+
<map>
18+
<map_step map_field_source="date"
19+
map_field_target="year" />
20+
</map>
21+
<map>
22+
<map_step map_field_source="year"
23+
map_match="(\d{4}|\d{2})-(\d{1,2})-(\d{1,2})"
24+
map_final="1" />
25+
<map_step map_field_source="year"
26+
map_match="(\d{4}|\d{2})-(\d{1,2})-(\d{1,2})"
27+
map_replace="$1" />
28+
<map_step map_field_set="month" map_origfieldval="1" />
29+
<map_step map_field_source="month"
30+
map_match="(\d{4}|\d{2})-(\d{1,2})-(\d{1,2})"
31+
map_replace="$2" />
32+
</map>
33+
<map>
34+
<map_step map_field_source="year"
35+
map_match="(\d{4}|\d{2})-(\d{1,2})" map_final="1" />
36+
<map_step map_field_source="year"
37+
map_match="(\d{4}|\d{2})-(\d{1,2})" map_replace="$1" />
38+
<map_step map_field_set="month" map_origfieldval="1" />
39+
<map_step map_field_source="month"
40+
map_match="(\d{4}|\d{2})-(\d{1,2})" map_replace="$2" />
41+
</map>
42+
</maps>
43+
</sourcemap>
44+
</config>

0 commit comments

Comments
 (0)