From 511b789f2be78e2ece4d0c787ba5db79dc1b6023 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 11 Apr 2022 19:54:38 +0200 Subject: [PATCH 1/5] path_info, not path --- CHANGELOG.rst | 3 +++ feincms3/root/middleware.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 99928c8c..5cf11b29 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,9 @@ Change log .. _Next version: https://github.com/matthiask/feincms3/compare/3.5...main +- Fixed the ``APPEND_SLASH`` handling to also use ``request.path_info``, not + ``request.path``. + `3.5`_ (2022-04-11) ~~~~~~~~~~~~~~~~~~~ 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 From c09385e0c494379fdd24e53f1861b4a91f5f6e1c Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Wed, 4 May 2022 18:02:36 +0200 Subject: [PATCH 2/5] Add reference docs for the template tags --- .pre-commit-config.yaml | 8 ++++---- docs/conf.py | 2 +- docs/ref/templatetags.rst | 7 +++++++ feincms3/templatetags/feincms3.py | 8 ++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 docs/ref/templatetags.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecb30d2b..8000aec2 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.0 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/adamchainz/django-upgrade - rev: 1.4.0 + rev: 1.6.0 hooks: - id: django-upgrade args: [--target-version, "3.2"] @@ -46,13 +46,13 @@ repos: args: [--list-different, --no-semi] exclude: "^conf/|.*\\.html$" - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.12.0 + rev: v8.14.0 hooks: - id: eslint args: [--fix] verbose: true additional_dependencies: - - eslint@8.12.0 + - eslint@8.14.0 - eslint-config-prettier@8.5.0 - "@babel/core" - "@babel/eslint-parser" 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/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/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) From e78afe8356d9e32b4d9b58b915505c5b07e4adea Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Thu, 12 May 2022 16:20:03 +0200 Subject: [PATCH 3/5] Add support for YouTube shorts --- CHANGELOG.rst | 2 ++ feincms3/embedding.py | 2 +- tests/testapp/test_embedding.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5cf11b29..887a3f5d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,8 @@ Change log - 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`. `3.5`_ (2022-04-11) 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/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""" From 81cb52d8816edf59ced8f151fda0ed495144e6da Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Thu, 12 May 2022 17:41:39 +0200 Subject: [PATCH 4/5] Add old_richtext API docs --- .pre-commit-config.yaml | 10 +++++----- CHANGELOG.rst | 2 ++ docs/ref/plugins.rst | 10 ++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8000aec2..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.32.0 + rev: v2.32.1 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/adamchainz/django-upgrade - rev: 1.6.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.14.0 + rev: v8.15.0 hooks: - id: eslint args: [--fix] verbose: true additional_dependencies: - - eslint@8.14.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 887a3f5d..04c64b84 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,8 @@ Change log ``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/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: From a85f4bf10df131049e29f6c26389f349a360debc Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Thu, 12 May 2022 17:43:12 +0200 Subject: [PATCH 5/5] feincms3 3.6 --- CHANGELOG.rst | 8 +++++++- feincms3/__init__.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 04c64b84..77425163 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,13 @@ 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``. 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))