emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vincent Beffara <vbeffara@ens-lyon.fr>
To: emacs-orgmode@gnu.org
Subject: Re: Create preamble from an .org file ?
Date: Wed, 28 Mar 2012 18:06:31 +0200	[thread overview]
Message-ID: <4F733707.7000306@ens-lyon.fr> (raw)
In-Reply-To: <87k4254wbm.fsf@altern.org>

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	other threads:[~2012-03-28 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27  9:04 Create preamble from an .org file ? Vincent Beffara
2012-03-27 20:11 ` Bastien
2012-03-28 16:06   ` Vincent Beffara [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=4F733707.7000306@ens-lyon.fr \
    --to=vbeffara@ens-lyon.fr \
    --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).