emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* sa-ignore-headline for HTML export
@ 2014-01-08  1:29 James Harkins
  0 siblings, 0 replies; only message in thread
From: James Harkins @ 2014-01-08  1:29 UTC (permalink / raw)
  To: orgmode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-01-08  1:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08  1:29 sa-ignore-headline for HTML export James Harkins

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