From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shiyuan Subject: org-latex filters Date: Wed, 30 Jul 2014 00:12:31 -0700 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2c34a2e1b9a04ff63e1a4 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCO3t-0006bO-QF for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 03:12:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCO3s-0004zg-JX for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 03:12:33 -0400 Received: from mail-vc0-x22d.google.com ([2607:f8b0:400c:c03::22d]:32956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCO3s-0004zb-EP for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 03:12:32 -0400 Received: by mail-vc0-f173.google.com with SMTP id hy10so1154134vcb.18 for ; Wed, 30 Jul 2014 00:12:31 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" --001a11c2c34a2e1b9a04ff63e1a4 Content-Type: text/plain; charset=UTF-8 Hi, I try to understand what the filter system is for and why the transcoders itself doesn't suffice. So I take an example and want to see how the filters are used in real exporter. I look at ox-latex.el and try to make sense of the filters 1. There are only two filters are used: :filters-alist '((:filter-options . org-latex-math-block-options-filter) (:filter-parse-tree . org-latex-math-block-tree-filter)) The purpose of org-latex-math-block-options-filter seems to be converting whatever in the property list of :author, :date, :title to strings of latex commands(please correct me if I am wrong). But what is the purpose of org-latex-math-block-tree-filter? The org-latex--wrap-latex-math-block is quite sophisticate and I don't get what it's doing. ----------------------------------------------------- (defun org-latex-math-block-options-filter (info backend) (dolist (prop '(:author :date :title) info) (plist-put info prop (org-latex--wrap-latex-math-block (plist-get info prop) info)))) ---------------------------------------------------- (defun org-latex-math-block-tree-filter (tree backend info) (org-latex--wrap-latex-math-block tree info)) ---------------------------------------------------- 2. For the filters of the form :filter-TYPE, there is also a transcoder for processing the same TYPE. For example, for bold, there are :filter-bold, but bold is also processed in the transcoder specified in the transcoder alist when the backend is defined(by org-export-define-backend). When shall we use a transcode and when shall we use a filter? Thank you. Shiyuan --001a11c2c34a2e1b9a04ff63e1a4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0
=C2=A0 =C2=A0 I try to understand what the f= ilter system is for and why the transcoders itself doesn't suffice. So = I take an example and want to see how the filters are used in real exporter= . =C2=A0I look at ox-latex.el and try to make sense of the filters=C2=A0

1. There are only two filters are used:=C2=A0

=C2=A0:filters-alist '((:filter-options . org-late= x-math-block-options-filter)
=C2=A0 (:filter-parse-tree . org-latex-math-block-tree-fil= ter))

The purpose of org-latex-math-block-options-filte= r seems to be converting whatever in the property list of :author, :date, := title =C2=A0to strings of latex commands(please correct me if I am wrong). = =C2=A0But what is the purpose of org-latex-math-block-tree-filter? The org-= latex--wrap-latex-math-block is quite sophisticate and I don't get what= it's doing.=C2=A0

-----------------------------------------------------
(defun org-latex-math-block-options-filter (info backend)
=C2=A0 (dolist (prop '(:author :date :title) info)
=C2= =A0 =C2=A0 (plist-put info prop
=C2=A0=C2=A0 =C2=A0= =C2=A0 (org-latex--wrap-latex-math-block (plist-get info prop) info))))
----------------------------------------------------
(defun org-latex-math-block-tree-filter (tree backend info)
=C2=A0 (org-latex--wrap-latex-math-block tree info))
-------= ---------------------------------------------

2. F= or the filters of the form :filter-TYPE, there is also a transcoder for pro= cessing the same TYPE. For example, for bold, there are :filter-bold, but b= old is also processed in the transcoder specified in the transcoder alist w= hen the backend is defined(by org-export-define-backend). When shall we use= a transcode and when shall we use a filter?=C2=A0

Thank you.=C2=A0

Shiyuan=C2=A0=




--001a11c2c34a2e1b9a04ff63e1a4--