Dear list,
I stumbled on the conversion of an HTML Babel export block to a "normal" Babel output. What follows is the verbatim transcript of an org file explaining and demonstrating the problem :
# Attempt to use emacs-jupyter to insert Dyalog APL org-src blocks.
#+options: author:nil toc:nil
#+latex_compiler: lualatex
#+latex_header: \usepackage{minted}
#+latex_header: \usepackage{fontspec}
#+latex_header: \setmonofont{Unifont}
#+property: header-args:jupyter-apl :kernel dyalog-kernel :session pa
I want to use APL `src` blocks in an Org document. This can be done by using
[[https://www.dyalog.com/][Dyalog APL]] interpreter though
[[https://github.com/emacs-jupyter/jupyter][jupyter-emacs]] and the Dyalog
[[https://github.com/Dyalog/dyalog-jupyter-kernel][jupyter kernel]].
This apparently works :
#+begin_src jupyter-apl :exports both :results replace
⍳7
#+end_src
#+RESULTS:
#+begin_export html
<pre class="language-APL">1 2 3 4 5 6 7
</pre>
#+end_export
But, no matter what I try to use as parameters, Dyalog's kernel returns an HTML block, which exports to HTML
successfully (of course) but /not/ to LaTeX nor `.odt`/`docx` or even `Unicode text`. A glimpse at the
kernel's source code (partially in APL, beware !) suggests that's a /feature/ of this kernel, which returns
either HTML or graphics (which I didn't (yet) attempt to use).
I then attempted to work around this (mis)feature by converting the HTML block to text, using this
Stackoverflow
[[https://stackoverflow.com/questions/64796235/html-to-text-conversion-in-emacs][suggestion]] :
#+name: html2text
#+begin_src emacs-lisp :var data="<pre></pre>" :exports code :results silent
(with-temp-buffer
(insert data)
(shr-render-region (point-min) (point-max))
(buffer-substring-no-properties (point-min) (point-max)))
#+end_src
#+RESULTS: html2text
The conversion works fine :
#+begin_src jupyter-apl :exports both :results raw :post html2text(data=*this*)
⍳7
#+end_src
#+RESULTS:
#+begin_export html
1 2 3 4 5 6 7
#+end_export
but what /enrages/ me is that the (correct) result is still wrapped in an HTML block ; again, I have been
unable to obtain a "normal" output.
Can someone suggest a way to transform an HTML export block to a normal output ?
Source file and various exports enclosed (HTML is correct, the other ones not).
The question still holds...