aa_macro syntax 
 aa_macro source 
 HTML source 
 HTML render 
Key

§ 4.54 - [dlist] Built-In

Mnemonic aid: dlist for Display LIST

See also:  [aisort] ,  [append] ,  [asort] ,  [clearl] ,  [cmap] ,  [e] ,  [hmap] ,  [isort] ,  [lcc] ,  [lcopy] ,  [lhsort] ,  [list] ,  [ljoin] ,  [llen] ,  [lpop] ,  [lset] ,  [lslice] ,  [lsplit] ,  [lsub] ,  [ltol]  and  [translate] 

Displays a list:

 [dlist]  provides the ability to display and/or process a list. These behaviors are generally controlled by the various style parameters, although if no styles are provided,  [dlist]  will display the list content directly, using inter= and/or parms= and/or posts= if they are specified.

style= specifies a style that will "wrap" every element of the list, except when one or both of fs= and/or ls= style parameters are also specified, in which case those styles will respectively wrap the first and/or last element of the list rather than the one specified by style=.

fs= specifies a style that will "wrap" the first element of a list. fs= is only used if style= has also been specified.

ls= specifies a style that will "wrap" the last element of a list. ls= is only used if style= has also been specified.

inter= specifies something that will go between each element of a list.

parms= specifies something that will go before each element of a list.

posts= specifies something that will go after each element of a list.

ntl= specifies something that will go between the next-to-last element and the last element of a list.

Caution: ntl=NTL is not wrapped by style=stylename. If you want that, then wrap it individually as shown in the last example.
Caution: if you want a style to be re-evaluated for each list element, you must put it in the style=styleName parameter, and, if used, the fs=styleName and/or ls=styleName parameters.

Styles in inter=, parms=, posts= and ntl= parameters are evaluated only once in the context of the  [dlist]  itself, whereas the style=styleName is evaluated once for each element, and fs=styleName and ls-styleName are evaluated once for the first and last element respectively.

See the example below that uses style=redcounter for an example of how to alter states for each element.

[dlist (style=styleName,)
(fs=styleName,)
(ls=styleName)
(inter=INT,)
(parms=PRE,)
(posts=PST,)
(ntl=NTL,)
listName
]

[style tag *[b]* ]
[style bold [b [b]]]
[local count 0]
[style redcounter [local count [inc [v count]]][color f00 [v count]:][b]]
[list list1,a,b,c,d]
[dlist list1]
[dlist style=tag,list1]
[dlist parms=-,list1]
[dlist posts=-,list1]
[dlist inter=-,list1]
[dlist ntl=-,list1]
[dlist inter=[co] ,ntl= and ,list1]
[dlist style=redcounter,inter= ,list1]
[dlist parms=letter:,posts=(s),inter=[co] ,ntl= and ,list1]
[dlist style=bold,parms=letter:,posts=(s),inter=[co] ,ntl= and ,list1]
[dlist style=bold,parms=letter:,posts=(s),inter=[co] ,ntl={bold and },list1]
----
[style first -[b] ]
[style middle :[b]: ]
[style last [b]-]
[dlist fs=first,style=middle,ls=last,list1]

abcd
*a* *b* *c* *d*
-a-b-c-d
a-b-c-d-
a-b-c-d
abc-d
a, b, c and d
<span style="background-color: #FFFFFF; color: #FF0000;">1:</span>a <span style="background-color: #FFFFFF; color: #FF0000;">2:</span>b <span style="background-color: #FFFFFF; color: #FF0000;">3:</span>c <span style="background-color: #FFFFFF; color: #FF0000;">4:</span>d
letter:a(s)&#44; letter:b(s)&#44; letter:c(s) and letter:d(s)
<strong>letter:a(s)</strong>&#44; <strong>letter:b(s)</strong>&#44; <strong>letter:c(s)</strong> and <strong>letter:d(s)</strong>
<strong>letter:a(s)</strong>&#44; <strong>letter:b(s)</strong>&#44; <strong>letter:c(s)</strong><strong> and </strong><strong>letter:d(s)</strong>
----
-a :b: :c: d-
abcd *a* *b* *c* *d* -a-b-c-d a-b-c-d- a-b-c-d abc-d a, b, c and d 1:a 2:b 3:c 4:d letter:a(s), letter:b(s), letter:c(s) and letter:d(s) letter:a(s), letter:b(s), letter:c(s) and letter:d(s) letter:a(s), letter:b(s), letter:c(s) and letter:d(s) ---- -a :b: :c: d-

Other built-ins used here:  [b] ,  [co] ,  [color] ,  [list]  and  [style] 

Keyboard Navigation
, Previous Page . Next Page t TOC i Index

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses Python 2.7