From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manuel Hermenegildo Subject: Re: Publishing org files : index Date: Tue, 8 Jul 2008 22:54:06 -0600 Message-ID: <18548.17518.100718.653924@clip.dia.fi.upm.es> References: <18532.22619.459713.33756@clip.dia.fi.upm.es> <8F8FE6E3-F310-41AD-A56A-6E1516683E7C@uva.nl> Reply-To: Manuel Hermenegildo Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGRhb-0007L2-HF for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 00:54:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGRha-0007K6-UX for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 00:54:51 -0400 Received: from [199.232.76.173] (port=56860 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGRha-0007K3-Ir for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 00:54:50 -0400 Received: from relay.fi.upm.es ([138.100.8.58]:57595 helo=relay1.fi.upm.es) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KGRha-0007if-6W for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 00:54:50 -0400 In-Reply-To: <8F8FE6E3-F310-41AD-A56A-6E1516683E7C@uva.nl> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: org-mode , Richard G Riley 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) -------------------------------------------------------------------------------