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: Build a menu for an HTML publish
Date: Mon, 12 Aug 2024 02:45:31 +0200	[thread overview]
Message-ID: <87cyme36xg.fsf@k-7.ch> (raw)

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

Hello,

I (continue to) write an online documentation with Org-mode and I want
to build the main navigation menu dynamically. I would like to have your
opinion about what I plan to do.


# What I plan

I plan to write a function that I can assign to the variable
`org-html-preamble` or the publish setting :html-preamble.

This function would take as parameters:

* The brand name and/or the brand logo url

* The main menu structure

And optionally the HTML templates for:

* The brand name and/or logo url

* The menu item

* The menu item with submenu

* The menu surrounding

* The preamble

This function will return the formatted preamble in HTML format.


# What I need to define

I need to choose how the menu structure is defined. An Elisp
alist ? An org-mode file containing only a list ?

If I choose an Elisp alist, do I reuse the Org-mode URL format ? If yes,
is there any org-mode internal function I can use to convert an url like
"file:example.org::*some headline" to "https://example.html#custom-id" ?

With the Elisp alist, I could use keys as menu labels and associated values as
targets. With this solution, I can have different kinds of targets.

If I choose an org-mode file, I cannot control how the HTML export is
built. I will need to write my own function that parse the file, extract
the needed information and format the HTML result. And I need to use a
different extension to avoid having to exclude this file with
org-publish.


# 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 ?


Best regards

-------
Gendre Sébastien

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

             reply	other threads:[~2024-08-12  0:47 UTC|newest]

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

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=87cyme36xg.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).