REPORT: add replace tag for custom header
bzr revid: ced-36461cec698fe6f194b90a390cf9ff8bd70ff98e
This commit is contained in:
parent
bb33521eb1
commit
aef0fff63a
|
@ -105,10 +105,12 @@ class rml_parse(object):
|
||||||
self._node = None
|
self._node = None
|
||||||
# self.already = {}
|
# self.already = {}
|
||||||
|
|
||||||
def setTag(self, oldtag, newtag):
|
def setTag(self, oldtag, newtag, attrs={}):
|
||||||
node = self._find_parent(self._node, [oldtag])
|
node = self._find_parent(self._node, [oldtag])
|
||||||
if node:
|
if node:
|
||||||
node.tagName = newtag
|
node.tagName = newtag
|
||||||
|
for key, val in attrs.items():
|
||||||
|
node.setAttribute(key, val)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def removeParentNode(self, tag):
|
def removeParentNode(self, tag):
|
||||||
|
@ -264,7 +266,10 @@ class rml_parse(object):
|
||||||
found = self._find_node(node, tag.localName)
|
found = self._find_node(node, tag.localName)
|
||||||
# rml_frames = found.getElementsByTagName('frame')
|
# rml_frames = found.getElementsByTagName('frame')
|
||||||
if found:
|
if found:
|
||||||
found.parentNode.replaceChild(tag, found)
|
if tag.hasAttribute('position') and (tag.getAttribute('position')=='inside'):
|
||||||
|
found.appendChild(tag)
|
||||||
|
else:
|
||||||
|
found.parentNode.replaceChild(tag, found)
|
||||||
# for frame in rml_frames:
|
# for frame in rml_frames:
|
||||||
# tag.appendChild(frame)
|
# tag.appendChild(frame)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue