Implemented <a> tag with support to href attribute.

This commit is contained in:
Christopher Ramírez 2013-09-12 18:24:40 -06:00
parent b8c5232dea
commit 99be02ad63
2 changed files with 13 additions and 3 deletions

View file

@ -51,8 +51,7 @@ transform_map = {
'a': {
'replace_with': 'text:a',
'attributes': {
'xlink:type': 'simple',
'xlink:href': ''
'xlink:type': 'simple'
}
},

View file

@ -327,11 +327,22 @@ class Render(object):
for child_node in html_node.childNodes:
odt_node.appendChild(child_node.cloneNode(True))
# Add style attributes defined in transform_map
# Add style-attributes defined in transform_map
if 'style_attributes' in transform_map[tag]:
for k, v in transform_map[tag]['style_attributes'].iteritems():
odt_node.setAttribute('text:%s' % k, v)
# Add defined attributes
if 'attributes' in transform_map[tag]:
for k, v in transform_map[tag]['attributes'].iteritems():
odt_node.setAttribute(k, v)
# copy original href attribute in <a> tag
if tag == 'a':
if html_node.hasAttribute('href'):
odt_node.setAttribute('xlink:href',
html_node.getAttribute('href'))
# Does the node need to create an style?
if 'style' in transform_map[tag]:
name = transform_map[tag]['style']['name']