Commit 8cba84ac authored by Tatuya Kamada's avatar Tatuya Kamada

Fix a bug when setting a span style directly, not creating a style.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30316 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b34a9e60
......@@ -400,6 +400,10 @@ class ODFStrategy(Implicit):
range reference example:
<text:reference-mark-start text:name="week"/>Monday<text:reference-mark-end text:name="week"/>
or
<text:reference-mark-start text:name="my_title"/><text:span text:style-name="T1">title</text:span>
<text:reference-mark-end text:name="my_title"/>
"""
field_value = self._renderField(field)
value = self._toUnicodeString(field_value)
......@@ -409,6 +413,11 @@ class ODFStrategy(Implicit):
return element_tree
target_node = reference_list[0]
if not isinstance(field_value, list):
next_node = target_node.getnext()
span_tag_name = '{%s}span' % element_tree.nsmap['text']
if next_node is not None and next_node.tag == span_tag_name:
next_node.text = value
else:
target_node.tail = value
# clear text until 'reference-mark-end'
for node in target_node.itersiblings():
......
......@@ -294,6 +294,28 @@ class TestFormPrintout(ERP5TypeTestCase):
self._validate(odf_document)
def test_01_Paragraph_09_RangeReferenceWithSpan(self, run=run_all_test):
"""test range reference and span setting"""
if not run: return
foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout
foo_form = self.portal.foo_module.test1.Foo_view
if foo_form._getOb("my_test_title", None) is None:
foo_form.manage_addField('my_test_title', 'test title', 'StringField')
test_title = foo_form.my_test_title
test_title.values['default'] = 'ZZZ test here ZZZ'
odf_document = foo_printout()
self.assertTrue(odf_document is not None)
test_output = open("/tmp/test_01_Paragraph_09_RangeReferenceWithSpan.odf", "w")
test_output.write(odf_document)
builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml")
self.assertTrue(content_xml.find("ZZZ test here ZZZ") > 0)
self.assertTrue(content_xml.find("test title") < 0)
self._validate(odf_document)
def test_02_Table_01_Normal(self, run=run_all_test):
"""To test listbox and ODF table mapping
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment