def markmin_aux(m):
    return '{%s}' % markmin_escape(m.group('s'))
Example #2
0
import logging
import marshal
import copy_reg
from fileutils import abspath, listdir
import settings
from cfs import getcfs, cfs
from thread import allocate_lock
from html import XML, xmlescape
from contrib.markmin.markmin2html import render, markmin_escape
from string import maketrans

__all__ = ['translator', 'findT', 'update_all_languages']

# used as default filter in translator.M()
markmin = lambda s: render( regex_param.sub(
                       lambda m: '{' + markmin_escape(m.group('s')) + '}',
                          s ), sep='br', autolinks=None, id_prefix='' )

NUMBERS = (int,long,float)

# pattern to find T(blah blah blah) expressions
PY_STRING_LITERAL_RE = r'(?<=[^\w]T\()(?P<name>'\
     + r"[uU]?[rR]?(?:'''(?:[^']|'{1,2}(?!'))*''')|"\
     + r"(?:'(?:[^'\\]|\\.)*')|" + r'(?:"""(?:[^"]|"{1,2}(?!"))*""")|'\
     + r'(?:"(?:[^"\\]|\\.)*"))'

regex_translate = re.compile(PY_STRING_LITERAL_RE, re.DOTALL)
regex_param=re.compile(r'{(?P<s>.+?)}')

# pattern for a valid accept_language
Example #3
0
 def markmin_aux(m):
     return '{%s}' % markmin_escape(m.group('s'))
Example #4
0
 def markmin_aux(m):
     return "{%s}" % markmin_escape(m.group("s"))
Example #5
0
import logging
import marshal
import copy_reg
from fileutils import abspath, listdir
import settings
from cfs import getcfs, cfs
from thread import allocate_lock
from html import XML, xmlescape
from contrib.markmin.markmin2html import render, markmin_escape
from string import maketrans

__all__ = ['translator', 'findT', 'update_all_languages']

# used as default filter in translator.M()
markmin = lambda s: render(regex_param.sub(
    lambda m: '{' + markmin_escape(m.group('s')) + '}', s),
                           sep='br',
                           autolinks=None,
                           id_prefix='')

NUMBERS = (int, long, float)

# pattern to find T(blah blah blah) expressions
PY_STRING_LITERAL_RE = r'(?<=[^\w]T\()(?P<name>'\
     + r"[uU]?[rR]?(?:'''(?:[^']|'{1,2}(?!'))*''')|"\
     + r"(?:'(?:[^'\\]|\\.)*')|" + r'(?:"""(?:[^"]|"{1,2}(?!"))*""")|'\
     + r'(?:"(?:[^"\\]|\\.)*"))'

regex_translate = re.compile(PY_STRING_LITERAL_RE, re.DOTALL)
regex_param = re.compile(r'{(?P<s>.+?)}')