Skip to content

Commit

Permalink
fixed tags not showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
calnfynn committed Oct 11, 2024
1 parent 65edd5d commit 08450ea
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 100 deletions.
97 changes: 51 additions & 46 deletions cosite001.ipynb

Large diffs are not rendered by default.

26 changes: 10 additions & 16 deletions cosite002.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 166,
"execution_count": 168,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -49,9 +49,7 @@
" results = data.get(\"query\", {}).get(\"results\", {})\n",
" \n",
" for item_id, item_data in results.items():\n",
" #print(item_data)\n",
" \n",
" \n",
" \n",
" txt_fields = [\"term\",\"vocabulary\",\"tags\",\"status\"]\n",
" item = {\n",
" \"id\": item_id\n",
Expand All @@ -63,12 +61,6 @@
" item[fieldname] = item_data[\"printouts\"].get(fieldname, [None])[0]\n",
" else:\n",
" item[fieldname] = \"\"\n",
" \n",
"\n",
" #else:\n",
" # item[fieldname] = \"\"\n",
" # item[f\"{fieldname}_links\"] = \"\"\n",
" \n",
"\n",
" if item[\"status\"]:\n",
" translate = {\n",
Expand All @@ -82,20 +74,22 @@
" item[\"status\"] = translate[t]\n",
" items.append(item)\n",
" \n",
" items_flipped = flip_tags_dictionary(items)\n",
"\n",
" return items_flipped\n",
"\n",
" items_inverted = flip_tags_dictionary(items)\n",
"\n",
" return items_inverted\n",
"\n",
"\n",
"#custom class for inverting keys + values of a dict\n",
"#automatically puts values with the same key into a list\n",
"class Dictlist(dict):\n",
" def __setitem__(self, key, value):\n",
" if key not in self:\n",
" super(Dictlist, self).__setitem__(key, [])\n",
" self[key].append(value)\n",
"\n",
"\n",
"#inverts the items dictionary\n",
"#from {term: tags} to {tag: terms}\n",
"def flip_tags_dictionary(items):\n",
"\n",
" items_tags = Dictlist()\n",
Expand All @@ -112,6 +106,7 @@
" \n",
" return items_tags\n",
"\n",
"#creates link to glossary term\n",
"def term_to_link(term):\n",
" link = f\"[{term.replace('/*in', ':in').replace('*in', ':in')}](https://tibhannover.github.io/co-site-glossar/cosite001.html#{term.lower().replace(' ', '-').replace('/*', '').replace('*', '')})\"\n",
" return link\n",
Expand All @@ -120,7 +115,6 @@
" # Sort the keys using locale.strxfrm\n",
" sorted_dict = sorted(items.keys(), key=locale.strxfrm)\n",
" # Return a list of tuples (key, values) in sorted order\n",
" # Print the sorted items\n",
" html = ''\n",
" for key in sorted_dict: \n",
" html += f''' \n",
Expand Down Expand Up @@ -198,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": 167,
"execution_count": 169,
"metadata": {},
"outputs": [
{
Expand Down
Binary file modified docs/Co-Site-Glossar.docx
Binary file not shown.
Binary file modified docs/Co-Site-Glossar.epub
Binary file not shown.
Binary file modified docs/Co-Site-Glossar.pdf
Binary file not shown.
74 changes: 37 additions & 37 deletions docs/cosite001.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

0 comments on commit 08450ea

Please sign in to comment.