是否可以在 emacs 组织模式下嵌套 "includes"?

Is it possible to have nested "includes" in emacs org mode?

我正在编写文档,但我的一份文档开始变得非常庞大。我决定将它分成几个部分并将它们全部包含在一个主要部分中,但我意识到当我这样做时我不可能正确导出 html 文件。

示例:

我有一个主组织文件:

#+TITLE: SO Example
#+LaTeX_CLASS: memoir
#+OPTIONS: ^:nil LaTeX:nil TeX:nil

* 1st Level
This is the first level.
#+INCLUDE: "nested_includes.org"

nested_includes.org 看起来像:

** 2nd Level
This is the second level
#+INCLUDE: "single_include.org"

single_include.org 看起来像:

*** 3rd Level
This is the third level

我使用以下命令构建我的 HTML 文件:

C:\...\emacs\bin\emacs.exe parent.org --batch -q --no-site-file --load C:\...\site-lisp\org-html-so.el -f org-export-as-html --kill

这是我的组织-html-so.el 的样子:

(setq org-export-author-info nil)
(setq org-export-creator-info nil)
(setq org-export-time-stamp-file nil)
(setq org-export-with-timestamps nil)

当我构建时,我最终得到这样的东西:

与此同时,我期待这样的事情:

这是已知的 issue/limitation emacs org 模式吗? 我有办法增加包含深度吗?

谢谢!

我怀疑您使用的导出功能是旧版本的 org-mode。在 org-mode 版本 8 中,导出功能被重写。我已经快速了解了如何使用我的 emacs 安装的 org 版本来实现它。所以对我来说:

M-x org-version

给出:

Org-mode version 8.2.10 (release_8.2.10 @ c:/dev/emacs/share/emacs/24.5/lisp/org/)

我的 emacs 24.5 版本附带了它。给定您创建的相同文件。我将 org-html-so.el 更改为:

(require 'org)
(require 'ox) 
(require 'ox-html)
(setq org-export-author-info nil)
(setq org-export-creator-info nil)
(setq org-export-time-stamp-file nil)
(setq org-export-with-timestamps nil)

然后 emacs 调用是:

emacs.exe parent.org --batch -q --no-site-file --load org-html-so.el -f org-html-export-to-html --kill

包括深度

这个版本的 include 似乎没有限制深度,但它确实会记住以前包含的文件区域以确保 include 不是递归的。

正在升级

如果您有较早版本的 emacs:您可以升级您的 emacs 版本,或者您可以在现有安装中安装更新版本的 org。

通过包管理器安装更新版本或从 github 在本地安装。请参阅 Org Manual 中的安装页面。

值得升级,至少因为以后的版本更活跃你可以利用最新的功能。例如,您可能喜欢 html 主题 org-html-themes 的支持。