Simplify example documentation of local filters

* doc/org.texi (Advanced configuration): Simplify example of local
filters, using #+BIND.
This commit is contained in:
Carsten Dominik 2013-09-23 16:28:39 +02:00
parent e5f16b80c8
commit b6cc24ae14
1 changed files with 11 additions and 13 deletions

View File

@ -13031,22 +13031,20 @@ from it (e.g., @code{beamer}).
@subheading Defining filters for individual files @subheading Defining filters for individual files
You can modify the export for just a specific file by inserting a source code You can customize the export for just a specific file by binding export
block that will be evaluated at export time and that will install filters filter variables using @code{#+BIND}. Here is an example where we introduce
just for this file. The following example modifies the timestamp formatting two filters, one to remove brackets from time stamps, and one to entirely
to remove the angular brackets during export. It defines a filter function, remove any strike-through text. The functions doing the filtering are
makes a filter variable local to the current buffer and adds the new filter defined in an src block that allows the filter function definitions to exist
to the filter variable. in the file itself and ensures that the functions will be there when needed.
@example @example
#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
#+begin_src emacs-lisp :exports results :results none #+begin_src emacs-lisp :exports results :results none
(defun my-org-export-filter-timestamp-function (timestamp backend info) (defun tmp-f-timestamp (s backend info)
"removes relevant brackets from a timestamp" (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
(when (org-export-derived-backend-p backend 'html) (defun tmp-f-strike-through (s backend info) "")
(replace-regexp-in-string "&[gl]t;\\|[][]" "" timestamp)))
(make-local-variable 'org-export-filter-timestamp-functions)
(add-to-list 'org-export-filter-timestamp-functions
'my-org-export-filter-timestamp-function)
#+end_src #+end_src
@end example @end example