Beispiel #1
0
 def apply(self,
           environment: ConstructionEnvironment) -> doc.SectionContents:
     article_contents = self.contents_constructor.apply(environment)
     return doc.SectionContents([], [
         doc.Section(self.header,
                     article_contents.combined_as_section_contents)
     ])
Beispiel #2
0
 def apply(self,
           environment: ConstructionEnvironment) -> doc.Section:
     return doc.Section(
         super_self._header,
         super_self._contents_renderer.apply(environment),
         target=None,
         tags=None)
Beispiel #3
0
 def apply(self,
           environment: ConstructionEnvironment) -> doc.Section:
     return doc.Section(
         super_self._root_target_info.presentation_text,
         super_self._contents_renderer.apply(environment),
         target=super_self._root_target_info.target,
         tags=node_environment.toc_section_item_tags)
Beispiel #4
0
def append_section_if_contents_is_non_empty(
        output_list_of_sections: List[doc.SectionItem],
        header: StrOrText,
        initial_paragraphs_or_section_contents: InitialParagraphsOrSectionContents):
    section_contents = initial_paragraphs_or_section_contents
    if isinstance(initial_paragraphs_or_section_contents, list):
        section_contents = doc.SectionContents(initial_paragraphs_or_section_contents)
    if not section_contents.is_empty:
        output_list_of_sections.append(doc.Section(docs.text_from_unknown(header),
                                                   section_contents))
Beispiel #5
0
 def test_section(self):
     # ARRANGE   #
     section = sut.Section(StringText('header'),
                           sut.empty_section_contents())
     visitor = SectionItemVisitorThatRecordsExpectedClassAndReturnsArg()
     # ACT #
     ret_val = section.accept(visitor)
     # ASSERT #
     self.assertEqual([sut.Section], visitor.visited_classes)
     self.assertIs(section, ret_val)
Beispiel #6
0
 def apply(self,
           environment: ConstructionEnvironment) -> doc.Section:
     sub_sections = [
         ss.section_item_constructor(node_environment).apply(
             environment) for ss in super_self._sub_sections
     ]
     return doc.Section(
         super_self._root_target_info.presentation_text,
         doc.SectionContents(
             super_self._initial_paragraphs.apply(environment),
             sub_sections),
         target=super_self._root_target_info.target,
         tags=node_environment.toc_section_item_tags)
Beispiel #7
0
 def apply(self,
           environment: ConstructionEnvironment) -> doc.SectionContents:
     sections = []
     for phase_and_instruction_description in self.phase_and_instruction_description_list:
         man_page_renderer = render_instruction.instruction_doc_section_contents_constructor(
             phase_and_instruction_description[1])
         phase_section = doc.Section(
             text(phase_and_instruction_description[0].syntax),
             man_page_renderer.apply(environment))
         sections.append(phase_section)
     initial_paragraphs = []
     if len(self.phase_and_instruction_description_list) > 1:
         initial_paragraphs = [
             para('The instruction "%s" exists in multiple phases.' %
                  self.instruction_name)
         ]
     return doc.SectionContents(initial_paragraphs, sections)
Beispiel #8
0
def synopsis_section(contents: doc.SectionContents) -> doc.Section:
    return doc.Section(SYNOPSIS_TEXT, contents)
Beispiel #9
0
def description_section(contents: doc.SectionContents) -> doc.Section:
    return doc.Section(DESCRIPTION__HEADER__UPPERCASE, contents)
Beispiel #10
0
 def apply(self, environment: ConstructionEnvironment) -> doc.Section:
     return doc.Section(self.header,
                        self.section_contents_renderer.apply(environment))
Beispiel #11
0
def _section_iff_has_paragraphs(
        header: str,
        paragraphs: Sequence[ParagraphItem]) -> Sequence[SectionItem]:
    return ((document.Section(core.StringText(header),
                              document.SectionContents(list(paragraphs))), )
            if paragraphs else ())
 def _add_section_for_contents_description(self,
                                           output: List[docs.SectionItem]):
     section_contents = self.doc.contents_description()
     output.append(doc.Section(self.CONTENTS_HEADER, section_contents))
 def visit_section(self, section: document.Section) -> document.SectionItem:
     return document.Section(section.header,
                             self._strip_section_contents(section.contents),
                             None, section.tags)