Switch from the rawHTML formatter function to text/url functions

They make the code shorter and more readable.
The escaping is done automatically in the functions.
They work with output formats other than HTML.
parent 75802814
......@@ -5,5 +5,5 @@ suites = set(['oldoldstable', 'oldstable', 'stable', 'testing', 'unstable', 'exp
def execute(macro, suite):
if suite in suites:
with open('/srv/wiki.debian.org/var/apt/%s.codename' % suite, 'r') as codename_file:
return macro.formatter.rawHTML(wikiutil.escape(codename_file.read().strip()))
return macro.formatter.text(codename_file.read().strip())
return ''
......@@ -5,5 +5,5 @@ suites = set(['oldoldstable', 'oldstable', 'stable', 'testing', 'unstable', 'exp
def execute(macro, suite):
if suite in suites:
with open('/srv/wiki.debian.org/var/apt/%s.date' % suite, 'r') as date_file:
return macro.formatter.rawHTML(wikiutil.escape(date_file.read().strip()))
return macro.formatter.text(date_file.read().strip())
return ''
......@@ -5,5 +5,5 @@ suites = set(['oldoldstable', 'oldstable', 'stable', 'testing', 'unstable', 'exp
def execute(macro, suite):
if suite in suites:
with open('/srv/wiki.debian.org/var/apt/%s.version' % suite, 'r') as version_file:
return macro.formatter.rawHTML(wikiutil.escape(version_file.read().strip()))
return macro.formatter.text(version_file.read().strip())
return ''
from MoinMoin import wikiutil
def execute(macro, id):
id = wikiutil.escape(id)
html = u'&lt;<a href="https://lists.debian.org/%(id)s">%(id)s</a>&gt;' % {'id': id}
return macro.formatter.rawHTML(html)
url = u'https://lists.debian.org/%(id)s' % {'id': id}
return \
macro.formatter.text('<') + \
macro.formatter.url(1, url) + \
macro.formatter.text(id) + \
macro.formatter.url(0) + \
macro.formatter.text('>')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment