emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: James Harkins <jamshark70@gmail.com>
To: orgmode <emacs-orgmode@gnu.org>
Subject: sa-ignore-headline for HTML export
Date: Wed, 08 Jan 2014 09:29:25 +0800	[thread overview]
Message-ID: <655e7cf5-021a-413d-9485-5f7e48bb05ba@dewdrop-world.net> (raw)

Hi Suvayu,

I've been using your "sa-ignore-headline" filter [1] for a while -- works 
great for LaTeX.

(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)))

Unfortunately, although this is supposed to apply to latex, html and ascii 
backends, the string-match works only for LaTeX. I was just trying it with 
HTML and there was no effect.

For HTML export, the "contents" end up looking like this:

<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> 
B&#xa0;&#xa0;&#xa0;<span class="tag"><span 
class="ignoreheading">ignoreheading</span></span></h2>
<div class="outline-text-2" id="text-2">
<p>
Text B
</p>
</div>
</div>

.. where there is no backquote to match.

So I've changed the string-match predicate to read as follows (also 
removing the downcase), and it now works with HTML export.

(string-match ".*ignoreheading.*" contents)

That's a hack -- sufficient for now, but ideally I suppose it should 
dispatch to a different predicate per backend.

Posting here because I didn't see a way on stackexchange to comment on your 
answer.

Thanks for the function! It would have taken me ages to figure it out on my 
own.
hjh

[1] 
http://stackoverflow.com/questions/10295177/is-there-an-equivalent-of-org-modes-b-ignoreheading-for-non-beamer-documents

                 reply	other threads:[~2014-01-08  1:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=655e7cf5-021a-413d-9485-5f7e48bb05ba@dewdrop-world.net \
    --to=jamshark70@gmail.com \
    --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).