Skip to main content
added 334 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 53 5250 bytes

VŻ;0Iµ>0ị“<ol>“<Ḋœṡ¥€⁶ZµḢVØ0jI>0ẋ"AƲị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪ“<li>“<ol>”żṪ“<li>“</li>”jⱮƊƲli>”jⱮƊ 

Try it online!Try it online!

A full programmonadic link taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists and return a syntactically valid HTML fragment.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 

yields:

<ol><li>All About Birds</li><ol><li>Kinds of Birds</li><ol><li>The Finch</li><li>The Swan</li></ol><li>Habitats</li><ol><li>Wetlands</li><ol><li>Types of wetlands</li><ol><li>Very wet wetland</li></ol></ol><li>Coast</li></ol></ol><li>All about fish</li><ol><li>Sharks</li></ol></ol> 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks

Jelly, 53 52 bytes

VŻ;0Iµ>0ị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪ“<li>“</li>”jⱮƊƲ 

Try it online!

A full program taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks

Jelly, 53 50 bytes

Ḋœṡ¥€⁶ZµḢVØ0jI>0ẋ"AƲị“<ol>“</ol>”żṪ“<li>“</li>”jⱮƊ 

Try it online!

A monadic link taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists and return a syntactically valid HTML fragment.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 

yields:

<ol><li>All About Birds</li><ol><li>Kinds of Birds</li><ol><li>The Finch</li><li>The Swan</li></ol><li>Habitats</li><ol><li>Wetlands</li><ol><li>Types of wetlands</li><ol><li>Very wet wetland</li></ol></ol><li>Coast</li></ol></ol><li>All about fish</li><ol><li>Sharks</li></ol></ol> 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks
added 10 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 5353 52 bytes

VŻ;0Iµ>0ị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪj@€“<li>“<Ḋœṡ¥€⁶ZḢÇżṪ“<li>“</li>”ƊƲli>”jⱮƊƲ 

Try it online!Try it online!

A full program taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks

Jelly, 53 bytes

VŻ;0Iµ>0ị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪj@€“<li>“</li>”ƊƲ 

Try it online!

A full program taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks

Jelly, 53 52 bytes

VŻ;0Iµ>0ị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪ“<li>“</li>”jⱮƊƲ 

Try it online!

A full program taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 53 bytes

VŻ;0Iµ>0ị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪj@€“<li>“</li>”ƊƲ 

Try it online!

A full program taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists.

Example:

H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks