W3C home > Mailing lists > Public > www-archive@w3.org > February 2004

Patch to make MoinMoin 1.1 (more) HTML Valid

From: Dominique HazaŽl-Massieux <dom@w3.org>
Date: Mon, 16 Feb 2004 13:03:58 +0100
To: www-archive@w3.org
Message-Id: <1076933038.30689.54.camel@stratustier>
This patch applied to MoinMoin version 1.178 helps make the output of
this Wiki more valid, by adding a doctype, removing inexistant
attributes, adding a default alt attributes for images, using properly
escaped ampersand in URIs, and setting html tag in the right orders.

It doesn't guarantee a perfect validity since there are still some
combinations of formatting that can make a page invalid, but that's
still a first step.

Hope this helps,

Dom
-- 
Dominique HazaŽl-Massieux - http://www.w3.org/People/Dom/
W3C/ERCIM
mailto:dom@w3.org


--- ./MoinMoin/formatter/text_html.py	2003-11-09 22:00:56.000000000 +0100
+++ ./MoinMoin/formatter/text_html.py.new	2004-02-16 12:32:18.000000000 +0100
@@ -80,7 +80,7 @@
         target = kw.get('target', None)
 
         if not pretty and wikiutil.isPicture(url):
-            return '<img src="%s" border="0">' % (url,)
+            return '<img src="%s" border="0" alt="%s">' % (url,text)
 
         if text is None: text = url
         str = ''
--- ./MoinMoin/wikiaction.py	2003-11-09 22:00:52.000000000 +0100
+++ ./MoinMoin/wikiaction.py.new	2004-02-16 12:01:25.000000000 +0100
@@ -76,7 +76,7 @@
             hiddenhits += 1
             continue
         print '<LI>' + Page(page_name).link_to(querystr=
-            'action=highlight&value=%s' % urllib.quote_plus(needle))
+            'action=highlight&amp;value=%s' % urllib.quote_plus(needle))
         print ' . . . . ' + `count`
         print (_(' match'), _(' matches'))[count != 1]
         if context:
@@ -258,8 +258,8 @@
 
     # options
     if not ignorews:
-        qstr = 'action=diff&ignorews=1'
-        if diff_date: qstr = '%s&date=%s' % (qstr, diff_date)
+        qstr = 'action=diff&amp;ignorews=1'
+        if diff_date: qstr = '%s&amp;date=%s' % (qstr, diff_date)
         print Page(pagename).link_to(
             text=_('Ignore changes in the amount of whitespace'),
             querystr=qstr), "<p>"
@@ -372,14 +372,14 @@
             if file != currentpage:
                 actions = '%s&nbsp;%s' % (actions, page.link_to(
                     text=_('view'),
-                    querystr='action=recall&date=%d' % mtime))
+                    querystr='action=recall&amp;date=%d' % mtime))
                 if may_revert:
                     actions = '%s&nbsp;%s' % (actions, page.link_to(
                         text=_('revert'),
-                        querystr='action=revert&date=%d' % mtime))
+                        querystr='action=revert&amp;date=%d' % mtime))
                 actions = '%s&nbsp;%s' % (actions, page.link_to(
                     text=_('diff'),
-                    querystr='action=diff&date=%d' % mtime))
+                    querystr='action=diff&amp;date=%d' % mtime))
 
             comment = log.comment
             if log.action.find('/REVERT') != -1:
@@ -465,9 +465,9 @@
             print "<p>"
 
         # links to detailed info
