SP/web2py/gluon/contrib/markdown/__init__.py
Saturneic 064f602b1a Add.
2018-10-25 23:33:13 +08:00

18 lines
531 B
Python

from .markdown2 import *
from gluon.html import XML
def WIKI(text, encoding="utf8", safe_mode='escape', html4tags=False, **attributes):
if not text:
test = ''
if 'extras' in attributes:
extras = attributes['extras']
del attributes['extras']
else:
extras=None
text = text.decode(encoding,'replace')
return XML(markdown(text,extras=extras,
safe_mode=safe_mode, html4tags=html4tags)\
.encode(encoding,'xmlcharrefreplace'),**attributes)