diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2025-02-16 20:59:22 +0100 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2025-02-16 21:42:10 +0100 |
| commit | 700aae6e4ae56034d105eab95be5fcb969b3853a (patch) | |
| tree | c95e1a663a6d472c2936b5f4c771d3399edd2545 /publications/export.nix | |
| parent | 62e4fd8bd3e86bbf32e6ef64811c055958c4e1e5 (diff) | |
publications: export inside a package
Diffstat (limited to 'publications/export.nix')
| -rw-r--r-- | publications/export.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/publications/export.nix b/publications/export.nix new file mode 100644 index 0000000..6a6c42d --- /dev/null +++ b/publications/export.nix @@ -0,0 +1,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=csljson --to=biblatex --output "biblatex/$id" <<< "[ $ref ]" + pandoc --from=csljson --to=bibtex --output "bibtex/$id" <<< "[ $ref ]" + done +'' |
