emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch for :index-title
@ 2008-05-24 17:38 Manuel Hermenegildo
  2008-05-24 19:54 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Hermenegildo @ 2008-05-24 17:38 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode


Hi Carsten,

:index-title (which I need) was not working and I saw that the
implementation was not there yet in the (git) code, so I added it to
org-publish-org-index (hopefully correctly). I send you the diff and
the new version of org-publish-org-index.

Btw, a minor thing I noticed in the manual: in the documentation for
org-publish-project-alist it says:

  "The :include property may be used to include extra files. Its value
   may be a list of filenames to include. The filenames are considered
   relative to the publishing directory."

I think it should say "base directory". 

Cheers --Manuel


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

Diff:

589,590d588
< 	 (index-title (or (plist-get project-plist :index-title)
< 			  (concat "Index for project " (car project))))
598d595
<       (insert (concat index-title "\n\n"))

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

(defun org-publish-org-index (project &optional index-filename)
  "Create an index of pages in set defined by PROJECT.
Optionally set the filename of the index with INDEX-FILENAME.
Default for INDEX-FILENAME is 'index.org'."
  (let* ((project-plist (cdr project))
	 (dir (file-name-as-directory
	       (plist-get project-plist :base-directory)))
	 (exclude-regexp (plist-get project-plist :exclude))
	 (files (org-publish-get-base-files project exclude-regexp))
	 (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-buffer (find-buffer-visiting index-filename))
	 (ifn (file-name-nondirectory index-filename))
	 file)
    ;; if buffer is already open, kill it to prevent error message
    (if index-buffer
	(kill-buffer index-buffer))
    (with-temp-buffer
      (insert (concat index-title "\n\n"))
      (while (setq file (pop files))
	(let ((fn (file-name-nondirectory file)))
	  ;; index shouldn't index itself
	  (unless (string= fn ifn)
	    (insert (concat " + [[file:" fn "]["
			    (file-name-sans-extension fn)
			    "]]\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)
-------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-24 19:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-24 17:38 patch for :index-title Manuel Hermenegildo
2008-05-24 19:54 ` Carsten Dominik

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