emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/org/org-publish.el,v


From: Carsten Dominik
Subject: [Emacs-diffs] Changes to emacs/lisp/org/org-publish.el,v
Date: Thu, 24 Jul 2008 14:00:08 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Carsten Dominik <cdominik>      08/07/24 13:59:57

Index: org-publish.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-publish.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- org-publish.el      17 Jun 2008 15:21:59 -0000      1.5
+++ org-publish.el      24 Jul 2008 13:59:55 -0000      1.6
@@ -4,7 +4,7 @@
 ;; Author: David O'Toole <address@hidden>
 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: hypermedia, outlines, wp
-;; Version: 6.05a
+;; Version: 6.06a
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -263,7 +263,12 @@
   :index-function        Plugin function to use for generation of index.
                          Defaults to `org-publish-org-index', which
                          generates a plain list of links to all files
-                         in the project."
+                         in the project.
+  :index-style           Can be `list' (index is just an itemized list
+                         of the titles of the files involved) or 
+                         `tree' (the directory structure of the source
+                         files is reflected in the index).  Defaults to
+                         `tree'."
   :group 'org-publish
   :type 'alist)
 
@@ -297,13 +302,12 @@
 
 (defun org-publish-timestamp-filename (filename)
   "Return path to timestamp file for filename FILENAME."
-  (while (string-match
-         (if (eq system-type 'windows-nt) "~\\|/\\|:" "~\\|/") filename)
-    (setq filename (replace-match "_" nil t filename)))
-  (concat org-publish-timestamp-directory filename ".timestamp"))
+  (concat (file-name-as-directory org-publish-timestamp-directory)
+         "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename))))
 
 (defun org-publish-needed-p (filename)
   "Return `t' if FILENAME should be published."
+  (let ((rtn
   (if org-publish-use-timestamps-flag
       (if (file-exists-p org-publish-timestamp-directory)
          ;; first handle possible wrong timestamp directory
@@ -312,9 +316,15 @@
                     org-publish-timestamp-directory)
            ;; there is a timestamp, check if FILENAME is newer
            (file-newer-than-file-p
-            filename (org-publish-timestamp-filename filename))))
+                   filename (org-publish-timestamp-filename filename)))
+              (make-directory org-publish-timestamp-directory)
+              t)
     ;; don't use timestamps, always return t
-    t))
+          t)))
+    (if rtn
+       (message "Publishing file %s" filename)
+      (message   "Skipping unmodified file %s" filename))
+    rtn))
 
 (defun org-publish-update-timestamp (filename)
   "Update publishing timestamp for file FILENAME.
@@ -602,6 +612,8 @@
         (index-filename (concat dir (or index-filename "index.org")))
         (index-title (or (plist-get project-plist :index-title)
                          (concat "Index for project " (car project))))
+        (index-style (or (plist-get project-plist :index-style)
+                         'tree))
         (index-buffer (find-buffer-visiting index-filename))
         (ifn (file-name-nondirectory index-filename))
         file)
@@ -616,6 +628,9 @@
              (oldlocal localdir))
          ;; index shouldn't index itself
          (unless (string= fn ifn)
+           (if (eq index-style 'list)
+               (message "Generating list-style index for %s" index-title)
+             (message "Generating tree-style index for %s" index-title)
            (setq localdir (concat (file-name-as-directory dir)
                                   (file-name-directory link)))
            (unless (string= localdir oldlocal)
@@ -630,11 +645,15 @@
                  (setq indent-str (make-string 2 ?\ ))
                  (dolist (d subdirs)
                    (setq subdir (concat subdir d "/"))
-                   (insert (concat indent-str " + [[file:" subdir "][" d 
"/]]\n"))
-                   (setq indent-str (make-string (+ (length indent-str) 2) ?\ 
))))))
+                     (insert (concat indent-str " + [[file:" 
+                                     subdir "][" d "/]]\n"))
+                     (setq indent-str (make-string 
+                                       (+ (length indent-str) 2) ?\ )))))))
+           ;; This is common to 'flat and 'tree
            (insert (concat indent-str " + [[file:" link "]["
-                           (file-name-sans-extension fn)
-                           "]]\n")))))
+                           (org-publish-find-title file)
+                           "]]\n"))
+           )))
       (write-file index-filename)
       (kill-buffer (current-buffer)))))
 
@@ -648,7 +667,8 @@
          (and (not
                (plist-get opt-plist :skip-before-1st-heading))
               (org-export-grab-title-from-buffer))
-         (file-name-sans-extension file)))))
+         (file-name-nondirectory (file-name-sans-extension file))))))
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Interactive publishing functions




reply via email to

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