Hi Nicolas,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> `org-element-context' never returns contents of objects or elements.
>
>> I'm sure there is something simple I am misunderstanding here about how
>> nested objects work...can you enlighten me?
>
> You could do the following
>
>   (let ((citation (org-element-lineage (org-element-context) '(citation) t))
>         references)
>     (save-excursion
>       (goto-char (org-element-property :contents-begin citation))
>       (let ((end (org-element-property :contents-end citation)))
>         (while (< (point) end)
>           (let ((reference (org-element-lineage
>                             (org-element-context) '(citation-reference) t))))
>           (push reference references)
>           (goto-char (org-element-property :end reference)))))
>     (nreverse references))

Thanks!

Just to clarify: I see that this is necessary when getting a citation
object via org-element-context, but is it also necessary in an export
context, where the whole buffer or region has already been parsed?

I ask because in that kind of context, I think it is generally going to
be more useful to deal with citation objects as a whole.  I am not sure
we will want to treat citation-references as individual objects which
are themselves exported; instead, I think we will want to handle
exporting the citation-references in a citation all at once.
 
Best,
Richard


Reply via email to