From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: New worg page: Publishing beamer slideshows and articles from one source
Date: Sun, 25 May 2014 12:12:10 +0200 [thread overview]
Message-ID: <87zji6dv5x.fsf@gmx.us> (raw)
In-Reply-To: 20140524095416.GD28472@chitra.no-ip.org
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Hi Bastien,
>
> On Wed, May 21, 2014 at 03:28:28PM +0200, Bastien wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> 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.
next prev parent reply other threads:[~2014-05-25 10:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-10 2:57 New worg page: Publishing beamer slideshows and articles from one source James Harkins
2014-05-12 19:17 ` Suvayu Ali
2014-05-14 0:56 ` James Harkins
2014-05-14 16:11 ` Suvayu Ali
2014-05-21 13:28 ` Bastien
2014-05-24 9:54 ` Suvayu Ali
2014-05-25 10:12 ` Rasmus [this message]
2014-05-26 5:24 ` Bastien
2014-05-26 10:24 ` Rasmus
2014-05-26 12:43 ` Bastien
2014-05-26 15:56 ` Rasmus
2014-05-27 13:15 ` Suvayu Ali
2014-05-28 19:51 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zji6dv5x.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).