emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Fabrice Popineau <fabrice.popineau@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Export filters question
Date: Mon, 15 Sep 2014 18:30:05 +0200	[thread overview]
Message-ID: <8738bslxnx.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAFgFV9MLf3g7CoUwZm4b1KF4n-2TeX-Jh4LMxVeSCRn0bBHFmA@mail.gmail.com> (Fabrice Popineau's message of "Mon, 15 Sep 2014 14:01:00 +0200")

Hello,

Fabrice Popineau <fabrice.popineau@gmail.com> writes:

> This is probably a very basic question,
> but what is the right way to access properties of the element in a filter ?
>
> Admit I want to define my own filter:
>
> (defun my-latex-filter-headline (text backend info)
>  ... )
>
> And I want to access the relative level of the current headline. How should
> I do it?

Short answer. You can't.

Long answer. Actually, `info' contains the full parse tree (plist-get
info :parse-tree) so you could be able to retrieve the headline
currently being exported (since export results are cached
in :exported-data, an untested idea would be to walk the tree with
`org-element-map' and find the last headline without an entry in the
cache). It is also probably bound to `data' per dynamic binding, but
I wouldn't count on that as it might change in the future.

Since filters are meant for tweaking generated output, the information
you're looking after is not readily accessible at this level. Your
request makes sense, but I think you really want to write a derived
back-end with a custom headline transcoder instead.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2014-09-15 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 12:01 Export filters question Fabrice Popineau
2014-09-15 16:30 ` Nicolas Goaziou [this message]
2014-09-16 13:43   ` Fabrice Popineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738bslxnx.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=fabrice.popineau@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).