emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Gendre" <seb@k-7.ch>
To: Org mailing list <emacs-orgmode@gnu.org>
Subject: Re: Build a menu for an HTML publish
Date: Tue, 13 Aug 2024 11:56:34 +0200	[thread overview]
Message-ID: <87v80421bh.fsf@k-7.ch> (raw)
In-Reply-To: <877ccl3ck0.fsf@k-7.ch> ("Sébastien Gendre"'s message of "Mon, 12 Aug 2024 18:56:15 +0200")

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


Another reply to myself about this specific part:

Sébastien Gendre <seb@k-7.ch> writes:
> 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 ?

If I want to define the value of my new option "very-strawbery" in the
level of an Org-mode buffer (or file), I need to add this new option
into the variable `org-export-options-alist` like this:

If I evaluate this:

    (add-to-list 'org-export-options-alist
                 '(:very-strawbery "VERYSTRAWBERY" nil nil))


To quote the docstring of `org-export-options-alist`:

> Alist between export properties and ways to set them.
> 
> The key of the alist is the property name, and the value is a list
> like (KEYWORD OPTION DEFAULT BEHAVIOR) where:
> 
> KEYWORD is a string representing a buffer keyword, or nil.  Each
>   property defined this way can also be set, during subtree
>   export, through a headline property named after the keyword
>   with the "EXPORT_" prefix (i.e. DATE keyword and EXPORT_DATE
>   property).
> OPTION is a string that could be found in an #+OPTIONS: line.
> DEFAULT is the default value for the property.
> BEHAVIOR determines how Org should handle multiple keywords for
>   the same property.  It is a symbol among:
>   nil       Keep old value and discard the new one.
>   t         Replace old value with the new one.
>   ‘space’   Concatenate the values, separating them with a space.
>   ‘newline’ Concatenate the values, separating them with
> 	    a newline.
>   ‘split’   Split values at white spaces, and cons them to the
> 	    previous list.
>   ‘parse’   Parse value as a list of strings and Org objects,
>             which can then be transcoded with, e.g.,
>             ‘org-export-data’.  It implies ‘space’ behavior.
> 
> Values set through KEYWORD and OPTION have precedence over
> DEFAULT.

After adding my new export option, I can use it by writing this on my
Org-mode buffer/file I want to export:

    #+VERYSTRAWBERRY: TestTestTest


After exporting my Org-mode buffer/file to HTML, I get a preamble with
the text "TestTestTest".


Note :

* Having a buffer option for "very-strawbery" is useful for export
  but also for publish. I can set a value that will override the
  value set in the Org-publish project settings.

* The variable `org-export-options-alist` is made for options who are
  back-end agnostic. But I didn't found a way to modify export options of
  HTML backend without redefine a new backend.


Best regards

-------
Gendre Sébastien


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

      parent reply	other threads:[~2024-08-13  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  0:45 Build a menu for an HTML publish Sébastien Gendre
2024-08-12 16:56 ` Sébastien Gendre
2024-08-13  8:50   ` Bruno Barbier
2024-08-13 10:58     ` Sébastien Gendre
2024-08-13  9:56   ` Sébastien Gendre [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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v80421bh.fsf@k-7.ch \
    --to=seb@k-7.ch \
    --cc=emacs-orgmode@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).