emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Manuel Hermenegildo <herme@fi.upm.es>
To: Carsten Dominik <dominik@uva.nl>
Cc: org-mode <emacs-orgmode@gnu.org>,
	Richard G Riley <rileyrgdev@googlemail.com>
Subject: Re: Publishing org files : index
Date: Tue, 8 Jul 2008 22:54:06 -0600	[thread overview]
Message-ID: <18548.17518.100718.653924@clip.dia.fi.upm.es> (raw)
In-Reply-To: <8F8FE6E3-F310-41AD-A56A-6E1516683E7C@uva.nl>


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)
-------------------------------------------------------------------------------

  reply	other threads:[~2008-07-09  4:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 20:56 Publishing org files : index Richard G Riley
2008-06-27  2:59 ` Manish
2008-06-27 13:51   ` Sebastian Rose
2008-06-27  3:02 ` Manuel Hermenegildo
2008-07-08 22:09   ` Carsten Dominik
2008-07-09  4:54     ` Manuel Hermenegildo [this message]
2008-07-09 16:56       ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18548.17518.100718.653924@clip.dia.fi.upm.es \
    --to=herme@fi.upm.es \
    --cc=dominik@uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=rileyrgdev@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).