def render_markup(markup, raw_data): data = raw_data if markup == Article.MARKUP_MARKDOWN: data = markdown(data) elif markup == Article.MARKUP_RST: data = publish_parts(source=data, writer_name="html4css1")["fragment"] elif markup == Article.MARKUP_TEXTILE: data = textile(data) data = html_parser(data) return data
def parse_html(request): if request.user.is_authenticated(): return HttpResponse(html_parser(request.POST.get('data', ''))) else: return HttpResponseForbidden()