help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: org-publish: can I use a function in :html-preamble-format?


From: Giovanni Biscuolo
Subject: Re: org-publish: can I use a function in :html-preamble-format?
Date: Tue, 23 Mar 2021 11:36:11 +0100

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: signature.asc
Description: PGP signature


reply via email to

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