Skip to content

Commit

Permalink
Merge pull request #126 from oprypin/esc
Browse files Browse the repository at this point in the history
For jinja autoescape, mark HTML strings as safe, not needing escaping
  • Loading branch information
timvink committed Feb 1, 2024
2 parents abfc750 + 77bff0c commit ce28e85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions mkdocs_git_revision_date_localized_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os
import time

from markupsafe import Markup

from mkdocs_git_revision_date_localized_plugin.ci import raise_ci_warnings
from mkdocs_git_revision_date_localized_plugin.dates import get_date_formats

Expand Down Expand Up @@ -85,7 +87,7 @@ def get_git_commit_timestamp(
commit_timestamp = git.log(
realpath, date="unix", format="%at", diff_filter="A", no_show_signature=True, follow=True
)
# A file can be created multiple times, through a file renamed.
# A file can be created multiple times, through a file renamed.
# Commits are ordered with most recent commit first
# Get the oldest commit only
if commit_timestamp != "":
Expand Down Expand Up @@ -165,7 +167,7 @@ def get_date_formats_for_timestamp(
dict: Localized date variants.
"""
date_formats = get_date_formats(
unix_timestamp=commit_timestamp,
unix_timestamp=commit_timestamp,
time_zone=self.config.get("timezone"),
locale=locale,
custom_format=self.config.get('custom_format')
Expand All @@ -183,7 +185,7 @@ def add_spans(date_formats: Dict[str, str]) -> Dict[str, str]:
"""
for date_type, date_string in date_formats.items():
date_formats[date_type] = (
'<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-%s">%s</span>'
Markup('<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-%s">%s</span>')
% (date_type, date_string)
)
return date_formats
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mkdocs>=1.0
GitPython
babel>=2.7.0
pytz
pytz
markupsafe

0 comments on commit ce28e85

Please sign in to comment.