emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* html preamble
@ 2015-03-23 20:12 hymie!
  2015-03-23 20:28 ` Rasmus
  2015-03-24 15:19 ` Scott Randby
  0 siblings, 2 replies; 3+ messages in thread
From: hymie! @ 2015-03-23 20:12 UTC (permalink / raw)
  To: emacs-orgmode

So my next task is to learn about the HTML preamble.

From reading the docs, it looks like all of my org files have to share a
single HTML preamble, which is set in my .emacs file through either the
org-html-preamble variable, the org-html-preamble-format variable, or the
org-publish-project-alist variable.  There is no way to tell a specific Org
file "This is your HTML preamble."  Is that correct?

Why are there two different variables org-html-preamble-format and
org-html-preamble if the org-html-preamble variable can perform all of the
tasks of org-html-preamble-format and more?

Finally, how do I get the current date into the preamble?  I see that I can
specifically set a date, and I see the current date in a comment at the top
of my exported HTML, but I can't figure out how to get the current date out
of the comment and into my preamble.

Thanks.

--hymie!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: html preamble
  2015-03-23 20:12 html preamble hymie!
@ 2015-03-23 20:28 ` Rasmus
  2015-03-24 15:19 ` Scott Randby
  1 sibling, 0 replies; 3+ messages in thread
From: Rasmus @ 2015-03-23 20:28 UTC (permalink / raw)
  To: emacs-orgmode

hymie! <hymie@lactose.homelinux.net> writes:

> So my next task is to learn about the HTML preamble.
>
> From reading the docs, it looks like all of my org files have to share a
> single HTML preamble, which is set in my .emacs file through either the
> org-html-preamble variable, the org-html-preamble-format variable, or the
> org-publish-project-alist variable.  There is no way to tell a specific Org
> file "This is your HTML preamble."  Is that correct?

That is incorrect (IMO).  On a file basis you can turn off most preamble
things via the relevant OPTIONS keyword.

On a project basis you could set the relevant variable.  See
org-publish-project-alist.

I guess you could make a clever function that sets the org-html-preamble
based on some heuristics and add it to one of hooks that are run before
parsing.  See e.g. org-export-before-parsing-hook.

> Why are there two different variables org-html-preamble-format and
> org-html-preamble if the org-html-preamble variable can perform all of the
> tasks of org-html-preamble-format and more?

org-html-preamble-format is a template, it seems, that is used by
org-html-preamble, which can also take a string or a function.  In
practice I always use org-html-preamble in ox-html projects.

> Finally, how do I get the current date into the preamble?  I see that I can
> specifically set a date, and I see the current date in a comment at the top
> of my exported HTML, but I can't figure out how to get the current date out
> of the comment and into my preamble.

Hmm.  Does %d or %C work? See org-html-postamble-format.

Hope it helps,
Rasmus

-- 
I almost cut my hair, it happened just the other day

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: html preamble
  2015-03-23 20:12 html preamble hymie!
  2015-03-23 20:28 ` Rasmus
@ 2015-03-24 15:19 ` Scott Randby
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Randby @ 2015-03-24 15:19 UTC (permalink / raw)
  To: emacs-orgmode

On 03/23/2015 04:12 PM, hymie! wrote:
> So my next task is to learn about the HTML preamble.
>
>From reading the docs, it looks like all of my org files have to share a
> single HTML preamble, which is set in my .emacs file through either the
> org-html-preamble variable, the org-html-preamble-format variable, or the
> org-publish-project-alist variable.  There is no way to tell a specific Org
> file "This is your HTML preamble."  Is that correct?
>
> Why are there two different variables org-html-preamble-format and
> org-html-preamble if the org-html-preamble variable can perform all of the
> tasks of org-html-preamble-format and more?
>
> Finally, how do I get the current date into the preamble?  I see that I can
> specifically set a date, and I see the current date in a comment at the top
> of my exported HTML, but I can't figure out how to get the current date out
> of the comment and into my preamble.
>

I don't know if this helps, but I have postamble requirements in each 
file that I export. I believe you can do the same for the preamble. 
Below is an example from one of my files.

----
* COMMENT Postamble Settings

#+BEGIN_SRC emacs-lisp

;; Turn off postamble creation
(setq org-html-postamble nil)

;; Turn on postamble creation (default)
(setq org-html-postamble t)

;; Postamble format for lessons
(setq org-html-postamble-format (quote (("en" "<p 
class=\"author\">Author: %a </p>
<p class=\"email\">Email: %e</p>
<p class=\"creator\">%c</p>"))))

;; Postamble format for non-lesson pages (default)
(setq org-html-postamble-format (quote (("en" "<p 
class=\"author\">Author: %a </p>
<p class=\"email\">Email: %e</p>
<p class=\"date\">Date: %T</p>
<p class=\"creator\">%c</p>"))))

#+END_SRC
----

Scott Randby

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-24 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 20:12 html preamble hymie!
2015-03-23 20:28 ` Rasmus
2015-03-24 15:19 ` Scott Randby

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).