view MoinMoin/formatter/text_html_percent.py @ 6111:1fdd537e9d83

SubProcess: reimplement exec_cmd subclassing Popen and overriding some methods isn't pretty. the code we have was written for py 2.4 or so and the py 2.7 Popen looked quite different. this way with the timer should be less problematic.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 06 Sep 2016 04:39:28 +0200
parents db3edaef0ba1
children
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - a special text/html formatter used by the i18n system

    If texts translated by the i18n system are used on the left side of a
    % operator, any markup-generated % char (e.g. in links to non-ASCII page
    names (%XX%XX%XX)) needs to get escaped (%%XX%%XX%%XX).

    Everything else is as in the text/html formatter.

    @copyright: 2007 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.formatter.text_html import Formatter as TextHtmlFormatter

class Formatter(TextHtmlFormatter):

    def _open(self, tag, newline=False, attr=None, allowed_attrs=None, **kw):
        """ Escape % characters in tags, see also text_html.Formatter._open. """
        tagstr = TextHtmlFormatter._open(self, tag, newline, attr, allowed_attrs, **kw)
        return tagstr.replace('%', '%%')

    # override more methods, if needed