[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add :noweb-prefix and :noweb-trans babel header arguments
From: |
Sébastien Miquel |
Subject: |
[PATCH] Add :noweb-prefix and :noweb-trans babel header arguments |
Date: |
Sat, 15 Jan 2022 10:42:38 +0000 |
Hi,
The attached patch adds support for two new babel header arguments:
=:noweb-prefix= and =:noweb-trans=.
=:noweb-prefix= can be set to =no= to disable the noweb prefix
behaviour, where prefix characters are repeated when expanding a
multiline noweb reference.
=:noweb-trans= can be set to =prin1-to-string= to insert a lisp string
representing the content of the referenced src block.
The goal is to allow one to use, say, a LaTeX src block to represent
some LaTeX snippet to be tangled into a string in some lisp (or other)
code. This isn't possible currently, and one has to manually string
escape the LaTeX code.
As an example, the following two blocks
#+BEGIN_SRC LaTeX :tangle no :noweb-ref nw
\usepackage{…}
\usepackage{…}
#+END_SRC
#+BEGIN_SRC emacs-lisp :noweb yes :tangle yes :noweb-prefix no
:noweb-trans prin1-to-string
(setq latex-header <<nw>>)
#+END_SRC
would tangle to
#+BEGIN_SRC emacs-lisp
(setq latex-header "\\usepackage{…}
\\usepackage{…}")
#+END_SRC
I've left undocumented the possibility of setting =:noweb-trans= to
another function. I wonder if anyone can think of some other use.
Regards,
--
Sébastien Miquel
0001-ob-core.el-Add-noweb-prefix-noweb-trans-babel-header.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments,
Sébastien Miquel <=