def __set_EG_PContents__()

in src/simplify_docx/utils/set_options.py [0:0]


def __set_EG_PContents__(options: Dict[str, Union[str, bool, int, float]]) -> None:
    """
    group:"EG_PContent"
    """
    TAGS_TO_YIELD: Dict[str, Type[el]] = {qn("w:subDoc"): subDoc}

    TAGS_TO_NEST: Dict[str, str] = {qn("w:r"): "CT_R"}

    # -----------------------------------------------
    if options["flatten-simpleField"]:
        TAGS_TO_NEST[qn("w:fldSimple")] = "EG_PContent"
    else:
        TAGS_TO_YIELD[qn("w:fldSimple")] = fldSimple

    # -----------------------------------------------
    if options["flatten-hyperlink"]:
        TAGS_TO_NEST[qn("w:hyperlink")] = "EG_PContent"
    else:
        TAGS_TO_YIELD[qn("w:hyperlink")] = hyperlink

    # -----------------------------------------------
    register_iterator(
        "EG_PContent",
        TAGS_TO_YIELD=TAGS_TO_YIELD,
        TAGS_TO_NEST=TAGS_TO_NEST,
        TAGS_TO_IGNORE=[qn("w:customXmlPr"), qn("w:smartTagPr")],
        extends=["EG_RunLevelElts"],
        check_name=False,
    )