From ed866074dffc8d846ff6e0d41ba58e61d7a32c11 Mon Sep 17 00:00:00 2001 From: Jason Ward Date: Tue, 16 Jul 2013 12:22:00 -0400 Subject: [PATCH 1/3] refs #53: Added a test showing that a val of none should not be triggering the handler. --- pydocx/tests/test_xml.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pydocx/tests/test_xml.py b/pydocx/tests/test_xml.py index 8142ef2b..84e2c697 100644 --- a/pydocx/tests/test_xml.py +++ b/pydocx/tests/test_xml.py @@ -12,11 +12,12 @@ from pydocx.utils import parse_xml_from_string, find_all -class BoldTestCase(_TranslationTestCase): +class StyleIsOnTestCase(_TranslationTestCase): expected_output = """

AAA

BBB

CCC

+

DDD

""" def get_xml(self): @@ -45,6 +46,14 @@ def get_xml(self): ), ], ), + DXB.p_tag( + [ + DXB.r_tag( + [DXB.t_tag('DDD')], + rpr=DXB.rpr_tag({'u': 'none'}), + ), + ], + ), ] body = '' From 91a6bdbfb20b01c1ee7e111c1f29b2df2899c339 Mon Sep 17 00:00:00 2001 From: Jason Ward Date: Tue, 16 Jul 2013 12:22:22 -0400 Subject: [PATCH 2/3] refs #53: a val of none no longer triggers the inline handlers. --- pydocx/DocxParser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydocx/DocxParser.py b/pydocx/DocxParser.py index fd16308f..5608c504 100644 --- a/pydocx/DocxParser.py +++ b/pydocx/DocxParser.py @@ -30,7 +30,7 @@ INDENTATION_RIGHT = 'right' INDENTATION_LEFT = 'left' INDENTATION_FIRST_LINE = 'firstLine' -DISABLED_VALUES = ['false', '0'] +DISABLED_VALUES = ['false', '0', 'none'] # Add some helper functions to Element to make it slightly more readable From 9313ae45c7b3186ba3854d0640ec67ae0572e794 Mon Sep 17 00:00:00 2001 From: Jason Ward Date: Tue, 16 Jul 2013 12:23:57 -0400 Subject: [PATCH 3/3] refs #53: update note --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f009a3b9..17808c30 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ Changelog ========= +* 0.3.7 + * Some inline tags (most notably the underline tag) could have a `val` of + `none` and that would signify that the style is disabled. A `val` of + `none` is now correctly handled. * 0.3.6 * It is possible for a docx file to not contain a `numbering.xml` file but still try to use lists. Now if this happens all lists get converted to