Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
> Sebastian Rose <sebastian_rose <at> gmx.de> writes:
>> did you revert the previous patch? The second patch was against master
>> again.
>
> I ran git reset --hard then applied the second patch.
>
>> I changed to a subdirectory of my :base-directory (here $BASE):
>>
>> $ cd ${BASE}/subdirectory
>> $ cp ~/images/first.jpg . # a simple image
>> $ ln -s ~/images/second.jpg # a link to an image
>> $ ln -s ~/images/screenshots/ # a link to a directory
>>
>> When exporting, I get this tree in :publishing-directory ($PUB):
>>
>> $PUB/
>> |-- subdirectory/
>> | |-- first.jpg
>> | |-- second.jpg
>> | `-- screenshots/
>> | |-- some.png
>> | `-- other.png
>>
>> which is what you expected, is that right?
>
> Yes, that's what I expected. What I'm getting is a little different.
>
> $PUB/
> `-- subdirectory/
> |-- screenshots/
> | `-- subdirectory/
> | `-- screenshots/
> | |-- other.png
> | `-- some.png
> `-- subdirectory/
> |-- first.jpg
> |-- second.jpg
>
> This is how the project is defined...
> (setq
> org-publish-project-alist
> '(("static"
> :base-directory "~/org-bug/"
> :publishing-directory "~/org-bug-pub/"
> :publishing-function org-publish-attachment
> :recursive t
> :base-extension "css\\|gz\\|bz\\|lzma\\|jpg\\|gif\\|png")))
>
> And published with this sexp.
> (org-publish "static")
>
> Perhaps the discrepancy between our setups is git commit (not sure if
> I'm using the right terms there)? git log shows
> 878d94b472 at the top of its output.
>
> Thanks for your help!
> --Aidan
Ahrrgh :)
I just pulled, because I couldn't find that commit.
That commit already includes the (obviously wrong) first patch...
Here's the patch that reverts the first attempt and applies the new
one. Hope this works :)
Sebastian
* lisp/org-publish.el (org-publish-attachment): Put the attachment
into the right directory.
Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
> On Thu, Sep 16, 2010 at 12:40:34AM +0200, Sebastian Rose wrote:
>> Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
>> > Sebastian Rose <sebastian_rose <at> gmx.de> writes:
>> >> It would be a bug.
>> >>
>> >> But I cannot reproduce it (current Org mode from git, emacs24).
>> >
>> > I just figured out why: I store all my images in ~/images/ and just
>> > have symbolic links to them in my Org website directory.
>> >
>> > Can you reproduce it now that you have this piece of information?
>>
>>
>> Ah, OK. That might be because of some call to
>>
>> (file-truename file...)
>>
>> or similar. `file-truename' removes symbolic links in filenames.
>>
>> Functions like this are called to make sure, the file is published only
>> if needed (i.e. the file has changed since last export).
>>
>> I'm not sure currently if it's clever to remove such calls (see
>> lisp/org-publish.el and search `file-truename').
>
> What if `file-truename' was used only to get the path of the actual
> file to copy, but the (relative) path of the link is used as the
> destination?
>
> --Aidan
Hi Aidan,
`org-publish-attachment' is wrong or called with wrong arguments.
This patch fixes it.
As always, there might be a better way to fix it,
but this way the function `org-publish-attachment' will work regardless
of parameters. Someone will always call this function with the wrong
`PUB-DIR' parameter...
Aidan, would like to apply the patch and verify it works for you?
Best wishes,
Sebastian
Org-publish: correctly find files in projects which didn't define a base-extension.
Previously, (org-publish-get-project-from-filename "~/org/file.org") would return nil because the constructed regular expression "^/home/dc/org/.+\\.\\(\\)$" required a dot at the end.
#+BEGIN_QUOTE
#+END_QUOTE
* lisp/org-publish.el (org-publish-write-cache-file):
Write a serialized version of the cache hash.
(org-publish-initialize-cache): Reset the cache hash before creating a
new one.Serialize publishing project cache with `puthash' expressions.
Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Sebastian,
>
> sorry for being slow. Could you do me a favor and send me the cache patch one
> more time - if possible updated to the current master.
>
> I am just not sure I have the right patch in my hands.
Hi Carsten,
no problem. The patch is attached.
Here is a list of my ChangeLog entries, redated to today:
2010-05-13 Sebastian Rose <sebastian_rose@gmx.de>
* org-publish.el (org-publish-cache): Use one big hashmap for
each project defined in `org-publish-project-alist'. The
hashmap will hold pairs of our timestamp-filenames and
timestamps, as well as pairs of source-paths and associated
plists for arbitrary values. Currently only the files title is
stored there.
The caching feature writes the information gathered during
publishing to disk and re-loads it from there the next time we
publish the same project. All those informations will hence
survive a restart of emacs.
One cache file per publishing project is used. The contents of
that file is the elisp that fills the new variable
`org-publish-cache'. The cache file is named according to the
project with `.cache' added and lives in
`org-timestamp-directory'.
* org-publish.el (initialize-files-alist): This function and
the variable `org-publish-files-alist' are not used anymore in
favour of the reloadable cache and the functions for handling
it. Removed therefor.
* org-publish.el (org-publish-validate-link) was not used
anywhere. Removed.
* org-publish.el (org-publish-get-base-files): Added the
variable `sitemap-requested' to avoid sorting where possible.
See also end of `org-publish-get-base-files-1'.
* org-publish.el (org-publish-get-files): This function is
not called anymore. Removed.
* org-publish.el (org-publish-get-project-from-filename) does
not depend on a list of files anymore. Instead of laoding all
files of all, we walk `org-publish-project-alist' until we
find a project, where the properties :base-directory, :recursive,
:base-extension, :include and :exclude match.
* org-publish.el (org-publish-file) takes an additional
parameter to avoid superfloues loading and writing of the
cache file when used to publish a part of a project.
This new code will search #+INDEX lines in the buffer. For LaTeX, it
will simple convert these into LaTeX \index{} commands. For other
backends, it will copy thee entries to a new file, with extension
orgx. These files can then later be post-processed to create the index.