Skip to content

Commit

Permalink
Merge pull request #4 from raimon49/release-1.3.0
Browse files Browse the repository at this point in the history
Release 1.3.0
  • Loading branch information
raimon49 committed Aug 10, 2020
2 parents 52032ef + 0c574f4 commit 7a11a83
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dist: xenial
language: python
python:
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9-dev"
install:
- pip install -r dev-requirements.txt
script:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## CHANGELOG

### 1.3.0

* Migrate using Python package from `bleach-whitelist` to `bleach-allowlist`
* Clarified support for Python 3.9
* Dropped support Python 3.5

### 1.2.0

* Clarified support for Python 3.8
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ When raw HTML like `<font>` tag is used in MKDocs, it is rendered as it is.

![No escaped font](https://user-images.githubusercontent.com/221802/35481481-ac9e4894-0467-11e8-89ab-47ca5037d9d2.png)

If you use this plug-in with MKDocs, tags that are not allowed in the whitelist are escaped.
If you use this plug-in with MKDocs, tags that are not allowed in the allowlist are escaped.

![Escaped font](https://user-images.githubusercontent.com/221802/35481484-b268e02c-0467-11e8-8b7a-c3c7232312ed.png)

Expand All @@ -42,7 +42,7 @@ An example of use can be checked by [example/basic-usage](https://github.com/rai
## Plugin configuration
This plugin works with the HTML tag element for Markdown defined by [bleach-whitelist](https://github.com/yourcelf/bleach-whitelist/blob/master/bleach_whitelist/bleach_whitelist.py) enabled. This implementation approach is recommended in [the Python-Markdown release notes](https://python-markdown.github.io/change_log/release-2.6/).
This plugin works with the HTML tag element for Markdown defined by [bleach-allowlist](https://github.com/yourcelf/bleach-allowlist/blob/main/bleach_allowlist/bleach_allowlist.py) enabled. This implementation approach is recommended in [the Python-Markdown release notes](https://python-markdown.github.io/change_log/release-2.6/).
And user can change this setting.
Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ wheel
pip-tools
pypandoc
pytest-cov
pytest-pycodestyle<2.1 # Pinned for Python 3.5
pytest-pycodestyle
pytest-runner
twine<2 # Pinned for Python 3.5
twine
32 changes: 20 additions & 12 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
# pip-compile dev-requirements.in
#
attrs==19.3.0 # via pytest
autopep8==1.5.3 # via -r dev-requirements.in
bleach-whitelist==0.0.10 # via -r requirements.in
autopep8==1.5.4 # via -r dev-requirements.in
bleach-allowlist==1.0.2 # via -r requirements.in
bleach==3.1.5 # via -r requirements.in, readme-renderer
certifi==2020.6.20 # via requests
cffi==1.14.1 # via cryptography
chardet==3.0.4 # via requests
click==7.1.2 # via mkdocs, nltk, pip-tools
codecov==2.1.7 # via -r dev-requirements.in
coverage==5.1 # via codecov, pytest-cov
codecov==2.1.8 # via -r dev-requirements.in
colorama==0.4.3 # via twine
coverage==5.2.1 # via codecov, pytest-cov
cryptography==3.0 # via secretstorage
docutils==0.16 # via -r dev-requirements.in, readme-renderer
future==0.18.2 # via lunr
idna==2.10 # via requests
jeepney==0.4.3 # via keyring, secretstorage
jinja2==2.11.2 # via mkdocs
joblib==0.14.1 # via nltk
joblib==0.16.0 # via nltk
keyring==21.3.0 # via twine
livereload==2.6.2 # via mkdocs
lunr[languages]==0.5.8 # via mkdocs
markdown==3.2.2 # via mkdocs
Expand All @@ -26,29 +31,32 @@ mkdocs==1.1.2 # via -r requirements.in
more-itertools==8.4.0 # via pytest
nltk==3.5 # via lunr
packaging==20.4 # via bleach, pytest
pip-tools==5.2.1 # via -r dev-requirements.in
pip-tools==5.3.1 # via -r dev-requirements.in
pkginfo==1.5.0.1 # via twine
pluggy==0.13.1 # via pytest
py==1.9.0 # via pytest
pycodestyle==2.6.0 # via autopep8, pytest-pycodestyle
pycparser==2.20 # via cffi
pygments==2.6.1 # via readme-renderer
pypandoc==1.5 # via -r dev-requirements.in
pyparsing==2.4.7 # via packaging
pytest-cov==2.10.0 # via -r dev-requirements.in
pytest-pycodestyle==2.0.0 # via -r dev-requirements.in
pytest-pycodestyle==2.1.3 # via -r dev-requirements.in
pytest-runner==5.2 # via -r dev-requirements.in
pytest==5.4.3 # via pytest-cov, pytest-pycodestyle
pyyaml==5.3.1 # via mkdocs
readme-renderer==26.0 # via twine
regex==2020.6.8 # via nltk
regex==2020.7.14 # via nltk
requests-toolbelt==0.9.1 # via twine
requests==2.24.0 # via codecov, requests-toolbelt, twine
six==1.15.0 # via bleach, livereload, lunr, packaging, pip-tools, readme-renderer
rfc3986==1.4.0 # via twine
secretstorage==3.1.2 # via keyring
six==1.15.0 # via bleach, cryptography, livereload, lunr, packaging, pip-tools, readme-renderer
toml==0.10.1 # via autopep8
tornado==6.0.4 # via livereload, mkdocs
tqdm==4.47.0 # via nltk, twine
twine==1.15.0 # via -r dev-requirements.in
urllib3==1.25.9 # via requests
tqdm==4.48.2 # via nltk, twine
twine==3.2.0 # via -r dev-requirements.in
urllib3==1.25.10 # via requests
wcwidth==0.2.5 # via pytest
webencodings==0.5.1 # via bleach
wheel==0.34.2 # via -r dev-requirements.in, pypandoc
Expand Down
2 changes: 1 addition & 1 deletion mkdocssafetext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
__version__ = '1.2.0'
__version__ = '1.3.0'
__author__ = 'raimon'
__license__ = 'BSD License'
10 changes: 5 additions & 5 deletions mkdocssafetext/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import copy

from mkdocs.config import config_options
from bleach_whitelist.bleach_whitelist import (
markdown_tags as whitelist_markdown_tags,
markdown_attrs as whitelist_markdown_attrs
from bleach_allowlist.bleach_allowlist import (
markdown_tags as allowlist_markdown_tags,
markdown_attrs as allowlist_markdown_attrs
)


Expand All @@ -45,8 +45,8 @@


class SafeTextPluginConfig(object):
markdown_tags = copy.deepcopy(whitelist_markdown_tags)
markdown_attrs = copy.deepcopy(whitelist_markdown_attrs)
markdown_tags = copy.deepcopy(allowlist_markdown_tags)
markdown_attrs = copy.deepcopy(allowlist_markdown_attrs)

def __init__(self, config):
self._update_allowed_tags(config['append_allowed_tags'],
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bleach
bleach-whitelist
bleach-allowlist
mkdocs>=0.17.0
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ classifiers =
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Documentation
Topic :: Text Processing

[options]
packages = find:
include_package_data = True
python_requires = ~=3.5
python_requires = ~=3.6
setup_requires =
setuptools >= 40.9.0
pytest-runner
install_requires =
bleach
bleach-whitelist
bleach-allowlist
mkdocs>=0.17.0
tests_require =
pytest-cov
Expand Down
18 changes: 9 additions & 9 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# vim:fenc=utf-8 ff=unix ft=python ts=4 sw=4 sts=4 si et
import unittest

from bleach_whitelist.bleach_whitelist import (
markdown_tags as whitelist_markdown_tags,
markdown_attrs as whitelist_markdown_attrs
from bleach_allowlist.bleach_allowlist import (
markdown_tags as allowlist_markdown_tags,
markdown_attrs as allowlist_markdown_attrs
)
from mkdocssafetext.config import SafeTextPluginConfig

Expand All @@ -12,7 +12,7 @@ class TestSafeTextPlugin(unittest.TestCase):
def setUp(self):
pass

def test_default_config_is_based_on_whitelist(self):
def test_default_config_is_based_on_allowlist(self):
config_is_nothing = {
'append_allowed_tags': [],
'remove_allowed_tags': [],
Expand All @@ -21,9 +21,9 @@ def test_default_config_is_based_on_whitelist(self):
plugin_config = SafeTextPluginConfig(config_is_nothing)

self.assertEqual(plugin_config.markdown_tags,
whitelist_markdown_tags)
allowlist_markdown_tags)
self.assertEqual(plugin_config.markdown_attrs,
whitelist_markdown_attrs)
allowlist_markdown_attrs)

def test_append_allowed_tags(self):
config_append_allowed_tags = {
Expand All @@ -37,7 +37,7 @@ def test_append_allowed_tags(self):
self.assertIn('audio', plugin_config.markdown_tags)
self.assertNotIn('undefined', plugin_config.markdown_tags)
self.assertNotEqual(plugin_config.markdown_tags,
whitelist_markdown_tags)
allowlist_markdown_tags)

def test_remove_allowed_tags(self):
config_remove_allowed_tags = {
Expand All @@ -52,7 +52,7 @@ def test_remove_allowed_tags(self):
self.assertNotIn('li', plugin_config.markdown_tags)
self.assertIn('h1', plugin_config.markdown_tags)
self.assertNotEqual(plugin_config.markdown_tags,
whitelist_markdown_tags)
allowlist_markdown_tags)

def test_allowed_attrs(self):
config_allowed_attrs = {
Expand All @@ -65,7 +65,7 @@ def test_allowed_attrs(self):
self.assertEqual(plugin_config.markdown_attrs,
config_allowed_attrs['allowed_attrs'])
self.assertNotEqual(plugin_config.markdown_attrs,
whitelist_markdown_attrs)
allowlist_markdown_attrs)

def test_str(self):
config_is_nothing = {
Expand Down

0 comments on commit 7a11a83

Please sign in to comment.