{{ if content.extract("heading1").count > 0 for chapter in content.splitBy("heading1") }}
  1. {{ chapter.head.plainText.replace('\u2028', ' ').replace('\u2029', ' ').replace('\u000A',' ').trimSpaces }}{{ if chapter.body.extract("heading2").count > 0 }}
      {{ for sectionItem in chapter.body.extract("heading2") }}
    1. {{ sectionItem.plainText.replace('\u2028', ' ').replace('\u2029', ' ').replace('\u000A',' ').trimSpaces }}
    2. {{ end }}
    {{ end }}
  2. {{ end end if (content.extract("heading1").count == 0) and (content.extract("heading2").count > 0) for chapter in content.splitBy("heading2") }}
  3. {{ chapter.head.plainText.replace('\u2028', ' ').replace('\u2029', ' ').replace('\u000A',' ').trimSpaces }}{{ if chapter.body.extract("heading3").count > 0 }}
      {{ for sectionItem in chapter.body.extract("heading3") }}
    1. {{ sectionItem.plainText.replace('\u2028', ' ').replace('\u2029', ' ').replace('\u000A',' ').trimSpaces }}
    2. {{ end }}
    {{ end }}
  4. {{ end end }}