Zelda Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!

Come join the Zelda Wiki community Discord server!

READ MORE

Zelda Wiki
Advertisement

This is the documentation page for Module:UtilsMarkup/List

This module exports the following functions.

list

list(items)

Parameters

  • items
    An array of strings (list items).

Returns

  • An unordered list with the plainlist class.

Examples

#InputOutputResultStatus
1
list({})
""
Green check
2
list({"single item"})
'<ul class="plainlist"><li>single item</li></ul>'
  • single item
Green check
3
list({"multiple", "items", ""})
'<ul class="plainlist"><li>multiple</li><li>items</li><li></li></ul>'
  • multiple
  • items
Green check

bulletList

bulletList(items, [attributes])

Parameters

  • items
    An array of strings (list items).
  • [attributes]
    [class]
    Sets the class attribute of HTML list tag. Note that this is recursively applied to sub-lists.

Returns

  • A string representation of an unordered list using HTML syntax.

Examples

#InputOutputResultStatus
4
bulletList({})
""
Green check
5
bulletList({"single item"})
"<ul><li>single item</li></ul>"
  • single item
Green check
6
bulletList({"multiple", "items", ""})
"<ul><li>multiple</li><li>items</li><li></li></ul>"
  • multiple
  • items
Green check
7
bulletList(
  {
    "list",
    {
      "with",
      {"nested", "items"},
      "inside",
    },
  },
  { class = "custom-class" }
)
'<ul class="custom-class"><li>list</li><ul class="custom-class"><li>with</li><ul class="custom-class"><li>nested</li><li>items</li></ul><li>inside</li></ul></ul>'
  • list
    • with
      • nested
      • items
    • inside
Green check

numberList

numberList(items, [attributes])

Parameters

  • items
    An array of strings (list items).
  • [attributes]
    [class]
    Sets the class attribute of HTML list tag. Note that this is recursively applied to sub-lists.
    [start]
    Sets the starting value.

Returns

  • A string representation of an ordered list using HTML syntax.

Examples

#InputOutputResultStatus
8
numberList({})
""
Green check
9
numberList({"single item"})
"<ol><li>single item</li></ol>"
  1. single item
Green check
10
numberList({"multiple", "items", ""})
"<ol><li>multiple</li><li>items</li><li></li></ol>"
  1. multiple
  2. items
Green check
11
numberList({
  "list",
  {
    "with",
    {"nested", "items"},
    "inside",
  },
})
"<ol><li>list</li><ol><li>with</li><ol><li>nested</li><li>items</li></ol><li>inside</li></ol></ol>"
  1. list
    1. with
      1. nested
      2. items
    2. inside
Green check
12
numberList(
  {"Eight", "Nine", "Ten"},
  {
    start = 8,
    class = "custom-class",
  }
)
'<ol start="8" class="custom-class"><li>Eight</li><li>Nine</li><li>Ten</li></ol>'
  1. Eight
  2. Nine
  3. Ten
Green check

definitionList

definitionList(pairs, [attributes])

Parameters

  • pairs
    Array of table of pairs where the first pair item is a term and the value is a definition.
  • [attributes]
    [class]
    Sets the class attribute of HTML list tag. Note that this is recursively applied to sub-lists.

Returns

  • A string representation of a definition list using HTML syntax.

Examples

#InputResultStatus
13
definitionList({})
Green check
14
definitionList({
  {"key1", "value1"},
})
key1
value1
Green check
15
definitionList({
  {"key1", "value1"},
  {"key2", "value2"},
})
key1
value1
key2
value2
Green check
16
definitionList({
  {"", "value1"},
  {[2] = "value2" },
  {"key3", ""},
  {"key4"},
})
value1
value2
key3
key4
Green check
17
definitionList({
  {
    "key 1",
    {
      {
        "key 1.1",
        {
          {"key 1.1.1", "value 1.1.1"},
        },
      },
      {"key 1.2", "value 1.2"},
    },
  },
  {"key2", "value2"},
})
key 1
key 1.1
key 1.1.1
value 1.1.1
key 1.2
value 1.2
key2
value2
Green check
18
definitionList(
  {
    {
      "key 1",
      "value 1.1",
      {
        {"key 1.1", "value 1.2"},
        {"key 1.2", "value 1.2"},
      },
    },
  },
  { class = "custom-class" }
)
key 1
value 1.1
key 1.1
value 1.2
key 1.2
value 1.2
Green check
Advertisement