

@ensure_tag(['p'])
def is_header(el, meta_data):
    if _is_top_level_upper_roman(el, meta_data):
        return 'h2'
    el_is_natural_header = is_natural_header(el, meta_data.styles_dict)
    if el_is_natural_header:
        return el_is_natural_header
    if _is_li(el):
        return False
    w_namespace = get_namespace(el, 'w')
    if (el.tag == ('%stbl' % w_namespace)):
        return False
    if DETECT_FONT_SIZE:
        font_size = get_font_size(el, meta_data.styles_dict)
        if (font_size is not None):
            if meta_data.font_sizes_dict[font_size]:
                return meta_data.font_sizes_dict[font_size]
    num_words = len(etree.tostring(el, encoding=unicode, method='text').split(' '))
    if (num_words > 8):
        return False
    (whole_line_bold, whole_line_italics) = whole_line_styled(el)
    if (whole_line_bold or whole_line_italics):
        return 'h2'
    return False

dataset/ETHPy150Open PolicyStat/docx2html/docx2html/core.py is_header/original