* Use CUSTOM_ID for outline-containers during HTML export
@ 2019-08-05 13:39 Yann Esposito (yogsototh)
2020-02-12 18:07 ` Bastien
0 siblings, 1 reply; 2+ messages in thread
From: Yann Esposito (yogsototh) @ 2019-08-05 13:39 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2415 bytes --]
Hello,
I would like to submit a simple patch that could make the HTML exporter closer to reproductible build.
I have given a bit more information in my commit below.
From 5d59d1e0b10430830aff77c17be1d37bb9e898bc Mon Sep 17 00:00:00 2001
From: "Yann Esposito (Yogsototh)" <yann.esposito@gmail.com>
Date: Mon, 5 Aug 2019 15:20:25 +0200
Subject: [PATCH] Use CUSTOM_ID for outline-containers
When exporting HTML the exporter generate ids for references.
Unfortunately those id are not stable in the sense that
exporting twice generate two different set of ids.
Using CUSTOM_ID one could already use have fixed anchors in the
generated HTML. So for example we could share URL with
...index.html#my-section-id and it will be the same URL even if
we export the HTML again.
Unfortunately, this CUSTOM_ID is not used for the outline ids.
And thus if we expose the html in a git repository for example.
Each export will generate a big diff that "pollute" the diff
because it will show changes for all org items while most of them
could still be unchanged.
With this PR, HTML export will use CUSTOM_ID for both the headers id
and the org outline ids. For Items without CUSTOM_ID the behavior will
stay identical as before.
n.b.: I've create a private package to generate meaningful CUSTOM_ID.
https://gitlab.esy.fun/yogsototh/org-auto-id
For my use case, it would be really preferable that those generated
ids use the content of org item.
p.s: if for some reason this patch might break some usage.
I would like to at least be able to provide an option
to disable the generation of those outline-container div.
---
lisp/ox-html.el | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 757006321..8056adc91 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2634,8 +2634,7 @@ holding contextual information."
(first-content (car (org-element-contents headline))))
(format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
(org-html--container headline info)
- (concat "outline-container-"
- (org-export-get-reference headline info))
+ (format "outline-container-%s" id)
(concat (format "outline-%d" level)
(and extra-class " ")
extra-class)
--
2.16.3
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Use CUSTOM_ID for outline-containers during HTML export
2019-08-05 13:39 Use CUSTOM_ID for outline-containers during HTML export Yann Esposito (yogsototh)
@ 2020-02-12 18:07 ` Bastien
0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2020-02-12 18:07 UTC (permalink / raw)
To: Yann Esposito (yogsototh); +Cc: emacs-orgmode
Hi Yann,
"Yann Esposito (yogsototh)" <yann.esposito@gmail.com> writes:
> I would like to submit a simple patch that could make the HTML
> exporter closer to reproductible build. I have given a bit more
> information in my commit below.
I applied your patch in the master branch, thanks.
--
Bastien
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-12 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-05 13:39 Use CUSTOM_ID for outline-containers during HTML export Yann Esposito (yogsototh)
2020-02-12 18:07 ` Bastien
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).