From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: New worg page: Publishing beamer slideshows and articles from one source Date: Sun, 25 May 2014 12:12:10 +0200 Message-ID: <87zji6dv5x.fsf@gmx.us> References: <3cc8efb7-57ae-4749-9c7e-3c178adb911d@dewdrop-world.net> <20140512191732.GA2281@chitra.no-ip.org> <87zjibuupv.fsf@bzg.ath.cx> <20140524095416.GD28472@chitra.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoVPv-0001u2-RB for emacs-orgmode@gnu.org; Sun, 25 May 2014 06:12:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WoVPr-0002ni-7z for emacs-orgmode@gnu.org; Sun, 25 May 2014 06:12:35 -0400 Received: from plane.gmane.org ([80.91.229.3]:37918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoVPq-0002nZ-Ur for emacs-orgmode@gnu.org; Sun, 25 May 2014 06:12:31 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WoVPo-0002p6-ED for emacs-orgmode@gnu.org; Sun, 25 May 2014 12:12:28 +0200 Received: from dynamic-adsl-94-34-149-122.clienti.tiscali.it ([94.34.149.122]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 25 May 2014 12:12:28 +0200 Received: from rasmus by dynamic-adsl-94-34-149-122.clienti.tiscali.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 25 May 2014 12:12:28 +0200 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 Suvayu Ali writes: > Hi Bastien, > > On Wed, May 21, 2014 at 03:28:28PM +0200, Bastien wrote: >> Suvayu Ali writes: >> >> > BTW, the ignoreheading thing has been asked so many times, maybe I >> > should put it in an FAQ. But then, the content is more appropriate for >> > org-hacks ... I'm undecided. Any thoughts? >> >> It's both a FAQ and a hack, perhaps put the answer in the FAQ and the >> details in org-hacks? > > Done! > > Fine. > The intention is nice, but this entry is flawed to the point that it should be removed or undergo some heavy editing IMO. . . Take a quick example, after initializing emacs -q as in the footnote¹: * my heading p1 * ignoreheading p2 * ignore this heading :ignoreheading: p3 When you export this with the proposed filter the result is *completely broken* in plain text and html². In html it doesn't even manage to remove the offending headlines, much less fix the toc. In LaTeX it removes a headline too much, but of course it's kind of artificial in the example above. So if we *really* want to document this in the FAQ let us be honest: all of our attempts so far suck badly! The code posted only works in LaTeX and this needs to be reflected in backend check. Depending on the reader's use case there a better solutions. 1. If you do not have :ignoreheading: after :noexport: a hook removing headlines is the best option. You fully leverage the power of ox and it thus is the only trivial solution for non-LaTeX exporters.³ 2. If you only want to do LaTeX and you want to use the section filter and you do not have heading that consist only of =verbatim= then you can recover the ox-object representation from the text properties and check the actual tags.⁴ 3. If you do have =verbatim= only headings you can use a regexp.⁵ If you want to remove headings in html and text via a section filters it's going to be pretty nontrivial as content such as the TOC is generated by Org. —Rasmus Footnotes: ¹ (add-to-list 'load-path "/usr/share/emacs/site-lisp/org") (require 'ox) (defun sa-ignore-headline (contents backend info) "Ignore headlines with tag `ignoreheading'." (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii) (string-match "\\`.*ignoreheading.*\n" (downcase contents))) (replace-match "" nil nil contents))) (add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline) (progn (switch-to-buffer "test.org") (org-mode) (insert-string "* my heading p1 * ignoreheading p2 * ignore this heading :ignoreheading: p3")) ² ━━━━━━━━━━ TEST.ORG Rasmus ━━━━━━━━━━ Table of Contents ───────────────── 1 my heading 2 ignoreheading 3 ignore this heading :ignoreheading: 1 my heading ════════════ p1 ═══════════════ p2 ═════════════════════ p3 ³ https://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg01459.html ⁴ https://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg01480.html ⁵ https://stackoverflow.com/questions/10295177/is-there-an-equivalent-of-org-modes-b-ignoreheading-for-non-beamer-documents -- Lasciate ogni speranza, voi che leggete questo.