Disable <img />

4 views
Skip to first unread message

Jerry

unread,
Nov 23, 2008, 6:22:11 PM11/23/08
to creoleparser
Hi,

Is there a (planed) way of disabling certain tag(s), e.g. <img />,
through (dialect) configuration without monkey-patching?

Many thanks in advance.

Sincerely,
Jerry

shday

unread,
Nov 24, 2008, 3:56:18 PM11/24/08
to creoleparser
Hi Jerry,

You can disable <img /> now by removing the assignment of, and all
references to, `self.img` from the Creole10 class.

There are plans to make the dialects module more modular :) This will
likely make it easier/cleaner to disable certain tags, although the
image tag is not a simple case.

http://code.google.com/p/creoleparser/issues/detail?id=12

Hope this helps.

Steve

Jerry

unread,
Nov 24, 2008, 6:29:37 PM11/24/08
to creoleparser
Hi Steve,

Thank you for your reply.

That's exactly how my monkey-patch looks --

"""
creole_dialect = Creole10()
for _index, _dummy_element in enumerate
(creole_dialect.inline_elements):
if isinstance(creole_dialect.inline_elements
[_index],

creoleparser.elements.Image):
# monkey-patching to disable self.img
tag
del creole_dialect.inline_elements
[_index]
creole_parser = Parser(dialect=creole_dialect)
"""

Sincerely,
Jerry

Stephen Day

unread,
Nov 24, 2008, 7:11:26 PM11/24/08
to creole...@googlegroups.com
Looks good, except you'll need to do the same with self.tr and self.dl (if use_additions = True).
Reply all
Reply to author
Forward
0 new messages