[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Help with export filter?
From: |
Samuel Loury |
Subject: |
Re: [O] Help with export filter? |
Date: |
Wed, 12 Aug 2015 15:33:27 +0200 |
User-agent: |
Notmuch/0.19 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) |
Hi all,
Rasmus <address@hidden> writes:
> Hi Tom,
>
> address@hidden (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 contents)))
>> (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 contents)))
>> (replace-match "\\\\clearpage\n" nil nil contents))
>> ((and (org-export-derived-backend-p backend 'latex 'html 'ascii)
>> (string-match "\\`.*ignoreheading.*\n" (downcase contents)))
>> (replace-match "" nil nil contents))
>> ((and (org-export-derived-backend-p backend 'latex)
>> (string-match "\\(\\`.*\\)newpage\\(.*\n\\)" (downcase
>> contents)))
>> (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,
--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
signature.asc
Description: PGP signature
- Re: [O] Help with export filter?,
Samuel Loury <=