[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] org-publish: Best practice to generate a html header on a per-file b
From: |
Sander Boer |
Subject: |
[O] org-publish: Best practice to generate a html header on a per-file basis ? |
Date: |
Mon, 18 Jul 2011 23:19:13 +0200 |
Hi all,
I've been investigating a viable way to generate for every exported html file
in an org-publish project a list of links to all the other html files in the
directory-tree and I'm stuck.
I want this list to be inserted as a header, nicely css-ed into a navigation
bar.
The idea is to graft a function that is either passed to :html-preamble or is
added as a hook to org-export-html-final-hook.
Incidently, it took a long time to figure out that one cannot pass mere
functions to html-preamble like this:
:html-preamble 'my-cool-function-that-returns-a-string
nor like this:
:html-preamble 'my-cool-function-that-*inserts*-a-string
instead it needs to be:
:html-preamble (lambda(x) (insert (my-cool-function-that-returns-a-string x)))
or,
:html-preamble (lambda(x) (my-cool-function-that-inserts-a-string x))
Anyway, with that out of the way, now I am left with the challenge of figuring
out how to determine the position of this file with regard to the other files
in the project, file-relative-name really comes in handy here. The issue for me
is that the html-preamble and the ....-final-hook are called in the html
buffer. It is easier to graft a link list based on the original org-tree than
on the exported html-tree, as path-changes would cause issues.
So the idea is now to find the path to the original org-file and construct a
link list based on the original org-publish tree (cunningly renaming .org into
.html)
Alternatively, how about extending the sitemap generator to generate a
link-list for every file like so:
file.org-> file.inc file.html
file.inc would only consist of:
<div id="linklist">
<a href=../projects/randomproject.html>cool project</a>
<a href=../contact/about.html>all me</a>
<a href=../../index.html>home</a>
</div>
(hmm bad example, it also needs some form of ul/li grouping based on
subdirectory, but you get the idea)
Any and all tips and pointers are appreciated.
sndr
- [O] org-publish: Best practice to generate a html header on a per-file basis ?,
Sander Boer <=