• Renumbering nested lists

    From Andrew Poulos@21:1/5 to All on Wed Apr 8 09:04:49 2020
    I have a dynamically generated list that looks something like this


    <li>Every</li>
    <li>Good</li>
    <li>
    <ol>
    <li>Boy</li>
    <li>Deserves</li>
    </ol>
    </li>
    <li>Fruit</li>
    <li>The</li>
    <li>Quick</li>
    <li>Brown</li>
    <li>
    <ol>
    <li>Fox</li>
    <li>Jumps</li>
    <li>Over</li>
    <li>The</li>
    </ol>
    </li>
    <li>Lazy</li>
    <li>Dog</li>
    </ol>

    I need the numbering to include any nested items but not the parent LI
    of any nested list. So the example above would appear as:

    1. Every
    2. Good
    3. Boy
    4. Deserves
    5. Fruit
    6. The
    7. Quick
    8. Brown
    9. Fox
    10. Jumps
    11. Over
    12. The
    13. Lazy
    14. Dog

    How can this be done (or do I need to code it)?

    Andrew Poulos

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Poulos@21:1/5 to Andrew Poulos on Wed Apr 8 11:08:29 2020
    On 8/04/2020 9:04 am, Andrew Poulos wrote:
    I have a dynamically generated list that looks something like this


      <li>Every</li>
      <li>Good</li>
      <li>
        <ol>
          <li>Boy</li>
          <li>Deserves</li>
        </ol>
      </li>
      <li>Fruit</li>
      <li>The</li>
      <li>Quick</li>
      <li>Brown</li>
      <li>
        <ol>
          <li>Fox</li>
          <li>Jumps</li>
          <li>Over</li>
          <li>The</li>
        </ol>
      </li>
      <li>Lazy</li>
      <li>Dog</li>
    </ol>

    I need the numbering to include any nested items but not the parent LI
    of any nested list. So the example above would appear as:

    1. Every
    2. Good
    3. Boy
    4. Deserves
    5. Fruit
    6. The
    7. Quick
    8. Brown
    9. Fox
    10. Jumps
    11. Over
    12. The
    13. Lazy
    14. Dog

    How can this be done (or do I need to code it)?

    I add a class to the parent LI and then used this CSS (Dr Google told me
    about 'counter'):

    body {
    counter-reset: part;
    }
    li > ol {
    padding-left: 0;
    }
    li:not(.nested)::before {
    counter-increment: part;
    content: counter(part) ". ";
    }

    and it seems to work.

    Andrew Poulos

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)