diff --git a/TODO b/TODO index 39226ec..fbb0555 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ * HTTPS for all links (grep http:// *.xml) * lsr.atom (requires some porting) -* Email -* link to find-subtags (search engine first?) -* HTML output (more beautiful, detailed, and fix SIL links) \ No newline at end of file +* link to find-subtags +* post search engine diff --git a/page.xslt b/page.xslt index e729350..5f3be66 100644 --- a/page.xslt +++ b/page.xslt @@ -30,6 +30,7 @@ + Language Tags: <xsl:value-of select="$title"/> diff --git a/registries/copy-and-convert.sh b/registries/copy-and-convert.sh index 30aed0a..762cd76 100755 --- a/registries/copy-and-convert.sh +++ b/registries/copy-and-convert.sh @@ -79,8 +79,7 @@ if [ -e ${LTR_LOCAL}.TMP ]; then mv lsr-sqlite-ncr.sql lsr-sqlite.sql ${CONVERT_HTML} ${FILL_DATABASE} - # Needs to be ported away from.DateTime - #./lsr2atom.py > lsr.atom + ./lsr2atom.py > lsr.atom version=`head -n 1 ${LTR_LOCAL} | awk '{print $2}'` echo $version > ${LTR_LOCAL}-version exit 0 diff --git a/registries/lsr2atom.py b/registries/lsr2atom.py index 1e85365..7663820 100755 --- a/registries/lsr2atom.py +++ b/registries/lsr2atom.py @@ -4,19 +4,15 @@ __version__ = "BETA" domain = "langtag.net" tag_prefix = "tag:%s,2007-05:LSR" % domain +# Standard library import sys import urllib.request, urllib.parse, urllib.error +# Now a standard part of Python >= 2.5 +import xml.etree.ElementTree as ET +import datetime + +# External libraries import psycopg2 -# ElementTree is painful, with all its renamings :-( -try: - import cElementTree as ET -except ImportError: - try: - import ElementTree as ET - except ImportError: - # Now a standard part of Python >= 2.5 - import xml.etree.ElementTree as ET -import mx.DateTime as DateTime # TODO move to another package max = 10 @@ -73,7 +69,7 @@ feed.attrib["xmlns"] = "http://www.w3.org/2005/Atom" title = ET.SubElement(feed, "title") title.text = "Language Tag Registry syndication feed" updated = ET.SubElement(feed, "updated") -updated.text = DateTime.now().strftime("%Y-%m-%dT%H:%M:00Z") +updated.text = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:00Z") link_html = ET.SubElement(feed, "link") link_html.attrib["rel"] = "alternate" link_html.attrib["type"] = "text/html" @@ -100,4 +96,5 @@ process_type(feed, "region") process_type(feed, "extlang") cursor.close() connection.close() -print(ET.tostring(feed, encoding="UTF-8")) +print("") +print(ET.tostring(feed, encoding="UTF-8").decode()) diff --git a/search.py b/search.py index 2141e2c..d4833a1 100755 --- a/search.py +++ b/search.py @@ -10,6 +10,7 @@ import psycopg2 # HTML templates http://www.yattag.org/ from yattag import Doc +# TODO include the standard elements such as CSS and footer REDIRECTION_URL = "https://www.langtag.net/registries/registry-html" # For # local testing: Firefox apparently does not accept a redirect to a