Template:Li/doc
Appearance
This is a documentation subpage for Template:Li It may contain usage information, categories and other content that is not part of the original template page. |
Li takes a list of up to 20 string elements, together with two parameters, one which is prefixed to each element and one which is suffixed to each element.
{{Li|p_str|s_str|ele_1|ele_2|...|ele_n}} returns p_str ele_1 s_str p_str ele_2 s_str . . . p_str ele_n s_str with one space added after the p_str. For example {{Li|<li>|</li>|dog|cat|mouse}} returns <li> dog</li> <li> cat</li> <li> mouse</li> The option num adds numbering starting at the value of num when set. For example {{Li|num=1.1.|<li>|</li>|dog|cat|mouse}} returns <li>1.1.1 dog</li> <li>1.1.2 cat</li> <li>1.1.3 mouse</li> Use num="" (empty quoted string) to add numbering starting at 1. For example {{Li|num=""|<li>|</li>|dog|cat|mouse}} returns <li>1 dog</li> <li>2 cat</li> <li>3 mouse</li> The options prolog and epilog prepend and appemd to the list. {{Li|prolog=<ul>|epilog=</ul>|num=1.1.|<li>|</li>|dog|cat|mouse}} returns <ul> <li>1.1.1 dog</li> <li>1.1.2 cat</li> <li>1.1.3 mouse</li> </ul> The option prefix inserts another copy of ele_i followed by prefix after p_str. For example you may hope {{Li|prefix=">|num=1.1.|<li><a href="#|</a></li>|dog|cat|mouse}} returns <li><a href="#dog">1.1.1 dog</a></li> <li><a href="#cat">1.1.2 cat</a></li> <li><a href="#mouse">1.1.3 mouse</a></li> which does not display in wiki, but you can use {{Li|prefix={{!}}|num=1.1.|<li>{{!((}}#|{{))!}}</li>|dog|cat|mouse}} which does produce the source <li><a href="#dog">1.1.1 dog</a></li> <li><a href="#cat">1.1.2 cat</a></li> <li><a href="#mouse">1.1.3 mouse</a></li> This is equivalent in use to <li>[[#dog|1.1.1 dog]]</li> <li>[[#cat|1.1.2 cat]]</li> <li>[[#mouse|1.1.3 mouse]]</li> The call {{Li|prolog=<ul>|epilog=</ul>|prefix={{!}}|num=1.1.|<li>{{!((}}#|{{))!}}</li>| dog|cat|mouse}} appears below.
An extra detail is that a | bar must end a line before a carraige return like {{Li| prolog=<ul>|epilog=</ul>| prefix={{!}}|num=1.1.| <li>{{!((}}#|{{))!}}</li>| dog| cat| mouse}} but it does not work for {{Li| prolog=<ul>|epilog=</ul>| prefix={{!}}|num=1.1.| <li>{{!((}}#|{{))!}}</li> |dog |cat |mouse}} .