replicator model:

    fields:
      my_page:
        type: replicator
        display: 'My page'
        sets:
          chapter:
            display: chapter
            fields:
              chapter_title:
                type: text
                display: chapter_title
          faq:
            display: faq
            fields:
              question:
                type: text
                width: 50
                display: Question
              answer:
                type: text
                width: 50
                display: Answer

My template:

{{ if type == "chapter" }}
  <h3>{{ chapter_title }}</h3>
{{ elseif type == "faq" }}
  <ul>
    <li>
      {{ question }}
      {{ answer }}
    </li>
  </ul>
{{ /if }}

I want to output like this:

<h3>chapter 1</h3>
<ul>
  <li>...</li>
  <li>...</li>
  <li>...</li>
  <li>...</li>
</ul>
<h3>chapter 2</h3>
<ul>
  <li>...</li>
  <li>...</li>
</ul>

Yes, the key is to output "ul" to wrap Continuous "li", not each "li". How to do it?