From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: Fix: ':recursive' and org-publish-attachment Date: Fri, 16 May 2008 05:04:30 +0200 Message-ID: <482CF9BE.1010502@gmx.de> Reply-To: sebastian_rose@gmx.de Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090700030800010000030101" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JwqEZ-0001IF-2C for emacs-orgmode@gnu.org; Thu, 15 May 2008 23:03:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JwqEU-0001HP-VH for emacs-orgmode@gnu.org; Thu, 15 May 2008 23:03:50 -0400 Received: from [199.232.76.173] (port=53206 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwqEU-0001HM-QG for emacs-orgmode@gnu.org; Thu, 15 May 2008 23:03:46 -0400 Received: from mail.gmx.net ([213.165.64.20]:34941) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JwqEU-0007BC-96 for emacs-orgmode@gnu.org; Thu, 15 May 2008 23:03:46 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "[emacs-orgmode]" This is a multi-part message in MIME format. --------------090700030800010000030101 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------090700030800010000030101 Content-Type: text/x-vcard; charset=utf-8; name="sebastian_rose.vcf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="sebastian_rose.vcf" YmVnaW46dmNhcmQNCmZuOlNlYmFzdGlhbiBSb3NlDQpuOlJvc2U7U2ViYXN0aWFuDQplbWFp bDtpbnRlcm5ldDpzZWJhc3RpYW5fcm9zZUBnbXguZGUNCnRpdGxlOkZhY2hpbmZvcm1hdGlr ZXIvQW53ZW5kZW5kdW5nc2VudHdpY2tsdW5nDQp0ZWw7Y2VsbDorNDkgMTczIC8gODMgOTMg NDE3DQpub3RlO3F1b3RlZC1wcmludGFibGU6RW50d2lja2x1bmcgIHZvbiBJbnRlcm5ldGFu d2VuZHVuZ2VuIHVuZCBQcm9ncmFtbWVuICBtaXQgIGZyZWllbiAgV2Vya3pldT0NCglnZW4g IHVuZCBCaWJsaW90aGVrZW4uPTBEPTBBPQ0KCT0wRD0wQT0NCglQSFAsIEphdmEsIEMvQysr LCAgQmFzaCwgIFBlcmwsICBBcGFjaGUsIE15U1FMLCAgUG9zdGdyZVNRTCwgeHQ6OmNvbW1l cmNlPQ0KCSwgVHlwbzMsIFNlcnZlciwgIE5ldHp3ZXJrLCAgRGVza3RvcCwgRGF0ZW5iYW5r LCBndGttbT0wRD0wQT0NCgkNCngtbW96aWxsYS1odG1sOkZBTFNFDQp2ZXJzaW9uOjIuMQ0K ZW5kOnZjYXJkDQoNCg== --------------090700030800010000030101 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --------------090700030800010000030101--