def href_id(self): """ Method will return unique id of this item if link_name was specified in attributes, it will be used :return: """ if getattr(self, 'attributes', None) and self.attributes.link_name: value = self.attributes.link_name else: value = self.get('unique_name', 'name', 'id') if FormatMode.format_mode == FormatMode.LATEX_MODE: return 'IT::{}'.format(TexList.name_mode(value)) return htmltree.secure(value)
def format(self, selection): """ :type selection: ist.nodes.TypeSelection """ self.root.attrib['id'] = selection.href_id self.root.attrib['data-name'] = htmltree.secure(selection.name) if selection.attributes.obsolete: self.root.attrib['data-obsolete'] = '1' self.mark_as_obsolete(selection) with self.open('header'): refs = selection.get_references() if refs: with self.open('div', cls='references'): self.info('used in: ') self.tag('br') for ref in refs: with self.open('span'): self.link_to_main(ref) if refs.index(ref) != len(refs)-1: self.info(', ') self.main_section_title(selection) self.description(selection.description) if selection.values: self.italic('Values', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for selection_value in selection.values: with self.open('li'): self.item_list_title(selection_value, add_link=True) self.description(selection_value.description) if selection.parameters: self.italic('Parameters', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for param in selection.parameters: reference = param.reference.get_reference() with self.open('li'): with self.open('section', attrib={'class': 'record-param'}): self.h3(param.name) self.span(str(reference.input_type)) self.info(' type of ') self.link_to_main(reference) return self
def format(self, selection): """ :type selection: ist.nodes.TypeSelection """ self.root.attrib['id'] = selection.href_id self.root.attrib['data-name'] = htmltree.secure(selection.name) if selection.attributes.obsolete: self.root.attrib['data-obsolete'] = '1' self.mark_as_obsolete(selection) with self.open('header'): self.add_header_right_side(selection) self.main_section_title(selection) with self.openc('div', 'details'): with self.openc('div', 'section'): self.info('Description') self.description(selection.description) if selection.values: self.spanc('section-list', 'Values') with self.open('ul', attrib={'class': 'item-list'}): for selection_value in selection.values: with self.open('li'): with self.openc('div', 'item-header'): self.item_list_title(selection_value, add_link=True) self.description(selection_value.description) if selection.parameters: self.spanc('section-list', 'Parameters') with self.open('ul', attrib={'class': 'item-list'}): for param in selection.parameters: reference = param.reference.get_reference() with self.open('li'): self.h3(param.name) self.span(str(reference.input_type)) self.info(' type of ') self.link_to_main(reference) return self
def href_name(self): return htmltree.secure(self.key)
def format(self, abstract_record): """ :type abstract_record: ist.nodes.TypeAbstract """ self.root.attrib['id'] = abstract_record.href_id self.root.attrib['data-name'] = htmltree.secure(abstract_record.name) if abstract_record.attributes.obsolete: self.root.attrib['data-obsolete'] = '1' self.mark_as_obsolete(abstract_record) with self.open('header'): self.add_header_right_side(abstract_record) self.main_section_title(abstract_record) with self.openc('div', 'details'): if abstract_record.attributes.root_of_generic_subtree: with self.openc('div', 'section'): self.italic( 'This abstract is root of the generic tree') if abstract_record.default_descendant: reference = abstract_record.default_descendant.get_reference( ) with self.openc('div', 'section'): self.info('Default descendant: ') self.link_to_main(reference) if abstract_record.generic_type: with self.openc('div', 'section'): self.info('Generic type: ') self.link_to_main( abstract_record.generic_type.get_reference()) with self.openc('div', 'section'): self.info('Description') self.description(abstract_record.description) if abstract_record.implementations: self.spanc('section-list', 'Implementations') with self.open('ul', attrib={'class': 'item-list'}): for descendant in abstract_record.implementations: reference = descendant.get_reference() with self.open('li'): with self.openc('div', 'item-header'): with self.open('h3'): self.link_to_main(reference) self.description(reference.description) if abstract_record.attributes.generic_parameters: self.spanc('section-list', 'Generic parameters') with self.open('ul', attrib={'class': 'item-list'}): for param_name in abstract_record.attributes.generic_parameters: with self.open('li'): with self.openc('div', 'item-header'): self.h3(param_name) if abstract_record.parameters: self.spanc('section-list', 'Parameters') with self.open('ul', attrib={'class': 'item-list'}): for param in abstract_record.parameters: reference = param.reference.get_reference() with self.open('li'): with self.openc('div', 'item-header'): self.h3(param.name) self.span(' ' + str(reference.input_type)) self.info(' type of ') with self.openc('span', 'chevron'): self.link_to_main(reference)
def format(self, record): """ :type record: ist.nodes.TypeRecord """ self.root.attrib['id'] = record.href_id self.root.attrib['data-name'] = htmltree.secure(record.name) if record.attributes.obsolete: self.root.attrib['data-obsolete'] = '1' self.mark_as_obsolete(record) with self.open('header'): self.add_header_right_side(record) self.main_section_title(record) with self.openc('div', 'details'): if record.generic_type: with self.openc('div', 'section'): self.info('Generic type: ') self.link_to_main(record.generic_type.get_reference()) if record.reducible_to_key: with self.openc('div', 'section'): self.info('Constructible from key: ') self.link_to_main(record.reducible_to_key) if record.implements: with self.openc('div', 'section'): self.info('Implements abstract type: ') with self.open('ul'): for reference in record.implements: with self.open('li'): self.link_to_main( reference.get_reference()) with self.openc('div', 'section'): self.info('Description') self.description(record.description) if record.keys: self.spanc('section-list', 'Keys') with self.openc('ul', 'item-list'): for record_key in record.keys: if not record_key.include_in_format(): continue with self.open('li'): with self.open('div', attrib={'class': 'r-key'}): link = self.format_key(record_key) with self.openc('div', 'item-header'): if link: self.item_list_title( link, add_link=True, add_id=False, text=record_key.href_name) else: self.item_list_title(record_key, add_link=False) self.format_key_default(record_key) self.description(record_key.description) self.add_clear() # fmt = HTMLFormatter.get_formatter_for(record_key) # fmt.format(record_key, record) # self.add(fmt.current()) if record.attributes.generic_parameters: self.spanc('section-list', 'Generic parameters') with self.open('ul', attrib={'class': 'item-list'}): for param_name in record.attributes.generic_parameters: with self.open('li'): with self.openc('div', 'item-header'): self.h3(param_name) if record.parameters: self.spanc('section-list', 'Parameters') with self.open('ul', attrib={'class': 'item-list'}): for param in record.parameters: reference = param.reference.get_reference() with self.open('li'): with self.openc('div', 'item-header'): self.h3(param.name) self.span(str(reference.input_type)) self.info(' type of ') self.link_to_main(reference)
def format(self, abstract_record): """ :type abstract_record: ist.nodes.TypeAbstract """ self.root.attrib['id'] = abstract_record.href_id self.root.attrib['data-name'] = htmltree.secure(abstract_record.name) if abstract_record.attributes.obsolete: self.root.attrib['data-obsolete'] = '1' self.mark_as_obsolete(abstract_record) with self.open('header'): refs = abstract_record.get_references() if refs: with self.open('div', cls='references'): self.info('used in: ') self.tag('br') for ref in refs: with self.open('span'): self.link_to_main(ref) if refs.index(ref) != len(refs)-1: self.info(', ') self.main_section_title(abstract_record) if abstract_record.default_descendant: reference = abstract_record.default_descendant.get_reference() with self.open('div'): self.italic('Default descendant: ') self.link_to_main(reference) if abstract_record.attributes.root_of_generic_subtree: with self.open('div'): self.italic('This abstract is root of the generic tree') if abstract_record.generic_type: with self.open('div'): self.italic('Generic type: ') self.link_to_main(abstract_record.generic_type.get_reference()) self.italic('Description', attrib={'class': 'section-list'}) self.description(abstract_record.description) if abstract_record.implementations: self.italic('Implementations', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for descendant in abstract_record.implementations: reference = descendant.get_reference() with self.open('li'): with self.open('section', attrib={'class': 'record-param'}): with self.open('h3'): self.link_to_main(reference) self.span(reference.description) if abstract_record.attributes.generic_parameters: self.italic('Generic parameters', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for param_name in abstract_record.attributes.generic_parameters: with self.open('li'): with self.open('section', attrib={'class': 'record-param'}): self.h3(param_name) if abstract_record.parameters: self.italic('Parameters', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for param in abstract_record.parameters: reference = param.reference.get_reference() with self.open('li'): with self.open('section', attrib={'class': 'record-param'}): self.h3(param.name) self.span(str(reference.input_type)) self.info(' type of ') self.link_to_main(reference)
def format(self, record): """ :type record: ist.nodes.TypeRecord """ self.root.attrib['id'] = record.href_id self.root.attrib['data-name'] = htmltree.secure(record.name) if record.attributes.obsolete: self.root.attrib['data-obsolete'] = '1' self.mark_as_obsolete(record) with self.open('header'): refs = record.get_references() if refs: with self.open('div', cls='references'): self.info('used in: ') self.tag('br') for ref in refs: with self.open('span'): self.link_to_main(ref) if refs.index(ref) != len(refs)-1: self.info(', ') self.main_section_title(record) if record.generic_type: with self.open('div'): self.italic('Generic type: ') self.link_to_main(record.generic_type.get_reference()) if record.reducible_to_key: with self.open('div'): self.italic('Constructible from key: ') self.link_to_main(record.reducible_to_key) if record.implements: with self.open('div'): self.italic('Implements abstract type: ') with self.open('ul'): for reference in record.implements: with self.open('li'): self.link_to_main(reference.get_reference()) self.italic('Description', attrib={'class': 'section-list'}) self.description(record.description) if record.keys: self.italic('Keys', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for record_key in record.keys: if not record_key.include_in_format(): continue with self.open('li'): with self.open('section', attrib={'class': 'record-key'}): self.item_list_title(record_key, add_link=True) self.format_key(record_key) self.description(record_key.description) self.add_clear() # fmt = HTMLFormatter.get_formatter_for(record_key) # fmt.format(record_key, record) # self.add(fmt.current()) if record.attributes.generic_parameters: self.italic('Generic parameters', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for param_name in record.attributes.generic_parameters: with self.open('li'): with self.open('section', attrib={'class': 'record-param'}): self.h3(param_name) if record.parameters: self.italic('Parameters', attrib={'class': 'section-list'}) with self.open('ul', attrib={'class': 'item-list'}): for param in record.parameters: reference = param.reference.get_reference() with self.open('li'): with self.open('section', attrib={'class': 'record-param'}): self.h3(param.name) self.span(str(reference.input_type)) self.info(' type of ') self.link_to_main(reference)