From a7a931010a2fc0532b17e807c36a543b53e87555 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 8 Jun 2014 22:36:49 +0100 Subject: Use style name in unrecognised styles warning --- mammoth/conversion.py | 5 ++++- tests/conversion_tests.py | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mammoth/conversion.py b/mammoth/conversion.py index 6c13225..a21a264 100644 --- a/mammoth/conversion.py +++ b/mammoth/conversion.py @@ -105,7 +105,10 @@ class DocumentConverter(object): return style.html_path if element.style_id is not None: - self.messages.append(results.warning("Unrecognised {0} style: {1}".format(element_type, element.style_id))) + self.messages.append(results.warning( + "Unrecognised {0} style: {1} (Style ID: {2})".format( + element_type, element.style_name, element.style_id) + )) return default diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py index 527ec2e..acac53b 100644 --- a/tests/conversion_tests.py +++ b/tests/conversion_tests.py @@ -86,11 +86,13 @@ def default_paragraph_style_is_specified_by_mapping_plain_paragraphs(): @istest def warning_is_emitted_if_paragraph_style_is_unrecognised(): result = convert_document_element_to_html( - documents.paragraph(style_id="TipsParagraph", children=[ - _run_with_text("Tip") - ]), + documents.paragraph( + style_id="Heading1", + style_name="Heading 1", + children=[_run_with_text("Tip")] + ), ) - assert_equal([results.warning("Unrecognised paragraph style: TipsParagraph")], result.messages) + assert_equal([results.warning("Unrecognised paragraph style: Heading 1 (Style ID: Heading1)")], result.messages) @istest -- cgit v1.2.3