[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Conditionally formatting org-html-postamble-format

From: Robert H. Klein
Subject: Re: [O] Conditionally formatting org-html-postamble-format
Date: Wed, 27 Jan 2016 20:55:36 +0100

Hi Kaushal,

> Thanks for the reply.
> > how about using a postamble function instead of
> > html-postamble-format  
> Does it mean that I need to look into modifying the
> org-html--build-pre/postamble function?
> If so, I will start looking into it but it will take a while as it
> full of elisp that I have never used (until today maybe):
> format-spec, plist-get and a lot of assoc's and assq's :)

No, I have two functions, one for the preamble, one for the postamble,
both returning a string.  In the project alist I set :html-preamble
and :html-postamble to those functions (beware of typos):

  ;; pre- and postamble for html export
  (defun linux-e-preamble (info)
      (insert-file-contents "~/linuxdocs/html/preamble.html")    
      (let ((title (car (plist-get info :title))))
        (when title
          (if (stringp title)
              (let ((case-fold-search t)) ; case-insensitive
                (goto-char (point-min))
                (while (search-forward "<org-title />" nil t)
                  (replace-match title))))))

  (defun linux-e-postamble (info)
      (insert-file-contents "~/linuxdocs/html/postamble.html")    

  ;; add linux to org-publish-poject-alist
  (add-to-list 'org-publish-project-alist
                 :base-directory "~/linuxdocs"
                 :base-extension "org"
                 :publishing-directory "~/public_html/linuxdocs"
                 :publishing-function org-html-publish-to-html
                 :html-head "<link rel=\"stylesheet\" type=\"text/css\"
  href=\"css/linuxdocs.css\" />" :html-head-include-default-style nil
                 :html-head-include-scripts nil
                 :html-preamble linux-e-preamble
                 :html-postamble linux-e-postamble

Best regards

reply via email to

[Prev in Thread] Current Thread [Next in Thread]