I'm using a Python code-block (the middle part of the code below) to convert the table (top part) into an Emacs Lisp code-block (the bottom part).
#+NAME: tmp_table
| key | trans | description |
|-----+----------+-----------------------|
| a. | \alpha | Greek lowercase alpha |
| b. | \beta | Greek lowercase beta |
| e. | \epsilon | Greek epsilon |
| p. | \pi | Greek lowercase pi |
| d. | \delta | Greek lowercase delta |
#+BEGIN_SRC python :var table=tmp_table :hlines no :results output code :results_switches ":tangle /tmp/tmp.el :noweb yes"
def format_table_to_elisp(table):
for line in table:
key, trans, desc = line
key = repr(key).replace("\'", "\"")
trans = repr(trans).replace("\'", "\"")
print(f"({key} [{trans:<11}] ) ;; {desc}")
format_table_to_elisp(table)
#+END_SRC
#+RESULTS:
#+begin_src python :tangle /tmp/tmp.el :noweb yes
("a." ["\\alpha" ] ) ;; Greek lowercase alpha
("b." ["\\beta" ] ) ;; Greek lowercase beta
("e." ["\\epsilon"] ) ;; Greek epsilon
("p." ["\\pi" ] ) ;; Greek lowercase pi
("d." ["\\delta" ] ) ;; Greek lowercase delta
#+end_src
So far the Python code above is converting the table into an Emacs Lisp good enough.
However, the outputted result code block (the bottom part) has #+RESULTS: #+begin_src python
(Python) and has Python syntax highlighting.
How can I make a Python code block output an Emacs Lisp code-block? I.e., #+RESULTS: #+begin_src elisp