diff --git a/bin/ampersand.sh b/bin/ampersand.sh deleted file mode 100755 index fd54289..0000000 --- a/bin/ampersand.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o xtrace - -# ampersand -perl -p -i -e 's/ & / & /g' giggity.xml -perl -p -i -e 's/next&id/next&id/g' giggity.xml - -xmllint giggity.xml --noout diff --git a/bin/check-urlids.sh b/bin/check-urlids.sh index 03bacfd..c120257 100755 --- a/bin/check-urlids.sh +++ b/bin/check-urlids.sh @@ -2,6 +2,8 @@ # Checks all URL IDs (urlid field) in talks.json for special characters # Whitelist: a-z A-Z and "-" (but not "--") +# TODO: Remove this script and figure out a proper URL ID solution for automatic +# imports from Pretalx. echo "Potentially problematic URL IDs:" grep urlid talks.json | sed -E 's/ +"urlid": "(.*)",/\1/' | \ diff --git a/bin/json2giggity.py b/bin/json2giggity.py deleted file mode 100755 index bc8cc64..0000000 --- a/bin/json2giggity.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python3 - -import json -import os -import re -import subprocess -import sys -import io - -def parse_weblink(weblinks): - link_list = [] - for val in weblinks.values(): - title = val['title'] - url = val['url'] - if not title: - title = url - link_list.append('- ' + title + '') - return "\n".join(link_list) - - -def giggitytimes(minutes): - hour = minutes // 60 - minutes = minutes % 60 - return "%02d:%02d" % (hour, minutes) - -def transform_linefeeds(string): - # Remove leading and trailing "\n" (optional normalization): - string = re.sub(r'^\n+|\n+$', '', string) - # Replace " *\n" with "
\n" but keep "\n\n": - # TODO: This also causes some issues (see: "git show 723f4b3"), so let's - # skip this for now: - #string = re.sub(r'([^(\n)]) *\n([^(\n)])', r'\1<br/>\n\2', string) - # Note: We don't replace "\n\n" as this already creates a new paragraph. - return string - -with io.open('talks.json', 'r', encoding='utf8') as talksfile: - data = json.load(talksfile) - -with io.open('giggity.xml', 'w', encoding='utf8') as gigxml: - gigxml.write('\n\n\nTübix 2023\nTübingen\n2023-07-01\n2023-07-01\n1\n1.20230530.1112\n00:30\n\n\n') - -# TODO Teleskop, Bienen, LPIC, generic helper slots - for roomsection in ['V1', 'V2', 'V3', 'V4', 'W1', 'W2']: - gigxml.write('\n') - for talk in data: - if talk["room"] == roomsection: - gigxml.write('\n') - gigxml.write('' + talk['timebegin'] + '\n') - gigxml.write('' + giggitytimes(talk['duration']) + '\n') - gigxml.write('' + talk['room'] + '\n') - gigxml.write('' + talk['titel'] + '\n') - gigxml.write('' + transform_linefeeds(talk['inhalt']) + '\n') - if talk['aboutme']: - gigxml.write('\n#### Über mich\n\n') - gigxml.write(transform_linefeeds(talk['aboutme']) + '\n') - if talk['vorwissen']: - gigxml.write('\n#### Vorwissen\n\n') - gigxml.write(transform_linefeeds(talk['vorwissen']) + '\n') - gigxml.write('\n') - gigxml.write('' + talk['name'] + '\n') - if talk["weblinks"]: - gigxml.write("\n") - gigxml.write(parse_weblink(talk["weblinks"])) - gigxml.write("\n\n") - gigxml.write('\n\n') - gigxml.write('\n') - gigxml.write('\n') - -# Try to automatically run ampersand.sh: -AMPERSAND_FILE = "../bin/ampersand.sh" -if os.path.isfile(AMPERSAND_FILE): - try: - subprocess.run(["nix", "--version"], stdout=subprocess.DEVNULL) - # Nix is available: - os.system("nix-shell -p libxml2 --run " + AMPERSAND_FILE) - except FileNotFoundError: - os.system(AMPERSAND_FILE) diff --git a/bin/update.sh b/bin/update.sh index b445a2e..d751bd6 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -8,6 +8,5 @@ if [[ ! -d ../bin ]]; then fi ../bin/json2md.py -../bin/json2giggity.py ../bin/check-urlids.sh