Exemple #1
0
 def runTest(self):
     # ARRANGE #
     root = Element('root')
     table = Table(TableFormat(first_row_is_header=True), [
         [text_cell('ignored'),
          cell([para('ignored'), para('ignored')])],
         [text_cell('ignored'),
          cell([para('ignored'), para('ignored')])],
     ])
     # ACT #
     ret_val = sut.render(ConstantPRenderer('para text'), root, table)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<table>'
         '<tr>'
         '<th>para text</th>'
         '<th><p>para text</p><p>para text</p></th>'
         '</tr>'
         '<tr>'
         '<td>para text</td>'
         '<td><p>para text</p><p>para text</p></td>'
         '</tr>'
         '</table>'
         '</root>', xml_string)
     self.assertIs(list(root)[0], ret_val)
Exemple #2
0
 def runTest(self):
     # ARRANGE #
     root = Element('root')
     table = Table(TableFormat(first_row_is_header=True),
                   [
                       [text_cell('ignored'), cell([para('ignored'), para('ignored')])],
                       [text_cell('ignored'), cell([para('ignored'), para('ignored')])],
                   ])
     # ACT #
     ret_val = sut.render(ConstantPRenderer('para text'),
                          root, table)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<table>'
                      '<tr>'
                      '<th>para text</th>'
                      '<th><p>para text</p><p>para text</p></th>'
                      '</tr>'
                      '<tr>'
                      '<td>para text</td>'
                      '<td><p>para text</p><p>para text</p></td>'
                      '</tr>'
                      '</table>'
                      '</root>',
                      xml_string)
     self.assertIs(list(root)[0],
                   ret_val)
Exemple #3
0
 def row(name: str, file_name: str) -> List[TableCell]:
     return [
         docs.cell(docs.paras(name)),
         docs.cell(
             docs.paras(
                 file_name_text(sds.SUB_DIRECTORY__RESULT + '/' +
                                file_name)))
     ]
Exemple #4
0
def transform_list_to_table(l: lists.HeaderContentList) -> table.Table:
    rows = []
    for item in l.items:
        assert isinstance(item, lists.HeaderContentListItem)
        header_cell = cell([Paragraph([item.header])])
        value_cell = cell(item.content_paragraph_items)
        rows.append([header_cell, value_cell])
    return table.Table(table.TableFormat(),
                       rows)
Exemple #5
0
def transform_list_to_table(l: lists.HeaderContentList) -> table.Table:
    rows = []
    for item in l.items:
        assert isinstance(item, lists.HeaderContentListItem)
        header_cell = cell([Paragraph([item.header])])
        value_cell = cell(item.content_paragraph_items)
        rows.append([header_cell, value_cell])
    return table.Table(table.TableFormat(),
                       rows)
Exemple #6
0
def singe_exit_value_display(exit_value: ExitValue) -> ParagraphItem:
    return first_column_is_header_table([
        [
            cell([para(misc_texts.EXIT_CODE_TITLE)]),
            cell([para(str(exit_value.exit_code))]),
        ],
        [
            cell([para(misc_texts.EXIT_IDENTIFIER_TITLE)]),
            cell([para(exit_value_text(exit_value))]),
        ],
    ])
Exemple #7
0
def singe_exit_value_display(exit_value: ExitValue) -> ParagraphItem:
    return first_column_is_header_table([
        [
            cell([para(misc_texts.EXIT_CODE_TITLE)]),
            cell([para(str(exit_value.exit_code))]),
        ],
        [
            cell([para(misc_texts.EXIT_IDENTIFIER_TITLE)]),
            cell([para(exit_value_text(exit_value))]),
        ],
    ])
Exemple #8
0
def _dir_info_items_table(env_var_name: Text,
                          rel_option: Text,
                          env_var_description: str) -> ParagraphItem:
    return docs.first_column_is_header_table([
        [
            docs.cell(docs.paras(env_var_name)),
            docs.cell(docs.paras(env_var_description)),
        ],
        [
            docs.cell(docs.paras(rel_option)),
            docs.cell(docs.paras('This option (accepted by many instructions) refers to this directory.')),
        ],
    ])
Exemple #9
0
def _dir_info_items_table(symbol_name: Text, rel_option: Text,
                          symbol_description: str) -> ParagraphItem:
    return docs.first_column_is_header_table([
        [
            docs.cell(docs.paras(symbol_name)),
            docs.cell(docs.paras(symbol_description)),
        ],
        [
            docs.cell(docs.paras(rel_option)),
            docs.cell(
                docs.paras(
                    'The path relativity option that refers to this directory.'
                )),
        ],
    ])
Exemple #10
0
def _escape_sequence_table() -> docs.ParagraphItem:
    def _row(escape_sequence: str, translation: str) -> List[TableCell]:
        return [
            cell(docs.paras(literal_source_text(escape_sequence))),
            cell(docs.paras(literal_source_text(translation))),
        ]

    return docs.first_row_is_header_table(
        [
            [
                cell(docs.paras('Source')),
                cell(docs.paras('Translation')),
            ]] +
        [
            _row('\\[', '['),
            _row('\\\\', '\\'),
        ],
        '  ')
Exemple #11
0
def _escape_sequence_table() -> docs.ParagraphItem:
    def _row(escape_sequence: str, translation: str) -> List[TableCell]:
        return [
            cell(docs.paras(literal_source_text(escape_sequence))),
            cell(docs.paras(literal_source_text(translation))),
        ]

    return docs.first_row_is_header_table(
        [
            [
                cell(docs.paras('Source')),
                cell(docs.paras('Translation')),
            ]] +
        [
            _row('\\[', '['),
            _row('\\\\', '\\'),
        ],
        '  ')
Exemple #12
0
 def row(name: str, file_name: str) -> List[TableCell]:
     return [docs.cell(docs.paras(name)),
             docs.cell(docs.paras(file_name_text(sds.SUB_DIRECTORY__RESULT + '/' + file_name)))]
Exemple #13
0
 def cell_of_literal(text: str) -> docs.TableCell:
     return docs.cell([docs.para(doc_format.literal_text(text))])
Exemple #14
0
 def cell_of_name_part_name(text: str) -> docs.TableCell:
     return docs.cell([docs.para(text)])
Exemple #15
0
 def _row(escape_sequence: str, translation: str) -> List[TableCell]:
     return [
         cell(docs.paras(literal_source_text(escape_sequence))),
         cell(docs.paras(literal_source_text(translation))),
     ]
 def row(type_name: str, description: str) -> List[TableCell]:
     return [
         docs.cell(docs.paras(doc_format.enum_name_text(type_name))),
         docs.cell(_TP.fnap(description)),
     ]
 def row(type_name: str, description: str) -> list:
     return [
         docs.cell(docs.paras(doc_format.enum_name_text(type_name))),
         docs.cell(_TP.fnap(description)),
     ]
Exemple #18
0
 def _row(escape_sequence: str, translation: str) -> List[TableCell]:
     return [
         cell(docs.paras(literal_source_text(escape_sequence))),
         cell(docs.paras(literal_source_text(translation))),
     ]