editor-functions.json 4.2 KB

123456789101112
  1. {
  2. "Upper-case text": "from calibre.utils.icu import upper\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",
  3. "Lower-case text": "from calibre.utils.icu import lower\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",
  4. "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",
  5. "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",
  6. "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",
  7. "Upper-case text (ignore tags)": "from calibre.utils.icu import upper\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",
  8. "Lower-case text (ignore tags)": "from calibre.utils.icu import lower\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",
  9. "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",
  10. "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",
  11. "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"
  12. }