ul.pug – Unordered lists generation

View source code on Github

Unordered list from string

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

Insert an unordered 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

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

Output

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

Render

  • one
  • two
  • three
  • four
  • five