On Mon, 7 Nov 2016, Lixin Chin wrote:

Hi,

Thanks, yes that almost works. Unfortunately the heading line is just
reproduced verbatim in the output, whereas ideally it should be parsed
as a normal heading.

I.e., currently:

#+BEGIN_EXPORT html
,* HTML only heading
Text which should appear in HTML exports, but not \LaTeX{}.
#+END_EXPORT

Exports as:

<div class="outline-text-2" id="text-1">
* HTML only heading
Text which should appear in HTML exports, but not \LaTeX{}.
</div>

Whereas ideally I'd like to be able to input:

#+BEGIN_EXPORT html
* HTML only heading
Text which should appear in HTML exports, but not \LaTeX{}.
#+END_EXPORT

that would export as:

<div id="outline-container-org2295e90" class="outline-2">
<h2 id="org2295e90"><span class="section-number-2">2</span> HTML only heading</h2>
 <div class="outline-text-2" id="text-2">
 <p>
   Text which should appear in HTML exports, but not \LaTeX{}.
 </p>
 </div>
</div>


Run this:

#+BEGIN_SRC emacs-lisp :eval never-export :exports none
  (require 'ob-org)
  (defun eval-if-html ()
    (if (not (eq org-export-current-backend 'html)) "never"))
#+END_SRC


Then export this with the html backend:

#+OPTIONS: toc:nil

#+BEGIN_SRC org :eval (eval-if-html) :exports results :results replace
  ,* HTML only heading
  Text which should appear in HTML exports, but not \LaTeX{}.
#+END_SRC

and you will get this:

<div id="outline-container-org1e9ad24" class="outline-2">
<h2 id="org1e9ad24"><span class="section-number-2">1</span> HTML only heading</h2>
<div class="outline-text-2" id="text-1">
<p>
Text which should appear in HTML exports, but not \LaTeX{}.
</p>
</div>
</div>

With other backends you get nothing.

HTH,

Chuck

Reply via email to