From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: More export filter examples out there? Date: Tue, 17 Mar 2015 23:53:48 +0100 Message-ID: <87fv931bib.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YY0Lp-0004P9-IT for emacs-orgmode@gnu.org; Tue, 17 Mar 2015 18:52:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YY0Ll-0006oa-CP for emacs-orgmode@gnu.org; Tue, 17 Mar 2015 18:52:41 -0400 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]:40754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YY0Ll-0006nc-72 for emacs-orgmode@gnu.org; Tue, 17 Mar 2015 18:52:37 -0400 In-Reply-To: (Allen S. Rout's message of "Tue, 17 Mar 2015 18:15:49 -0400") 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: "Allen S. Rout" Cc: emacs-orgmode@gnu.org Hello, "Allen S. Rout" writes: > I'm trying to accomplish a custom export task which I'd hoped to be > pretty simple: something like: > > > In each status section, only export the first child headline. > > > After several dumb ideas, I decided that doing it with a filter was > probably the Right Place. I built a filter intended to be used on > > :filter-parse-tree > > and attempted to express: > > If you're parent is a headline > and your parent's title is 'Status' > and you're not the first of your siblings > > then don't be included. I've added my malfunctioning filter below,to > clearly display my "thinking". Untested: (defun ox-asr-only-first-status (tree backend info) (org-element-map tree 'headline (lambda (h) (let ((parent (org-export-get-parent-headline h))) (when (and parent (string= (org-element-property :raw-value parent) "Status") (not (org-export-first-sibling-p h info))) (org-element-extract-element h))))) tree) > I don't seem to be able to get the title as a string. Use `:raw-value' property. > org-export-data seems to expect a different 'info' than the 'info' > present at filter time. I get complaints about > > org-export-data: Wrong type argument: hash-table-p, nil > > if I uncomment the attempt to string compare the title. Indeed. One cannot use `org-export-data' during parse tree filtering. Export output really depends on the tree and the options, which are being re-arranged. Regards, -- Nicolas Goaziou