From 2182fae8fed235b266bf0c01ec0c289447ea86c3 Mon Sep 17 00:00:00 2001
From: Christian Boulanger <boulanger@lhlt.mpg.de>
Date: Mon, 30 Sep 2024 09:14:42 +0200
Subject: [PATCH] Publish diff files on gitlab pages

---
 convert-anystyle-data/anystyle-to-tei.ipynb | 52 ++++++++++++++-------
 1 file changed, 35 insertions(+), 17 deletions(-)

diff --git a/convert-anystyle-data/anystyle-to-tei.ipynb b/convert-anystyle-data/anystyle-to-tei.ipynb
index 37af644..049c9ce 100644
--- a/convert-anystyle-data/anystyle-to-tei.ipynb
+++ b/convert-anystyle-data/anystyle-to-tei.ipynb
@@ -690,8 +690,8 @@
   {
    "metadata": {
     "ExecuteTime": {
-     "end_time": "2024-09-30T07:07:29.730Z",
-     "start_time": "2024-09-30T07:07:29.371437300Z"
+     "end_time": "2024-09-30T07:14:09.985435200Z",
+     "start_time": "2024-09-30T07:14:09.618955100Z"
     }
    },
    "cell_type": "code",
@@ -728,7 +728,7 @@
     "for input_path in glob.glob('tei-bibl-corrected/*.xml'):\n",
     "    base_name = os.path.basename(input_path)\n",
     "    id = os.path.splitext(base_name)[0]\n",
-    "    print(f'Extracting and comparing input data for {id}  ...')\n",
+    "    \n",
     "    with open(input_path, 'r', encoding='utf-8') as f:\n",
     "        tei_input_data = tei_to_ground_truth_input(f.read())\n",
     "    anystyle_input_path = f'refs/{id}.txt'\n",
@@ -738,27 +738,45 @@
     "    html_diff = HtmlDiff().make_file(anystyle_input_data, tei_input_data)\n",
     "    with open(f\"../public/convert-anystyle-data/diffs/{id}.diff.html\", \"w\", encoding=\"utf-8\") as f:\n",
     "        f.write(html_diff)\n",
-    "        print(f'  View diff at https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/{id}.diff.html')\n",
+    "        display(HTML(f'<p>Extracted and compared input data for {id}  (<a href=\"https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/{id}.diff.html\" target=_blank>See diff</a>)'))\n",
     "        "
    ],
    "id": "4c19609699dc79c",
    "outputs": [
     {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Extracting and comparing input data for 10.1111_1467-6478.00057  ...\n",
-      "  View diff at https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1111_1467-6478.00057.diff.html\n",
-      "Extracting and comparing input data for 10.1111_1467-6478.00080  ...\n",
-      "  View diff at https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1111_1467-6478.00080.diff.html\n",
-      "Extracting and comparing input data for 10.1515_zfrs-1980-0103  ...\n",
-      "  View diff at https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1515_zfrs-1980-0103.diff.html\n",
-      "Extracting and comparing input data for 10.1515_zfrs-1980-0104  ...\n",
-      "  View diff at https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1515_zfrs-1980-0104.diff.html\n"
-     ]
+     "data": {
+      "text/plain": "<IPython.core.display.HTML object>",
+      "text/html": "<p>Extracted and compared input data for 10.1111_1467-6478.00057  (<a href=\"https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1111_1467-6478.00057.diff.html\" target=_blank>See diff</a>)"
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": "<IPython.core.display.HTML object>",
+      "text/html": "<p>Extracted and compared input data for 10.1111_1467-6478.00080  (<a href=\"https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1111_1467-6478.00080.diff.html\" target=_blank>See diff</a>)"
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": "<IPython.core.display.HTML object>",
+      "text/html": "<p>Extracted and compared input data for 10.1515_zfrs-1980-0103  (<a href=\"https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1515_zfrs-1980-0103.diff.html\" target=_blank>See diff</a>)"
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": "<IPython.core.display.HTML object>",
+      "text/html": "<p>Extracted and compared input data for 10.1515_zfrs-1980-0104  (<a href=\"https://experiments-boulanger-27b5c1c5c975b0350675064f0f85580e618945eef.pages.gwdg.de/convert-anystyle-data/diffs/10.1515_zfrs-1980-0104.diff.html\" target=_blank>See diff</a>)"
+     },
+     "metadata": {},
+     "output_type": "display_data"
     }
    ],
-   "execution_count": 2
+   "execution_count": 4
   },
   {
    "metadata": {},
-- 
GitLab