reports: ODS links default to using URL as link text.

This commit is contained in:
Brett Smith 2020-06-12 16:42:54 -04:00
parent 44946a061d
commit 17c5468a7d
2 changed files with 3 additions and 3 deletions

View file

@ -928,7 +928,7 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
text = None
cell.addElement(odf.text.P())
cell.lastChild.addElement(odf.text.A(
type='simple', href=href, text=text,
type='simple', href=href, text=text or href,
))
return cell

View file

@ -514,7 +514,7 @@ def test_ods_writer_multilink_singleton(ods_writer, cell_source, style_name):
href = cell_source
text = None
anchor = get_child(cell, odf.text.A, type='simple', href=href)
assert get_text(anchor) == (text or '')
assert get_text(anchor) == (text or href)
def test_ods_writer_multilink_cell(ods_writer):
cell = ods_writer.multilink_cell(iter(LINK_CELL_DATA))
@ -528,7 +528,7 @@ def test_ods_writer_multilink_cell(ods_writer):
text = None
assert child.getAttribute('type') == 'simple'
assert child.getAttribute('href') == href
assert get_text(child) == (text or '')
assert get_text(child) == (text or href)
@pytest.mark.parametrize('cell_source,style_name', testutil.combine_values(
STRING_CELL_DATA,