Skip to content

Commit c09385e

Browse files
committed
Add reference docs for the template tags
1 parent 511b789 commit c09385e

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ repos:
1616
language: system
1717
always_run: true
1818
- repo: https://github.com/asottile/pyupgrade
19-
rev: v2.31.1
19+
rev: v2.32.0
2020
hooks:
2121
- id: pyupgrade
2222
args: [--py38-plus]
2323
- repo: https://github.com/adamchainz/django-upgrade
24-
rev: 1.4.0
24+
rev: 1.6.0
2525
hooks:
2626
- id: django-upgrade
2727
args: [--target-version, "3.2"]
@@ -46,13 +46,13 @@ repos:
4646
args: [--list-different, --no-semi]
4747
exclude: "^conf/|.*\\.html$"
4848
- repo: https://github.com/pre-commit/mirrors-eslint
49-
rev: v8.12.0
49+
rev: v8.14.0
5050
hooks:
5151
- id: eslint
5252
args: [--fix]
5353
verbose: true
5454
additional_dependencies:
55-
- eslint@8.12.0
55+
- eslint@8.14.0
5656
- eslint-config-prettier@8.5.0
5757
- "@babel/core"
5858
- "@babel/eslint-parser"

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
release = subprocess.check_output(
1818
"git fetch --tags; git describe",
1919
shell=True,
20-
universal_newlines=True,
20+
text=True,
2121
).strip()
2222
language = "en"
2323

docs/ref/templatetags.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. _ref-templatetags:
2+
3+
Template tags (``feincms3.templatetags.feincms3``)
4+
==================================================
5+
6+
.. automodule:: feincms3.templatetags.feincms3
7+
:members:

feincms3/templatetags/feincms3.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ def translations(iterable):
160160

161161
@register.simple_tag
162162
def maybe_target_blank(href, *, attributes='target="_blank" rel="noopener"'):
163+
"""
164+
Return the value of ``attributes`` if the first argument isn't a first party link
165+
(as determined by :func:`~feincms3.utils.is_first_party_link`)
166+
167+
Usage::
168+
169+
<a href="{{ url }}" {% maybe_target_blank url %}>...</a>
170+
"""
163171
if is_first_party_link(href):
164172
return ""
165173
return mark_safe(attributes)

0 commit comments

Comments
 (0)