diff --git a/README.md b/README.md index 91bd33e3..de86d68f 100644 --- a/README.md +++ b/README.md @@ -166,10 +166,10 @@ OR, let's say FOO is your new favorite markup language. Simply customize your ow The base parser `Docx2Html` relies on certain css class being set for certain behaviour to occur. Currently these include: -* class `insert` -> Turns the text green. -* class `delete` -> Turns the text red and draws a line through the text. -* class `center` -> Aligns the text to the center. -* class `right` -> Aligns the text to the right. -* class `left` -> Aligns the text to the left. -* class `comment` -> Turns the text blue. +* class `pydocx-insert` -> Turns the text green. +* class `pydocx-delete` -> Turns the text red and draws a line through the text. +* class `pydocx-center` -> Aligns the text to the center. +* class `pydocx-right` -> Aligns the text to the right. +* class `pydocx-left` -> Aligns the text to the left. +* class `pydocx-comment` -> Turns the text blue. * class `pydocx-underline` -> Underlines the text. diff --git a/pydocx/parsers/Docx2Html.py b/pydocx/parsers/Docx2Html.py index 9aa78354..782be941 100644 --- a/pydocx/parsers/Docx2Html.py +++ b/pydocx/parsers/Docx2Html.py @@ -1,7 +1,6 @@ from pydocx.DocxParser import DocxParser import xml.sax.saxutils -import textwrap class Docx2Html(DocxParser): @@ -21,16 +20,22 @@ def head(self): } def style(self): - return textwrap.dedent('''''') % { + result = ( + '' + ) % { + #multiple by (4/3) to get to px 'width': (self.page_width * (4 / 3)), } - #multiple by (4/3) to get to px + return result def escape(self, text): return xml.sax.saxutils.quoteattr(text)[1:-1] @@ -49,7 +54,7 @@ def heading(self, text, heading_value): def insertion(self, text, author, date): return ( - "%(text)s" ) % { 'author': author, @@ -83,7 +88,7 @@ def image(self, path, x, y): def deletion(self, text, author, date): return ( - "%(text)s" ) % { 'author': author, @@ -97,8 +102,9 @@ def list_element(self, text): } def ordered_list(self, text, list_style): - return "
    %(text)s
" % { + return '
    %(text)s
' % { 'text': text, + 'list_style': list_style, } def unordered_list(self, text): @@ -121,7 +127,7 @@ def tab(self): return '    ' def table(self, text): - return '' + text + '
' + return '' + text + '
' def table_row(self, text): return '' + text + '' @@ -145,7 +151,7 @@ def page_break(self): def indent(self, text, just='', firstLine='', left='', right=''): slug = '' + '.pydocx-insert {color:green;}' + '.pydocx-delete {color:red;text-decoration:line-through;}' + '.pydocx-center {text-align:center;}' + '.pydocx-right {text-align:right;}' + '.pydocx-left {text-align:left;}' + '.pydocx-comment {color:blue;}' + '.pydocx-underline {text-decoration: underline;}' + 'body {width:612px;margin:0px auto;}' + '' +) + +BASE_HTML = ''' + + + %s + + %%s + +''' % STYLE + def assert_html_equal(actual_html, expected_html): assert collapse_html( @@ -78,6 +100,10 @@ def _build_data( remove_namespaces(document_xml), ) + # This is the standard page width for a word document, Also the page + # width that we are looking for in the test. + self.page_width = 612 + def _parse_rels_root(self, *args, **kwargs): if self._test_rels_dict is None: return {} @@ -92,29 +118,6 @@ def get_list_style(self, num_id, ilvl): def _parse_styles(self): return {} - def head(self): - return '' - - def table(self, text): - return '' + text + '
' - - def ordered_list(self, text, list_style): - list_type_conversions = { - 'decimal': 'decimal', - 'decimalZero': 'decimal-leading-zero', - 'upperRoman': 'upper-roman', - 'lowerRoman': 'lower-roman', - 'upperLetter': 'upper-alpha', - 'lowerLetter': 'lower-alpha', - 'ordinal': 'decimal', - 'cardinalText': 'decimal', - 'ordinalText': 'decimal', - } - return '
    {text}
'.format( - list_style=list_type_conversions.get(list_style, 'decimal'), - text=text, - ) - DEFAULT_NUMBERING_DICT = { '1': { @@ -122,8 +125,8 @@ def ordered_list(self, text, list_style): '1': 'decimal', }, '2': { - '0': 'none', - '1': 'none', + '0': 'lowerLetter', + '1': 'lowerLetter', }, } @@ -159,4 +162,4 @@ def test_expected_output(self): numbering_dict=self.numbering_dict, ).parsed - assert_html_equal(html, self.expected_output) + assert_html_equal(html, BASE_HTML % self.expected_output) diff --git a/pydocx/tests/test_docx.py b/pydocx/tests/test_docx.py index 815d2ef2..72b98f5b 100644 --- a/pydocx/tests/test_docx.py +++ b/pydocx/tests/test_docx.py @@ -6,37 +6,12 @@ from nose.plugins.skip import SkipTest #from nose.tools import assert_raises -from pydocx.tests import assert_html_equal +from pydocx.tests import assert_html_equal, BASE_HTML from pydocx.parsers.Docx2Html import Docx2Html -class TestDocx2HTML(Docx2Html): - def head(self): - return '' - - def table(self, text): - return '' + text + '
' - - def ordered_list(self, text, list_style): - list_type_conversions = { - 'decimal': 'decimal', - 'decimalZero': 'decimal-leading-zero', - 'upperRoman': 'upper-roman', - 'lowerRoman': 'lower-roman', - 'upperLetter': 'upper-alpha', - 'lowerLetter': 'lower-alpha', - 'ordinal': 'decimal', - 'cardinalText': 'decimal', - 'ordinalText': 'decimal', - } - return '
    {text}
'.format( - list_style=list_type_conversions.get(list_style, 'decimal'), - text=text, - ) - - def convert(path): - return TestDocx2HTML(path).parsed + return Docx2Html(path).parsed def test_extract_html(): @@ -47,17 +22,16 @@ def test_extract_html(): 'simple.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

Simple text

-
    +
    1. one
    2. two
    3. three
    - +
    @@ -67,7 +41,6 @@ def test_extract_html():
    Cell1 Cell2Cell4
    - ''') @@ -79,17 +52,16 @@ def test_nested_list(): 'nested_lists.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - -
      + assert_html_equal(actual_html, BASE_HTML % ''' +
      1. one
      2. two
      3. three -
          +
          1. AAA
          2. BBB
          3. CCC -
              +
              1. alpha
              @@ -97,9 +69,9 @@ def test_nested_list():
            1. four
            -
              +
              1. xxx -
                  +
                  1. yyy
                  @@ -111,7 +83,6 @@ def test_nested_list(): - ''') @@ -123,15 +94,13 @@ def test_simple_list(): 'simple_lists.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - -
                    + assert_html_equal(actual_html, BASE_HTML % ''' +
                    1. One
                    • two
                    - ''') @@ -143,12 +112,11 @@ def test_inline_tags(): 'inline_tags.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ( - '

                    This sentence has some bold, ' + assert_html_equal(actual_html, BASE_HTML % ( + '

                    This sentence has some bold, ' 'some italics and some ' 'underline, ' - 'as well as a hyperlink' - '.

                    ' + 'as well as a hyperlink.

                    ' )) @@ -172,8 +140,8 @@ def test_special_chars(): 'special_chars.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' -

                    & < > link

                    ''') # noqa + assert_html_equal(actual_html, BASE_HTML % ''' +

                    & < > link

                    ''') # noqa def test_table_col_row_span(): @@ -184,9 +152,8 @@ def test_table_col_row_span(): 'table_col_row_span.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - - + assert_html_equal(actual_html, BASE_HTML % ''' +
                    @@ -199,17 +166,17 @@ def test_table_col_row_span():
                    AAA
                    -
                    EEE +
                    EEE
                    FFF
                    -
                    GGG +
                    GGG
                    - +
                    @@ -232,7 +199,6 @@ def test_table_col_row_span():
                    1 213
                    - ''') @@ -244,16 +210,15 @@ def test_nested_table_rowspan(): 'nested_table_rowspan.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - - + assert_html_equal(actual_html, BASE_HTML % ''' +
                    AAA
                    BBB - +
                    @@ -265,7 +230,6 @@ def test_nested_table_rowspan():
                    CCC DDD
                    - ''') @@ -278,9 +242,8 @@ def test_nested_tables(): ) actual_html = convert(file_path) # Find out why br tag is there. - assert_html_equal(actual_html, ''' - - + assert_html_equal(actual_html, BASE_HTML % ''' +
                    @@ -288,7 +251,7 @@ def test_nested_tables():
                    AAA BBB
                    CCC - +
                    @@ -301,7 +264,6 @@ def test_nested_tables():
                    DDD EEE
                    - ''') @@ -313,12 +275,11 @@ def test_list_in_table(): 'list_in_table.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - - + assert_html_equal(actual_html, BASE_HTML % ''' +
                    -
                      +
                      1. AAA
                      2. BBB
                      3. CCC
                      4. @@ -326,7 +287,6 @@ def test_list_in_table():
                    - ''') @@ -338,12 +298,11 @@ def test_tables_in_lists(): 'tables_in_lists.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - -
                      + assert_html_equal(actual_html, BASE_HTML % ''' +
                      1. AAA
                      2. BBB - +
                        @@ -356,7 +315,6 @@ def test_tables_in_lists():
                      3. GGG
                      4. - ''') @@ -368,8 +326,8 @@ def test_track_changes_on(): 'track_changes_on.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' -

                        This was some content.

                        + assert_html_equal(actual_html, BASE_HTML % ''' +

                        This was some content.

                        ''') @@ -381,8 +339,7 @@ def test_headers(): 'headers.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        This is an H1

                        This is an H2

                        This is an H3

                        @@ -393,7 +350,6 @@ def test_headers():
                        This is an H8
                        This is an H9
                        This is an H10
                        - ''') @@ -420,8 +376,8 @@ def test_split_headers(): new_file_path, _ = _copy_file_to_tmp_dir(file_path, filename) actual_html = convert(new_file_path) - assert_html_equal(actual_html, ''' -

                        AAA

                        BBB

                        CCC

                        + assert_html_equal(actual_html, BASE_HTML % ''' +

                        AAA

                        BBB

                        CCC

                        ''') @@ -440,10 +396,8 @@ def test_has_image(): actual_html = convert(new_file_path) # Ignore height, width for now. - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        AAA

                        - ''') @@ -457,10 +411,8 @@ def test_local_dpi(): ) new_file_path, dp = _copy_file_to_tmp_dir(file_path, filename) actual_html = convert(new_file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        - ''') @@ -481,45 +433,11 @@ def test_has_image_using_image_handler(): def image_handler(*args, **kwargs): return 'test' actual_html = convert(new_file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        AAA

                        - ''') -#def test_attachment_is_tiff(): -# filename = 'attachment_is_tiff.docx' -# file_path = path.join( -# path.abspath(path.dirname(__file__)), -# '..', -# 'fixtures', -# 'attachment_is_tiff.docx', -# ) -# # preserve_images must be true in order for the image to not be removed. -# # This is handled in build_import, however here we need to manually set it -# # to True. -# new_file_path, _ = _copy_file_to_tmp_dir(file_path, filename) -# -# # First open the file and verify that the image attachment is a tiff. -# try: -# zf = ZipFile(new_file_path) -# # Get the document data. -# _, meta_data = _get_document_data(zf) -# finally: -# zf.close() -# # Find the path to the image. -# image_file = None -# for file_path in meta_data.relationship_dict.values(): -# if file_path.endswith('.gif'): -# image_file = file_path -# assert image_file is not None -# with open(image_file) as f: -# magic_number = f.read()[:4] -# # Make sure the image is actually a gif. -# assert magic_number == 'GIF8' - - def test_headers_with_full_line_styles(): raise SkipTest('This test is not yet passing') # Show that if a natural header is completely bold/italics that @@ -531,12 +449,10 @@ def test_headers_with_full_line_styles(): 'headers_with_full_line_styles.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        AAA

                        BBB

                        CCC

                        - ''') @@ -551,17 +467,16 @@ def test_convert_p_to_h(): 'convert_p_to_h.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        AAA

                        BBB

                        CCC

                        -
                          +
                          1. DDD
                          2. EEE
                          3. FFF
                          -
                        CCC DDD
                        +
                        @@ -571,43 +486,9 @@ def test_convert_p_to_h():
                        GGG HHHJJJ
                        - ''') -#def test_bigger_font_size_to_header(): -# # Show when it is appropriate to convert p tags to h tags based on font -# # size. -# if not DETECT_FONT_SIZE: -# raise SkipTest('Font size detection is disabled.') -# file_path = path.join( -# path.abspath(path.dirname(__file__)), -# '..', -# 'fixtures', -# 'bigger_font_size_to_header.docx', -# ) -# actual_html = convert(file_path) -# assert_html_equal(actual_html, ''' -# -#

                        Paragraphs:

                        -#

                        Header

                        -#

                        paragraph 1

                        -#

                        Lists:

                        -#
                          -#
                        1. bigger
                        2. -#
                        3. smaller
                        4. -#
                        -#

                        Tables:

                        -# -# -# -# -# -#
                        biggersmaller
                        -# -# ''') - - def test_fake_headings_by_length(): raise SkipTest('This test is not yet passing') # Show that converting p tags to h tags has a length limit. If the p tag is @@ -620,14 +501,12 @@ def test_fake_headings_by_length(): 'fake_headings_by_length.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        Heading.

                        Still a heading.

                        This is not a heading because it is too many words.

                        - ''') @@ -642,15 +521,14 @@ def test_shift_enter(): # Test just the convert without clean_html to make sure the first # break tag is present. actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                        AAA
                        BBB

                        CCC

                        -
                          +
                          1. DDD
                            EEE
                          2. FFF
                          - +
                          @@ -660,7 +538,6 @@ def test_shift_enter():
                          GGG
                          HHH
                          III
                          JJJ
                          LLL
                          - ''') @@ -672,17 +549,16 @@ def test_lists_with_styles(): 'lists_with_styles.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - -
                            + assert_html_equal(actual_html, BASE_HTML % ''' +
                            1. AAA
                            2. BBB -
                                +
                                1. CCC
                                2. DDD -
                                    +
                                    1. EEE -
                                        +
                                        1. FFF
                                        @@ -691,7 +567,6 @@ def test_lists_with_styles():
                                    - ''') @@ -706,25 +581,23 @@ def test_list_to_header(): actual_html = convert(file_path) # It should be noted that list item `GGG` is upper roman in the word # document to show that only top level upper romans get converted. - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                                    AAA

                                    -
                                      +
                                      1. BBB

                                      CCC

                                      -
                                        +
                                        1. DDD

                                        EEE

                                        -
                                          +
                                          1. FFF -
                                              +
                                              1. GGG
                                            - ''') @@ -736,11 +609,10 @@ def test_has_title(): 'has_title.docx', ) actual_html = convert(file_path) - assert_html_equal( - actual_html, - '''

                                            Title

                                            -

                                            Text

                                            ''', - ) + assert_html_equal(actual_html, BASE_HTML % ''' +

                                            Title

                                            +

                                            Text

                                            + ''') def test_upper_alpha_all_bold(): @@ -752,12 +624,10 @@ def test_upper_alpha_all_bold(): 'upper_alpha_all_bold.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                                            AAA

                                            BBB

                                            CCC

                                            - ''') @@ -769,14 +639,21 @@ def test_simple_table(): 'simple_table.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - - - - + assert_html_equal(actual_html, BASE_HTML % ''' +
                                            Cell1
                                            Cell3
                                            Cell2
                                            - And I am writing in the table
                                            Cell4
                                            + + + + + + + +
                                            Cell1
                                            + Cell3 +
                                            Cell2
                                            + And I am writing in the table +
                                            Cell4
                                            - ''') @@ -788,21 +665,21 @@ def test_justification(): 'justification.docx', ) actual_html = convert(file_path) - assert_html_equal(actual_html, ''' - + assert_html_equal(actual_html, BASE_HTML % '''

                                            -

                                            Center Justified
                                            +
                                            Center Justified

                                            -

                                            Right justified
                                            +
                                            Right justified

                                            -

                                            +
                                            Right justified and pushed in from right

                                            -

                                            +
                                            Center justified and pushed in from left and it is great and it is the coolest thing of all time and I like it and I think it is cool @@ -813,7 +690,6 @@ def test_justification(): Left justified and pushed in from left

                                            - ''') diff --git a/pydocx/tests/test_xml.py b/pydocx/tests/test_xml.py index fb1a47fe..4e5cf1a0 100644 --- a/pydocx/tests/test_xml.py +++ b/pydocx/tests/test_xml.py @@ -15,10 +15,8 @@ class BoldTestCase(_TranslationTestCase): expected_output = """ - -

                                            AAA

                                            -

                                            BBB

                                            - +

                                            AAA

                                            +

                                            BBB

                                            """ def get_xml(self): @@ -40,9 +38,7 @@ class HyperlinkVanillaTestCase(_TranslationTestCase): } expected_output = ''' -

                                            link.

                                            - ''' def get_xml(self): @@ -61,9 +57,7 @@ class HyperlinkWithMultipleRunsTestCase(_TranslationTestCase): } expected_output = ''' -

                                            link.

                                            - ''' def get_xml(self): @@ -80,10 +74,7 @@ class HyperlinkNoTextTestCase(_TranslationTestCase): 'rId0': 'www.google.com', } - expected_output = ''' - - - ''' + expected_output = '' def get_xml(self): run_tags = [] @@ -98,11 +89,7 @@ class HyperlinkNotInRelsDictTestCase(_TranslationTestCase): # 'rId0': 'www.google.com', missing } - expected_output = ''' - -

                                            link.

                                            - - ''' + expected_output = '

                                            link.

                                            ' def get_xml(self): run_tags = [] @@ -119,11 +106,7 @@ class HyperlinkWithBreakTestCase(_TranslationTestCase): 'rId0': 'www.google.com', } - expected_output = ''' - -

                                            link

                                            - - ''' + expected_output = '

                                            link

                                            ' def get_xml(self): run_tags = [] @@ -141,14 +124,12 @@ class ImageTestCase(_TranslationTestCase): 'rId1': 'media/image2.jpeg', } expected_output = ''' - -

                                            - -

                                            -

                                            - -

                                            - +

                                            + +

                                            +

                                            + +

                                            ''' def get_xml(self): @@ -216,10 +197,7 @@ class ImageNotInRelsDictTestCase(_TranslationTestCase): relationship_dict = { # 'rId0': 'media/image1.jpeg', } - expected_output = ''' - - - ''' + expected_output = '' def get_xml(self): drawing = DXB.drawing(height=20, width=40, r_id='rId0') @@ -271,18 +249,16 @@ def get_xml(self): class TableTag(_TranslationTestCase): expected_output = ''' - - - - - - - - - - -
                                            AAABBB
                                            CCCDDD
                                            - + + + + + + + + + +
                                            AAABBB
                                            CCCDDD
                                            ''' def get_xml(self): @@ -299,8 +275,7 @@ def get_xml(self): class NestedTableTag(_TranslationTestCase): expected_output = ''' - - +
                                            @@ -308,7 +283,7 @@ class NestedTableTag(_TranslationTestCase):
                                            AAA BBB
                                            CCC - +
                                            @@ -321,7 +296,6 @@ class NestedTableTag(_TranslationTestCase):
                                            DDD EEE
                                            - ''' def get_xml(self): @@ -344,18 +318,16 @@ def get_xml(self): class TableWithInvalidTag(_TranslationTestCase): expected_output = ''' - - - - - - - - - - -
                                            AAABBB
                                            DDD
                                            - + + + + + + + + + +
                                            AAABBB
                                            DDD
                                            ''' def get_xml(self): @@ -374,11 +346,10 @@ def get_xml(self): class TableWithListAndParagraph(_TranslationTestCase): expected_output = ''' - - +
                                            -
                                              +
                                              1. AAA
                                              2. BBB
                                              @@ -387,7 +358,6 @@ class TableWithListAndParagraph(_TranslationTestCase):
                                            - ''' def get_xml(self): @@ -416,13 +386,11 @@ def get_xml(self): class SimpleListTestCase(_TranslationTestCase): expected_output = ''' - -
                                              -
                                            1. AAA
                                            2. -
                                            3. BBB
                                            4. -
                                            5. CCC
                                            6. -
                                            - +
                                              +
                                            1. AAA
                                            2. +
                                            3. BBB
                                            4. +
                                            5. CCC
                                            6. +
                                            ''' # Ensure its not failing somewhere and falling back to decimal @@ -448,11 +416,9 @@ def get_xml(self): class SingleListItemTestCase(_TranslationTestCase): expected_output = ''' - -
                                              -
                                            1. AAA
                                            2. -
                                            - +
                                              +
                                            1. AAA
                                            2. +
                                            ''' # Ensure its not failing somewhere and falling back to decimal @@ -476,24 +442,22 @@ def get_xml(self): class ListWithContinuationTestCase(_TranslationTestCase): expected_output = ''' - -
                                              -
                                            1. AAA
                                              BBB
                                            2. -
                                            3. CCC - - - - - - - - - -
                                              DDDEEE
                                              FFFGGG
                                              -
                                            4. -
                                            5. HHH
                                            6. -
                                            - +
                                              +
                                            1. AAA
                                              BBB
                                            2. +
                                            3. CCC + + + + + + + + + +
                                              DDDEEE
                                              FFFGGG
                                              +
                                            4. +
                                            5. HHH
                                            6. +
                                            ''' def get_xml(self): @@ -520,23 +484,21 @@ def get_xml(self): class ListWithMultipleContinuationTestCase(_TranslationTestCase): expected_output = ''' - -
                                              -
                                            1. AAA - - - - -
                                              BBB
                                              - - - - -
                                              CCC
                                              -
                                            2. -
                                            3. DDD
                                            4. -
                                            - +
                                              +
                                            1. AAA + + + + +
                                              BBB
                                              + + + + +
                                              CCC
                                              +
                                            2. +
                                            3. DDD
                                            4. +
                                            ''' def get_xml(self): @@ -562,18 +524,16 @@ def get_xml(self): class MangledIlvlTestCase(_TranslationTestCase): expected_output = ''' - -
                                              +
                                              1. AAA
                                              -
                                                +
                                                1. BBB -
                                                    +
                                                    1. CCC
                                                  - ''' def get_xml(self): @@ -592,17 +552,15 @@ def get_xml(self): class SeperateListsTestCase(_TranslationTestCase): expected_output = ''' - -
                                                    +
                                                    1. AAA
                                                    -
                                                      +
                                                      1. BBB
                                                      -
                                                        +
                                                        1. CCC
                                                        - ''' def get_xml(self): @@ -624,19 +582,17 @@ def get_xml(self): class InvalidIlvlOrderTestCase(_TranslationTestCase): expected_output = ''' - -
                                                          +
                                                          1. AAA -
                                                              +
                                                              1. BBB -
                                                                  +
                                                                  1. CCC
                                                              - ''' def get_xml(self): @@ -654,8 +610,7 @@ def get_xml(self): class DeeplyNestedTableTestCase(_TranslationTestCase): - expected_output = ''' - ''' + expected_output = '' run_expected_output = False def get_xml(self): @@ -686,10 +641,8 @@ def test_performance(self): class NonStandardTextTagsTestCase(_TranslationTestCase): expected_output = ''' - -

                                                              insert +

                                                              insert smarttag

                                                              - ''' def get_xml(self): @@ -705,7 +658,7 @@ def get_xml(self): class RTagWithNoText(_TranslationTestCase): - expected_output = '' + expected_output = '' def get_xml(self): p_tag = DXB.p_tag(None) # No text @@ -720,14 +673,12 @@ def get_xml(self): class DeleteTagInList(_TranslationTestCase): expected_output = ''' - -
                                                                +
                                                                1. AAA
                                                                  - BBB + BBB
                                                                2. CCC
                                                                - ''' def get_xml(self): @@ -744,14 +695,12 @@ def get_xml(self): class InsertTagInList(_TranslationTestCase): expected_output = ''' - -
                                                                  +
                                                                  1. AAA
                                                                    - BBB + BBB
                                                                  2. CCC
                                                                  - ''' def get_xml(self): @@ -769,14 +718,12 @@ def get_xml(self): class SmartTagInList(_TranslationTestCase): expected_output = ''' - -
                                                                    +
                                                                    1. AAA
                                                                      BBB
                                                                    2. CCC
                                                                    - ''' def get_xml(self): @@ -794,12 +741,10 @@ def get_xml(self): class SingleListItem(_TranslationTestCase): expected_output = ''' - -
                                                                      +
                                                                      1. AAA

                                                                      BBB

                                                                      - ''' numbering_dict = { @@ -822,11 +767,23 @@ def get_xml(self): class SimpleTableTest(_TranslationTestCase): expected_output = ''' - - - - -
                                                                      BlankColumn 1Column 2
                                                                      Row 1FirstSecond
                                                                      Row 2ThirdFourth
                                                                      ''' + + + + + + + + + + + + + + + + +
                                                                      BlankColumn 1Column 2
                                                                      Row 1FirstSecond
                                                                      Row 2ThirdFourth
                                                                      ''' def get_xml(self): table = DXB.table(num_rows=3, num_columns=3, text=chain( @@ -848,14 +805,12 @@ def get_xml(self): class MissingIlvl(_TranslationTestCase): expected_output = ''' - -
                                                                        +
                                                                        1. AAA
                                                                          BBB
                                                                        2. CCC
                                                                        - ''' def get_xml(self): @@ -874,13 +829,12 @@ def get_xml(self): class SameNumIdInTable(_TranslationTestCase): expected_output = ''' - -
                                                                          +
                                                                          1. AAA - +
                                                                            @@ -889,7 +843,6 @@ class SameNumIdInTable(_TranslationTestCase):
                                                                          2. CCC
                                                                          3. - ''' # Ensure its not failing somewhere and falling back to decimal @@ -921,14 +874,12 @@ def get_xml(self): class SDTTestCase(_TranslationTestCase): expected_output = ''' - -
                                                                              +
                                                                              1. AAA
                                                                                BBB
                                                                              2. CCC
                                                                              - ''' def get_xml(self):
                                                                            -
                                                                              +
                                                                              1. BBB