You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
630 B

from jinja2.utils import Markup
from jinja2._compat import text_type
import re
def do_stringtags_and_img(value):
"""
Strip SGML/XML tags and replace adjacent whitespace by one space.
"""
if hasattr(value, '__html__'):
value = value.__html__()
no_img_part = re.sub(r'<img(.?)*src=\"(.?)*[\"\s\/>]+?', "", value)
return Markup(text_type(no_img_part)).striptags()
def sidebar(value):
value = '%s' % value
if value.startswith('archives') or value.startswith('category'):
return 'right-sidebar'
elif value == 'index':
return 'index'
else:
return 'no-sidebar'