Back to index

moin  1.9.0~rc2
text_html_percent.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - a special text/html formatter used by the i18n system
00004 
00005     If texts translated by the i18n system are used on the left side of a
00006     % operator, any markup-generated % char (e.g. in links to non-ASCII page
00007     names (%XX%XX%XX)) needs to get escaped (%%XX%%XX%%XX).
00008 
00009     Everything else is as in the text/html formatter.
00010 
00011     @copyright: 2007 MoinMoin:ThomasWaldmann
00012     @license: GNU GPL, see COPYING for details.
00013 """
00014 
00015 from MoinMoin.formatter.text_html import Formatter as TextHtmlFormatter
00016 
00017 class Formatter(TextHtmlFormatter):
00018 
00019     def _open(self, tag, newline=False, attr=None, allowed_attrs=None, **kw):
00020         """ Escape % characters in tags, see also text_html.Formatter._open. """
00021         tagstr = TextHtmlFormatter._open(self, tag, newline, attr, allowed_attrs, **kw)
00022         return tagstr.replace('%', '%%')
00023 
00024     # override more methods, if needed