org-export: Nil value from a filter means filter will be skipped
commitcc839259a4561210374f4c1c7ba7933e4455aae7
authorNicolas Goaziou <n.goaziou@gmail.com>
Wed, 22 Aug 2012 11:48:12 +0000 (22 13:48 +0200)
committerNicolas Goaziou <n.goaziou@gmail.com>
Fri, 24 Aug 2012 07:56:48 +0000 (24 09:56 +0200)
tree1da39a531d021dd601e6ab05763a4febca3f7a7a
parent3f40057adc81999ac7aa994434b5ed1e5e67e4a9
org-export: Nil value from a filter means filter will be skipped

* contrib/lisp/org-export.el (org-export-filter-apply-functions): Nil
  value from a filter means filter will be skipped. To ignore the
  current element or object, the filter has to return the empty string
  instead.

This change is done to ease filter writing. When writing
a backend-specific filter (and I guess most are), there's no more need
for the somewhat contrived:

  (if (not (eq backend 'e-latex)) data
    ... filter's job...)

A more straightforward:

  (when (eq backend 'e-latex)
    ... filter's job...)

is now enough.

On the other hand, it is not possible anymore to specify 'ignore as
a filter to ignore every element or object of a given type. To
achieve that goal, one can now write, for example:

  (add-to-list 'org-export-filter-example-block-functions
                 (lambda (value backend info)
                   (when (eq backend 'e-html) "")))

It will ignore every example block in the `e-html' export back-end.
contrib/lisp/org-export.el