Yue Yi <includeyy...@gmail.com> writes: >> > 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.
Ok. Could you then prepare a full patch, including changelog and maybe add a test? -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>