From: "Robert H. Klein" <roklein@roklein.de>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Conditionally formatting org-html-postamble-format
Date: Wed, 27 Jan 2016 20:55:36 +0100 [thread overview]
Message-ID: <20160127205536.5fb468ca@lt70.mpip-mainz.mpg.de> (raw)
In-Reply-To: <CAFyQvY1Ndshc_50kPp9XjxXbXHNMU_sUw1+QW-tLGa3Cwe0sRQ@mail.gmail.com>
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)
(with-temp-buffer
(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))))))
(buffer-string)))
(defun linux-e-postamble (info)
(with-temp-buffer
(insert-file-contents "~/linuxdocs/html/postamble.html")
(buffer-string)))
;; add linux to org-publish-poject-alist
(add-to-list 'org-publish-project-alist
'("linux-e-html"
: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
Robert
next prev parent reply other threads:[~2016-01-27 19:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 21:46 Conditionally formatting org-html-postamble-format Kaushal Modi
2016-01-27 18:26 ` Robert H. Klein
2016-01-27 18:35 ` Kaushal Modi
2016-01-27 19:51 ` Nick Dokos
2016-01-27 19:55 ` Robert H. Klein [this message]
2016-01-28 4:36 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160127205536.5fb468ca@lt70.mpip-mainz.mpg.de \
--to=roklein@roklein.de \
--cc=emacs-orgmode@gnu.org \
--cc=kaushal.modi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.