[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Build a menu for an HTML publish
From: |
Sébastien Gendre |
Subject: |
Re: Build a menu for an HTML publish |
Date: |
Mon, 12 Aug 2024 18:56:15 +0200 |
User-agent: |
mu4e 1.12.1; emacs 29.4 |
So, I can partially reply to myself:
Sébastien Gendre <seb@k-7.ch> writes:
> # How to pass parameters to this function
>
> If I set a function as value to the variable `org-html-preamble`, this
> function will receive a plist containing all the export options.
>
> But can I set custom export option in the publish project alist ?
> And when I export manually a file, can I set custom export option on
> buffer level ?
>
> Or each option in the plist that my function receive need to be defined
> in the HTML export backend level ?
If I use org-publish, define a publish project and set a function as
its preamble: Any custom settings in the publish project will be put in the
info plist that the preamble function receive as parameter.
For example, if I define this function:
(defun my/preamble-test (info)
"docstring"
(plist-get info :very-strawbery))
Then I set a publish project like this:
(setq org-publish-project-alist
'(("pages-org"
:base-directory "./Pages/"
:base-extension "org"
:recursive t
:publishing-function org-html-publish-to-html
:publishing-directory "./public/"
:html-doctype "html5"
:html-html5-fancy t
:very-strawbery "Test 1, test 2, test 3"
:html-preamble my/preamble-test)))
And finally I publish the project "pages-org", in my published web pages
I get a preamble with the content "Test 1, test 2, test 3".
But if I set the variable `org-html-preamble` to my custom preamble
function like this:
(setq org-html-preamble 'my/preamble-test)
I cannot found a way to define "very-strawbery" value in an Org-mode
buffer and having it used while I manually export the Org-mode buffer.
I tried with "#+very-strawbery: test123" and "#+OPTIONS: very-strawbery:
test123", without success.
Someone have an idea ?
In conclusion, about this point: It is possible to define custom
Org-mode publish settings that will be available to a preamble function.
But, I cannot found a way to set the value of "very-strawbery" that is
used when I export an Org-mode buffer instead of publish it.
Best regards
-------
Gendre Sébastien
signature.asc
Description: PGP signature