def type_row(ts: TypeSetup) -> List[TableCell]: return [ docs.text_cell(syntax_text(ts.type_info.identifier)), docs.text_cell( syntax_text( cl_syntax.cl_syntax_for_args(ts.value_arguments))), ]
def _item( option: a.OptionName, tp: TextParser, ) -> lists.HeaderContentListItem: return docs.list_item( doc_format.syntax_text(option_syntax.option_syntax(option)), tp.fnap(_DESCRIPTION))
def syntax_element_description_list() -> ParagraphItem: items = [] for sed in syntax_element_descriptions: variants_list_paragraphs = [] if sed.invokation_variants: variants_list_paragraphs = [variants_list(None, sed.invokation_variants, True, custom_separations=BLANK_LINE_BETWEEN_ELEMENTS)] separator_paras = ( [FORMS_PARA] if sed.invokation_variants and invokation_variants_are_surrounded_by_text(sed) else [] ) contents = ( list(sed.before_invokation_variants) + separator_paras + variants_list_paragraphs + list(sed.after_invokation_variants) ) items.append(docs.list_item(syntax_text(sed.element_name), contents)) return lists.HeaderContentList(items, lists.Format(lists.ListType.VARIABLE_LIST, custom_indent_spaces=_custom_list_indent(True), custom_separations=BLANK_LINE_BETWEEN_ELEMENTS))
def _symbol_reference_syntax_table() -> ParagraphItem: return docs.first_column_is_header_table([ [ docs.text_cell('Plain name'), docs.text_cell( syntax_text( syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument.name)), ], [ docs.text_cell('Special syntax'), docs.text_cell( syntax_text( symbol_reference_syntax_for_name( syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument. name))), ], ], ' : ')
def _item( self, arguments: Sequence[a.ArgumentUsage], description_template: str, ) -> lists.HeaderContentListItem: return docs.list_item( doc_format.syntax_text(cl_syntax.cl_syntax_for_args(arguments)), self._tp.fnap(description_template))
def type_row(type_info: TypeNameAndCrossReferenceId) -> list: type_syntax_info = syntax.ANY_TYPE_INFO_DICT[type_info.value_type] first_column = docs.text_cell(syntax_text(type_info.identifier)) if type_info.value_type == ValueType.STRING: arg = a.Choice(a.Multiplicity.MANDATORY, [instruction_arguments.STRING, instruction_arguments.HERE_DOCUMENT]) second_column = [arg] else: second_column = type_syntax_info.value_arguments return [ first_column, docs.text_cell(syntax_text(cl_syntax.cl_syntax_for_args(second_column))), ]
def _options_for_rel_source_file(self) -> List[ParagraphItem]: return ([ docs.first_column_is_header_table([ [ docs.text_cell(syntax_text(REL_source_file_dir_OPTION)), ] ]) ] + self._parser.fnap(_REL_SOURCE_FILE_DESCRIPTION) )
def _options_for_symbol(self) -> List[ParagraphItem]: return ([ docs.first_column_is_header_table([ [ docs.text_cell(syntax_text(render_argument(REL_SYMBOL_OPTION))), ] ]) ] + self._parser.fnap(_REL_SYMBOL_DESCRIPTION) )
def _options_for_rel_source_file(self) -> List[ParagraphItem]: return ([ docs.first_column_is_header_table([ [ docs.text_cell(syntax_text(REL_source_file_dir_OPTION)), ] ]) ] + self._parser.fnap(_REL_SOURCE_FILE_DESCRIPTION) )
def _options_for_symbol(self) -> List[ParagraphItem]: return ([ docs.first_column_is_header_table([ [ docs.text_cell(syntax_text(render_argument(REL_SYMBOL_OPTION))), ] ]) ] + self._parser.fnap(_REL_SYMBOL_DESCRIPTION) )
def variants_list(instruction_name: Optional[str], invokation_variants: Iterable[InvokationVariant], indented: bool = False, custom_separations: lists.Separations = None) -> ParagraphItem: title_prefix = instruction_name + ' ' if instruction_name else '' items = [] for x in invokation_variants: assert isinstance(x, InvokationVariant) title = title_prefix + x.syntax items.append(docs.list_item(syntax_text(title), list(x.description_rest))) return lists.HeaderContentList(items, lists.Format(lists.ListType.VARIABLE_LIST, custom_indent_spaces=_custom_list_indent(indented), custom_separations=custom_separations))
def variants_list(instruction_name: str, invokation_variants: Iterable[InvokationVariant], indented: bool = False, custom_separations: lists.Separations = None) -> ParagraphItem: title_prefix = instruction_name + ' ' if instruction_name else '' items = [] for x in invokation_variants: assert isinstance(x, InvokationVariant) title = title_prefix + x.syntax items.append(docs.list_item(syntax_text(title), list(x.description_rest))) return lists.HeaderContentList(items, lists.Format(lists.ListType.VARIABLE_LIST, custom_indent_spaces=_custom_list_indent(indented), custom_separations=custom_separations))
def syntax_element_description_list() -> ParagraphItem: items = [] for x in syntax_element_descriptions: assert isinstance(x, SyntaxElementDescription) variants_list_paragraphs = [] if x.invokation_variants: variants_list_paragraphs = [variants_list(None, x.invokation_variants, True, custom_separations=BLANK_LINE_BETWEEN_ELEMENTS)] separator_paras = [FORMS_PARA] if x.invokation_variants and x.description_rest else [] contents = list(x.description_rest) + separator_paras + variants_list_paragraphs items.append(docs.list_item(syntax_text(x.element_name), contents)) return lists.HeaderContentList(items, lists.Format(lists.ListType.VARIABLE_LIST, custom_indent_spaces=_custom_list_indent(True), custom_separations=BLANK_LINE_BETWEEN_ELEMENTS))
def option_name_text(self) -> StringText: return syntax_text(option_syntax(self._option_name))
def item_for(syntax: str, description: str) -> lists.HeaderContentListItem: return docs.list_item(syntax_text(syntax), docs.paras(description))
def directory_variable_name_text(self) -> StringText: return syntax_text(self.directory_variable_name)
def option_name_text(self) -> StringText: return syntax_text(option_syntax(self._option_name))
def configuration_parameter_name_text(self) -> StringText: return syntax_text(self._configuration_parameter_name)
def singular_name_text(self) -> StringText: return syntax_text(self._singular_name)
def singular_name_text(self) -> StringText: return syntax_text(self._singular_name)
def _arg_description_list_item( self, argument: DescribedArgument) -> lists.HeaderContentListItem: header = doc_format.syntax_text( self.arg_in_description_renderer.visit(argument.argument)) return docs.list_item( header, self._arg_description_list_item_contents(argument))
def instruction_name_text(self) -> StringText: return syntax_text(self._instruction_name)
def _arg_description_list_item(self, argument: DescribedArgument) -> lists.HeaderContentListItem: header = doc_format.syntax_text(self.arg_in_description_renderer.visit(argument.argument)) return docs.list_item(header, self._arg_description_list_item_contents(argument))
def apply(self, command_line: arg.CommandLine) -> docs.Text: return doc_format.syntax_text(self.as_str(command_line))
def row(names: EntityTypeNames) -> List[docs.TableCell]: return [ docs.text_cell(doc_format.syntax_text(names.identifier)), docs.text_cell(names.name.plural.capitalize()), ]
_TP = TextParser() _HEADER = """\ Unix shell-style wildcards. Patterns: """ _DIRECTORY_SPECIFICATIONS_HEADER = 'Directory specifications:' _FOOTER = """\ For a literal match, wrap the meta-characters in brackets. For example, '[?]' matches the character '?'. """ _PATTERNS = docs.simple_list_with_space_between_elements_and_content([ docs.list_item(syntax_text('?'), docs.paras('Matches any single character.') ), docs.list_item(syntax_text('*'), docs.paras('Matches any number of any characters including none.') ), docs.list_item(syntax_text('[CHARACTERS]'), docs.paras('Matches a single character that is listed in CHARACTERS.') ), docs.list_item(syntax_text('[CHARACTER-CHARACTER]'), docs.paras('Matches a single character in the given range.') ), docs.list_item(syntax_text('[!CHARACTERS]'), docs.paras('Matches a single character that is not listed in CHARACTERS.') ), ],
def singular_name_text(self) -> StringText: return doc_format.syntax_text(self._single_string_type_name)
def row(names: EntityTypeNames) -> List[docs.TableCell]: return [ docs.text_cell(doc_format.syntax_text(names.identifier)), docs.text_cell(names.name.plural.capitalize()), ]
def item(option: a.OptionName, description_template: str) -> lists.HeaderContentListItem: return docs.list_item( doc_format.syntax_text(option_syntax.option_syntax(option)), tp.fnap(description_template))
def instruction_name_text(self) -> StringText: return syntax_text(self._instruction_name)
A file name, with ability to match multiple files. Pattern matchers: """ _DIRECTORY_SPECIFICATIONS_HEADER = 'Directory specifications:' _FOOTER = """\ For a literal match, wrap the meta-characters in brackets. For example, '[?]' matches the character '?'. A patterns cannot denote an absolute path. """ _PATTERNS = docs.simple_list_with_space_between_elements_and_content([ docs.list_item(syntax_text('?'), docs.paras('Matches any single character.') ), docs.list_item(syntax_text('*'), docs.paras('Matches any number of any characters including none.') ), docs.list_item(syntax_text('[CHARACTERS]'), docs.paras('Matches a single character that is listed in CHARACTERS. ') ), docs.list_item(syntax_text('[CHARACTER-CHARACTER]'), docs.paras('Matches a single character in the given range.') ), docs.list_item(syntax_text('[!CHARACTER-SET]'), docs.paras('Matches a single character NOT in CHARACTER-SET.') ), ],
def item_for(syntax: str, description: str) -> lists.HeaderContentListItem: return docs.list_item(syntax_text(syntax), docs.paras(description))
def directory_symbol_name_text(self) -> StringText: return syntax_text(self.directory_name)
def configuration_parameter_name_text(self) -> StringText: return syntax_text(self._configuration_parameter_name)