TWiki::Attrs
%TAG{fred='bad' "sad" joe="mad"}%
An attribute set is a map containing an entry for each parameter. The
default parameter (unnamed quoted string) is named _DEFAULT
in the map.
Attributes declared later in the string will override those of the same
name defined earlier. The one exception to this is the _DEFAULT key, where
the first instance of a setting is always taken.
As well as standard TWiki syntax (parameter values double-quoted)
it also parses single-quoted values, unquoted spaceless
values, spaces around the =, and commas as well as spaces separating values,
though none of these alternatives is advertised in documentation and
the extended syntax can be turned off by passing the 'strict' parameter
to new
.
This class replaces the old TWiki::extractNameValuePair and
TWiki::extractParameters.
$string
- String containing attribute specification
$friendly
- if true, the parse will be according to the extended syntax pioneered by the original Contrib::Attrs. Otherwise it will be strict as per traditional TWiki syntax.
my $attrs = new TWiki::Attrs('the="time \\"has come", "the walrus" said to=speak of=\'many \\'things\', 1);In this example:
the
will be time "has come
__default__
will be the walrus
said
will be on
to
will be speak
of
will be many 'things
$key | Attribute to remove |
remove
the attribute is no longer defined.
$key | Attribute to get |
USER REFERENCES
ADMIN MAINTENANCE
CATEGORIES WEBS PERSONAL |
Copyright © by the contributing authors. Bernstein - The Memory of Paper http://www.bernstein.oeaw.ac.at Ideas, requests, problems regarding Bernstein? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiAttrsDotPm |