Hi Marcin,
Marcin Borkowski <[email protected]> writes:
> as I mentioned, I'm writing a simple exporter. However, I stumbled on
> something apparently simple. How to get the current list level within
> org-whatever-item transcoder?
I ran into this problem once; the solution I found was to just walk up
the AST via org-export-get-parent until you run out of parents.
Something like this should work (untested, and probably needs to be
tweaked, as my Elisp is a little rusty):
(defun find-depth (element)
"Find the depth of a (list) element during export."
(let ((parent (org-export-get-parent element)))
(case (org-element-type parent)
('item (1+ (find-depth parent)))
('plain-list (find-depth (org-export-get-parent parent)))
(t 1))))
Hope that helps!
Best,
Richard