Mercurial > emacs
comparison lisp/org/org-publish.el @ 100458:ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
* Fix typos in comments and docstrings throughout Org-mode.
* org.el (org-get-outline-path): Fix bug if level is not given.
* org-agenda.el (org-finalize-agenda): Fix typo with variable
name.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Wed, 17 Dec 2008 12:34:50 +0000 |
parents | cea079b68b76 |
children | 0d3c634e0bd9 |
comparison
equal
deleted
inserted
replaced
100457:022a6a6d35ab | 100458:ba23e35d3eaf |
---|---|
2 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. | 2 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Author: David O'Toole <dto@gnu.org> | 4 ;; Author: David O'Toole <dto@gnu.org> |
5 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org> | 5 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org> |
6 ;; Keywords: hypermedia, outlines, wp | 6 ;; Keywords: hypermedia, outlines, wp |
7 ;; Version: 6.15a | 7 ;; Version: 6.15d |
8 | 8 |
9 ;; This file is part of GNU Emacs. | 9 ;; This file is part of GNU Emacs. |
10 ;; | 10 ;; |
11 ;; GNU Emacs is free software: you can redistribute it and/or modify | 11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
12 ;; it under the terms of the GNU General Public License as published by | 12 ;; it under the terms of the GNU General Public License as published by |
68 ;;;; Simple example configuration: | 68 ;;;; Simple example configuration: |
69 | 69 |
70 ;; (setq org-publish-project-alist | 70 ;; (setq org-publish-project-alist |
71 ;; (list | 71 ;; (list |
72 ;; '("org" . (:base-directory "~/org/" | 72 ;; '("org" . (:base-directory "~/org/" |
73 ;; :base-extension "org" | 73 ;; :base-extension "org" |
74 ;; :publishing-directory "~/public_html" | 74 ;; :publishing-directory "~/public_html" |
75 ;; :with-section-numbers nil | 75 ;; :with-section-numbers nil |
76 ;; :table-of-contents nil | 76 ;; :table-of-contents nil |
77 ;; :recursive t | 77 ;; :recursive t |
78 ;; :style "<link rel="stylesheet" href=\"../other/mystyle.css\" type=\"text/css\">"))) | 78 ;; :style "<link rel="stylesheet" href=\"../other/mystyle.css\" type=\"text/css\">"))) |
79 | 79 |
80 ;;;; More complex example configuration: | 80 ;;;; More complex example configuration: |
81 | 81 |
82 ;; Imagine your *.org files are kept in ~/org, your images in | 82 ;; Imagine your *.org files are kept in ~/org, your images in |
83 ;; ~/images, and stylesheets in ~/other. Now imagine you want to | 83 ;; ~/images, and stylesheets in ~/other. Now imagine you want to |
94 ;; HTML, and leaving other files alone. | 94 ;; HTML, and leaving other files alone. |
95 | 95 |
96 ;; (setq org-publish-project-alist | 96 ;; (setq org-publish-project-alist |
97 ;; (list | 97 ;; (list |
98 ;; '("orgfiles" :base-directory "~/org/" | 98 ;; '("orgfiles" :base-directory "~/org/" |
99 ;; :base-extension "org" | 99 ;; :base-extension "org" |
100 ;; :publishing-directory "/ssh:user@host:~/html/notebook/" | 100 ;; :publishing-directory "/ssh:user@host:~/html/notebook/" |
101 ;; :publishing-function org-publish-org-to-html | 101 ;; :publishing-function org-publish-org-to-html |
102 ;; :exclude "PrivatePage.org" ;; regexp | 102 ;; :exclude "PrivatePage.org" ;; regexp |
103 ;; :headline-levels 3 | 103 ;; :headline-levels 3 |
104 ;; :with-section-numbers nil | 104 ;; :with-section-numbers nil |
105 ;; :table-of-contents nil | 105 ;; :table-of-contents nil |
106 ;; :style "<link rel="stylesheet" href=\"../other/mystyle.css\" type=\"text/css\">" | 106 ;; :style "<link rel="stylesheet" href=\"../other/mystyle.css\" type=\"text/css\">" |
107 ;; :auto-preamble t | 107 ;; :auto-preamble t |
108 ;; :auto-postamble nil) | 108 ;; :auto-postamble nil) |
109 ;; ("images" :base-directory "~/images/" | 109 ;; ("images" :base-directory "~/images/" |
110 ;; :base-extension "jpg\\|gif\\|png" | 110 ;; :base-extension "jpg\\|gif\\|png" |
111 ;; :publishing-directory "/ssh:user@host:~/html/images/" | 111 ;; :publishing-directory "/ssh:user@host:~/html/images/" |
112 ;; :publishing-function org-publish-attachment) | 112 ;; :publishing-function org-publish-attachment) |
113 ;; ("other" :base-directory "~/other/" | 113 ;; ("other" :base-directory "~/other/" |
114 ;; :base-extension "css" | 114 ;; :base-extension "css" |
115 ;; :publishing-directory "/ssh:user@host:~/html/other/" | 115 ;; :publishing-directory "/ssh:user@host:~/html/other/" |
116 ;; :publishing-function org-publish-attachment) | 116 ;; :publishing-function org-publish-attachment) |
117 ;; ("website" :components ("orgfiles" "images" "other")))) | 117 ;; ("website" :components ("orgfiles" "images" "other")))) |
118 | 118 |
119 ;; For more information, see the documentation for the variable | 119 ;; For more information, see the documentation for the variable |
120 ;; `org-publish-project-alist'. | 120 ;; `org-publish-project-alist'. |
121 | 121 |
300 ;;; Timestamp-related functions | 300 ;;; Timestamp-related functions |
301 | 301 |
302 (defun org-publish-timestamp-filename (filename) | 302 (defun org-publish-timestamp-filename (filename) |
303 "Return path to timestamp file for filename FILENAME." | 303 "Return path to timestamp file for filename FILENAME." |
304 (concat (file-name-as-directory org-publish-timestamp-directory) | 304 (concat (file-name-as-directory org-publish-timestamp-directory) |
305 "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) | 305 "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) |
306 | 306 |
307 (defun org-publish-needed-p (filename) | 307 (defun org-publish-needed-p (filename) |
308 "Return `t' if FILENAME should be published." | 308 "Return `t' if FILENAME should be published." |
309 (let ((rtn | 309 (let ((rtn |
310 (if org-publish-use-timestamps-flag | 310 (if org-publish-use-timestamps-flag |
337 (write-file timestamp-file) | 337 (write-file timestamp-file) |
338 (setq newly-created-timestamp t))) | 338 (setq newly-created-timestamp t))) |
339 ;; Emacs 21 doesn't have `set-file-times' | 339 ;; Emacs 21 doesn't have `set-file-times' |
340 (if (and (fboundp 'set-file-times) | 340 (if (and (fboundp 'set-file-times) |
341 (not newly-created-timestamp)) | 341 (not newly-created-timestamp)) |
342 (set-file-times timestamp-file) | 342 (set-file-times timestamp-file) |
343 (call-process "touch" nil 0 nil timestamp-file)))) | 343 (call-process "touch" nil 0 nil timestamp-file)))) |
344 | 344 |
345 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 345 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
346 ;;; Mapping files to project names | 346 ;;; Mapping files to project names |
347 | 347 |
427 "Set `org-publish-temp-files' with files from BASE-DIR directory. | 427 "Set `org-publish-temp-files' with files from BASE-DIR directory. |
428 If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is | 428 If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is |
429 non-nil, restrict this list to the files matching the regexp | 429 non-nil, restrict this list to the files matching the regexp |
430 MATCH. If SKIP-FILE is non-nil, skip file matching the regexp | 430 MATCH. If SKIP-FILE is non-nil, skip file matching the regexp |
431 SKIP-FILE. If SKIP-DIR is non-nil, don't check directories | 431 SKIP-FILE. If SKIP-DIR is non-nil, don't check directories |
432 matching the regexp SKIP-DIR when recursiing through BASE-DIR." | 432 matching the regexp SKIP-DIR when recursing through BASE-DIR." |
433 (mapc (lambda (f) | 433 (mapc (lambda (f) |
434 (let ((fd-p (file-directory-p f)) | 434 (let ((fd-p (file-directory-p f)) |
435 (fnd (file-name-nondirectory f))) | 435 (fnd (file-name-nondirectory f))) |
436 (if (and fd-p recurse | 436 (if (and fd-p recurse |
437 (not (string-match "^\\.+$" fnd)) | 437 (not (string-match "^\\.+$" fnd)) |
449 If EXCLUDE-REGEXP is set, this will be used to filter out | 449 If EXCLUDE-REGEXP is set, this will be used to filter out |
450 matching filenames." | 450 matching filenames." |
451 (let* ((project-plist (cdr project)) | 451 (let* ((project-plist (cdr project)) |
452 (base-dir (file-name-as-directory | 452 (base-dir (file-name-as-directory |
453 (plist-get project-plist :base-directory))) | 453 (plist-get project-plist :base-directory))) |
454 (include-list (plist-get project-plist :include)) | 454 (include-list (plist-get project-plist :include)) |
455 (recurse (plist-get project-plist :recursive)) | 455 (recurse (plist-get project-plist :recursive)) |
456 (extension (or (plist-get project-plist :base-extension) "org")) | 456 (extension (or (plist-get project-plist :base-extension) "org")) |
457 (match (concat "^[^\\.].*\\.\\(" extension "\\)$"))) | 457 (match (concat "^[^\\.].*\\.\\(" extension "\\)$"))) |
458 (setq org-publish-temp-files nil) | 458 (setq org-publish-temp-files nil) |
459 (org-publish-get-base-files-1 base-dir recurse match | 459 (org-publish-get-base-files-1 base-dir recurse match |
460 ;; FIXME distinguish exclude regexp | 460 ;; FIXME distinguish exclude regexp |
461 ;; for skip-file and skip-dir? | 461 ;; for skip-file and skip-dir? |
462 exclude-regexp exclude-regexp) | 462 exclude-regexp exclude-regexp) |
468 org-publish-temp-files)) | 468 org-publish-temp-files)) |
469 | 469 |
470 (defun org-publish-get-project-from-filename (filename) | 470 (defun org-publish-get-project-from-filename (filename) |
471 "Return the project FILENAME belongs." | 471 "Return the project FILENAME belongs." |
472 (let* ((project-name (cdr (assoc (expand-file-name filename) | 472 (let* ((project-name (cdr (assoc (expand-file-name filename) |
473 org-publish-files-alist)))) | 473 org-publish-files-alist)))) |
474 (dolist (prj org-publish-project-alist) | 474 (dolist (prj org-publish-project-alist) |
475 (if (member project-name (plist-get (cdr prj) :components)) | 475 (if (member project-name (plist-get (cdr prj) :components)) |
476 (setq project-name (car prj)))) | 476 (setq project-name (car prj)))) |
477 (assoc project-name org-publish-project-alist))) | 477 (assoc project-name org-publish-project-alist))) |
478 | 478 |
479 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 479 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
480 ;;; Pluggable publishing back-end functions | 480 ;;; Pluggable publishing back-end functions |
481 | 481 |