{
    "Upper-case text": "from calibre.utils.icu import change_case\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_match_groups\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Make matched text upper case. If the regular expression contains groups,\n    only the text in the groups will be changed, otherwise the entire text is\n    changed.'''\n    return apply_func_to_match_groups(match, upper)\n",
    "Lower-case text": "from calibre.utils.icu import change_case\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_match_groups\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Make matched text lower case. If the regular expression contains groups,\n    only the text in the groups will be changed, otherwise the entire text is\n    changed.'''\n    return apply_func_to_match_groups(match, lower)\n",
    "Capitalize text": "from calibre.utils.icu import capitalize\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_match_groups\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Capitalize matched text. If the regular expression contains groups,\n    only the text in the groups will be changed, otherwise the entire text is\n    changed.'''\n    return apply_func_to_match_groups(match, capitalize)\n",
    "Title-case text": "from calibre.utils.titlecase import titlecase\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_match_groups\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Title-case matched text. If the regular expression contains groups,\n    only the text in the groups will be changed, otherwise the entire text is\n    changed.'''\n    return apply_func_to_match_groups(match, titlecase)\n",
    "Swap the case of text": "from calibre_extensions.icu import swap_case\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_match_groups\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Swap the case of the matched text. If the regular expression contains groups,\n    only the text in the groups will be changed, otherwise the entire text is\n    changed.'''\n    return apply_func_to_match_groups(match, swapcase)\n",
    "Upper-case text (ignore tags)": "from calibre.utils.icu import change_case\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_html_text\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Make matched text upper case, ignoring the text inside tag definitions.'''\n    return apply_func_to_html_text(match, upper)\n",
    "Lower-case text (ignore tags)": "from calibre.utils.icu import change_case\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_html_text\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Make matched text lower case, ignoring the text inside tag definitions.'''\n    return apply_func_to_html_text(match, lower)\n",
    "Capitalize text (ignore tags)": "from calibre.utils.icu import capitalize\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_html_text\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Capitalize matched text, ignoring the text inside tag definitions.'''\n    return apply_func_to_html_text(match, capitalize)\n",
    "Title-case text (ignore tags)": "from calibre.utils.titlecase import titlecase\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_html_text\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Title-case matched text, ignoring the text inside tag definitions.'''\n    return apply_func_to_html_text(match, titlecase)\n",
    "Swap the case of text (ignore tags)": "from calibre_extensions.icu import swap_case\nfrom calibre.ebooks.oeb.polish.utils import apply_func_to_html_text\n\ndef replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):\n    '''Swap the case of the matched text, ignoring the text inside tag definitions.'''\n    return apply_func_to_html_text(match, swapcase)\n"
}