Syndication feed fixed
This commit is contained in:
parent
dce4cba60f
commit
210f011a09
5
TODO
5
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)
|
||||
* link to find-subtags
|
||||
* post search engine
|
||||
|
@ -30,6 +30,7 @@
|
||||
<html xml:lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="ltru.css" />
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom syndication feed" href="/registries/lsr.atom" />
|
||||
<title>Language Tags: <xsl:value-of select="$title"/></title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -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
|
||||
|
@ -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("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
|
||||
print(ET.tostring(feed, encoding="UTF-8").decode())
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user