以 cweb 或 noweb 样式导出代码块名称? [英] Export code block names in cweb or noweb style?

查看:68
本文介绍了以 cweb 或 noweb 样式导出代码块名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Org 模式下编写文学程序时,导出类似于在早期的文学编程工具(如 cweb 或 noweb)中编织.这些工具会将代码块名称添加到编织(导出)输出中.在 Org 模式下,它看起来像这样:

When writing a literate program in Org mode, exporting is analogous to weaving in earlier literate programming tools such as cweb or noweb. Those tools would add a code block name to the woven (exported) output. In Org mode, it would look something like this:

组织文件:

#+NAME: mycodeblock
#+BEGIN_SRC language
[Source code here]
#+END_SRC

导出的输出:

<mycodeblock>=
[Source code here]

我想知道 Org 模式是否支持以这种方式导出代码块的名称.如果不是,有没有办法至少将代码块的名称输出为某种标签?

I am wondering if there is any support in Org mode for exporting names of code blocks in this style. If not, is there any way to at least output the name of the code block as a label of some kind?

我看到了可以导出代码块名称的提示,但我没有找到确切的语法.

I have seen hints that names of code blocks can be exported, but I have failed to find the exact syntax.

推荐答案

您可以尝试:

;; template used to export the body of code blocks
(setq org-babel-exp-code-template
      ;; (concat "\n=%name=:\n"
              org-babel-exp-code-template)
      ;; )
)

虽然,这不如 NuWeb/NoWeb 的结果好;见 http://lists.gnu.org/archive/html/emacs-orgmode/2009-12/msg00170.html 用于比较它们与 Org(尽管 PDF 链接不再可用).

Though, that's not as nice as the results of NuWeb / NoWeb; see http://lists.gnu.org/archive/html/emacs-orgmode/2009-12/msg00170.html for a comparison of them vs Org (though the PDF links aren't accessible anymore).

这篇关于以 cweb 或 noweb 样式导出代码块名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