From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Loury Subject: Re: Help with export filter? Date: Wed, 12 Aug 2015 15:33:27 +0200 Message-ID: <878u9gd42g.fsf@gmail.com> References: <8761ir0yvw.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPWA3-0004Yq-LD for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 09:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPW9y-0000kS-PL for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 09:33:43 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:33092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPW9y-0000jq-Ez for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 09:33:38 -0400 Received: by wijp15 with SMTP id p15so218024324wij.0 for ; Wed, 12 Aug 2015 06:33:37 -0700 (PDT) In-Reply-To: <8761ir0yvw.fsf@gmx.us> 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: Rasmus , tsd@tsdye.com Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi all, Rasmus writes: > Hi Tom, > > tsd@tsdye.com (Thomas S. Dye) writes: > >> Aloha all, >> >> Inspired by discussions and code on the mailing list, I managed to >> cobble together the headline filter below. It "works" in that the >> pdf output from LaTeX export is exactly what I want. I'm thrilled! >> >> It has one unwanted side effect. In the tex file, a headline tagged >> with either :newpage: or :clearpage: includes some extra baggage, like >> this: >> >> \newpage >> \section*{Introduction\hfill{}\textsc{}} >> \label{sec-5} >> >> I tried setting the option tags:nil, but then my export tags had no >> effect. Can someone suggest how I can avoid the \hfill etc.? Or, am I >> picking nits here? >> >> ***** Filter headline tags >> >> #+name: filter-headline-tags >> #+BEGIN_SRC emacs-lisp :results silent >> >> (defun tsd-filter-headline-tags (contents backend info) >> "Ignore headlines with tag `ignoreheading' and/or start LaTeX >> section with `newpage' or `clearpage' command." >> (cond ((and (org-export-derived-backend-p backend 'latex) >> (string-match "\\`.*newpage.*\n" (downcase contents)) >> (string-match "\\`.*ignoreheading.*\n" (downcase content= s))) >> (replace-match "\\\\newpage\n" nil nil contents)) >> ((and (org-export-derived-backend-p backend 'latex) >> (string-match "\\`.*clearpage.*\n" (downcase contents)) >> (string-match "\\`.*ignoreheading.*\n" (downcase content= s))) >> (replace-match "\\\\clearpage\n" nil nil contents)) >> ((and (org-export-derived-backend-p backend 'latex 'html 'asci= i) >> (string-match "\\`.*ignoreheading.*\n" (downcase content= s))) >> (replace-match "" nil nil contents)) >> ((and (org-export-derived-backend-p backend 'latex) >> (string-match "\\(\\`.*\\)newpage\\(.*\n\\)" (downcase c= ontents))) >> (replace-match "\\\\newpage\n\\1\\2" nil nil contents)) >> ((and (org-export-derived-backend-p backend 'latex) >> (string-match "\\(\\`.*\\)clearpage\\(.*\n\\)" (downcase= contents))) >> (replace-match "\\\\clearpage\n\\1\\2" nil nil contents)))) >> #+END_SRC This I just the feature I need today. Thank you for sharing. Do you know what is missing to add the feature to org-mode instead of adding in each user's .emacs file? My best, =2D-=20 Konubinix GPG Key : 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVy0sqAAoJEHXSPO10ORBqbdUH/inFzmO9GRM/8xceZBmBTP9i UgW9OdhlCzGguGYlI5VriDsH+wU2NoLyowJhs8kjYlrAsN0iWK6oXd09SeC/IFC6 3Dt9EDc+vRrdun7Bb6U9DSk3eIM9TfGaGR+pOl+VsX9/vR5Xxjb0jULWQ0B47zI1 LFzgrw76ineFs8ervJRaOaZOGukASGUsaAXQOCe1SsoSlABiGoZgu3c1c50DZn3A SRXqIbCswNSTSsAZY4GMRsCZm6Yzlmqp8+L8bSbh3Y4A+8Eabte1ZS7+/vdjgxrN PVg1uENpkqOJx3g4lOS3XlRf0CyvVQCx9UVs5FytUQDma5pO0HcENF0UHNe4ErA= =leKQ -----END PGP SIGNATURE----- --=-=-=--