blob: 22c965d28798b13afbe0e27ff170c9d4eeaf549c (
plain)
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
|
{
jq,
pandoc,
refsJSON,
runCommand,
}:
runCommand "export-research-bib"
{
buildInputs = [
jq
pandoc
];
}
''
mkdir -p "$out"/{biblatex,bibtex,csljson}
cd "$out"
for refs in ${refsJSON}
do
jq --compact-output ".[]" $refs | while read -r ref
do
id=$(echo "$ref" | jq --raw-output '.id')
echo $id
echo "$ref" > "csljson/$id"
cat csljson/$id
pandoc --from=csljson --to=biblatex --output "biblatex/$id" <<< "[ $ref ]"
pandoc --from=csljson --to=bibtex --output "bibtex/$id" <<< "[ $ref ]"
done
done
''
|