* change JS & CSS paths when publishing? @ 2014-03-13 15:10 Matt Price 2014-03-13 15:57 ` Bastien 0 siblings, 1 reply; 3+ messages in thread From: Matt Price @ 2014-03-13 15:10 UTC (permalink / raw) To: Org Mode Hi, I've been using ox-deck to export my lectures as slides. Internet connectivity in one of my lecture halls is a little unreliable, so I keep a local copy of deck.js (which contains js and css files) on my laptop. Without those files, the slideshow just exports as plain HTML. 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. So, my question: how can I rewrite those paths when I publish? I guess there are two possible ways: - defadvice on org-deck-publish-to-html? - use a :completion-function on the project definition? But honestly I have no experience with writing defadvices, and I am not sure how the completion-function is supposed to work (like, what arguments it takes). If anyone has done something similar, I would be be very grateful to hear about it! Thanks, Matt ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: change JS & CSS paths when publishing? 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> 0 siblings, 1 reply; 3+ messages in thread From: Bastien @ 2014-03-13 15:57 UTC (permalink / raw) To: Matt Price; +Cc: Org Mode 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 -- Bastien ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CAN_Dec_D=H6pymh+CLoKdv_Pf+DB5d48dW6KZi-xK2e8B-5YmA@mail.gmail.com>]
* Re: change JS & CSS paths when publishing? [not found] ` <CAN_Dec_D=H6pymh+CLoKdv_Pf+DB5d48dW6KZi-xK2e8B-5YmA@mail.gmail.com> @ 2014-03-14 3:01 ` Matt Price 0 siblings, 0 replies; 3+ messages in thread From: Matt Price @ 2014-03-14 3:01 UTC (permalink / raw) To: Org Mode 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-14 3:01 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.