Package trac :: Package wiki :: Module parser

Module parser

source code

Classes
  WikiParser
Wiki text parser.
Functions
 
parse_processor_args(processor_args)
Parse a string containing parameter assignments, and return the corresponding dictionary.
source code
Variables
  __package__ = 'trac.wiki'

Imports: re, EMAIL_LOOKALIKE_PATTERN, Component, ExtensionPoint, Interface, TracBaseError, TracError, TracValueError, implements


Function Details

parse_processor_args(processor_args)

source code 

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)]