ol.pug – Ordered lists generation

View source code on Github

Ordered list from string

mixin ol-string(value, separator=",")
  ol&attributes(attributes)
    each elem in value.split(separator)
      li #{elem}
+ol-string(value, separator=", ")

Insert a ordered list from a string indicating a separator to split the string.

Arguments:
  • value (string) – String from which the list will be built.
  • separator (string) – The string will be splitted into differents elements using a separator passed as value of this parameter. As default ",".

Usage

Input

+ol-string("one,two,three,four,five")

Output

<ol>
  <li>one</li>
  <li>two</li>
  <li>three</li>
  <li>four</li>
  <li>five</li>
</ol>

Render

  1. one
  2. two
  3. three
  4. four
  5. five