reportlab/platypus/paraparser.py
changeset 248 c103b7a55e79
parent 238 4c6d5db33635
child 250 a1bcf9c6c21e
equal deleted inserted replaced
247:5d531acd7059 248:c103b7a55e79
    30 # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    30 # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    31 # PERFORMANCE OF THIS SOFTWARE. 
    31 # PERFORMANCE OF THIS SOFTWARE. 
    32 #
    32 #
    33 ###############################################################################
    33 ###############################################################################
    34 #	$Log: paraparser.py,v $
    34 #	$Log: paraparser.py,v $
       
    35 #	Revision 1.19  2000/05/26 09:49:23  rgbecker
       
    36 #	Color fixes; thanks to J Alet
       
    37 #
    35 #	Revision 1.18  2000/05/20 15:36:42  andy_robinson
    38 #	Revision 1.18  2000/05/20 15:36:42  andy_robinson
    36 #	Removed 1.5.2-style getattr call
    39 #	Removed 1.5.2-style getattr call
    37 #
    40 #	
    38 #	Revision 1.17  2000/05/16 14:28:55  rgbecker
    41 #	Revision 1.17  2000/05/16 14:28:55  rgbecker
    39 #	Fixes/Changes to get testplatypus to work with new framework
    42 #	Fixes/Changes to get testplatypus to work with new framework
    40 #	
    43 #	
    41 #	Revision 1.16  2000/05/15 12:15:29  rgbecker
    44 #	Revision 1.16  2000/05/15 12:15:29  rgbecker
    42 #	CDATA handler added
    45 #	CDATA handler added
    48 #	Use reportlab.lib.xmllib
    51 #	Use reportlab.lib.xmllib
    49 #	
    52 #	
    50 #	Revision 1.13  2000/04/25 13:07:57  rgbecker
    53 #	Revision 1.13  2000/04/25 13:07:57  rgbecker
    51 #	Added license
    54 #	Added license
    52 #	
    55 #	
    53 __version__=''' $Id: paraparser.py,v 1.18 2000/05/20 15:36:42 andy_robinson Exp $ '''
    56 __version__=''' $Id: paraparser.py,v 1.19 2000/05/26 09:49:23 rgbecker Exp $ '''
    54 import string
    57 import string
    55 import re
    58 import re
    56 from types import TupleType
    59 from types import TupleType
    57 import sys
    60 import sys
    58 import os
    61 import os
    67 except ImportError:
    70 except ImportError:
    68 	import xmllib
    71 	import xmllib
    69 	_xmllib_newStyle = 0
    72 	_xmllib_newStyle = 0
    70 
    73 
    71 
    74 
    72 from reportlab.lib.colors import stringToColor, white, black, red, Color
    75 from reportlab.lib.colors import toColor, white, black, red, Color
    73 from reportlab.lib.fonts import tt2ps, ps2tt
    76 from reportlab.lib.fonts import tt2ps, ps2tt
    74 from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
    77 from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
    75 
    78 
    76 _re_para = re.compile('^\\s*<\\s*para(\\s+|>)')
    79 _re_para = re.compile('^\\s*<\\s*para(\\s+|>)')
    77 
    80 
   110 				'spaceb': ('spaceBefore', _num),
   113 				'spaceb': ('spaceBefore', _num),
   111 				'spacea': ('spaceAfter', _num),
   114 				'spacea': ('spaceAfter', _num),
   112 				'bfont': ('bulletFontName', None),
   115 				'bfont': ('bulletFontName', None),
   113 				'bfontsize': ('bulletFontIndent',_num),
   116 				'bfontsize': ('bulletFontIndent',_num),
   114 				'bindent': ('bulletFontIndent',_num),
   117 				'bindent': ('bulletFontIndent',_num),
   115 				'bcolor': ('bulletColor',stringToColor),
   118 				'bcolor': ('bulletColor',toColor),
   116 				'color':('textColor',stringToColor),
   119 				'color':('textColor',toColor),
   117 				'fg': ('textColor',stringToColor)}
   120 				'fg': ('textColor',toColor)}
   118 
   121 
   119 #things which are valid font attributes
   122 #things which are valid font attributes
   120 _fontAttrMap = {'size': ('fontSize', _num),
   123 _fontAttrMap = {'size': ('fontSize', _num),
   121 				'name': ('fontName', None),
   124 				'name': ('fontName', None),
   122 				'fg': 	('textColor', stringToColor),
   125 				'fg': 	('textColor', toColor),
   123 				'color':('textColor', stringToColor)}
   126 				'color':('textColor', toColor)}
   124 
   127 
   125 def _addAttributeNames(m):
   128 def _addAttributeNames(m):
   126 	K = m.keys()
   129 	K = m.keys()
   127 	for k in K:
   130 	for k in K:
   128 		n = string.lower(m[k][0])
   131 		n = string.lower(m[k][0])