emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Manuel Hermenegildo <herme@fi.upm.es>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: patch for :index-title
Date: Sat, 24 May 2008 19:38:46 +0200	[thread overview]
Message-ID: <18488.21158.163869.995461@clip.dia.fi.upm.es> (raw)


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	other threads:[~2008-05-24 17:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-24 17:38 Manuel Hermenegildo [this message]
2008-05-24 19:54 ` patch for :index-title 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=18488.21158.163869.995461@clip.dia.fi.upm.es \
    --to=herme@fi.upm.es \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).