[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Fix: ':recursive' and org-publish-attachment
From: |
Sebastian Rose |
Subject: |
[Orgmode] Fix: ':recursive' and org-publish-attachment |
Date: |
Fri, 16 May 2008 05:04:30 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.9 (X11/20080110) |
The following patch fixes a bug in org-publish. There must be a better
way to fix this (maybe it is fixed already) cause this one only works on
the local host (?), but my poor lisp...
It is possible to supply the ':recursive' property to a project in
org-publish-project-alist to publish recursively.
But org-publish-attachment crashes if one of the target sub directories
does not exist. Here is a fix.
diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index 55cca97..0d1e8e2 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -512,6 +512,8 @@ See `org-publish-org-to' to the list of arguments."
(require 'eshell)
(require 'esh-maint)
(require 'em-unix))
+ (or (file-directory-p pub-dir)
+ (make-directory pub-dir t))
(eshell/cp filename pub-dir))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
M-x org-version RET
Org-mode version 6.03pre01
I just was about getting my feet wet with elisp. But fortunately I
found, that a 'recursive' property is already provided in
org-publish.el! Could not find it in the docs. I feel it realy should be
documented, since it is an great feature. My orgfiles already have names
like emacs-orgmode.org, emacs-gnus.org and emacs-whatever.org :-D
But this did not work with static files if the target directory did not
exist.
This is what I tried to do:
(setq org-publish-project-alist
'(("org-notes"
:base-directory "~/notes/"
:recursive t
:base-extension "org"
:publishing-directory "~/htdocs/org-notes/"
:publishing-function org-publish-org-to-html
)
("org-notes-static"
:base-directory "~/notes/"
:recursive t
:base-extension "css\\|js\\|png\\|jpg\\|gif"
:publishing-directory "~/htdocs/org-notes/"
:publishing-function org-publish-attachment)
("public-notes" :components ("org-notes" "org-notes-static"))))
M-x org-publish-project RET public-notes RET
The images live in a subdirectory 'img/'.
When I deleted the sub directory 'img/' under ':publishing-directory'
the publishing of the images failed.
Have fun,
Sebastian
sebastian_rose.vcf
Description: Vcard
- [Orgmode] Fix: ':recursive' and org-publish-attachment,
Sebastian Rose <=