;;; org-publish.el --- publish related org-mode files as a website
-;; Copyright (C) 2006-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
;; Author: David O'Toole <dto@gnu.org>
;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
;; Keywords: hypermedia, outlines, wp
-;; Version: 7.7
;; This file is part of GNU Emacs.
;;
:type 'string)
(defcustom org-publish-sitemap-file-entry-format "%t"
- "How a sitemap file entry is formated.
+ "How a sitemap file entry is formatted.
You could use brackets to delimit on what part the link will be.
%t is the title.
%a is the author.
-%d is the date formated using `org-publish-sitemap-date-format'."
+%d is the date formatted using `org-publish-sitemap-date-format'."
:group 'org-publish
:type 'string)
(declare-function org-publish-delete-dups "org-publish" (list))
(declare-function find-lisp-find-files "find-lisp" (directory regexp))
+(declare-function org-pop-to-buffer-same-window
+ "org-compat" (&optional buffer-or-name norecord label))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Getting project information out of org-publish-project-alist
(make-directory pub-dir t))
(let ((visiting (find-buffer-visiting filename)))
(save-excursion
- (switch-to-buffer (or visiting (find-file filename)))
+ (org-pop-to-buffer-same-window (or visiting (find-file filename)))
(let* ((plist (cons :buffer-will-be-killed (cons t plist)))
(init-buf (current-buffer))
(init-point (point))
org-export-preprocess-after-headline-targets-hook)
org-export-preprocess-after-headline-targets-hook)))
,@body))
+(def-edebug-spec org-publish-with-aux-preprocess-maybe (body))
(defvar project-plist)
(defun org-publish-org-to-latex (plist filename pub-dir)
(pub-dir
(file-name-as-directory
(file-truename
- (or (plist-get project-plist :publishing-directory)
+ (or (eval (plist-get project-plist :publishing-directory))
(error "Project %s does not have :publishing-directory defined"
(car project))))))
tmp-pub-dir)
If :makeindex is set, also produce a file theindex.org."
(mapc
(lambda (project)
- ;; Each project uses it's own cache file:
+ ;; Each project uses its own cache file:
(org-publish-initialize-cache (car project))
(let*
((project-plist (cdr project))
It returns time in `current-time' format."
(let ((visiting (find-buffer-visiting file)))
(save-excursion
- (switch-to-buffer (or visiting (find-file-noselect file nil t)))
+ (org-pop-to-buffer-same-window (or visiting (find-file-noselect file nil t)))
(let* ((plist (org-infile-export-plist))
(date (plist-get plist :date)))
(unless visiting
main last-main letter last-letter file sub link tgext)
;; `files' contains the list of relative file names
(dolist (file files)
- (setq origfile (substring file 1 -1))
+ (setq origfile
+ (concat (file-name-directory file)
+ (substring (file-name-nondirectory file) 1 -1)))
(setq buf (find-file-noselect file))
(with-current-buffer buf
(goto-char (point-min))
(kill-buffer buf))
(setq index (sort index (lambda (a b) (string< (downcase (car a))
(downcase (car b))))))
- (setq ibuffer (find-file-noselect (expand-file-name "theindex.org" directory)))
+ (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory)))
(with-current-buffer ibuffer
(erase-buffer)
(insert "* Index\n")
(insert " - " link "\n")
(insert " - " link "\n")))
(save-buffer))
- (kill-buffer ibuffer)))
+ (kill-buffer ibuffer)
+ ;; Create theindex.org if it doesn't exist already
+ (let ((index-file (expand-file-name "theindex.org" directory)))
+ (unless (file-exists-p index-file)
+ (setq ibuffer (find-file-noselect index-file))
+ (with-current-buffer ibuffer
+ (erase-buffer)
+ (insert "\n\n#+include: \"theindex.inc\"\n\n")
+ (save-buffer))
+ (kill-buffer ibuffer)))))
;; Caching functions:
(setq buf (find-file (expand-file-name filename)))
(with-current-buffer buf
(goto-char (point-min))
- (while (re-search-forward "^#\\+INCLUDE:[ \t]+\"?\\([^ \t\"]*\\)\"?[ \t]*.*$" nil t)
+ (while (re-search-forward "^#\\+INCLUDE:[ \t]+\"?\\([^ \t\n\r\"]*\\)\"?[ \t]*.*$" nil t)
(let* ((included-file (expand-file-name (match-string 1))))
(add-to-list 'included-files-ctime
(org-publish-cache-ctime-of-src included-file) t))))
(let ((ctime (org-publish-cache-ctime-of-src filename)))
(or (< pstamp ctime)
(when included-files-ctime
- (not (null (delq nil (mapcar (lambda(ct) (< ctime ct))
+ (not (null (delq nil (mapcar (lambda(ct) (< ctime ct))
included-files-ctime))))))))))
(defun org-publish-cache-set-file-property (filename property value &optional project-name)
(provide 'org-publish)
-
-
;;; org-publish.el ends here