Fix the HTML filter flag
Set all the HTML callbacks to NULL instead of escaping inside methods. This makes the skipped HTML disappear from the rendered document, instead of appear as HTML entities or such.
This commit is contained in:
parent
bb9dbe8b5f
commit
e2a3063b6e
1 changed files with 12 additions and 15 deletions
|
@ -437,26 +437,20 @@ static int
|
|||
rndr_raw_html(struct buf *ob, struct buf *text, void *opaque)
|
||||
{
|
||||
struct xhtml_renderopt *options = opaque;
|
||||
int escape_html = 0;
|
||||
|
||||
if (options->flags & XHTML_SKIP_HTML)
|
||||
escape_html = 1;
|
||||
if ((options->flags & XHTML_SKIP_HTML) != 0)
|
||||
return 1;
|
||||
|
||||
else if ((options->flags & XHTML_SKIP_STYLE) != 0 && is_html_tag(text, "style"))
|
||||
escape_html = 1;
|
||||
if ((options->flags & XHTML_SKIP_STYLE) != 0 && is_html_tag(text, "style"))
|
||||
return 1;
|
||||
|
||||
else if ((options->flags & XHTML_SKIP_LINKS) != 0 && is_html_tag(text, "a"))
|
||||
escape_html = 1;
|
||||
if ((options->flags & XHTML_SKIP_LINKS) != 0 && is_html_tag(text, "a"))
|
||||
return 1;
|
||||
|
||||
else if ((options->flags & XHTML_SKIP_IMAGES) != 0 && is_html_tag(text, "img"))
|
||||
escape_html = 1;
|
||||
|
||||
|
||||
if (escape_html)
|
||||
attr_escape(ob, text->data, text->size);
|
||||
else
|
||||
bufput(ob, text->data, text->size);
|
||||
if ((options->flags & XHTML_SKIP_IMAGES) != 0 && is_html_tag(text, "img"))
|
||||
return 1;
|
||||
|
||||
bufput(ob, text->data, text->size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -788,6 +782,9 @@ ups_xhtml_renderer(struct mkd_renderer *renderer, unsigned int render_flags)
|
|||
renderer->autolink = NULL;
|
||||
}
|
||||
|
||||
if (render_flags & XHTML_SKIP_HTML)
|
||||
renderer->blockhtml = NULL;
|
||||
|
||||
if (render_flags & XHTML_SMARTYPANTS)
|
||||
renderer->normal_text = rndr_smartypants;
|
||||
|
||||
|
|
Loading…
Reference in a new issue