* Fix: ':recursive' and org-publish-attachment
@ 2008-05-16 3:04 Sebastian Rose
2008-05-16 14:03 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Rose @ 2008-05-16 3:04 UTC (permalink / raw)
To: [emacs-orgmode]
[-- Attachment #1: Type: text/plain, Size: 2210 bytes --]
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
[-- Attachment #2: sebastian_rose.vcf --]
[-- Type: text/x-vcard, Size: 499 bytes --]
begin:vcard
fn:Sebastian Rose
n:Rose;Sebastian
email;internet:sebastian_rose@gmx.de
title:Fachinformatiker/Anwendendungsentwicklung
tel;cell:+49 173 / 83 93 417
note;quoted-printable:Entwicklung von Internetanwendungen und Programmen mit freien Werkzeu=
gen und Bibliotheken.=0D=0A=
=0D=0A=
PHP, Java, C/C++, Bash, Perl, Apache, MySQL, PostgreSQL, xt::commerce=
, Typo3, Server, Netzwerk, Desktop, Datenbank, gtkmm=0D=0A=
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 204 bytes --]
_______________________________________________
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Fix: ':recursive' and org-publish-attachment
2008-05-16 3:04 Fix: ':recursive' and org-publish-attachment Sebastian Rose
@ 2008-05-16 14:03 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2008-05-16 14:03 UTC (permalink / raw)
To: sebastian_rose; +Cc: [emacs-orgmode]
Applied, thanks.
- Carsten
On May 16, 2008, at 5:04 AM, Sebastian Rose wrote:
> 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>_______________________________________________
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-16 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-16 3:04 Fix: ':recursive' and org-publish-attachment Sebastian Rose
2008-05-16 14:03 ` Carsten Dominik
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).