emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export filters question
@ 2014-09-15 12:01 Fabrice Popineau
  2014-09-15 16:30 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Popineau @ 2014-09-15 12:01 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

Hi,

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?

Thanks for your help,

Fabrice

[-- Attachment #2: Type: text/html, Size: 540 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Export filters question
  2014-09-15 12:01 Export filters question Fabrice Popineau
@ 2014-09-15 16:30 ` Nicolas Goaziou
  2014-09-16 13:43   ` Fabrice Popineau
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2014-09-15 16:30 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Export filters question
  2014-09-15 16:30 ` Nicolas Goaziou
@ 2014-09-16 13:43   ` Fabrice Popineau
  0 siblings, 0 replies; 3+ messages in thread
From: Fabrice Popineau @ 2014-09-16 13:43 UTC (permalink / raw)
  To: Fabrice Popineau, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

2014-09-15 18:30 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> 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.
>
>
Thanks a lot. I was wondering if I had missed an option.

I may have an option to change my LaTeX macros and if it is does not work,
I'll try to derive a new backend.

Fabrice

[-- Attachment #2: Type: text/html, Size: 924 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-16 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 12:01 Export filters question Fabrice Popineau
2014-09-15 16:30 ` Nicolas Goaziou
2014-09-16 13:43   ` Fabrice Popineau

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).