Fix an issue with previous markdown fix.
Previous fix was only keeping the last text node found in a list element.
This commit is contained in:
parent
e17d03ecae
commit
5f30fc93bf
1 changed files with 13 additions and 12 deletions
23
secretary.py
23
secretary.py
|
|
@ -719,19 +719,20 @@ class Renderer(object):
|
||||||
|
|
||||||
# Transfer child nodes
|
# Transfer child nodes
|
||||||
if html_node.hasChildNodes():
|
if html_node.hasChildNodes():
|
||||||
for child_node in html_node.childNodes:
|
# We can't directly insert text into a text:list-item element.
|
||||||
# We can't directly insert text into a text:list-item
|
# The content of the item most be wrapped inside a container
|
||||||
# element. The content of the item most be wrapped inside
|
# like text:p. When there's not a double linebreak separating
|
||||||
# a container like text:p. When there's not a double linebreak
|
# list elements, markdown2 creates <li> elements without wraping
|
||||||
# separating list elements, markdown2 creates <li> elements without
|
# their contents inside a container. Here we automatically create
|
||||||
# wraping their contents inside a container. Here we automatically
|
# the container if one was not created by markdown2.
|
||||||
# create the container if one was not created by markdown2.
|
if (tag=='li' and html_node.childNodes[0].localName <> 'p'):
|
||||||
if (tag == 'li' and (not child_node.localName)):
|
|
||||||
container = xml_object.createElement('text:p')
|
container = xml_object.createElement('text:p')
|
||||||
container.appendChild(child_node.cloneNode(True))
|
odt_node.appendChild(container)
|
||||||
child_node = container
|
else:
|
||||||
|
container = odt_node
|
||||||
|
|
||||||
odt_node.appendChild(child_node.cloneNode(True))
|
for child_node in html_node.childNodes:
|
||||||
|
container.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]:
|
if 'style_attributes' in transform_map[tag]:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue