Mercurial > emacs
annotate lisp/org/org-publish.el @ 110742:f0f8f95b6535
Remove directory-sep-char, obsolete since 21.1.
* lisp/subr.el (directory-sep-char): Remove obsolete variable.
* lisp/net/tramp-compat.el: Don't mess about with the byte-compiler unless
it is "necessary".
* doc/lispref/files.texi (File Name Components): Remove ignored
section about deleted variable directory-sep-char.
* etc/NEWS: Mention above change.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sun, 03 Oct 2010 14:23:13 -0700 |
parents | a150e8a14679 |
children | 5cb272c831e8 |
rev | line source |
---|---|
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1 ;;; org-publish.el --- publish related org-mode files as a website |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
2 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5 ;; Author: David O'Toole <dto@gnu.org> |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
6 ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com> |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7 ;; Keywords: hypermedia, outlines, wp |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
8 ;; Version: 7.01 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11 ;; |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
15 ;; (at your option) any later version. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
16 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
24 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
25 ;;; Commentary: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
26 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
27 ;; This program allow configurable publishing of related sets of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
28 ;; Org-mode files as a complete website. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
29 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
30 ;; org-publish.el can do the following: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
31 ;; |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
32 ;; + Publish all one's org-files to HTML or PDF |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 ;; + Upload HTML, images, attachments and other files to a web server |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
34 ;; + Exclude selected private pages from publishing |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
35 ;; + Publish a clickable sitemap of pages |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
36 ;; + Manage local timestamps for publishing only changed files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
37 ;; + Accept plugin functions to extend range of publishable content |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 ;; |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
39 ;; Documentation for publishing is in the manual. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 ;;; Code: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
42 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
43 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
44 (defun org-publish-sanitize-plist (plist) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
45 (mapcar (lambda (x) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
46 (or (cdr (assq x '((:index-filename . :sitemap-filename) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
47 (:index-title . :sitemap-title) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
48 (:index-function . :sitemap-function) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
49 (:index-style . :sitemap-style) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
50 (:auto-index . :auto-sitemap)))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
51 x)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
52 plist)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
53 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
54 (eval-when-compile |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
55 (require 'cl)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
56 (require 'org) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
57 (require 'org-exp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
58 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
59 (eval-and-compile |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
60 (unless (fboundp 'declare-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
61 (defmacro declare-function (fn file &optional arglist fileonly)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
62 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
63 (defgroup org-publish nil |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
64 "Options for publishing a set of Org-mode and related files." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
65 :tag "Org Publishing" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
66 :group 'org) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
67 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
68 (defcustom org-publish-project-alist nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
69 "Association list to control publishing behavior. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
70 Each element of the alist is a publishing 'project.' The CAR of |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
71 each element is a string, uniquely identifying the project. The |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
72 CDR of each element is in one of the following forms: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
73 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
74 (:property value :property value ... ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
75 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
76 OR, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
77 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
78 (:components (\"project-1\" \"project-2\" ...)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
79 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
80 When the CDR of an element of org-publish-project-alist is in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
81 this second form, the elements of the list after :components are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
82 taken to be components of the project, which group together files |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
83 requiring different publishing options. When you publish such a |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
84 project with \\[org-publish], the components all publish. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
85 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
86 When a property is given a value in org-publish-project-alist, its |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
87 setting overrides the value of the corresponding user variable |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
88 \(if any) during publishing. However, options set within a file |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
89 override everything. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
90 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
91 Most properties are optional, but some should always be set: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
92 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
93 :base-directory Directory containing publishing source files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
94 :base-extension Extension (without the dot!) of source files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
95 This can be a regular expression. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
96 :publishing-directory Directory (possibly remote) where output |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
97 files will be published |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
98 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
99 The :exclude property may be used to prevent certain files from |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
100 being published. Its value may be a string or regexp matching |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
101 file names you don't want to be published. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
102 |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
103 The :include property may be used to include extra files. Its |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
104 value may be a list of filenames to include. The filenames are |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
105 considered relative to the base directory. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
106 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 When both :include and :exclude properties are given values, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 exclusion step happens first. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
109 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
110 One special property controls which back-end function to use for |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
111 publishing files in the project. This can be used to extend the |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
112 set of file types publishable by org-publish, as well as the set |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
113 of output formats. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
114 |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
115 :publishing-function Function to publish file. The default is |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
116 `org-publish-org-to-html', but other |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
117 values are possible. May also be a |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
118 list of functions, in which case |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
119 each function in the list is invoked |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
120 in turn. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
122 Another property allows you to insert code that prepares a |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
123 project for publishing. For example, you could call GNU Make on a |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 certain makefile, to ensure published files are built up to date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
125 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
126 :preparation-function Function to be called before publishing |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
127 this project. This may also be a list |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
128 of functions. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
129 :completion-function Function to be called after publishing |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
130 this project. This may also be a list |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
131 of functions. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
132 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
133 Some properties control details of the Org publishing process, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
134 and are equivalent to the corresponding user variables listed in |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
135 the right column. See the documentation for those variables to |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
136 learn more about their use and default values. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
137 |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
138 :language `org-export-default-language' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
139 :headline-levels `org-export-headline-levels' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
140 :section-numbers `org-export-with-section-numbers' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
141 :table-of-contents `org-export-with-toc' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
142 :emphasize `org-export-with-emphasize' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
143 :sub-superscript `org-export-with-sub-superscripts' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
144 :TeX-macros `org-export-with-TeX-macros' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
145 :fixed-width `org-export-with-fixed-width' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
146 :tables `org-export-with-tables' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
147 :table-auto-headline `org-export-highlight-first-table-line' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
148 :style `org-export-html-style' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
149 :convert-org-links `org-export-html-link-org-files-as-html' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
150 :inline-images `org-export-html-inline-images' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
151 :expand-quoted-html `org-export-html-expand' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
152 :timestamp `org-export-html-with-timestamp' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
153 :publishing-directory `org-export-publishing-directory' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
154 :preamble `org-export-html-preamble' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
155 :postamble `org-export-html-postamble' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
156 :auto-preamble `org-export-html-auto-preamble' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
157 :auto-postamble `org-export-html-auto-postamble' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
158 :author `user-full-name' |
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
159 :email `user-mail-address' |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
160 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
161 The following properties may be used to control publishing of a |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
162 sitemap of files or summary page for a given project. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
163 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
164 :auto-sitemap Whether to publish a sitemap during |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
165 `org-publish-current-project' or `org-publish-all'. |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
166 :sitemap-filename Filename for output of sitemap. Defaults |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
167 to 'sitemap.org' (which becomes 'sitemap.html'). |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
168 :sitemap-title Title of sitemap page. Defaults to name of file. |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
169 :sitemap-function Plugin function to use for generation of sitemap. |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
170 Defaults to `org-publish-org-sitemap', which |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
171 generates a plain list of links to all files |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
172 in the project. |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
173 :sitemap-style Can be `list' (sitemap is just an itemized list |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
174 of the titles of the files involved) or |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
175 `tree' (the directory structure of the source |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
176 files is reflected in the sitemap). Defaults to |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
177 `tree'. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
178 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
179 If you create a sitemap file, adjust the sorting like this: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
180 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
181 :sitemap-sort-folders Where folders should appear in the sitemap. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
182 Set this to `first' (default) or `last' to |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
183 display folders first or last, respectively. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
184 Any other value will mix files and folders. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
185 :sitemap-alphabetically The site map is normally sorted alphabetically. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
186 Set this explicitly to nil to turn off sorting. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
187 :sitemap-ignore-case Should sorting be case-sensitive? Default nil. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
188 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
189 The following properties control the creation of a concept index. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
190 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
191 :makeindex Create a concept index." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
192 :group 'org-publish |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
193 :type 'alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
194 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
195 (defcustom org-publish-use-timestamps-flag t |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
196 "Non-nil means use timestamp checking to publish only changed files. |
94773
817e282b0cc9
(org-publish-project-alist): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94676
diff
changeset
|
197 When nil, do no timestamp checking and always publish all files." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
198 :group 'org-publish |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
199 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
200 |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
201 (defcustom org-publish-timestamp-directory (convert-standard-filename |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
202 "~/.org-timestamps/") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
203 "Name of directory in which to store publishing timestamps." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
204 :group 'org-publish |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
205 :type 'directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
206 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
207 (defcustom org-publish-list-skipped-files t |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
208 "Non-nil means show message about files *not* published." |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
209 :group 'org-publish |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
210 :type 'boolean) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
211 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
212 (defcustom org-publish-before-export-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
213 "Hook run before export on the Org file. |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
214 The hook may modify the file in arbitrary ways before publishing happens. |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
215 The original version of the buffer will be restored after publishing." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
216 :group 'org-publish |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
217 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
218 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
219 (defcustom org-publish-after-export-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
220 "Hook run after export on the exported buffer. |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
221 Any changes made by this hook will be saved." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
222 :group 'org-publish |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
223 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
224 |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
225 (defcustom org-publish-sitemap-sort-alphabetically t |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
226 "Should sitemaps be sorted alphabetically by default? |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
227 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
228 You can overwrite this default per project in your |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
229 `org-publish-project-alist', using `:sitemap-alphabetically'." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
230 :group 'org-publish |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
231 :type 'boolean) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
232 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
233 (defcustom org-publish-sitemap-sort-folders 'first |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
234 "A symbol, denoting if folders are sorted first in sitemaps. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
235 Possible values are `first', `last', and nil. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
236 If `first', folders will be sorted before files. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
237 If `last', folders are sorted to the end after the files. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
238 Any other value will not mix files and folders. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
239 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
240 You can overwrite this default per project in your |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
241 `org-publish-project-alist', using `:sitemap-sort-folders'." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
242 :group 'org-publish |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
243 :type 'symbol) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
244 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
245 (defcustom org-publish-sitemap-sort-ignore-case nil |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
246 "Sort sitemaps case insensitively by default? |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
247 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
248 You can overwrite this default per project in your |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
249 `org-publish-project-alist', using `:sitemap-ignore-case'." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
250 :group 'org-publish |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
251 :type 'boolean) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
252 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
253 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
254 ;;; Timestamp-related functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
255 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
256 (defun org-publish-timestamp-filename (filename &optional pub-dir pub-func) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
257 "Return path to timestamp file for filename FILENAME." |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
258 (setq filename (concat filename "::" (or pub-dir "") "::" |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
259 (format "%s" (or pub-func "")))) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
260 (concat "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
261 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
262 (defun org-publish-needed-p (filename &optional pub-dir pub-func true-pub-dir) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
263 "Return t if FILENAME should be published in PUB-DIR using PUB-FUNC. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
264 TRUE-PUB-DIR is where the file will truly end up. Currently we are not using |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
265 this - maybe it can eventually be used to check if the file is present at |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
266 the target location, and how old it is. Right ow we cannot do this, because |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
267 we do not know under what file name the file will be stored - the publishing |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
268 function can still decide about that independently." |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
269 (let ((rtn |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
270 (if org-publish-use-timestamps-flag |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
271 (org-publish-cache-file-needs-publishing |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
272 filename pub-dir pub-func) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
273 ;; don't use timestamps, always return t |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
274 t))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
275 (if rtn |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
276 (message "Publishing file %s using `%s'" filename pub-func) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
277 (when org-publish-list-skipped-files |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
278 (message "Skipping unmodified file %s" filename))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
279 rtn)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
280 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
281 (defun org-publish-update-timestamp (filename &optional pub-dir pub-func) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
282 "Update publishing timestamp for file FILENAME. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
283 If there is no timestamp, create one." |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
284 (let ((key (org-publish-timestamp-filename filename pub-dir pub-func)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
285 (stamp (org-publish-cache-ctime-of-src filename))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
286 (org-publish-cache-set key stamp))) |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
287 |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
288 (defun org-publish-remove-all-timestamps () |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
289 "Remove all files in the timestamp directory." |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
290 (let ((dir org-publish-timestamp-directory) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
291 files) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
292 (when (and (file-exists-p dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
293 (file-directory-p dir)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
294 (mapc 'delete-file (directory-files dir 'full "[^.]\\'")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
295 (org-publish-reset-cache)))) |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
296 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
297 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
298 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
299 ;;; |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
300 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
301 (defvar org-publish-initial-buffer nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
302 "The buffer `org-publish' has been called from.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
303 (defvar org-publish-temp-files nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
304 "Temporary list of files to be published.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
305 |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
306 ;; Here, so you find the variable right before it's used the first time: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
307 (defvar org-publish-cache nil |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
308 "This will cache timestamps and titles for files in publishing projects. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
309 Blocks could hash sha1 values here.") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
310 |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
311 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
312 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
313 ;;; Compatibility aliases |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
314 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
315 ;; Delete-dups is not in Emacs <22 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
316 (if (fboundp 'delete-dups) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
317 (defalias 'org-publish-delete-dups 'delete-dups) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
318 (defun org-publish-delete-dups (list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
319 "Destructively remove `equal' duplicates from LIST. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
320 Store the result in LIST and return it. LIST must be a proper list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
321 Of several `equal' occurrences of an element in LIST, the first |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
322 one is kept. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
323 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
324 This is a compatibility function for Emacsen without `delete-dups'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
325 ;; Code from `subr.el' in Emacs 22: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
326 (let ((tail list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
327 (while tail |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
328 (setcdr tail (delete (car tail) (cdr tail))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
329 (setq tail (cdr tail)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
330 list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
331 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
332 (declare-function org-publish-delete-dups "org-publish" (list)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
333 (declare-function find-lisp-find-files "find-lisp" (directory regexp)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
334 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
335 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
336 ;;; Getting project information out of org-publish-project-alist |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
337 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
338 (defun org-publish-expand-projects (projects-alist) |
98644
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
339 "Expand projects in PROJECTS-ALIST. |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
340 This splices all the components into the list." |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
341 (let ((rest projects-alist) rtn p components) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
342 (while (setq p (pop rest)) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
343 (if (setq components (plist-get (cdr p) :components)) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
344 (setq rest (append |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
345 (mapcar (lambda (x) (assoc x org-publish-project-alist)) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
346 components) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
347 rest)) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
348 (push p rtn))) |
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
349 (nreverse (org-publish-delete-dups (delq nil rtn))))) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
350 |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
351 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
352 (defvar sitemap-alphabetically) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
353 (defvar sitemap-sort-folders) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
354 (defvar sitemap-ignore-case) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
355 (defvar sitemap-requested) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
356 (defun org-publish-compare-directory-files (a b) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
357 "Predicate for `sort', that sorts folders-first/last and alphabetically." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
358 (let ((retval t)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
359 (when (or sitemap-alphabetically sitemap-sort-folders) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
360 ;; First we sort alphabetically: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
361 (when sitemap-alphabetically |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
362 (let* ((adir (file-directory-p a)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
363 (aorg (and (string-match "\\.org$" a) (not adir))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
364 (bdir (file-directory-p b)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
365 (borg (and (string-match "\\.org$" b) (not bdir))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
366 (A (if aorg |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
367 (concat (file-name-directory a) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
368 (org-publish-find-title a)) a)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
369 (B (if borg |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
370 (concat (file-name-directory b) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
371 (org-publish-find-title b)) b))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
372 (setq retval (if sitemap-ignore-case |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
373 (not (string-lessp (upcase B) (upcase A))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
374 (not (string-lessp B A)))))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
375 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
376 ;; Directory-wise wins: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
377 (when sitemap-sort-folders |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
378 ;; a is directory, b not: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
379 (cond |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
380 ((and (file-directory-p a) (not (file-directory-p b))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
381 (setq retval (equal sitemap-sort-folders 'first))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
382 ;; a is not a directory, but b is: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
383 ((and (not (file-directory-p a)) (file-directory-p b)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
384 (setq retval (equal sitemap-sort-folders 'last)))))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
385 retval)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
386 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
387 (defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
388 "Set `org-publish-temp-files' with files from BASE-DIR directory. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
389 If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
390 non-nil, restrict this list to the files matching the regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
391 MATCH. If SKIP-FILE is non-nil, skip file matching the regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
392 SKIP-FILE. If SKIP-DIR is non-nil, don't check directories |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
393 matching the regexp SKIP-DIR when recursing through BASE-DIR." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
394 (mapc (lambda (f) |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
395 (let ((fd-p (file-directory-p f)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
396 (fnd (file-name-nondirectory f))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
397 (if (and fd-p recurse |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
398 (not (string-match "^\\.+$" fnd)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
399 (if skip-dir (not (string-match skip-dir fnd)) t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
400 (org-publish-get-base-files-1 f recurse match skip-file skip-dir) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
401 (unless (or fd-p ;; this is a directory |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
402 (and skip-file (string-match skip-file fnd)) |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
403 (not (file-exists-p (file-truename f))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
404 (not (string-match match fnd))) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
405 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
406 (pushnew f org-publish-temp-files))))) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
407 (if sitemap-requested |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
408 (sort (directory-files base-dir t (unless recurse match)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
409 'org-publish-compare-directory-files) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
410 (directory-files base-dir t (unless recurse match))))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
411 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
412 (defun org-publish-get-base-files (project &optional exclude-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
413 "Return a list of all files in PROJECT. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
414 If EXCLUDE-REGEXP is set, this will be used to filter out |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
415 matching filenames." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
416 (let* ((project-plist (cdr project)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
417 (base-dir (file-name-as-directory |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
418 (plist-get project-plist :base-directory))) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
419 (include-list (plist-get project-plist :include)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
420 (recurse (plist-get project-plist :recursive)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
421 (extension (or (plist-get project-plist :base-extension) "org")) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
422 ;; sitemap-... variables are dynamically scoped for |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
423 ;; org-publish-compare-directory-files: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
424 (sitemap-requested |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
425 (plist-get project-plist :auto-sitemap)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
426 (sitemap-sort-folders |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
427 (if (plist-member project-plist :sitemap-sort-folders) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
428 (plist-get project-plist :sitemap-sort-folders) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
429 org-publish-sitemap-sort-folders)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
430 (sitemap-alphabetically |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
431 (if (plist-member project-plist :sitemap-alphabetically) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
432 (plist-get project-plist :sitemap-alphabetically) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
433 org-publish-sitemap-sort-alphabetically)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
434 (sitemap-ignore-case |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
435 (if (plist-member project-plist :sitemap-ignore-case) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
436 (plist-get project-plist :sitemap-ignore-case) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
437 org-publish-sitemap-sort-ignore-case)) |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
438 (match (if (eq extension 'any) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
439 "^[^\\.]" |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
440 (concat "^[^\\.].*\\.\\(" extension "\\)$")))) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
441 ;; Make sure sitemap-sort-folders' has an accepted value |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
442 (unless (memq sitemap-sort-folders '(first last)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
443 (setq sitemap-sort-folders nil)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
444 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
445 (setq org-publish-temp-files nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
446 (org-publish-get-base-files-1 base-dir recurse match |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
447 ;; FIXME distinguish exclude regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
448 ;; for skip-file and skip-dir? |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
449 exclude-regexp exclude-regexp) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
450 (mapc (lambda (f) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
451 (pushnew |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
452 (expand-file-name (concat base-dir f)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
453 org-publish-temp-files)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
454 include-list) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
455 org-publish-temp-files)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
456 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
457 (defun org-publish-get-project-from-filename (filename &optional up) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
458 "Return the project that FILENAME belongs to." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
459 (let* ((filename (expand-file-name filename)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
460 project-name) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
461 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
462 (catch 'p-found |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
463 (dolist (prj org-publish-project-alist) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
464 (unless (plist-get (cdr prj) :components) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
465 ;; [[info:org:Selecting%20files]] shows how this is supposed to work: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
466 (let* ((r (plist-get (cdr prj) :recursive)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
467 (b (expand-file-name (plist-get (cdr prj) :base-directory))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
468 (x (or (plist-get (cdr prj) :base-extension) "org")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
469 (e (plist-get (cdr prj) :exclude)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
470 (i (plist-get (cdr prj) :include)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
471 (xm (concat "^" b (if r ".+" "[^/]+") "\\.\\(" x "\\)$"))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
472 (when (or |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
473 (and i (string-match i filename)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
474 (and |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
475 (not (and e (string-match e filename))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
476 (string-match xm filename))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
477 (setq project-name (car prj)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
478 (throw 'p-found project-name)))))) |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
479 (when up |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
480 (dolist (prj org-publish-project-alist) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
481 (if (member project-name (plist-get (cdr prj) :components)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
482 (setq project-name (car prj))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
483 (assoc project-name org-publish-project-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
484 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
485 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
486 ;;; Pluggable publishing back-end functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
487 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
488 (defun org-publish-org-to (format plist filename pub-dir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
489 "Publish an org file to FORMAT. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
490 PLIST is the property list for the given project. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
491 FILENAME is the filename of the org file to be published. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
492 PUB-DIR is the publishing directory." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
493 (require 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
494 (unless (file-exists-p pub-dir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
495 (make-directory pub-dir t)) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
496 (let ((visiting (find-buffer-visiting filename))) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
497 (save-excursion |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
498 (switch-to-buffer (or visiting (find-file filename))) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
499 (let* ((plist (cons :buffer-will-be-killed (cons t plist))) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
500 (init-buf (current-buffer)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
501 (init-point (point)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
502 (init-buf-string (buffer-string)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
503 export-buf-or-file) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
504 ;; run hooks before exporting |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
505 (run-hooks 'org-publish-before-export-hook) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
506 ;; export the possibly modified buffer |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
507 (setq export-buf-or-file |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
508 (funcall (intern (concat "org-export-as-" format)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
509 (plist-get plist :headline-levels) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
510 nil plist nil nil pub-dir)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
511 (when (and (bufferp export-buf-or-file) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
512 (buffer-live-p export-buf-or-file)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
513 (set-buffer export-buf-or-file) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
514 ;; run hooks after export and save export |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
515 (progn (run-hooks 'org-publish-after-export-hook) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
516 (if (buffer-modified-p) (save-buffer))) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
517 (kill-buffer export-buf-or-file)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
518 ;; maybe restore buffer's content |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
519 (set-buffer init-buf) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
520 (when (buffer-modified-p init-buf) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
521 (erase-buffer) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
522 (insert init-buf-string) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
523 (save-buffer) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
524 (goto-char init-point)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
525 (unless visiting |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
526 (kill-buffer init-buf)))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
527 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
528 (defmacro org-publish-with-aux-preprocess-maybe (&rest body) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
529 "Execute BODY with a modified hook to preprocess for index." |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
530 `(let ((org-export-preprocess-after-headline-targets-hook |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
531 (if (plist-get project-plist :makeindex) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
532 (cons 'org-publish-aux-preprocess |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
533 org-export-preprocess-after-headline-targets-hook) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
534 org-export-preprocess-after-headline-targets-hook))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
535 ,@body)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
536 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
537 (defvar project-plist) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
538 (defun org-publish-org-to-latex (plist filename pub-dir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
539 "Publish an org file to LaTeX. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
540 See `org-publish-org-to' to the list of arguments." |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
541 (org-publish-with-aux-preprocess-maybe |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
542 (org-publish-org-to "latex" plist filename pub-dir))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
543 |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
544 (defun org-publish-org-to-pdf (plist filename pub-dir) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
545 "Publish an org file to PDF (via LaTeX). |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
546 See `org-publish-org-to' to the list of arguments." |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
547 (org-publish-with-aux-preprocess-maybe |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
548 (org-publish-org-to "pdf" plist filename pub-dir))) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
549 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
550 (defun org-publish-org-to-html (plist filename pub-dir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
551 "Publish an org file to HTML. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
552 See `org-publish-org-to' to the list of arguments." |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
553 (org-publish-with-aux-preprocess-maybe |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
554 (org-publish-org-to "html" plist filename pub-dir))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
555 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
556 (defun org-publish-org-to-org (plist filename pub-dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
557 "Publish an org file to HTML. |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
558 See `org-publish-org-to' to the list of arguments." |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
559 (org-publish-org-to "org" plist filename pub-dir)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
560 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
561 (defun org-publish-attachment (plist filename pub-dir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
562 "Publish a file with no transformation of any kind. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
563 See `org-publish-org-to' to the list of arguments." |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
564 ;; make sure eshell/cp code is loaded |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
565 (unless (file-directory-p pub-dir) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
566 (make-directory pub-dir t)) |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
567 (or (equal (expand-file-name (file-name-directory filename)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
568 (file-name-as-directory (expand-file-name pub-dir))) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
569 (copy-file filename |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
570 (expand-file-name (file-name-nondirectory filename) pub-dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
571 t))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
572 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
573 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
574 ;;; Publishing files, sets of files, and indices |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
575 |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
576 (defun org-publish-file (filename &optional project no-cache) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
577 "Publish file FILENAME from PROJECT. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
578 If NO-CACHE is not nil, do not initialize org-publish-cache and |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
579 write it to disk. This is needed, since this function is used to |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
580 publish single files, when entire projects are published. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
581 See `org-publish-projects'." |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
582 (let* ((project |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
583 (or project |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
584 (or (org-publish-get-project-from-filename filename) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
585 (error "File %s not part of any known project" |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
586 (abbreviate-file-name filename))))) |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
587 (project-plist (cdr project)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
588 (ftname (file-truename filename)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
589 (publishing-function |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
590 (or (plist-get project-plist :publishing-function) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
591 'org-publish-org-to-html)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
592 (base-dir (file-name-as-directory |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
593 (file-truename (plist-get project-plist :base-directory)))) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
594 (pub-dir (file-name-as-directory |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
595 (file-truename (plist-get project-plist :publishing-directory)))) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
596 tmp-pub-dir) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
597 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
598 (unless no-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
599 (org-publish-initialize-cache (car project))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
600 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
601 (setq tmp-pub-dir |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
602 (file-name-directory |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
603 (concat pub-dir |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
604 (and (string-match (regexp-quote base-dir) ftname) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
605 (substring ftname (match-end 0)))))) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
606 (if (listp publishing-function) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
607 ;; allow chain of publishing functions |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
608 (mapc (lambda (f) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
609 (when (org-publish-needed-p filename pub-dir f tmp-pub-dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
610 (funcall f project-plist filename tmp-pub-dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
611 (org-publish-update-timestamp filename pub-dir f))) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
612 publishing-function) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
613 (when (org-publish-needed-p filename pub-dir publishing-function |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
614 tmp-pub-dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
615 (funcall publishing-function project-plist filename tmp-pub-dir) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
616 (org-publish-update-timestamp |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
617 filename pub-dir publishing-function))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
618 (unless no-cache (org-publish-write-cache-file)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
619 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
620 (defun org-publish-projects (projects) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
621 "Publish all files belonging to the PROJECTS alist. |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
622 If :auto-sitemap is set, publish the sitemap too. |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
623 If :makeindex is set, also produce a file theindex.org." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
624 (mapc |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
625 (lambda (project) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
626 ;; Each project uses it's own cache file: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
627 (org-publish-initialize-cache (car project)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
628 (let* |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
629 ((project-plist (cdr project)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
630 (exclude-regexp (plist-get project-plist :exclude)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
631 (sitemap-p (plist-get project-plist :auto-sitemap)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
632 (sitemap-filename (or (plist-get project-plist :sitemap-filename) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
633 "sitemap.org")) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
634 (sitemap-function (or (plist-get project-plist :sitemap-function) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
635 'org-publish-org-sitemap)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
636 (preparation-function (plist-get project-plist :preparation-function)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
637 (completion-function (plist-get project-plist :completion-function)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
638 (files (org-publish-get-base-files project exclude-regexp)) file) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
639 (when preparation-function (run-hooks 'preparation-function)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
640 (if sitemap-p (funcall sitemap-function project sitemap-filename)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
641 (while (setq file (pop files)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
642 (org-publish-file file project t)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
643 (when (plist-get project-plist :makeindex) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
644 (org-publish-index-generate-theindex.inc |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
645 (plist-get project-plist :base-directory)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
646 (org-publish-file (expand-file-name |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
647 "theindex.org" |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
648 (plist-get project-plist :base-directory)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
649 project t)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
650 (when completion-function (run-hooks 'completion-function)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
651 (org-publish-write-cache-file))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
652 (org-publish-expand-projects projects))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
653 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
654 (defun org-publish-org-sitemap (project &optional sitemap-filename) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
655 "Create a sitemap of pages in set defined by PROJECT. |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
656 Optionally set the filename of the sitemap with SITEMAP-FILENAME. |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
657 Default for SITEMAP-FILENAME is 'sitemap.org'." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
658 (let* ((project-plist (cdr project)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
659 (dir (file-name-as-directory |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
660 (plist-get project-plist :base-directory))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
661 (localdir (file-name-directory dir)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
662 (indent-str (make-string 2 ?\ )) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
663 (exclude-regexp (plist-get project-plist :exclude)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
664 (files (nreverse (org-publish-get-base-files project exclude-regexp))) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
665 (sitemap-filename (concat dir (or sitemap-filename "sitemap.org"))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
666 (sitemap-title (or (plist-get project-plist :sitemap-title) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
667 (concat "Sitemap for project " (car project)))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
668 (sitemap-style (or (plist-get project-plist :sitemap-style) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
669 'tree)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
670 (visiting (find-buffer-visiting sitemap-filename)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
671 (ifn (file-name-nondirectory sitemap-filename)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
672 file sitemap-buffer) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
673 (with-current-buffer (setq sitemap-buffer |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
674 (or visiting (find-file sitemap-filename))) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
675 (erase-buffer) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
676 (insert (concat "#+TITLE: " sitemap-title "\n\n")) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
677 (while (setq file (pop files)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
678 (let ((fn (file-name-nondirectory file)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
679 (link (file-relative-name file dir)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
680 (oldlocal localdir)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
681 ;; sitemap shouldn't list itself |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
682 (unless (equal (file-truename sitemap-filename) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
683 (file-truename file)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
684 (if (eq sitemap-style 'list) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
685 (message "Generating list-style sitemap for %s" sitemap-title) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
686 (message "Generating tree-style sitemap for %s" sitemap-title) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
687 (setq localdir (concat (file-name-as-directory dir) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
688 (file-name-directory link))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
689 (unless (string= localdir oldlocal) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
690 (if (string= localdir dir) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
691 (setq indent-str (make-string 2 ?\ )) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
692 (let ((subdirs |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
693 (split-string |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
694 (directory-file-name |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
695 (file-name-directory |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
696 (file-relative-name localdir dir))) "/")) |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
697 (subdir "") |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
698 (old-subdirs (split-string |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
699 (file-relative-name oldlocal dir) "/"))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
700 (setq indent-str (make-string 2 ?\ )) |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
701 (while (string= (car old-subdirs) (car subdirs)) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
702 (setq indent-str (concat indent-str (make-string 2 ?\ ))) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
703 (pop old-subdirs) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
704 (pop subdirs)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
705 (dolist (d subdirs) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
706 (setq subdir (concat subdir d "/")) |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
707 (insert (concat indent-str " + " d "\n")) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
708 (setq indent-str (make-string |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
709 (+ (length indent-str) 2) ?\ ))))))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
710 ;; This is common to 'flat and 'tree |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
711 (insert (concat indent-str " + [[file:" link "][" |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96044
diff
changeset
|
712 (org-publish-find-title file) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
713 "]]\n"))))) |
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
714 (save-buffer)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
715 (or visiting (kill-buffer sitemap-buffer)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
716 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
717 (defun org-publish-find-title (file) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
718 "Find the title of FILE in project." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
719 (or |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
720 (org-publish-cache-get-file-property file :title nil t) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
721 (let* ((visiting (find-buffer-visiting file)) |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
722 (buffer (or visiting (find-file-noselect file))) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
723 title) |
105865
131bccfc4f5d
* org.el (org-version, org-get-refile-targets, org-refile)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105341
diff
changeset
|
724 (with-current-buffer buffer |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
725 (let* ((opt-plist (org-combine-plists (org-default-export-plist) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
726 (org-infile-export-plist)))) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
727 (setq title |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
728 (or (plist-get opt-plist :title) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
729 (and (not |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
730 (plist-get opt-plist :skip-before-1st-heading)) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
731 (org-export-grab-title-from-buffer)) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
732 (file-name-nondirectory (file-name-sans-extension file)))))) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
733 (unless visiting |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99415
diff
changeset
|
734 (kill-buffer buffer)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
735 (org-publish-cache-set-file-property file :title title) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
736 title))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
737 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
738 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
739 ;;; Interactive publishing functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
740 |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98872
diff
changeset
|
741 ;;;###autoload |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
742 (defalias 'org-publish-project 'org-publish) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
743 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
744 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
745 (defun org-publish (project &optional force) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
746 "Publish PROJECT." |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
747 (interactive |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
748 (list |
104810
86b7fe7d1d8f
2009-09-02 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
104164
diff
changeset
|
749 (assoc (org-icompleting-read |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
750 "Publish project: " |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
751 org-publish-project-alist nil t) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
752 org-publish-project-alist) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
753 current-prefix-arg)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
754 (setq org-publish-initial-buffer (current-buffer)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
755 (save-window-excursion |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
756 (let* ((org-publish-use-timestamps-flag |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
757 (if force nil org-publish-use-timestamps-flag))) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
758 (org-publish-projects |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
759 (if (stringp project) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
760 ;; If this function is called in batch mode, |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
761 ;; project is still a string here. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
762 (list (assoc project org-publish-project-alist)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
763 (list project)))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
764 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
765 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
766 (defun org-publish-all (&optional force) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
767 "Publish all projects. |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
768 With prefix argument, remove all files in the timestamp |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
769 directory and force publishing all files." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
770 (interactive "P") |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
771 (when force |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
772 (org-publish-remove-all-timestamps)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
773 ;; (org-publish-initialize-files-alist force) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
774 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
775 (let ((org-publish-use-timestamps-flag |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
776 (if force nil org-publish-use-timestamps-flag))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
777 (org-publish-projects org-publish-project-alist)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
778 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
779 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
780 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
781 (defun org-publish-current-file (&optional force) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
782 "Publish the current file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
783 With prefix argument, force publish the file." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
784 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
785 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
786 (let ((org-publish-use-timestamps-flag |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
787 (if force nil org-publish-use-timestamps-flag))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
788 (org-publish-file (buffer-file-name))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
789 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
790 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
791 (defun org-publish-current-project (&optional force) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
792 "Publish the project associated with the current file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
793 With a prefix argument, force publishing of all files in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
794 the project." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
795 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
796 (save-window-excursion |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
797 (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
798 (org-publish-use-timestamps-flag |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
799 (if force nil org-publish-use-timestamps-flag))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
800 (if (not project) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
801 (error "File %s is not part of any known project" (buffer-file-name))) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
802 ;; FIXME: force is not used here? |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
803 (org-publish project)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
804 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
805 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
806 ;;; Index generation |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
807 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
808 (defvar backend) ; dynamically scoped |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
809 (defun org-publish-aux-preprocess () |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
810 "Find index entries and write them to an .orgx file." |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
811 (let ((case-fold-search t) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
812 entry index target) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
813 (goto-char (point-min)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
814 (while |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
815 (and |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
816 (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
817 (> (match-end 1) (match-beginning 1))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
818 (setq entry (match-string 1)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
819 (when (eq backend 'latex) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
820 (replace-match (format "\\index{%s}" entry) t t)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
821 (save-excursion |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
822 (ignore-errors (org-back-to-heading t)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
823 (setq target (get-text-property (point) 'target)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
824 (setq target (or (cdr (assoc target org-export-preferred-target-alist)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
825 (cdr (assoc target org-export-id-target-alist)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
826 target "")) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
827 (push (cons entry target) index))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
828 (with-temp-file |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
829 (concat (file-name-sans-extension org-current-export-file) ".orgx") |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
830 (dolist (entry (nreverse index)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
831 (insert (format "INDEX: (%s) %s\n" (cdr entry) (car entry))))))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
832 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
833 (defun org-publish-index-generate-theindex.inc (directory) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
834 "Generate the index from all .orgx files in the current directory and below." |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
835 (require 'find-lisp) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
836 (let* ((fulldir (file-name-as-directory |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
837 (expand-file-name directory))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
838 (full-files (find-lisp-find-files directory "\\.orgx\\'")) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
839 (re (concat "\\`" fulldir)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
840 (files (mapcar (lambda (f) (if (string-match re f) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
841 (substring f (match-end 0)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
842 f)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
843 full-files)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
844 (default-directory directory) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
845 index origfile buf target entry ibuffer |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
846 main last-main letter last-letter file sub link tgext) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
847 ;; `files' contains the list of relative file names |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
848 (dolist (file files) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
849 (setq origfile (substring file 0 -1)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
850 (setq buf (find-file-noselect file)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
851 (with-current-buffer buf |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
852 (goto-char (point-min)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
853 (while (re-search-forward "^INDEX: (\\(.*?\\)) \\(.*\\)" nil t) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
854 (setq target (match-string 1) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
855 entry (match-string 2)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
856 (push (list entry origfile target) index))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
857 (kill-buffer buf)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
858 (setq index (sort index (lambda (a b) (string< (downcase (car a)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
859 (downcase (car b)))))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
860 (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
861 (with-current-buffer ibuffer |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
862 (erase-buffer) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
863 (insert "* Index\n") |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
864 (setq last-letter nil) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
865 (dolist (idx index) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
866 (setq entry (car idx) file (nth 1 idx) target (nth 2 idx)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
867 (if (and (stringp target) (string-match "\\S-" target)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
868 (setq tgext (concat "::#" target)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
869 (setq tgext "")) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
870 (setq letter (upcase (substring entry 0 1))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
871 (when (not (equal letter last-letter)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
872 (insert "** " letter "\n") |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
873 (setq last-letter letter)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
874 (if (string-match "!" entry) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
875 (setq main (substring entry 0 (match-beginning 0)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
876 sub (substring entry (match-end 0))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
877 (setq main nil sub nil last-main nil)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
878 (when (and main (not (equal main last-main))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
879 (insert " - " main "\n") |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
880 (setq last-main main)) |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
881 (setq link (concat "[[file:" file tgext "]" |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
882 "[" (or sub entry) "]]")) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
883 (if (and main sub) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
884 (insert " - " link "\n") |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
885 (insert " - " link "\n"))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
886 (save-buffer)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
887 (kill-buffer ibuffer) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
888 |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
889 (let ((index-file (expand-file-name "theindex.org" directory))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
890 (unless (file-exists-p index-file) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
891 (setq ibuffer (find-file-noselect index-file)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
892 (with-current-buffer ibuffer |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
893 (erase-buffer) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
894 (insert "\n\n#+include: \"theindex.inc\"\n\n") |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
895 (save-buffer)) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
896 (kill-buffer ibuffer))))) |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
897 |
109462
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
898 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
899 ;; Caching functions: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
900 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
901 (defun org-publish-write-cache-file (&optional free-cache) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
902 "Write `org-publish-cache' to file. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
903 If FREE-CACHE, empty the cache." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
904 (unless org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
905 (error "%s" "`org-publish-write-cache-file' called, but no cache present")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
906 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
907 (let ((cache-file (org-publish-cache-get ":cache-file:"))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
908 (unless cache-file |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
909 (error |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
910 "%s" "Cannot find cache-file name in `org-publish-write-cache-file'")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
911 (with-temp-file cache-file |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
912 (let ((print-level nil) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
913 (print-length nil)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
914 (insert "(setq org-publish-cache (make-hash-table :test 'equal :weakness nil :size 100))\n") |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
915 (maphash (lambda (k v) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
916 (insert |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
917 (format (concat "(puthash %S " |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
918 (if (or (listp v) (symbolp v)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
919 "'" "") |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
920 "%S org-publish-cache)\n") k v))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
921 org-publish-cache))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
922 (when free-cache (org-publish-reset-cache)))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
923 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
924 (defun org-publish-initialize-cache (project-name) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
925 "Initialize the projects cache if not initialized yet and return it." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
926 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
927 (unless project-name |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
928 (error "%s%s" "Cannot initialize `org-publish-cache' without projects name" |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
929 " in `org-publish-initialize-cache'")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
930 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
931 (unless (file-exists-p org-publish-timestamp-directory) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
932 (make-directory org-publish-timestamp-directory t)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
933 (if (not (file-directory-p org-publish-timestamp-directory)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
934 (error "Org publish timestamp: %s is not a directory" |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
935 org-publish-timestamp-directory)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
936 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
937 (unless (and org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
938 (string= (org-publish-cache-get ":project:") project-name)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
939 (let* ((cache-file (concat |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
940 (expand-file-name org-publish-timestamp-directory) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
941 project-name |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
942 ".cache")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
943 (cexists (file-exists-p cache-file))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
944 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
945 (when org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
946 (org-publish-reset-cache)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
947 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
948 (if cexists |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
949 (load-file cache-file) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
950 (setq org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
951 (make-hash-table :test 'equal :weakness nil :size 100)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
952 (org-publish-cache-set ":project:" project-name) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
953 (org-publish-cache-set ":cache-file:" cache-file)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
954 (unless cexists (org-publish-write-cache-file nil)))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
955 org-publish-cache) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
956 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
957 (defun org-publish-reset-cache () |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
958 "Empty org-publish-cache and reset it nil." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
959 (message "%s" "Resetting org-publish-cache") |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
960 (if (hash-table-p org-publish-cache) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
961 (clrhash org-publish-cache)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
962 (setq org-publish-cache nil)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
963 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
964 (defun org-publish-cache-file-needs-publishing (filename &optional pub-dir pub-func) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
965 "Check the timestamp of the last publishing of FILENAME. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
966 Return `t', if the file needs publishing" |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
967 (unless org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
968 (error "%s" "`org-publish-cache-file-needs-publishing' called, but no cache present")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
969 (let* ((key (org-publish-timestamp-filename filename pub-dir pub-func)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
970 (pstamp (org-publish-cache-get key))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
971 (if (null pstamp) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
972 t |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
973 (let ((ctime (org-publish-cache-ctime-of-src filename))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
974 (< pstamp ctime))))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
975 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
976 (defun org-publish-cache-set-file-property (filename property value &optional project-name) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
977 "Set the VALUE for a PROPERTY of file FILENAME in publishing cache to VALUE. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
978 Use cache file of PROJECT-NAME. If the entry does not exist, it will be |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
979 created. Return VALUE." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
980 ;; Evtl. load the requested cache file: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
981 (if project-name (org-publish-initialize-cache project-name)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
982 (let ((pl (org-publish-cache-get filename))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
983 (if pl |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
984 (progn |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
985 (plist-put pl property value) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
986 value) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
987 (org-publish-cache-get-file-property |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
988 filename property value nil project-name)))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
989 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
990 (defun org-publish-cache-get-file-property |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
991 (filename property &optional default no-create project-name) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
992 "Return the value for a PROPERTY of file FILENAME in publishing cache. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
993 Use cache file of PROJECT-NAME. Return the value of that PROPERTY or |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
994 DEFAULT, if the value does not yet exist. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
995 If the entry will be created, unless NO-CREATE is not nil." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
996 ;; Evtl. load the requested cache file: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
997 (if project-name (org-publish-initialize-cache project-name)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
998 (let ((pl (org-publish-cache-get filename)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
999 (retval nil)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1000 (if pl |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1001 (if (plist-member pl property) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1002 (setq retval (plist-get pl property)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1003 (setq retval default)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1004 ;; no pl yet: |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1005 (unless no-create |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1006 (org-publish-cache-set filename (list property default))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1007 (setq retval default)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1008 retval)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1009 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1010 (defun org-publish-cache-get (key) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1011 "Return the value stored in `org-publish-cache' for key KEY. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1012 Returns nil, if no value or nil is found, or the cache does not |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1013 exist." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1014 (unless org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1015 (error "%s" "`org-publish-cache-get' called, but no cache present")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1016 (gethash key org-publish-cache)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1017 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1018 (defun org-publish-cache-set (key value) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1019 "Store KEY VALUE pair in `org-publish-cache'. |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1020 Returns value on success, else nil." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1021 (unless org-publish-cache |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1022 (error "%s" "`org-publish-cache-set' called, but no cache present")) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1023 (puthash key value org-publish-cache)) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1024 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1025 (defun org-publish-cache-ctime-of-src (filename) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1026 "Get the files ctime as integer." |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1027 (let ((src-attr (file-attributes filename))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1028 (+ |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1029 (lsh (car (nth 5 src-attr)) 16) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1030 (cadr (nth 5 src-attr))))) |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1031 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1032 |
a150e8a14679
Install version 7.01 of Org-mode
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107863
diff
changeset
|
1033 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1034 (provide 'org-publish) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1035 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1036 ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94773
diff
changeset
|
1037 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1038 ;;; org-publish.el ends here |