Emacs内将Org文件生成HTML的方法
C-c C-e h h
自不必说。但在命令行下将org文件生成html的方法,却没有发现一个权威的。
http://orgmode.org/worg/org-tools/ 这里列出了各种org2html的实现,不知靠谱不?
各位Emacser大大们用什么来把org转html呢?
Emacs里不同情况下调用不同版本的org-mode,很诡异。期待高手出来解释一下:
$ emacs --batch --eval "(message (version))" --eval "(package-initialize)" --eval "(message (org-version))"
GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-04-02 on amoblin.local
8.2.5h
$ emacs --batch --eval "(message (version))" --eval "(package-initialize)" --eval "(message (org-version))" test.org
GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-04-02 on amoblin.local
8.2.5h
Loading vc-git...
$ emacs test.org --batch --eval "(message (version))" --eval "(package-initialize)" --eval "(message (org-version))"
OVERVIEW
Loading vc-git...
GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-04-02 on amoblin.local
7.9.3f
$ emacs --batch --eval "(message (version))" --eval "(message (org-version))" --eval "(package-initialize)" --eval "(message (org-version))"
GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-04-02 on amoblin.local
7.9.3f
7.9.3f
$ emacs test.org --batch --eval "(message (version))" --eval "(message (org-version))" --eval "(package-initialize)" --eval "(message (org-version))"
OVERVIEW
Loading vc-git...
GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-04-02 on amoblin.local
7.9.3f
7.9.3f
$ emacs --batch --eval "(message (version))" --eval "(message (org-version))" --eval "(package-initialize)" --eval "(message (org-version))" test.org
GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-04-02 on amoblin.local
7.9.3f
7.9.3f
Problems while trying to load feature `org-gnus'
Problems while trying to load feature `org-jsinfo'
OVERVIEW
Loading vc-git...
可以写emacs脚本来做这件事情,但是我觉得没有必要在命令行下面做这个事情吧?写orgmode文档是在emacs中进行的,那么在emacs中将orgmode文档导出成html是很自然的行为,为什么非得要在命令行下?
首先, 你需要了解 Batch-mode
http://www.emacswiki.org/emacs/BatchMode,
然后是你的答案
emacs test.org --batch --eval "(require 'ox)" --eval "(org-html-export-to-html)"
另外在补充一句, org-mode
重构了大量代码, 现在导出工作一般交给 ox-*
这些工具库来做, ox-html
的 org-html-export-to-html
用来导出 html 效果很不错.
org2html.el