all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Giovanni Biscuolo <giovanni@biscuolo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: org-publish: can I use a function in :html-preamble-format?
Date: Tue, 23 Mar 2021 11:36:11 +0100	[thread overview]
Message-ID: <87a6quw410.fsf@biscuolo.net> (raw)
In-Reply-To: <87im5jw6pi.fsf@biscuolo.net>

[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]

Hello,

I solved this with a backquote (instead of quote), I write this just in
case someone need an example (of what NOT to do :-D ).

Giovanni Biscuolo <giovanni@biscuolo.net> writes:

[...]

> If I use this:
>
> --8<---------------cut here---------------start------------->8---
>
> :html-preamble-format (("en"
> 			(xmlgen
> 			 '(div
> 			   (div
> 			    (a :href "/" "Home")
> 			    (span :class "pre-sep" "|")
> 			    (a :href "/colophon.html" "Colophon")))))
> 		       ("it"
> 			(xmlgen
> 			 '(div
> 			   (div
> 			    (a :href "/" "Home")
> 			    (span :class "pre-sep" "|")
> 			    (a :href "/colophon.html" "Colophon"))))))
>
> --8<---------------cut here---------------end--------------->8---

OK the code above was included as part of <<sites_config>> in a list
like this:

--8<---------------cut here---------------start------------->8---

      (setq org-publish-project-alist
	  '(
	    <<sites_config>>))

--8<---------------cut here---------------end--------------->8---

In this way all the sites_config part is _quoted_ (see the quote ad the
beginning of the org-publish-project-alist).

If I want the xmlgen code above to be evaluated, I have to backquote the
list and use the evaluator symbol (",") for the (xmlgen ...) block; this
way:

--8<---------------cut here---------------start------------->8---

      (setq org-publish-project-alist
	  `(
	    [OMISSIS]
            :html-preamble-format (("en"
            			,(xmlgen
            			 '(div
            			   (div
            			    (a :href "/" "Home")
            			    (span :class "pre-sep" "|")
            			    (a :href "/colophon.html" "Colophon")))))
            		       ("it"
            			,(xmlgen
            			 '(div
            			   (div
            			    (a :href "/" "Home")
            			    (span :class "pre-sep" "|")
            			    (a :href "/colophon.html" "Colophon"))))))))
           
--8<---------------cut here---------------end--------------->8---

...OK, lesson learned! :-D


Happy hacking!
Giovanni.

-- 
Giovanni Biscuolo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 865 bytes --]

      reply	other threads:[~2021-03-23 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 15:26 org-publish: can I use a function in :html-preamble-format? Giovanni Biscuolo
2021-03-23 10:36 ` Giovanni Biscuolo [this message]

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=87a6quw410.fsf@biscuolo.net \
    --to=giovanni@biscuolo.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.