From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yann Esposito (yogsototh)" Subject: Use CUSTOM_ID for outline-containers during HTML export Date: Mon, 5 Aug 2019 15:39:31 +0200 Message-ID: <1ACD8322-4973-41FE-9341-995D3C4DF98C@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/signed; boundary="Apple-Mail=_82BB8949-30FD-4E7B-9931-FEBBAD4BE261"; protocol="application/pgp-signature"; micalg=pgp-sha512 Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:57444) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hudD7-0006Vd-FQ for emacs-orgmode@gnu.org; Mon, 05 Aug 2019 09:39:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hudD6-0006Ry-8f for emacs-orgmode@gnu.org; Mon, 05 Aug 2019 09:39:37 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:45305) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hudD5-0006Qd-Vg for emacs-orgmode@gnu.org; Mon, 05 Aug 2019 09:39:36 -0400 Received: by mail-ed1-x534.google.com with SMTP id x19so72755939eda.12 for ; Mon, 05 Aug 2019 06:39:35 -0700 (PDT) Received: from ?IPv6:2001:420:44f3:1300:45df:b098:e155:a938? ([2001:420:44f3:1300:45df:b098:e155:a938]) by smtp.gmail.com with ESMTPSA id e12sm19732072edb.72.2019.08.05.06.39.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Aug 2019 06:39:33 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --Apple-Mail=_82BB8949-30FD-4E7B-9931-FEBBAD4BE261 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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. =46rom 5d59d1e0b10430830aff77c17be1d37bb9e898bc Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" 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=3D\"%s\" class=3D\"%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 --Apple-Mail=_82BB8949-30FD-4E7B-9931-FEBBAD4BE261 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEERI6f709bht55wWabexmkxlDVlkYFAl1IMZMACgkQexmkxlDV lkYicBAAk8zm2l8itvvnXzzq2cT6d+zgIWNZuv1v+Q0zXyRPQ0eCZfZdp59awVbN 3lLdY54Lyl5MTWcVqplnFwMQSgvWOllWaTpOTU4AnoyS/Z+QjmWkwJiD2ovZ2YRo KOAFrwNby95a+97GJm5D8s06qBQ4XJqjoNdDGUVpD0HsivdJGIHUthnxzQ4ws7Ta 0Zsw8ag1S+vuMpQN7Cyrh/yY/UtmmivLUs+48ZIT+8JGwfmyEU+mEtwb4vD/Vaax P3s2AvBQ0/sag6nXMbdVf+NEscBFOpzYY1OlBdYjXiKXOexYeAT34ktI5TvGa8Hk Fv+XxEx1xPoylttu8ak4q4krATAr7kkKv/2nthEqlurQfgSunlIrY0mnQ1s4hFf2 cWTLx02TK43x+rHGYx6a5xNkZcdD9DjHybRgUZlIGDsi8+SLdBdx/gXjcOClI/sp DNIAr/7gI7d7reYylhRICNZiY9LOx0E9yraZ3hxeE88++HS519nT+0NMRPqliKZP owP0m+5qubmCn2QKJO7u6KnrW67gJgwpKp7wy+G7D5uAtHp2bMM91Qm3RlZl/De3 V+yq7+ZOHfS6FtKQPp2dhqtJJVOOeVdutRRF5XjzbPUcH5TT5YiH9Tljo5xsbhfA ODdstbyg0xNBkHOecbzXoLOh/Sjw2a7+EdFUojgvKS+JVs1BhP8= =Qvoy -----END PGP SIGNATURE----- --Apple-Mail=_82BB8949-30FD-4E7B-9931-FEBBAD4BE261--