Browse Source

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 years ago
parent
commit
dd98619286
1 changed files with 11 additions and 2 deletions
  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: