From f9d5943d2ba2cf8a756a7b2ed97f4d9327ec4025 Mon Sep 17 00:00:00 2001 From: aristote Date: Sun, 27 Jul 2025 13:29:21 +0200 Subject: publications: fix export --- publications/default.nix | 2 +- publications/export.nix | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'publications') diff --git a/publications/default.nix b/publications/default.nix index 553692c..1a15c87 100644 --- a/publications/default.nix +++ b/publications/default.nix @@ -16,5 +16,5 @@ in { reports = importPublications (lib.importJSON ./reports.json); talks = importPublications (lib.importJSON ./talks.json); misc = importPublications (lib.importJSON ./miscellaneous.json); - files = pkgs.callPackage ./export.nix {}; + files = pkgs.callPackage ./export.nix {refsJSON = lib.concatStringsSep " " [./conferences.json ./journals.json ./reports.json ./miscellaneous.json];}; } diff --git a/publications/export.nix b/publications/export.nix index 6a6c42d..93a51f2 100644 --- a/publications/export.nix +++ b/publications/export.nix @@ -1,20 +1,23 @@ { jq, pandoc, - refsJSON ? ./publications.json, + refsJSON, runCommand, }: runCommand "publications" {buildInputs = [jq pandoc];} '' mkdir -p "$out"/{biblatex,bibtex,csljson} cd "$out" - jq --compact-output ".[]" ${refsJSON} | while read ref + for refs in ${refsJSON} 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 ]" + jq --compact-output ".[]" $refs | 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 done '' -- cgit v1.2.3