最小的例子
我使用带有 :noweb 扩展(?)的文学编程技术在 org 模式下编写了一个程序。典型的代码如下所示:
* Section
In order to do foo with bar, we define a function ~do_foo~, which initializes object of a class ~BarParser~ with a value of parameter of the type ~bar_t~.
#+name: section_function_blockname
#+begin_src cpp
void do_foo
( bar_t bar
, <<additional_parameter_to_do_foo>>
) {
BarParser barParser(bar);
<<section_function_do_fooBody>>
}
#+end_src
The function will require additional parameter for the purposes of the /FizzBazz/ module. We will discuss them in a [[*Decoding FizzBazz messages][later_section]].
程序的全部内容存储在一个文件中,顶部有#+SETUP: theme-readtheorg.setup
. 安装文件不是问题,因为 HTML 生成正确,只是没有我想要的内容。
问题
为了生成代码,我使用(org-babel-tangle)
. 这会生成我期望的所有带有 :tangle 参数的块的所有文件。这些文件具有我期望它们具有的内容,并且代码按应有的方式编译和运行。
为了生成我想随代码发布的文档,我使用(org-html-export-to-html)
. 我期望发生的是:
- 将
<<tags>>
被他们的期望值取代,这不是理想的,但至少可以接受,或者 - 当
<<tags>>
使用 Emacs 编辑 org 文件时,它们的呈现方式将保持不变。
然而,输出(org-html-export-to-html)
是完全不同且出乎意料的 - 所有<<tags>>
都被换行符替换。这让我看到所有代码块的内容不正确,如果不查看生成的代码或原始 org 文件就无法理解,这完全违背了文档在单独文件中的目的。我不能强迫与我一起工作的每个人都切换到 Emacs 让他们浏览文档!
问题
如上所述,问题在于 noweb <> 被内部的一些调用处理(org-html-export-to-html)
。我对这个问题的问题是:
如何(org-html-export-to-html)
在不剥离 noweb 的情况下强制保留源块的内容<<tags>>
?