TWiki
>
TWiki/ Web
>
TWikiAttrsDotPm
(22 Jan 2008,
TWikiContributor
)
(raw view)
E
dit
A
ttach
---+ Package =TWiki::Attrs= Class of attribute sets, designed for parsing and storing attribute values from a TWiki tag e.g. =%<nop>TAG{"joe" fred="bad" joe="mad"}%= An attribute set is a hash containing an entry for each parameter. The default parameter (unnamed quoted string) is named <code>_<nop>DEFAULT</code> in the hash. 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 is always taken. As well as the default TWiki syntax (parameter values double-quoted) this class also parses single-quoted values, unquoted spaceless values, spaces around the =, and commas as well as spaces separating values. The extended syntax has to be enabled by passing the =$friendly= parameter to =new=. %TOC% ---++ ClassMethod *new* <tt>($string,$friendly)=>\%attrsObjectRef</tt> * =$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. Parse a standard attribute string containing name=value pairs and create a new attributes object. The value may be a word or a quoted string. If there is an error during parsing, the parse will complete but $attrs->{_ERROR} will be set in the new object. $attrs->{_RAW} will always contain the full unprocessed $string. Extended syntax example: <verbatim> my $attrs = new TWiki::Attrs('the="time \\"has come", "the walrus" said to=speak of=\'many \\'things\', 1); </verbatim> In this example: * =the= will be =time "has come= * <code>_<nop>_<nop>default__</code> will be =the walrus= * =said= will be =on= * =to= will be =speak= * =of= will be =many 'things= Only " and ' are escaped. Traditional syntax is as old TWiki, except that the whole string is parsed (the old parser would only recognise default values in position 1, nowhere else) ---++ ObjectMethod *isEmpty* <tt>() -> boolean</tt> Return false if attribute set is not empty. ---++ ObjectMethod *remove* <tt>($key) -> $value</tt> * =$key= - Attribute to remove Remove an attr value from the map, return old value. After a call to =remove= the attribute is no longer defined. ---++ ObjectMethod *stringify* <tt>() -> $string</tt> Generate a printed form for the map, using strict attribute syntax, with only the single-quote extension syntax observed (no {} brackets, though).
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r3 - 22 Jan 2008 - 00:21:26 -
TWikiContributor
TWiki/
Log In
or
Register
TWiki/ Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
AdminToolsCategory
InterWikis
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Webs
Abacos
Acbahia
AnpedGT16
ArcoDigital
Argumento
Avsan
CalculoB
Ceb
Cetad
CetadObserva
Cibercultura
Ciberfem
CiberParque
ColoquioCiags
Coloquiofasa
ConexoesSaberes
Cpdteste
Cppd
Creche
Cridi
Da
DACN
DCE
DelzaTeste
DeniseCarla
DepHistoria
DicionarioBelasartes
Ecologia
EDC
Educandow
EduMus
EleicoesReitor2010
Encima
Enearte
Estruturas
EstruturasEng
FACED
FAT
FepFaced
GEC
GeneticaBiodiversidade
GeneticaBiodiversidade3
GeneticaBiodiversidade
Gepindi
GetecEng
Godofredofilho
GrupoAlgebra
ICI010
Informev
Ites
LabioComp
LEG
Lepeja
Letras
LivroLivreSalvador
Main
MaisUm
Mata07
Mefes
MefesCpd
MetaReciclagem
Neclif
NelsonPretto
Nuclear
Numcad
Nutricao
Observa
OrfaosdeRua
PauloCostaLima
PdI
PescandoLetras
PETFilosofia
Pgif
PGNUT
PortalPpga
PosCultura
Pospetroigeo
PPGAC
PPGE
PpggBio
Ppggenbio
Pretto
Proad
PROGESP
ProjetoLencois
Quimica
RadioFACED
RadioTeatro
RadioWeb
Riosymposium10
Ripe
Salasdoctai
Sat
Sedu
SemBio
SeminarioPibid
SimoneLucena
Sociologia
SSL
Tabuleiro
TabuleirosUfba
TCinema
TerritoriosDigitais
TWiki
Twikidea
UFBAIrece
UniversidadeNova
VizinhoEstrangeiro
XIISNHCT
Български
English
Español
日本語
Português
Copyright � by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback