Adding H[1-4] tags to replacement_map.
This commit is contained in:
parent
605e980c21
commit
26e5bae9be
1 changed files with 40 additions and 6 deletions
46
secretary.py
46
secretary.py
|
|
@ -267,8 +267,8 @@ def markdown_filter(markdown_text):
|
||||||
'style-name': 'markdown_bold'
|
'style-name': 'markdown_bold'
|
||||||
},
|
},
|
||||||
|
|
||||||
'style': {
|
'append_style': {
|
||||||
'create': 'markdown_bold',
|
'name': 'markdown_bold',
|
||||||
'properties': {
|
'properties': {
|
||||||
'fo:font-weight': 'bold',
|
'fo:font-weight': 'bold',
|
||||||
'style:font-weight-asian': 'bold',
|
'style:font-weight-asian': 'bold',
|
||||||
|
|
@ -283,15 +283,45 @@ def markdown_filter(markdown_text):
|
||||||
'style-name': 'markdown_italic'
|
'style-name': 'markdown_italic'
|
||||||
},
|
},
|
||||||
|
|
||||||
'style': {
|
'append_style': {
|
||||||
'create': 'markdown_italic',
|
'name': 'markdown_italic',
|
||||||
'properties': {
|
'properties': {
|
||||||
'fo:font-style': 'italic',
|
'fo:font-style': 'italic',
|
||||||
'style:font-style-asian': 'italic',
|
'style:font-style-asian': 'italic',
|
||||||
'style:font-style-complex': 'italic'
|
'style:font-style-complex': 'italic'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
# Heading Styles (Use styles defined in the document)
|
||||||
|
'h1': {
|
||||||
|
'replace_with': 'text:p',
|
||||||
|
'attributes': {
|
||||||
|
'style-name': 'Heading_20_1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'h2': {
|
||||||
|
'replace_with': 'text:p',
|
||||||
|
'attributes': {
|
||||||
|
'style-name': 'Heading_20_2'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'h3': {
|
||||||
|
'replace_with': 'text:p',
|
||||||
|
'attributes': {
|
||||||
|
'style-name': 'Heading_20_3'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'h4': {
|
||||||
|
'replace_with': 'text:p',
|
||||||
|
'attributes': {
|
||||||
|
'style-name': 'Heading_20_4'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xml_object = parseString( html_text )
|
xml_object = parseString( html_text )
|
||||||
|
|
@ -318,11 +348,15 @@ def markdown_filter(markdown_text):
|
||||||
else:
|
else:
|
||||||
odt_node.appendChild(deepcopy(child_node))
|
odt_node.appendChild(deepcopy(child_node))
|
||||||
|
|
||||||
# Agregar los atributos definidos en el mapa
|
# Add attributes defined in replacement_map
|
||||||
if 'attributes' in replacement_map[tag]:
|
if 'attributes' in replacement_map[tag]:
|
||||||
for k, v in replacement_map[tag]['attributes'].iteritems():
|
for k, v in replacement_map[tag]['attributes'].iteritems():
|
||||||
odt_node.setAttribute('text:%s' % k, v)
|
odt_node.setAttribute('text:%s' % k, v)
|
||||||
|
|
||||||
|
# Does the node need to create an style?
|
||||||
|
if 'append_style' in replacement_map[tag]:
|
||||||
|
pass
|
||||||
|
|
||||||
html_node.parentNode.replaceChild(odt_node, html_node)
|
html_node.parentNode.replaceChild(odt_node, html_node)
|
||||||
|
|
||||||
return xml_object.firstChild.toxml()
|
return xml_object.firstChild.toxml()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue