query_tag_callers()
void|mapping(string:function) query_tag_callers()
The query_tag_callers() method is called by
Challenger to find all plain tags handled by the module. It returns a
mapping of string, function pairs where the string is the name of the
tag and the function is a callback method that handles that tag. The
method need not be implemented if a particular parser module has no
plain tags but only container tags.
The definition for the acctual callback method is:
void|string|array(string) tag_caller( string tag, mapping
(string:string) att, object id)
tag contains the name of the tag being parsed. It makes it
possible to have one tag caller that handles several tags slightly
differently. att contains the attributes sent to the
tag. id is the request information object.
Attributes are decoded and sent as a mapping with the attribute
name as key and the attribute value as value. Attributes that does not
have a value is given their name as value. Thus <tag hi=hopp
foo> will be decoded as ([ "hi" : "hopp", "foo" : "foo"
]). It won't be possible to separate from <tag hi=hopp
foo=foo>.
The return value will usually be a string that will replace the
tag. The string will in turn will be RXML parsed. Thus a tag caller
can return RXML that will be parsed. Care must however be taken to
quote things properly before returning them, otherwise it might be
possible for a user to get his input RXML parsed.
If zero is returned the tag will be left as is. If an array
containing one string is returned the tag will be replaced with that
string, but the string won't be RXML parsed.
|