-        historylink =  wikiutil.link_tag('%s?action=info&history=1' % qpagename,
+        historylink =  wikiutil.link_tag('%s?action=info&amp;history=1' % qpagename,
             _('Show "%(title)s"') % {'title': _('Revision History')})
-        hitcountlink = wikiutil.link_tag('%s?action=info&hitcounts=1' % qpagename,
+        hitcountlink = wikiutil.link_tag('%s?action=info&amp;hitcounts=1' % qpagename,
             _('Show chart "%(title)s"') % {'title': _('Page hits and edits')})
         request.write("<h2>%s</h2>\n<p>%s<br />%s<br /></p>" % (
             _('Detailed Information'), historylink, hitcountlink))
--- ./MoinMoin/wikimacro.py	2004-02-16 12:01:54.000000000 +0100
+++ ./MoinMoin/wikimacro.py.new	2004-02-16 12:02:05.000000000 +0100
@@ -223,7 +223,7 @@
         index = index + _make_index_key(index_letters, """<br>
 <a href="%s?allpages=%d">%s</a>&nbsp;|
 <a href="%s?action=titleindex">%s</a>&nbsp;|
-<a href="%s?action=titleindex&mimetype=text/xml">%s</a>
+<a href="%s?action=titleindex&amp;mimetype=text/xml">%s</a>
 """ % (qpagename, not allpages, (self._('Include system pages'), self._('Exclude system pages'))[allpages],
        qpagename, self._('Plain title index'),
        qpagename, self._('XML title index')) )
--- ./MoinMoin/config.py	2004-02-16 12:10:11.000000000 +0100
+++ ./MoinMoin/config.py.new	2004-02-16 12:10:20.000000000 +0100
@@ -122,7 +122,7 @@
 <a href="%(scriptname)s/%(pagename)s?action=info" title="Info"><img src="%(url)s/img/moin-info.gif" alt="Info" width="12" height="11" border="0" hspace="2" align="right"></a>
 <a href="%(scriptname)s/%(pagename)s?action=edit" title="Edit"><img src="%(url)s/img/moin-edit.gif" alt="Edit" width="12" height="12" border="0" hspace="2" align="right"></a>
 <a href="%(scriptname)s/%(pagename)s?action=subscribe" title="Subscribe"><img src="%(url)s/img/moin-email.gif" alt="Subscribe" width="14" height="10" border="0" hspace="2" vspace="1" align="right"></a>
-<a href="%(scriptname)s/%(pagename)s?action=format&mimetype=text/xml" title="XML"><img src="%(url)s/img/moin-xml.gif" alt="XML" width="20" height="13" border="0" hspace="2" align="right"></a>
+<a href="%(scriptname)s/%(pagename)s?action=format&amp;mimetype=text/xml" title="XML"><img src="%(url)s/img/moin-xml.gif" alt="XML" width="20" height="13" border="0" hspace="2" align="right"></a>
 <a href="%(scriptname)s/%(pagename)s?action=print" title="Print"><img src="%(url)s/img/moin-print.gif" alt="Print" width="16" height="14" border="0" hspace="2" align="right"></a>
 <a href="%(scriptname)s/%(pagename)s" title="View"><img src="%(url)s/img/moin-show.gif" alt="View" width="12" height="13" border="0" hspace="2" align="right"></a>
 ''',
--- ./MoinMoin/wikiutil.py	2004-02-16 12:34:43.000000000 +0100
+++ ./MoinMoin/wikiutil.py.new	2004-02-16 12:42:17.000000000 +0100
@@ -618,7 +618,7 @@
     user_head = config.html_head
     if os.environ.get('QUERY_STRING', '') or os.environ.get('REQUEST_METHOD', '') == 'POST':
         user_head = user_head + config.html_head_queries
-    request.write("<html><head>%s<title>%s - %s</title>%s" % (
+    request.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>%s<title>%s - %s</title>%s""" % (
         user_head, cgi.escape(text),
         cgi.escape(config.html_pagetitle or config.sitename),
         keywords.get('html_head', ''),
@@ -846,8 +846,8 @@
     emit_custom_html(request, config.page_footer1)
 
     print """
-<table lang="%s" dir="%s" border="0" cellspacing="0" cellpadding="0" class="footer" width="100%%">
 <form method="POST" action="%s/%s">
+<table lang="%s" dir="%s" border="0" cellspacing="0" cellpadding="0" class="footer" width="100%%">
 <tr><td>
 <input type="hidden" name="action" value="inlinesearch">
 <input type="hidden" name="context" value="40">
@@ -879,7 +879,7 @@
         ' size="15" maxlength="50">'
         '<input type="image" src="%s/img/moin-search.gif"'
         ' name="button_%%(type)s" '
-        ' alt="[?]" hspace="3" width="12" height="12" border="0">'
+        ' alt="Search" class="search_button">'
         ) % config.url_prefix
     titlesearch = searchfield % {
         'type': 'title',
@@ -920,8 +920,9 @@
 
     print """
 </td></tr>
-</form>
 </table>
+</form>
+
 """
 
     emit_custom_html(request, config.page_footer2)
--- ./MoinMoin/Page.py	2003-11-09 22:00:45.000000000 +0100
+++ ./MoinMoin/Page.py.new	2004-02-16 12:15:26.000000000 +0100
@@ -407,7 +407,7 @@
                 page_needle = self.page_name
                 if config.allow_subpages and string.count(page_needle, '/'):
                     page_needle = '/' + string.split(page_needle, '/')[-1]
-                link = '%s/%s?action=fullsearch&value=%s&literal=1&case=1&context=40' % (
+                link = '%s/%s?action=fullsearch&amp;value=%s&amp;literal=1&camp;ase=1&amp;context=40' % (
                     webapi.getScriptname(),
                     wikiutil.quoteWikiname(self.page_name),
                     urllib.quote_plus(page_needle, ''))
@@ -528,7 +528,7 @@
             print self.formatter.bullet_list(1)
             for page in templates:
                 print self.formatter.listitem(1)
-                print wikiutil.link_tag("%s?action=edit&template=%s" % (
+                print wikiutil.link_tag("%s?action=edit&amp;template=%s" % (
                         wikiutil.quoteWikiname(self.page_name),
                         wikiutil.quoteWikiname(page)),
                     page)
--- ./wiki/htdocs/css/moinmoin.css	2003-04-01 00:26:29.000000000 +0200
+++ ./wiki/htdocs/css/moinmoin.css.new	2004-02-16 12:45:18.000000000 +0100
@@ -105,3 +105,11 @@
     border-width: thin;
     width: 100%;
 }
+
+input.search_button {
+  width:12px;
+  height:12px;
+  margin-left:3px;
+  margin-right:3px;
+  border:none;
+}
\ Pas de fin de ligne à la fin du fichier.

Received on Monday, 16 February 2004 07:05:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:39 GMT