Commit 74bbf63a authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Bug fix: markdown renderer



The version of misaka used in development and in the docker container
weren't the same, bringing a type error. I fixed by using the right
syntax. The drawback of using an older version of misaka markdown
renderer is the lack of extesion support for some common features such
as footnotes and new syntax for links.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 5337ba09
Pipeline #30606 failed with stage
in 1 minute and 18 seconds
......@@ -2,26 +2,20 @@ import json
from django import template
from django.utils.safestring import mark_safe
from misaka import Markdown, HtmlRenderer
from misaka import Markdown, HtmlRenderer, EXT_SUPERSCRIPT, EXT_FENCED_CODE, EXT_AUTOLINK
from main.models import Job
register = template.Library()
@register.filter(name='markdown')
def markdown(value):
def markdown_filter(value):
""" Convert markdown content into HTML. """
renderer = HtmlRenderer()
markdown = Markdown(
renderer,
extensions=(
'fenced-code',
'footnotes',
'superscript',
'quote',
))
return markdown(value)
extensions=EXT_SUPERSCRIPT | EXT_FENCED_CODE )
return markdown.render(value)
@register.filter(name='email2name')
......@@ -29,7 +23,6 @@ def email2name(email):
""" Convert INRIA/IRISA emails into firstname name pattern
"""
value = email.split('@')
print(len(value))
if '.' in value[0]:
data = value[0].split('.')
contact = data[0] + ' ' + data[1]
......@@ -73,4 +66,3 @@ def status_icon(obj):
for status in _JOB_STATUS_RENDER_VALUES})
raise TypeError(type(obj))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment