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= From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: org-publish: Best practice to generate a html header on a per-file basis ? Date: Tue, 19 Jul 2011 18:36:12 +0200 Message-ID: <871uxmns77.fsf@altern.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjWn7-0006kn-RE for emacs-orgmode@gnu.org; Wed, 20 Jul 2011 09:26:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjWn2-0007gY-Bx for emacs-orgmode@gnu.org; Wed, 20 Jul 2011 09:26:21 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:41183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjWn1-0007bj-VO for emacs-orgmode@gnu.org; Wed, 20 Jul 2011 09:26:16 -0400 Received: by mail-wy0-f169.google.com with SMTP id 36so201109wyg.0 for ; Wed, 20 Jul 2011 06:26:15 -0700 (PDT) In-Reply-To: (Sander Boer's message of "Mon, 18 Jul 2011 23:19:13 +0200") 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: Sander Boer Cc: "emacs-orgmode@gnu.org" Hi Sander, Sander Boer writes: > 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. Not tested: perhaps you can try to generate the sitemap.org file and include it into your other Org files with #+INCLUDE? > 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 You can use :html-preamble my-cool-function-that-returns-a-string with no "'" Note that this function must take no argument and output a string since the commit I just pushed. Thanks, -- Bastien