File: paraparser.py

package info (click to toggle)
python-wordaxe 0.3.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,228 kB
  • ctags: 786
  • sloc: python: 9,814; makefile: 5
file content (31 lines) | stat: -rw-r--r-- 926 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/paraparser.py
__version__=''' $Id: paraparser.py 2853 2006-05-10 12:56:39Z rgbecker $ '''

from reportlab.platypus.paraparser import *

_orig_parser = ParaParser

class ParaParser(_orig_parser):

    def setEncoding(self, enc):
        self._enc = enc
        
    def parse(self, text, style):
        
        # HVB 20070201
        if not hasattr(self, "_enc"):
            self._enc = 'cp1252' #our legacy default
        enc = self._enc
        
        return _orig_parser.parse(self, text, style)

class NoBrParaParser(ParaParser):
    """ParaParser with support for 'nobr' Tags."""

    def start_nobr( self, attributes ):
        self._push(nobr=True)

    def end_nobr( self ):
        self._pop(nobr=True)