Previous Next blank.gif blank.gif

Function markup_re


SYNOPSIS

import HTMLgen
def markup_re(text, rex=None, marker=None, collapse=0)

DESCRIPTION

Markup the contained text with a given re pattern/object with a given tag class instance. Uses re module.

Arguments

text
string to act on
rex
a regular expression object or pattern from the re module which will be used to match all text patterns in the Paragraph body. Must have a single group defined. Group 1 is the matching text that will be marked. Defaults to all parenthetical text.
marker
an HTMLgen class instance to which the found text will be sent for wrapping (using its __call__ method). Default is Emphasis. Can be your function as well.
collapse
Optional flag. When set to 1 removes the non- grouped matching text from the output. Default 0.

Returns tuple pair of the marked text and the number of matching text groups.

SEE ALSO

HTMLgen


Previous Next blank.gif blank.gif
Buzz.gif

Copyright © Robin Friedrich
All Rights Reserved
Comments to author: friedrich@pythonpros.com
Generated: Tue Apr 20, 1999