Hi Carsten,

 > Any news on this, Manuel?

A call went missing when the patch I sent you was applied (my fault
for not using -u ;-)) but it is actually fixed in the current git
version. 

Btw, the current index includes directory information, so that if I
have in my project two files:

org/test/too/foo.org (Title: This is file foo)
org/test/simple.org  (Title: This is a simple Org-generated web page)

the index looks like:

    * org/
          o test/
                + too/
                      # This is file foo
    * org/
          o test/
                + This is a simple Org-generated web page

which can be useful if the directory names are explicit
enough. However, I think in some cases one actually wants the index to
look simply like:

    * This is file foo
    * This is a simple Org-generated web page

I send a patch that implements a new index option:

  :index-style           Can be 'list (index is just an itemized list
                         of the titles of the files involved) or 
                         'tree (the directory structure of the source
                         files is reflected in the index). Defaults to
                         'tree."

(Btw, I would actually prefer to default to 'list, but I leave that to
you Carsten, or what people prefer, since it would change the current
behavior.)

Please include the patch if you find it useful.

Cheers,

Manuel


=================================================================

--- org-publish.el      2008-07-08 22:30:49.000000000 -0600
+++ org-publish.el.git  2008-07-08 19:00:04.000000000 -0600
@@ -263,12 +263,7 @@
   :index-function        Plugin function to use for generation of index.
                          Defaults to `org-publish-org-index', which
                          generates a plain list of links to all files
-                         in the project.
-  :index-style           Can be 'list (index is just an itemized list
-                         of the titles of the files involved) or 
-                         'tree (the directory structure of the source
-                         files is reflected in the index). Defaults to
-                         'tree."
+                         in the project."
   :group 'org-publish
   :type 'alist)
 
@@ -612,8 +607,6 @@
         (index-filename (concat dir (or index-filename "index.org")))
         (index-title (or (plist-get project-plist :index-title)
                          (concat "Index for project " (car project))))
-        (index-style (or (plist-get project-plist :index-style)
-                         'tree))
         (index-buffer (find-buffer-visiting index-filename))
         (ifn (file-name-nondirectory index-filename))
         file)
@@ -628,32 +621,25 @@
              (oldlocal localdir))
          ;; index shouldn't index itself
          (unless (string= fn ifn)
-           (if (eq index-style 'list)
-               (message "Generating list-style index for %s" index-title)
-             (message "Generating tree-style index for %s" index-title)
-             (setq localdir (concat (file-name-as-directory dir)
-                                    (file-name-directory link)))
-             (unless (string= localdir oldlocal)
-               (if (string= localdir dir)
-                   (setq indent-str (make-string 2 ?\ ))
-                 (let ((subdirs
-                        (split-string
-                         (directory-file-name
-                          (file-name-directory
-                           (file-relative-name localdir dir))) "/"))
-                       (subdir ""))
-                   (setq indent-str (make-string 2 ?\ ))
-                   (dolist (d subdirs)
-                     (setq subdir (concat subdir d "/"))
-                     (insert (concat indent-str " + [[file:" 
-                                     subdir "][" d "/]]\n"))
-                     (setq indent-str (make-string 
-                                       (+ (length indent-str) 2) ?\ )))))))
-           ;; This is common to 'flat and 'tree
+           (setq localdir (concat (file-name-as-directory dir)
+                                  (file-name-directory link)))
+           (unless (string= localdir oldlocal)
+             (if (string= localdir dir)
+                 (setq indent-str (make-string 2 ?\ ))
+               (let ((subdirs
+                      (split-string
+                       (directory-file-name
+                        (file-name-directory
+                         (file-relative-name localdir dir))) "/"))
+                     (subdir ""))
+                 (setq indent-str (make-string 2 ?\ ))
+                 (dolist (d subdirs)
+                   (setq subdir (concat subdir d "/"))
+                   (insert (concat indent-str " + [[file:" subdir "][" d 
"/]]\n"))
+                   (setq indent-str (make-string (+ (length indent-str) 2) ?\ 
))))))
            (insert (concat indent-str " + [[file:" link "]["
                            (org-publish-find-title file)
-                           "]]\n"))
-           )))
+                           "]]\n")))))
       (write-file index-filename)
       (kill-buffer (current-buffer)))))
 

-- 
-------------------------------------------------------------------------------
 Manuel Hermenegildo                     |              Prof., C.S. Department
 Director, IMDEA-Software and CLIP Group |                T.U. of Madrid (UPM)
 http://www.cliplab.org/herme            | +34-91-336-7435 (W) -352-4819 (Fax)
-------------------------------------------------------------------------------



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to