added functionality to handle comment Node and support for font tag and its attributes (ref:nch)

bzr revid: hda@hda-20090525065901-7943qtd1q9x1u9vb
This commit is contained in:
husen daudi 2009-05-25 12:29:01 +05:30
commit 47d9e9dda3
2 changed files with 16 additions and 3 deletions

View File

@ -12,6 +12,8 @@ class report(object):
_regex2 = re.compile("\[\[(.*?)(removeParentNode\(\s*(?:['\"](.*?)['\"])\s*\))(.*?)\]\]")
_regex3 = re.compile("\[\[\s*(.*?setTag\(\s*['\"](.*?)['\"]\s*,\s*['\"].*?['\"]\s*(?:,.*?)?\).*?)\s*\]\]")
for node in root_node:
if node.tag == etree.Comment:
continue
if node.text:
def _sub3(txt):
n = node

View File

@ -446,9 +446,14 @@ class _rml_flowable(object):
def _textual(self, node):
rc1 = utils._process_text(self, node.text or '')
for n in utils._child_get(node,self):
rc1 += '<'+n.tag+'>'
rc1 += self._textual(n)
rc1 += '</'+n.tag+'>'
txt_n = copy.deepcopy(n)
for key in txt_n.attrib.keys():
if key in ('rml_except', 'rml_loop', 'rml_tag'):
del txt_n.attrib[key]
if not self._textual(n).isspace():
txt_n.text = self._textual(n)
txt_n.tail = ''
rc1 += etree.tostring(txt_n)
rc1 += utils._process_text(self, node.tail or '')
return rc1
@ -490,6 +495,9 @@ class _rml_flowable(object):
flow = []
for n in utils._child_get(td, self):
if n.tag == etree.Comment:
n.text = ''
continue
fl = self._flowable(n, extra_style=paraStyle)
if isinstance(fl,list):
flow += fl
@ -674,6 +682,9 @@ class _rml_flowable(object):
def process_story(node_story):
sub_story = []
for node in utils._child_get(node_story, self):
if node.tag == etree.Comment:
node.text = ''
continue
flow = self._flowable(node)
if flow:
if isinstance(flow,list):