From: Matt Price <moptop99@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: change JS & CSS paths when publishing?
Date: Thu, 13 Mar 2014 23:01:17 -0400 [thread overview]
Message-ID: <CAN_Dec9PZtZvsAB-2q6+8t6xY8vyyuW-8oy6uikywm7YLwQQcw@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec_D=H6pymh+CLoKdv_Pf+DB5d48dW6KZi-xK2e8B-5YmA@mail.gmail.com>
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 <moptop99@gmail.com> wrote:
> On Thu, Mar 13, 2014 at 11:57 AM, Bastien <bzg@gnu.org> wrote:
>> Hi Matt,
>>
>> Matt Price <moptop99@gmail.com> 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
prev parent reply other threads:[~2014-03-14 3:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 15:10 change JS & CSS paths when publishing? Matt Price
2014-03-13 15:57 ` Bastien
[not found] ` <CAN_Dec_D=H6pymh+CLoKdv_Pf+DB5d48dW6KZi-xK2e8B-5YmA@mail.gmail.com>
2014-03-14 3:01 ` Matt Price [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN_Dec9PZtZvsAB-2q6+8t6xY8vyyuW-8oy6uikywm7YLwQQcw@mail.gmail.com \
--to=moptop99@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).