title: Pandoc Lua : how to walk inside a div?
body: <p>I need the two BulletList to be treated differently.</p>
  <p>The one inside the Div is correctly parsed when I simply return the element in the normal BulletList.</p>
  <p>But how to make the walk inside the div work when I change the normal Bulletlist and return RawInline?</p>
  <pre><code># normal chapter
  * a normal list
  * with items
  * or more
  * to finish
  
  ::: Special
  
  # special chapter
  * at the start
  * something else
  * the end
  
  :::
  </code></pre>
  <p>The expected result would be like this. The items of each list are differently treated.</p>
  <pre><code>&lt;h1 class=&quot;normalHeader&quot; id=&quot;normal-chapter&quot;&gt;normal chapter&lt;/h1&gt;
  &lt;ul&gt;
  &lt;li class=&quot;normal-item&quot;&gt;a normal list&lt;/li&gt;
  &lt;li class=&quot;normal-item&quot;&gt;with items&lt;/li&gt;
  &lt;li class=&quot;normal-item&quot;&gt;or more&lt;/li&gt;
  &lt;li class=&quot;normal-item&quot;&gt;to finish&lt;/li&gt;
  &lt;/ul&gt;
  &lt;section id=&quot;special-chapter&quot; class=&quot;Special&quot; class=&quot;specialHeader&quot;&gt;
  &lt;h1 class=&quot;specialHeader&quot;&gt;special chapter&lt;/h1&gt;
  &lt;ul &gt;
  &lt;li class=&quot;special-item&quot;&gt;at the start&lt;/li&gt;
  &lt;li class=&quot;special-item&quot;&gt;something else&lt;/li&gt;
  &lt;li class=&quot;special-item&quot;&gt;the end&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;/section&gt;
  </code></pre>
  <p>Lua filter:</p>
  <pre><code>
  Div = function (el)
      if el.classes[1] == 'Special' then
        return pandoc.walk_block(el, {
          Header = function(el)
              el.attributes['class']='specialHeader'
              return el
          end,
          BulletList = function(el)
              print(&quot;specialltest&quot;)
                local mylist ='&lt;ul &gt;\n'
                for i, item in ipairs(el.content) do
                  local first = item[1]
                  if first  then
                    mylist =  mylist .. '&lt;li class=&quot;special-item&quot;&gt;' .. pandoc.utils.stringify(first) ..  '&lt;/li&gt;\n'
                  end
                end
             mylist =  mylist .. '&lt;/ul&gt;\n'
             return pandoc.RawInline('html', mylist)
          end,
        })
      end
      return el
  end
  
  Header = function (el)
      el.attributes['class']='normalHeader'
      return el
  end
  
  
  BulletList = function (el)
              print(&quot;normalltest&quot;)
                local mylist ='&lt;ul &gt;\n'
                for i, item in ipairs(el.content) do
                  local first = item[1]
                  if first  then
                    mylist =  mylist .. '&lt;li class=&quot;normal-item&quot;&gt;' .. pandoc.utils.stringify(first) ..  '&lt;/li&gt;\n'
                  end
                end
             mylist =  mylist .. '&lt;/ul&gt;\n'
             return pandoc.RawInline('html', mylist)
             -- works if I return el without treatment
  end
  </code></pre>