From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Fully featured Web publishing Date: Sat, 18 Apr 2009 13:04:07 +0200 Message-ID: <5ED87B67-0654-411B-BA8A-31F7E5083049@gmail.com> References: <87d4ba71tw.fsf@logand.com> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lv8LK-0005as-7o for emacs-orgmode@gnu.org; Sat, 18 Apr 2009 07:04:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lv8LF-0005Yf-1p for emacs-orgmode@gnu.org; Sat, 18 Apr 2009 07:04:17 -0400 Received: from [199.232.76.173] (port=39093 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lv8LE-0005YU-Nc for emacs-orgmode@gnu.org; Sat, 18 Apr 2009 07:04:12 -0400 Received: from mail-ew0-f160.google.com ([209.85.219.160]:51186) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lv8LD-0003Wl-SQ for emacs-orgmode@gnu.org; Sat, 18 Apr 2009 07:04:12 -0400 Received: by ewy4 with SMTP id 4so1213125ewy.42 for ; Sat, 18 Apr 2009 04:04:11 -0700 (PDT) In-Reply-To: <87d4ba71tw.fsf@logand.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Tomas Hlavaty Cc: emacs-orgmode@gnu.org Hi Tomas, if you have or will sign a copyright assignment, I'd be happy to accept a patch to this effect. - Carsten On Apr 18, 2009, at 11:23 AM, Tomas Hlavaty wrote: > Hi all, > > thanks for the excelent org-mode;-) > >> Automatical computing of navigations is not possible (yet). > > There is a way of achieving this: > > 1. define and use function my-org-publish-org-to-html which determines > what directory level we are on and then calls the original > org-publish-org-to-html function > > 2. define and use my-org-preamble which inserts the preamble based on > the directory level computed above > > 3. patch org-export-as-html so that the config parameters :style and > :preamble can be functions as well as strings. > > Here is rough code. > > Configuration: > > :publishing-function my-org-publish-org-to-html > :style my-org-style > :preamble my-org-preamble > > The "user" code: > > (defun my-org-publish-org-to-html (plist filename pubdir) > (let* ((dir (file-name-as-directory > (file-truename (plist-get plist :base-directory)))) > (fname (file-truename filename)) > (rel (substring fname (length dir))) > (*org-publish-level* > (loop for x in (split-string rel "") > count (and (stringp x) (string= "/" x))))) > (org-publish-org-to-html plist filename pubdir))) > > (defun my-org-preamble () > (let ((pre (apply 'concat > (loop for i from 1 upto *org-publish-level* collect > "../")))) > (insert " >
> Home > | Software > | Blog > | Contact > | Site Map >
>
> "))) > > (defun my-org-style () > (let ((pre (apply 'concat > (loop for i from 1 upto *org-publish-level* collect > "../")))) > (concat " > > > x-icon\"/>"))) > > The "patched" code in org-export-as-html: > > @@ -465,7 +465,12 @@ PUB-DIR is set, use this as the publishing > directory." > (org-infile-export-plist)))) > (style (concat (if (plist-get opt-plist :style-include-default) > org-export-html-style-default) > - (plist-get opt-plist :style) > + ;;; THL Changed !!! > + (let ((s (plist-get opt-plist :style))) > + (cond > + ((and s (stringp s)) s) > + (s (funcall s)))) > + ;;;(plist-get opt-plist :style) > (plist-get opt-plist :style-extra) > "\n" > (if (plist-get opt-plist :style-include-scripts) > @@ -664,7 +669,12 @@ lang=\"%s\" xml:lang=\"%s\"> > date author description keywords > style)) > > - (insert (or (plist-get opt-plist :preamble) "")) > + ;; THL Changed !!! > + (let ((preamble (plist-get opt-plist :preamble))) > + (cond > + ((and preamble (stringp preamble)) (insert preamble)) > + (preamble (funcall preamble)))) > + ;;(insert (or (plist-get opt-plist :preamble) "")) > > (when (plist-get opt-plist :auto-preamble) > (if title (insert (format org-export-html-title-format > > I think that in general, the org-mode configuration > (org-publish-project-alist) would be more flexible/user programable if > the config parameters could also be functions (i.e. not limited to > strings only). Any ideas whether and how to improve and make the > above functionality available in the official release? > > Thank you, > > Tomas > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode