diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecb30d2b..7142283a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,12 +16,12 @@ repos: language: system always_run: true - repo: https://github.com/asottile/pyupgrade - rev: v2.31.1 + rev: v2.32.1 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/adamchainz/django-upgrade - rev: 1.4.0 + rev: 1.7.0 hooks: - id: django-upgrade args: [--target-version, "3.2"] @@ -46,14 +46,14 @@ repos: args: [--list-different, --no-semi] exclude: "^conf/|.*\\.html$" - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.12.0 + rev: v8.15.0 hooks: - id: eslint args: [--fix] verbose: true additional_dependencies: - - eslint@8.12.0 - - eslint-config-prettier@8.5.0 + - eslint@8.15.0 + - eslint-config-prettier@^8.5.0 - "@babel/core" - "@babel/eslint-parser" - "@babel/preset-env" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 99928c8c..77425163 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,20 @@ Change log `Next version`_ ~~~~~~~~~~~~~~~ -.. _Next version: https://github.com/matthiask/feincms3/compare/3.5...main +.. _Next version: https://github.com/matthiask/feincms3/compare/3.6...main + + +`3.6`_ (2022-05-12) +~~~~~~~~~~~~~~~~~~~ + +.. _3.6: https://github.com/matthiask/feincms3/compare/3.5...3.6 + +- Fixed the ``APPEND_SLASH`` handling to also use ``request.path_info``, not + ``request.path``. +- Added support for embedding YouTube shorts when using + :mod:`feincms3.embedding`. +- Added autogenerated API documentation for the template tags and the + ``old_richtext`` plugin to the docs. `3.5`_ (2022-04-11) diff --git a/docs/conf.py b/docs/conf.py index bcecff3f..9a5313cf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,7 +17,7 @@ release = subprocess.check_output( "git fetch --tags; git describe", shell=True, - universal_newlines=True, + text=True, ).strip() language = "en" diff --git a/docs/ref/plugins.rst b/docs/ref/plugins.rst index eb9848ed..aceae68b 100644 --- a/docs/ref/plugins.rst +++ b/docs/ref/plugins.rst @@ -44,3 +44,13 @@ Snippets .. automodule:: feincms3.plugins.snippet :members: + + +Deprecated plugins +~~~~~~~~~~~~~~~~~~ + +Rich text support using django-ckeditor +--------------------------------------- + +.. automodule:: feincms3.plugins.old_richtext + :members: diff --git a/docs/ref/templatetags.rst b/docs/ref/templatetags.rst new file mode 100644 index 00000000..57b54599 --- /dev/null +++ b/docs/ref/templatetags.rst @@ -0,0 +1,7 @@ +.. _ref-templatetags: + +Template tags (``feincms3.templatetags.feincms3``) +================================================== + +.. automodule:: feincms3.templatetags.feincms3 + :members: diff --git a/feincms3/__init__.py b/feincms3/__init__.py index 10734fc1..b1e7b2e8 100644 --- a/feincms3/__init__.py +++ b/feincms3/__init__.py @@ -1,2 +1,2 @@ -VERSION = (3, 5, 0) +VERSION = (3, 6, 0) __version__ = ".".join(map(str, VERSION)) diff --git a/feincms3/embedding.py b/feincms3/embedding.py index 20699772..b52d2dc5 100644 --- a/feincms3/embedding.py +++ b/feincms3/embedding.py @@ -13,7 +13,7 @@ YOUTUBE_RE = re.compile( r"""youtu(\.?)be(\.com)?/ # match youtube's domains (\#/)? # for mobile urls - (embed/)? # match the embed url syntax + (embed/|shorts/|watch/)? # match the embed/shorts/watch url syntax (v/)? (watch\?v=)? # match the youtube page url (ytscreeningroom\?v=)? diff --git a/feincms3/root/middleware.py b/feincms3/root/middleware.py index 9dc66883..c77441c8 100644 --- a/feincms3/root/middleware.py +++ b/feincms3/root/middleware.py @@ -96,7 +96,7 @@ def inner(request): if qs.filter(path=target).exists(): return HttpResponseRedirect(target) if settings.APPEND_SLASH and not request.path_info.endswith("/"): - target = request.path + "/" + target = request.path_info + "/" if qs.filter(path=target).exists(): return HttpResponsePermanentRedirect(target) return response diff --git a/feincms3/templatetags/feincms3.py b/feincms3/templatetags/feincms3.py index 4e6dde71..cea158b8 100644 --- a/feincms3/templatetags/feincms3.py +++ b/feincms3/templatetags/feincms3.py @@ -160,6 +160,14 @@ def translations(iterable): @register.simple_tag def maybe_target_blank(href, *, attributes='target="_blank" rel="noopener"'): + """ + Return the value of ``attributes`` if the first argument isn't a first party link + (as determined by :func:`~feincms3.utils.is_first_party_link`) + + Usage:: + + ... + """ if is_first_party_link(href): return "" return mark_safe(attributes) diff --git a/tests/testapp/test_embedding.py b/tests/testapp/test_embedding.py index 836bd5c2..a6676c80 100644 --- a/tests/testapp/test_embedding.py +++ b/tests/testapp/test_embedding.py @@ -34,6 +34,8 @@ def test_youtube(self): "https://www.youtube.com/watch?v=DYu_bGbZiiQ&list=RDJMOOG7rWTPg&index=7" ) ) + self.assertTrue(embed("https://www.youtube.com/watch/ZumRshfKdtM")) + self.assertTrue(embed("https://www.youtube.com/shorts/ZumRshfKdtM")) def test_vimeo(self): """Vimeo video embedding works"""