emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] patch for :index-title


From: Manuel Hermenegildo
Subject: [Orgmode] patch for :index-title
Date: Sat, 24 May 2008 19:38:46 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]