Example #1
0
def get_table_with_metadata(
        table_with_tdiv: Tuple[List[TableDictType], Tag]) -> MetadataTableType:
    table, tdiv = table_with_tdiv
    table_name = pr.table_name(tdiv)
    clean_name = pl.clean_table_name(table_name)
    table_description = pr.table_description(tdiv)
    is_macro = True if MACRO_TABLE_SUFFIX.match(table_name) else False
    # Standard workaround: Add description to module without a description paragraph
    # http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_F.3.html#sect_F.3.2.1
    if table_description.has_attr(
            'class') and 'title' in table_description.get('class'):
        table_description_str = f'<p>{clean_name} {"Macro" if is_macro else "Module"}.</p>'
        table_description = BeautifulSoup(table_description_str, 'html.parser')
    return {
        'name':
        clean_name,
        'attributes':
        table,
        'id':
        pl.create_slug(clean_name),
        'description':
        str(clean_table_description(table_description, is_macro)),
        'linkToStandard':
        fix_nonstandard_section_links(get_short_standard_link(tdiv)),
        'isMacro':
        is_macro,
    }
def get_table_with_metadata(table_with_tdiv):
    table, tdiv = table_with_tdiv
    clean_name = pl.clean_table_name(pr.table_name(tdiv))
    table_description = get_ciod_description(tdiv)
    return {
        'name': clean_name,
        'modules': table,
        'id': pl.create_slug(clean_name),
        'description': str(table_description),
        'linkToStandard': get_short_standard_link(tdiv)
    }
Example #3
0
def get_table_with_metadata(
        table_with_tdiv: Tuple[List[TableDictType], Tag]) -> MetadataTableType:
    table, tdiv = table_with_tdiv
    clean_name = clean_macro_table_name(pr.table_name(tdiv))
    table_description = get_table_description(tdiv)
    return {
        'name': clean_name,
        'macros': table,
        'id': pl.create_slug(clean_name),
        'description': str(table_description),
        'linkToStandard': get_short_standard_link(tdiv)
    }
def get_table_with_metadata(table_with_tdiv: Tuple[List[TableDictType], Tag]) -> MetadataTableType:
    table, tdiv = table_with_tdiv
    clean_name = clean_macro_table_name(pr.table_name(tdiv))
    clean_description = pl.clean_html(str(tdiv.find_previous('p')))
    module_type = 'Multi-frame' if 'Multi-frame' in clean_description \
        else 'Current Frame' if 'Current Frame' in clean_description \
        else None
    return {
        'name': clean_name,
        'macros': table,
        'id': pl.create_slug(clean_name),
        'description': clean_description,
        'linkToStandard': get_short_standard_link(tdiv),
        'moduleType': module_type,
    }
def is_valid_ciod_table(table_div):
    return TABLE_SUFFIX.match(pr.table_name(table_div))
Example #6
0
def is_valid_macro_table(table_div: Tag) -> bool:
    return bool(TABLE_SUFFIX_RE.match(pr.table_name(table_div)))
Example #7
0
def is_valid_ciod_table(table_div: Tag) -> bool:
    return bool(TABLE_SUFFIX.match(pr.table_name(table_div)))
Example #8
0
def is_valid_macro_table(table_div: Tag) -> bool:
    print(pr.table_name(table_div), file=sys.stderr)
    return bool(TABLE_SUFFIX_RE.match(pr.table_name(table_div))) or pr.table_name(table_div) in EXPLICIT_MACRO_TABLE_TITLES
Example #9
0
def is_valid_table(table_div: Tag) -> bool:
    table_name = pr.table_name(table_div)
    return bool(TABLE_SUFFIX.match(table_name)) and 'Example' not in table_name