~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/formatter/text_html_percent.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: iso-8859-1 -*-
 
2
"""
 
3
    MoinMoin - a special text/html formatter used by the i18n system
 
4
 
 
5
    If texts translated by the i18n system are used on the left side of a
 
6
    % operator, any markup-generated % char (e.g. in links to non-ASCII page
 
7
    names (%XX%XX%XX)) needs to get escaped (%%XX%%XX%%XX).
 
8
 
 
9
    Everything else is as in the text/html formatter.
 
10
 
 
11
    @copyright: 2007 MoinMoin:ThomasWaldmann
 
12
    @license: GNU GPL, see COPYING for details.
 
13
"""
 
14
 
 
15
from MoinMoin.formatter.text_html import Formatter as TextHtmlFormatter
 
16
 
 
17
class Formatter(TextHtmlFormatter):
 
18
 
 
19
    def _open(self, tag, newline=False, attr=None, allowed_attrs=None, **kw):
 
20
        """ Escape % signs in tags, see also text_html.Formatter._open. """
 
21
        tagstr = TextHtmlFormatter._open(self, tag, newline, attr, allowed_attrs, **kw)
 
22
        return tagstr.replace('%', '%%')
 
23
 
 
24
    # override more methods, if needed