From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sander Boer Subject: org-publish: Best practice to generate a html header on a per-file basis ? Date: Mon, 18 Jul 2011 23:19:13 +0200 Message-ID: Mime-Version: 1.0 (iPad Mail 8J2) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:33178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QivDY-0000e8-EA for emacs-orgmode@gnu.org; Mon, 18 Jul 2011 17:19:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QivDW-0000i8-5o for emacs-orgmode@gnu.org; Mon, 18 Jul 2011 17:19:07 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:45266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QivDV-0000i1-NI for emacs-orgmode@gnu.org; Mon, 18 Jul 2011 17:19:05 -0400 Received: by eyx24 with SMTP id 24so3359006eyx.19 for ; Mon, 18 Jul 2011 14:19:04 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" Hi all, I've been investigating a viable way to generate for every exported html fil= e in an org-publish project a list of links to all the other html files in t= he 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 i= s added as a hook to org-export-html-final-hook. Incidently, it took a long time to figure out that one cannot pass mere func= tions 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 figuri= ng out how to determine the position of this file with regard to the other f= iles in the project, file-relative-name really comes in handy here. The issu= e 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-tr= ee 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 i= nto .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: (hmm bad example, it also needs some form of ul/li grouping based on subdire= ctory, but you get the idea) Any and all tips and pointers are appreciated. sndr=