summaryrefslogtreecommitdiff
path: root/publications/export.nix
blob: 31571338ef72ea8def2a7f39c47bbf39aee3d94d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
  jq,
  pandoc,
  refsJSON ? ./publications.json,
  runCommand,
}:
runCommand "publications" {buildInputs = [jq pandoc];} ''
  mkdir -p "$out"/{biblatex,bibtex,csljson}
  cd "$out"

  jq --compact-output ".[]" ${refsJSON} | while read ref
  do
    id=$(echo "$ref" | jq --raw-output '.id')
    echo $id
    echo "$ref" > "csljson/$id"
    cat csljson/$id
    pandoc --from=cslyaml --to=biblatex --output "biblatex/$id" <<< "[ $ref ]"
    pandoc --from=cslyaml --to=bibtex   --output "bibtex/$id"   <<< "[ $ref ]"
  done
''