Ihor Radchenko <[email protected]> writes:
> > #+title: test
> > #+options: html-style:nil html-preamble:nil html-postamble:nil
> > ** a
> > * b
> ...
>
> > toc-id-counter) ""))
> > - (org-html--toc-text toc-entries)
> > + (org-html--toc-text toc-entries scope)
>
> Why do you need to pass SCOPE?
In ox-html.el, `org-html-toc' is only called from `org-html-keyword' and
`org-html-inner-template'. The latter does not specify the scope
parameter, meaning it defaults to nil, which represents the entire
document.
Within `org-html-keyword', when options specified with `#+TOC:' include
:target or local, scope will be a headline or keyword element itself.
It is then used as an argument for `org-export-collect-headlines' to
retrieve the relevant Org syntax elements:
(let* ((scope (cond ((not scope) (plist-get info :parse-tree))
((org-element-type-p scope 'headline) scope)
((org-element-lineage scope 'headline))
(t (plist-get info :parse-tree))))
...)
...)
In other words, when scope is non-nil, we can always obtain an Org
element with a logical hierarchical structure. However, when scope is
nil, we may not be able to do so, as explained in my previous
email. This is why I introduced the scope parameter.