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) ])
def act_phase_contents_syntax(self) -> doc.SectionContents: return doc.SectionContents( self._tp.fnap( SINGLE_LINE_PROGRAM_ACT_PHASE_CONTENTS_SYNTAX_INITIAL_PARAGRAPH ), self._act_phase_contents_syntax_sub_sections(), )
def _main_description_rest_sections(self) -> List[docs.Section]: d = self.documentation ip = list(d.main_description_rest()) ss = list(d.main_description_rest_sub_sections()) if not (ip or ss): return [] section = description_section(doc.SectionContents(ip, ss)) return [section]
def apply(self, environment: ConstructionEnvironment) -> doc.SectionContents: initial_paragraphs = list(itertools.chain.from_iterable([ renderer.apply(environment) for renderer in self._paragraph_items ])) sub_sections = [ss.apply(environment) for ss in self._sub_sections] return doc.SectionContents(initial_paragraphs, sub_sections)
def invokation_variants_content(instruction_name: Optional[str], invokation_variants: Sequence[InvokationVariant], syntax_element_descriptions: Iterable[SyntaxElementDescription] ) -> doc.SectionContents: return doc.SectionContents(invokation_variants_paragraphs(instruction_name, invokation_variants, syntax_element_descriptions ), [])
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: purpose = self.concept.purpose() sub_sections = [] sub_sections += self._rest_section(purpose) sub_sections += self._see_also_sections(environment) return doc.ArticleContents(docs.paras(purpose.single_line_description), doc.SectionContents([], sub_sections))
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))
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: initial_paragraphs = [ self._type_paragraph(), ] sub_sections = description_section_if_non_empty( self.builtin_doc.description) sub_sections += self._see_also_sections(environment) return doc.ArticleContents( docs.paras(self.builtin_doc.single_line_description()), doc.SectionContents(initial_paragraphs, sub_sections))
def _section_contents( self, environment: ConstructionEnvironment, purpose_rest: List[docs.ParagraphItem]) -> doc.SectionContents: paras = (purpose_rest + self._default_section_info(DEFAULT_SECTION_NAME)) sections = [] self._add_section_for_contents_description(sections) self._add_section_for_see_also(environment, sections) self._add_section_for_instructions(environment, sections) return doc.SectionContents(paras, sections)
def act_phase_contents_syntax(self) -> doc.SectionContents: documentation = ActPhaseDocumentationSyntax() initial_paragraphs = self._tp.fnap( SINGLE_LINE_PROGRAM_ACT_PHASE_CONTENTS_SYNTAX_INITIAL_PARAGRAPH) sub_sections = [] synopsis_section = doc_utils.synopsis_section( invokation_variants_content( None, documentation.invokation_variants(), documentation.syntax_element_descriptions())) sub_sections.append(synopsis_section) return doc.SectionContents(initial_paragraphs, sub_sections)
def apply(self, environment: ConstructionEnvironment) -> doc.SectionContents: sections = [] for test_case_phase_help in self.test_case_help.phase_helps_in_order_of_execution: if test_case_phase_help.has_instructions: renderer = instruction_set_constructor( test_case_phase_help.instruction_set, instruction_group_by=test_case_phase_help. instruction_group_by) sections.append( docs.Section(text(test_case_phase_help.name.syntax), renderer.apply(environment))) return doc.SectionContents([], sections)
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)
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: initial_paragraphs = [] invokation_variants = self.syntax_element.invokation_variants() if len(invokation_variants) > 1: initial_paragraphs.append(headers.FORMS_PARA) initial_paragraphs += invokation_variants_paragraphs( None, invokation_variants, self.syntax_element.syntax_element_descriptions()) return doc.ArticleContents( docs.paras(self.syntax_element.single_line_description()), doc.SectionContents(initial_paragraphs, self._sub_sections(environment)))
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: srd = self.suite_reporter initial_paragraphs = srd.main_description_rest() initial_paragraphs.extend(self._default_reporter_info()) sub_sections = [] names_and_contents = [ ('Output syntax', srd.syntax_of_output()), ('Exit code', srd.exit_code_description()), ] append_sections_if_contents_is_non_empty(sub_sections, names_and_contents) sub_sections += see_also_sections(srd.see_also_targets(), environment) return doc.ArticleContents(docs.paras(srd.single_line_description()), doc.SectionContents(initial_paragraphs, sub_sections))
def _section_contents( self, environment: ConstructionEnvironment, purpose_rest_paras: List[docs.ParagraphItem] ) -> doc.SectionContents: paras = (purpose_rest_paras + self._default_section_info(DEFAULT_PHASE.section_name)) sections = [] self._add_section_for_contents_description(sections) self._add_section_for_phase_sequence_description(sections) self._add_section_for_environment(sections) self._add_section_for_see_also(environment, sections) self._add_section_for_instructions(environment, sections) return doc.SectionContents(paras, sections)
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)
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: sub_sections = [] if self.doc.invokation_variants(): sub_sections.append( synopsis_section( invokation_variants_content(None, self.doc.invokation_variants(), self.doc.syntax_elements()))) append_section_if_contents_is_non_empty( sub_sections, 'Description', self.doc.main_description_rest()) sub_sections += see_also_sections(self.doc.see_also_targets(), environment, uppercase_title=True) return doc.ArticleContents( docs.paras(self.doc.single_line_description()), doc.SectionContents([], sub_sections))
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: self.rendering_environment = environment initial_paragraphs = self._default_reporter_info() initial_paragraphs.extend(self.actor.main_description_rest()) sub_sections = [] append_sections_if_contents_is_non_empty( sub_sections, [ (self._parser.format('{act_phase} phase contents'), self.actor.act_phase_contents()), (self._parser.format('Syntax of {act_phase} phase contents'), self.actor.act_phase_contents_syntax()), (headers.NOTES__HEADER__CAPITALIZED, self.actor.notes()), ] ) sub_sections += see_also_sections(self.actor.see_also_targets(), environment) return doc.ArticleContents(docs.paras(self.actor.single_line_description()), doc.SectionContents(initial_paragraphs, sub_sections))
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: documentation = self.documentation sub_sections = [] if documentation.invokation_variants(): sub_sections.append( synopsis_section( invokation_variants_content( documentation.instruction_name(), documentation.invokation_variants(), documentation.syntax_element_descriptions()))) sub_sections += self._main_description_rest_sections() sub_sections += self._outcome() sub_sections += self._notes() sub_sections += see_also_sections(documentation.see_also_targets(), environment, uppercase_title=True) abstract_paragraphs = docs.paras( self.documentation.single_line_description()) return doc.ArticleContents(abstract_paragraphs, doc.SectionContents([], sub_sections))
def apply(self, environment: ConstructionEnvironment) -> doc.SectionContents: return doc.SectionContents([ transform_list_to_table( self._sorted_entities_list(self.all_entities)) ], [])
def apply(self, environment: ConstructionEnvironment) -> doc.SectionContents: initial_paragraphs = TEXT_PARSER.fnap(REPORTING) sub_sections = see_also.see_also_sections(_SEE_ALSO_TARGETS, environment) return doc.SectionContents(initial_paragraphs, sub_sections)
def apply(self, environment: ConstructionEnvironment) -> doc.SectionContents: return doc.SectionContents( self._tp.fnap(_INITIAL_DESCRIPTION), [docs.section('File structure', self._tp.fnap(_FILE_STRUCTURE))])
def apply(self, environment: ConstructionEnvironment) -> doc.ArticleContents: return doc.ArticleContents( docs.paras('abstract paragraph'), doc.SectionContents(docs.paras('initial paragraph'), []))
def _strip_section_contents( self, contents: document.SectionContents) -> document.SectionContents: return document.SectionContents( contents.initial_paragraphs, [section.accept(self) for section in contents.sections])
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 act_phase_contents(self) -> doc.SectionContents: return doc.SectionContents(self._tp.fnap(_ACT_PHASE_CONTENTS))