diff --git a/CHANGELOG.md b/CHANGELOG.md index cee7faf3..9cdcc0bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## Version 6.0.1 (April 12, 2021) + +- The `remove_terminal_escapes` step was accidentally not being used. This + version restores it. + +- Specified in setup.py that ftfy 6 requires Python 3.6 or later. + +- Use a lighter link color when the docs are viewed in dark mode. + ## Version 6.0 (April 2, 2021) - New function: `ftfy.fix_and_explain()` can describe all the transformations @@ -17,7 +26,7 @@ use less RAM when imported. - The heuristic `ftfy.badness.is_bad(text)` can be used to determine whether - there apears to be mojibake in a string. Some users were already using + there appears to be mojibake in a string. Some users were already using the old function `sequence_weirdness()` for that, but this one is actually designed for that purpose. diff --git a/README.md b/README.md index 2a4809fb..f6bd747e 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,15 @@ The full documentation of ftfy is available at [ftfy.readthedocs.org](https://ftfy.readthedocs.org). The documentation covers a lot more than this README, so here are some links into it: -- [Fixing problems and getting explanations](https://ftfy.readthedocs.io/en/v6.0/explain.html) -- [Configuring ftfy](https://ftfy.readthedocs.io/en/v6.0/config.html) -- [Encodings ftfy can handle](https://ftfy.readthedocs.io/en/v6.0/encodings.html) -- [“Fixer” functions](https://ftfy.readthedocs.io/en/v6.0/fixes.html) -- [Is ftfy an encoding detector?](https://ftfy.readthedocs.io/en/v6.0/detect.html) -- [Heuristics for detecting mojibake](https://ftfy.readthedocs.io/en/v6.0/heuristics.html) -- [Support for “bad” encodings](https://ftfy.readthedocs.io/en/v6.0/bad_encodings.html) -- [Command-line usage](https://ftfy.readthedocs.io/en/v6.0/cli.html) -- [Citing ftfy](https://ftfy.readthedocs.io/en/v6.0/cite.html) +- [Fixing problems and getting explanations](https://ftfy.readthedocs.io/en/v6.0.1/explain.html) +- [Configuring ftfy](https://ftfy.readthedocs.io/en/v6.0.1/config.html) +- [Encodings ftfy can handle](https://ftfy.readthedocs.io/en/v6.0.1/encodings.html) +- [“Fixer” functions](https://ftfy.readthedocs.io/en/v6.0.1/fixes.html) +- [Is ftfy an encoding detector?](https://ftfy.readthedocs.io/en/v6.0.1/detect.html) +- [Heuristics for detecting mojibake](https://ftfy.readthedocs.io/en/v6.0.1/heuristics.html) +- [Support for “bad” encodings](https://ftfy.readthedocs.io/en/v6.0.1/bad_encodings.html) +- [Command-line usage](https://ftfy.readthedocs.io/en/v6.0.1/cli.html) +- [Citing ftfy](https://ftfy.readthedocs.io/en/v6.0.1/cite.html) ## Testimonials diff --git a/docs/conf.py b/docs/conf.py index 1e8c0f6e..2f98f740 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ # built documents. # # The short X.Y version. -version = '5.9' +version = '6.0' # The full version, including alpha/beta/rc tags. -release = '5.9' +release = '6.0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -111,6 +111,15 @@ # I don't know why furo wants inline code to be so small, but don't let it "font-size--small--2": "100%", }, + "dark_css_variables": { + "color-brand-primary": "#AC8DFF", + "color-brand-content": "#AC8DFF", + "font-stack": "Source Sans Pro, sans-serif", + "font-stack--monospace": "Inconsolata", + "code-font-size": "18px", + + "font-size--small--2": "100%", + }, } html_css_files = [ 'css/custom.css', diff --git a/docs/index.rst b/docs/index.rst index f9734ca1..18082d8c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ ftfy: fixes text for you ======================== -*Version 6.0* +*Version 6.0.1* **ftfy** fixes Unicode that's broken in various ways. diff --git a/ftfy/__init__.py b/ftfy/__init__.py index b52288a7..2c8be4f8 100644 --- a/ftfy/__init__.py +++ b/ftfy/__init__.py @@ -13,7 +13,7 @@ from ftfy.badness import is_bad from ftfy.formatting import display_ljust -__version__ = "6.0" +__version__ = "6.0.1" # Though this function does nothing, it lets linters know that we're using @@ -343,6 +343,7 @@ def fix_and_explain( "uncurl_quotes", "fix_line_breaks", "fix_surrogates", + "remove_terminal_escapes", "remove_control_chars", ]: text = _try_fix(fixer, text, config, steps) @@ -517,7 +518,7 @@ def fix_encoding(text: str, config: TextFixerConfig = None, **kwargs): 'ó' """ if config is None: - config = TextFixerConfig() + config = TextFixerConfig(explain=False) config = config._replace(**kwargs) fixed, _explan = fix_encoding_and_explain(text, config) return fixed diff --git a/setup.py b/setup.py index 215dd22e..af9af78b 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name="ftfy", - version='6.0', + version='6.0.1', maintainer='Robyn Speer', maintainer_email='rspeer@luminoso.com', license="MIT", @@ -33,7 +33,7 @@ packages=['ftfy', 'ftfy.bad_codecs'], install_requires=['wcwidth'], tests_require=['pytest'], - python_requires='>=3.5', + python_requires='>=3.6', classifiers=[ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", diff --git a/tests/test_characters.py b/tests/test_characters.py index 52318e40..91fa872b 100644 --- a/tests/test_characters.py +++ b/tests/test_characters.py @@ -1,4 +1,6 @@ -from ftfy import fix_encoding, fix_encoding_and_explain, fix_text, apply_plan +from ftfy import ( + fix_encoding, fix_encoding_and_explain, fix_text, fix_and_explain, apply_plan +) from ftfy.fixes import remove_control_chars, fix_surrogates from ftfy.chardata import possible_encoding from ftfy.badness import badness @@ -44,3 +46,12 @@ def test_surrogates(): assert fix_surrogates('\udbff\udfff') == '\U0010ffff' assert fix_surrogates('\ud800\udc00') == '\U00010000' + +def test_color_escapes(): + fixed, plan = fix_and_explain("\001\033[36;44mfoo") + print(plan) + assert fixed == "foo" + assert plan == [ + ("apply", "remove_terminal_escapes"), + ("apply", "remove_control_chars") + ]