]>
git.p6c8.net - pcdenotes.git/blob - notes/templatetags/notes_extras.py
81674b8c9aa2931db0dc1badcfa60ff4995bbdc6
1 from django
import template
2 from django
.template
.defaultfilters
import stringfilter
5 from markdown
.extensions
import Extension
9 register
= template
.Library()
11 # See https://python-markdown.github.io/change_log/release-3.0/#safe_mode-and-html_replacement_text-keywords-deprecated
12 class EscapeHtml(Extension
):
13 def extendMarkdown(self
, md
):
14 md
.preprocessors
.deregister('html_block')
15 md
.inlinePatterns
.deregister('html')
20 return md
.markdown(value
, extensions
=[EscapeHtml(), 'nl2br'])
23 def month_name(value
):
24 return calendar
.month_name
[value
]
patrick-canterino.de