Repeat

[repeat] shortcode allows to produce repetetive content easily.

[repeat] shortcode arguments
data:
value1, value2, value3
separator:
Custom separator symbol (default: ",").
divider:
Custom divider symbol (default: "|").
variable:
Custom variable enclosing symbols (default: "%").
Repeat
Item
Another item
Third item
Item
Another item
Third item
<list bulleted>
  <item>Item</item>
  <item>Another item</item>
  <item>Third item</item>
</list>

<list bulleted>
  <repeat data="Item, Another item, Third item">
    <item>%0%</item>
  </repeat>
</list>
Notes
Separate data with commas.
Use %n% as variable name, where n = index.
Multiple variables
Header
Item
Another header
Another item
Third header
Third item
<list bulleted>
  <repeat data="
    Header|Item, 
    Another header|Another item, 
    Third header|Third item
  ">
    <item header="%0%">%1%</item>
  </repeat>
</list>
Table
NameStatusNotes
JohnApprovedNone
JamieApprovedRequires call
JillDeniedNone
JohnApprovedNone
JamieApprovedRequires call
JillDeniedNone
JohnApprovedNone
JamieApprovedRequires call
JillDeniedNone
{lt}table class="ui celled table"{gt}
  {lt}thead{gt}
    {lt}tr{gt}
      {lt}th{gt}Name{lt}/th{gt}
      {lt}th{gt}Status{lt}/th{gt}
      {lt}th{gt}Notes{lt}/th{gt}
    {lt}/tr{gt}
  {lt}/thead{gt}
  {lt}tbody{gt}
  <repeat data="
    John|Approved|None, 
    Jamie|Approved|Requires call, 
    Jill|Denied|None,
    John|Approved|None, 
    Jamie|Approved|Requires call, 
    Jill|Denied|None,
    John|Approved|None, 
    Jamie|Approved|Requires call, 
    Jill|Denied|None,
  ">
    {lt}tr{gt}
      {lt}td{gt}%0%{lt}/td{gt}
      {lt}td{gt}%1%{lt}/td{gt}
      {lt}td{gt}%2%{lt}/td{gt}
    {lt}/tr{gt}
  </repeat>
  {lt}/tbody{gt}
{lt}/table{gt}

Leave a comment

Your email address will not be published. Required fields are marked *