emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] New worg page: Publishing beamer slideshows and articles from on


From: Rasmus
Subject: Re: [O] New worg page: Publishing beamer slideshows and articles from one source
Date: Sun, 25 May 2014 12:12:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Suvayu Ali <address@hidden> writes:

> Hi Bastien,
>
> On Wed, May 21, 2014 at 03:28:28PM +0200, Bastien wrote:
>> Suvayu Ali <address@hidden> 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!
>
> <http://orgmode.org/worg/org-faq.html#ignoreheadline>

Fine.

> <http://orgmode.org/worg/org-hacks.html#ignoreheadline>

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]