File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ <h3>{% trans 'Metadata' %}</h3>
9696 < dt class ="col-sm-3 text-right "> {{ description.descriptionType }}:</ dt >
9797 < dd class ="col-sm-9 ">
9898 {% for paragraph in description.description|split_br %}
99- < p > {{ paragraph|urlize|replace_caveats }}</ p >
99+ < p > {{ paragraph|render_description }}</ p >
100100 {% endfor %}
101101 </ dd >
102102 </ dl >
Original file line number Diff line number Diff line change 22
33from django import template
44from django .conf import settings
5+ from django .template .defaultfilters import urlize
56from django .utils .safestring import mark_safe
67
78register = template .Library ()
@@ -29,8 +30,15 @@ def restricted_message(obj):
2930
3031
3132@register .filter
32- def replace_caveats (value ):
33+ def render_description (value ):
34+ description = urlize (value )
35+
3336 # replaces, e.g. <a ...>https://data.isimip.org/issues/8/</a>
3437 # with <a ...>#8</a>
35- return mark_safe (re .sub (r'(<a.*?>)(https://data\.isimip\.org/(caveats|issues|notes)/.*?)(\d+)([/]*)(</a>)' ,
36- r'\1#\4\6' , value ))
38+ description = re .sub (r'(<a.*?>)(https://data\.isimip\.org/(caveats|issues|notes)/.*?)(\d+)([/]*)(</a>)' ,
39+ r'\1#\4\6' , description )
40+
41+ if value .endswith ('.' ) and not description .endswith ('.' ):
42+ description += '.'
43+
44+ return mark_safe (description )
You can’t perform that action at this time.
0 commit comments