trac.wiki.parser

class trac.wiki.parser.WikiParser

Bases: trac.core.Component

Wiki text parser.

parse(wikitext)

Parse wikitext and produce a WikiDOM tree.

trac.wiki.parser.parse_processor_args(processor_args)

Parse a string containing parameter assignments, and return the corresponding dictionary.

Isolated keywords are interpreted as bool flags, False if the keyword is prefixed with “-”, True otherwise.

>>> parse_processor_args('ab="c de -f gh=ij" -')
{'ab': 'c de -f gh=ij'}
>>> sorted(parse_processor_args('ab=c de -f gh="ij klmn" p=q-r,s').items())
[('ab', 'c'), ('de', True), ('f', False), ('gh', 'ij klmn'), ('p', 'q-r,s')]
>>> args = 'data-name=foo-bar data-true -data-false'
>>> sorted(parse_processor_args(args).items())
[('data-false', False), ('data-name', 'foo-bar'), ('data-true', True)]