浏览代码

Use theindex.inc and theindex.org as described in the manual.

* org-publish.el (org-publish-index-generate-theindex): Use
theindex.inc for storing index entries, and theindex.org for
including theindex.inc.

Commit f0d7ac removed the theindex.inc and directly included
index entries in theindex.org.  This is not as flexible as using
theindex.org as a page you want to manually edit, which can then
include theindex.inc with proper content.

Thanks to Stefan Vollmar for insisting about this issue.
Bastien Guerry 13 年之前
父节点
当前提交
dd98619286
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      lisp/org-publish.el

+ 11 - 2
lisp/org-publish.el

@@ -997,7 +997,7 @@ the project."
       (kill-buffer buf))
     (setq index (sort index (lambda (a b) (string< (downcase (car a))
 						   (downcase (car b))))))
-    (setq ibuffer (find-file-noselect (expand-file-name "theindex.org" directory)))
+    (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory)))
     (with-current-buffer ibuffer
       (erase-buffer)
       (insert "* Index\n")
@@ -1024,7 +1024,16 @@ the project."
 	    (insert "     - " link "\n")
 	  (insert "   - " link "\n")))
       (save-buffer))
-    (kill-buffer ibuffer)))
+    (kill-buffer ibuffer)
+    ;; Create theindex.org if it doesn't exist already
+    (let ((index-file (expand-file-name "theindex.org" directory)))
+      (unless (file-exists-p index-file)
+       (setq ibuffer (find-file-noselect index-file))
+       (with-current-buffer ibuffer
+         (erase-buffer)
+         (insert "\n\n#+include: \"theindex.inc\"\n\n")
+         (save-buffer))
+       (kill-buffer ibuffer)))))
 
 ;; Caching functions: