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 via email to