emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Create preamble from an .org file ?


From: Vincent Beffara
Subject: Re: [O] Create preamble from an .org file ?
Date: Wed, 28 Mar 2012 18:06:31 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Hi,

How do I do that? Maybe a dedicated .org file for the navigation bar is
not the right way to do, is there a better one?

Since you only need to export your preamble in HTML once, I'd rather use
`org-export-html-preamble' and set it to the HTML string you want.

Thanks for the tip. In terms of time spent to build a web page, that would have been the wise thing to do. However, I wanted something more modular, say being able to add a few pages without having to tweak the variable each time, and so on.

So in the mean time I cobbled something together, which works for me and feels a bit more flexible if I want to modify the navigation bar in the page:

(defun my-org-publish-org-to-html (plist filename pubdir)
  (org-pop-to-buffer-same-window
    (find-file "~/Boulot/org/web/preamble.org"))
    (let* ((preamble (org-export-as-html 3 nil nil 'string t))
           (plist (plist-put plist :html-preamble preamble)))
          (org-publish-org-to-html plist filename pubdir)))

(Everything is hard-coded, it should use the :base-directory and test whether :html-preamble is equal to 'file or something, and it does not feel optimal at all, if only because it exports the preamble once for every file - that's more like a proof-of-concept ...)

The file .../preamble.org contains a few links and contact info, and the line to #+INCLUDE: the sitemap. Works reasonably well :-) and it could be something that others would find useful.

Thanks again,

Cheers,

        /vincent





reply via email to

[Prev in Thread] Current Thread [Next in Thread]