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 " <div id=\"menu\"> <a href=\"" pre "index.html\">Home</a> | <a href=\"" pre "sw/index.html\">Software</a> | <a href=\"" pre "blog/index.html\">Blog</a> | <a href=\"" pre "contact.html\">Contact</a> | <a href=\"" pre "sitemap.html\">Site Map</a> </div> <div> "))) (defun my-org-style () (let ((pre (apply 'concat (loop for i from 1 upto *org-publish-level* collect "../")))) (concat " <link rel=\"stylesheet\" href=\"" pre "style.css\" type=\"text/css\"/> <link rel=\"icon\" href=\"" pre "favicon.ico\" type=\"image/x-icon\"/> <link rel=\"shortcut icon\" href=\"" pre "favicon.ico\" type=\"image/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