Short description

  1. the macro "include" use a div tag around included page
  2. the macro create an HTML id based on wiki name
  3. the macro use wikiutil.quoteWikinameFS() function to get a name, without non-ascii character
  4. the function quoteWikinameFS add parenthesis ( ) around non-ascii character
  5. parenthesis (, ) are wrong for HTML id attribute character (non-standard in HTML or XML)

Solution Replace ( or ) by underscore _

--- Include.py.old      2006-05-14 10:31:58.000000000 -0400
+++ Include.py  2006-05-14 10:32:24.000000000 -0400
@@ -215,7 +215,7 @@
         strfile = StringIO.StringIO()
         request.redirect(strfile)
         try:
-            cid = request.makeUniqueID("Include_%s" % wikiutil.quoteWikinameFS(inc_page.page_name))
+            cid = request.makeUniqueID("Include_%s" % wikiutil.quoteWikinameID(inc_page.page_name))
             inc_page.send_page(request, content_only=1, content_id=cid)
             result.append(strfile.getvalue())
         finally:

and

--- wikiutil.py.old     2006-05-14 10:42:06.000000000 -0400
+++ wikiutil.py 2006-05-14 10:33:31.000000000 -0400
@@ -207,6 +207,14 @@
     quoted.append(filename[location:])
     return ''.join(quoted)

+# 2006-05-14 10:39 : YM | ID can't have ( or )
+def quoteWikinameID(wikiname, charset=config.charset):
+    wikiname = quoteWikinameFS(wikiname, charset)
+    wikiname = wikiname.replace('(', '_')
+    wikiname = wikiname.replace(')', '_')
+    return wikiname
+
+
 # FIXME: better name would be unquoteFilename
 def unquoteWikiname(filename, charsets=[config.charset]):
     """ Return Unicode WikiName from quoted file name.

Discussion

Did you mean to file this as a bug rather than a feature request? Anyway, according to WC3 HTML standard:

so any quoting that occurs should do so according to those rules. For example, an ID can not legally start with a digit either. Other restrictions are also likely too, especially as HTML standards are revised, such as trimming of spaces. See http://www.w3.org/TR/xml-id/ for some more information on how XML is heading. Another potential problem as well is that with a single HTML page id values can not occur more than once. It is though sometimes useful to include the same page twice....each inclusion should get a new id. -- -- DeronMeranda 2006-05-17 22:14:41


CategoryFeatureImplemented

MoinMoin: FeatureRequests/IncludeMacroHtmlIdError (last edited 2008-03-18 01:16:51 by JohannesBerg)