From b5d864b30330f6de5cdda2ec0a9b0eb9a675d810 Mon Sep 17 00:00:00 2001 From: Christian Boulanger <info@bibliograph.org> Date: Sat, 31 Aug 2024 21:41:40 +0100 Subject: [PATCH] Added transformation MODS -> BibTeX -> CSL-JSON --- .../lib/{run-citeproc.sh => run-pandoc.sh} | 2 +- convert-anystyle-data/tei-to-bibformats.ipynb | 41 +++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-) rename convert-anystyle-data/lib/{run-citeproc.sh => run-pandoc.sh} (80%) diff --git a/convert-anystyle-data/lib/run-citeproc.sh b/convert-anystyle-data/lib/run-pandoc.sh similarity index 80% rename from convert-anystyle-data/lib/run-citeproc.sh rename to convert-anystyle-data/lib/run-pandoc.sh index badc529..b9cec18 100644 --- a/convert-anystyle-data/lib/run-citeproc.sh +++ b/convert-anystyle-data/lib/run-pandoc.sh @@ -10,5 +10,5 @@ for input_path in $input_dir/*.$input_ext do out_file=$(basename ${input_path/\.$input_ext/.$output_ext}) echo "Running citeproc to convert $input_path to $output_dir/$out_file..." - pandoc -f $convert_from -t $convert_to -o "$output_dir/$out_file" $input_path 2>&1 + pandoc -f "$convert_from" -t "$convert_to" -o "$output_dir/$out_file" "$input_path" 2>&1 done \ No newline at end of file diff --git a/convert-anystyle-data/tei-to-bibformats.ipynb b/convert-anystyle-data/tei-to-bibformats.ipynb index b371130..22871cc 100644 --- a/convert-anystyle-data/tei-to-bibformats.ipynb +++ b/convert-anystyle-data/tei-to-bibformats.ipynb @@ -325,8 +325,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-08-31T14:08:36.676792Z", - "start_time": "2024-08-31T14:08:36.428050Z" + "end_time": "2024-08-31T20:39:19.077022Z", + "start_time": "2024-08-31T20:39:18.691518Z" } }, "cell_type": "code", @@ -355,23 +355,48 @@ ] } ], - "execution_count": 58 + "execution_count": 2 }, { - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2024-08-31T20:40:43.883111Z", + "start_time": "2024-08-31T20:40:37.701850Z" + } + }, "cell_type": "code", - "outputs": [], - "execution_count": null, "source": [ "# BibTeX to CSL\n", "\n", - "cmd = ['bash', 'lib/run-bibutils.sh', 'xml2bib']\n", + "cmd = ['bash', 'lib/run-pandoc.sh', 'bibtex', 'csljson']\n", "if platform.system() == 'Windows':\n", " cmd = ['wsl.exe', '-e'] + cmd\n", "output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)\n", "print(output.decode())" ], - "id": "a2cdccaf919c268e" + "id": "a2cdccaf919c268e", + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running citeproc to convert bib/10.1111_1467-6478.00057.bib to csljson/10.1111_1467-6478.00057.csl.json...\n", + "Running citeproc to convert bib/10.1111_1467-6478.00080.bib to csljson/10.1111_1467-6478.00080.csl.json...\n", + "Running citeproc to convert bib/10.1515_zfrs-1980-0103.bib to csljson/10.1515_zfrs-1980-0103.csl.json...\n", + "Running citeproc to convert bib/10.1515_zfrs-1980-0104.bib to csljson/10.1515_zfrs-1980-0104.csl.json...\n", + "\n" + ] + } + ], + "execution_count": 4 + }, + { + "metadata": {}, + "cell_type": "code", + "outputs": [], + "execution_count": null, + "source": "", + "id": "77ff73f83a1db70e" } ], "metadata": { -- GitLab