[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] change JS & CSS paths when publishing?
From: |
Matt Price |
Subject: |
Re: [O] change JS & CSS paths when publishing? |
Date: |
Thu, 13 Mar 2014 23:01:17 -0400 |
Ooops, forgot to send to the list! Forwarding my last reply to
Bastien, and then answering my own question below, sort of:
On Thu, Mar 13, 2014 at 1:29 PM, Matt Price <address@hidden> wrote:
> On Thu, Mar 13, 2014 at 11:57 AM, Bastien <address@hidden> wrote:
>> Hi Matt,
>>
>> Matt Price <address@hidden> writes:
>>
>>> I would like to provide those lectures on the web for my students.
>>> (Ideally, in fact, I would like to provide a couple of versions of
>>> each lecture: one deck slideshow, one plain html, and maybe one pdf
>>> or odt version.) Howver, the deck publish ocmmand writes paths to the
>>> local copies of deck's css and js files. I would like to rewrite these
>>> paths in the published files, to use the version of deck on my server
>>> instead.
>>
>> IIUC, you can use something like this in your file:
>>
>> #+DECK_BASE_URL: http://some/server/url.js
>
> I would like to use the local copies of the deck.js files when I
> simply export to deck; but server copies when I publish. So I think I
> would need a simple function like this that modifies the buffer before
> (or, I guess after!) it gets written to a *published* (but not
> *exported*) file:
>
>
> (defun mwp-update-published-paths ()
> (interactive)
> (let ((case-fold-search t))
> (goto-char (point-min))
> (while (search-forward "/home/matt/src/deck.js" nil t)
> (replace-match "http://sandbox.hackinghistory.ca/Tools/deck.js" t t))))
>
>
> I just am not quite sure how and when to run it, and what argument to
> pass it (like, can I do normal buffer operations, or do I need to
> operate on the file contents as a string or something?).
>
I found an easy way around my problem, by writing my own trivial
publishing function:
-----------------------
(defun mwp-org-deck-publish-to-html (plist filename pub-dir)
"Publish an org file to deck.js HTML Presentation.
FILENAME is the filename of the Org file to be published. PLIST
is the property list for the given project. PUB-DIR is the
publishing directory. Returns output file name."
(let ((org-deck-base-url "http://sandbox.hackinghistory.ca/Tools/deck.js/"))
(org-publish-org-to 'deck filename ".html" plist pub-dir))
)
-----------------------
Then I just set :org-publishing-function to
mwp-org-deck-publish-to-html, and I'm all set.
There are doubtless more elegant ways to do this but this will do for
now. Now I just need to figure out a better way to manage images -- I
like to keep them all in the same place, and I need to keep my course
lectures in different directories, so it would be nice to be able to
use absolute file links. But there's probably a way around that as
well. For now I'm pretty happy!
Thanks again,
matt
>>
>> --
>> Bastien