我有一个包含许多小组织文件的组织模式项目,我想将其导出为
HTML.我没有在许多文件中设置#TITLE,因为它们没有正确的标题.我在导出时发现部分第一句被导出为文档的标题.
例如,组织文件如下:
This is a short file. Mary had a little lamb,etc.
将导出为具有以下HTML:
*snip* <div id="content"> <h1 class="title">This is a short file.</h1> <p>Mary had a little lamb,etc.</p> *snip*
解决方法
如果您查看org-export-region-as-html的代码,您将看到以下片段
(title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) (and buffer-file-name (file-name-sans-extension (file-name-nondirectory buffer-file-name))) "UNTITLED"))
如果没有定义标题,则调用函数org-export-grab-title-from-buffer.您可以通过建议禁用此功能
(defadvice org-export-grab-title-from-buffer (around org-export-grab-title-from-buffer-disable activate))