@ensure_tag(['p', 'ins', 'smartTag', 'hyperlink'])
def get_element_content(
        p,
        meta_data,
        is_td=False,
        remove_italics=False,
        remove_bold=False,
):

    # Only remove bold or italics if this tag is an h tag.
    # Td elements have the same look and feel as p/h elements. Right now we are
    # never putting h tags in td elements, as such if we are in a td we will
    # never be stripping bold/italics since that is only done on h tags
    if not is_td and is_header(p, meta_data):
        # Check to see if the whole line is bold or italics.
        remove_bold, remove_italics = whole_line_styled(p)

    p_text = ''
    w_namespace = get_namespace(p, 'w')
    if len(p) == 0:
        return ''
    # Only these tags contain text that we care about (eg. We don't care about
    # delete tags)
    content_tags = (
        '%sr' % w_namespace,
        '%shyperlink' % w_namespace,
        '%sins' % w_namespace,
        '%ssmartTag' % w_namespace,
    )
    elements_with_content = []
    for child in p:
        if child is None:
            break
        if child.tag in content_tags:
            elements_with_content.append(child)

    # Gather the content from all of the children
    for el in elements_with_content:
        # Hyperlinks and insert tags need to be handled differently than
        # r and smart tags.
        if el.tag in ('%sins' % w_namespace, '%ssmartTag' % w_namespace):
            p_text += get_element_content(
                el,
                meta_data,
                remove_bold=remove_bold,
                remove_italics=remove_italics,
            )
        elif el.tag == '%shyperlink' % w_namespace:
            p_text += build_hyperlink(el, meta_data)
        elif el.tag == '%sr' % w_namespace:
            p_text += get_text_run_content(
                el,
                meta_data,
                remove_bold=remove_bold,
                remove_italics=remove_italics,
            )
        else:
            raise SyntaxNotSupported(
                'Content element "%s" not handled.' % el.tag
            )

    # This function does not return a p tag since other tag types need this as
    # well (td, li).
    return p_text
Creates the test template in the given template directory, with
dataset/ETHPy150Open PolicyStat/docx2html/docx2html/core.py/get_element_content--crossover with--dataset/ETHPy150Open stephenmcd/django-overextends/overextends/tests.py/Tests._create_template