emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: chris <inkbottle007@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Internal link broken when publishing (was org-id with ox-html)
Date: Tue, 07 Sep 2021 17:46:12 +0200	[thread overview]
Message-ID: <4827285.5yCLvEFndJ@pluto> (raw)
In-Reply-To: <sg32te$r48$1@ciao.gmane.io>

On Tuesday, 24 August 2021 17:23:24 CEST Maxim Nikulin wrote:
> On 23/08/2021 03:42, inkbottle wrote:
> > Links between two different files, like
> > `[[id:e54113f9-2ad7-4a86-94be-68ffc696de0b][hello]]`, get broken when
> > publishing. (whatever the settings).
> > 
> > I haven't found any workaround.
> > 
> > Being able to move around entries, functionality provided by
> > `org-id-link-to- org-use-id`, is pivotal, IMO.
> 
>  From my point of view it looks like a bug.
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox.el#L4381

Thanks a lot for your help, I'm really struggling on this one. Sorry, I was 
afk for a few days.

I believe it's a bug, plain and simple.

With a unique org file, the `:ID: e54113f9-2ad7-4a86-94be-68ffc696de0b` are 
resolved to `orgfa9c151` consistently.

Which is the expected behavior: the translation table is consistent.

When there are multiple org files, in every example I've tried, every `org-id` 
based links was broken.

There is a patch here:
https://gist.github.com/jethrokuan/d6f80caaec7f49dedffac7c4fe41d132
but, as I understand it, the workaround consists in treating `:ID:` similarly 
as `:CUSTOM_ID:`, that is, exporting them "verbatim".

That method, would be different from the *upstream* way, consisting in creating 
a "translation table".

IMO the "patch" is more like a temporary workaround which can make the code 
confusing and difficult to maintain. Because a unique question is solved in 
different ways by different developers in different files.

I think that the fix should happen in
https://github.com/emacsmirror/org/blob/master/lisp/ox.el
where the translation table is created and used, but I failed to grasp how it 
works due to my insufficient understanding of emacs-lisp.

> checks for ID property.
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox-html.el#L1659
> queries CUSTOM_ID only. I suppose, ID should be here as well. A subtle
> point is which one (ID or CUSTOM_ID) should be used if both are defined
> for some headers.

Yes, "ID should be here as well" => No.
That is the point I'm advocating above.
`:CUSTOM_ID:` are meant to be treated in a so-called "stable" way. That is to 
say, the `CUSTOM_ID` you see in your org-file, is what you get in your HTML file 
(also I've done some tests with that method, and I recall it wasn't working at 
all in a multiple org files setting).
On the other hand, `:ID:` are meant to be treated through a *translation 
table*, and should result in some `orgfa9c151` thing, on the HTML side.
Weaving the two methods together doesn't seem like "road to success".

> Maybe it is possible to create workaround as a custom config without
> touching of Org code. I guess, "nicer" ids may be replaced by values of
> ID property. Examples (I tried none of them):
> -
> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading
> https://orgmode.org/list/E1jxAjq-0004Dk-LH@lists.gnu.org/ (TEC.
> [Interest] Determanistic Org IDs. Sun, 19 Jul 2020 22:27:31 +0800)
> -
> https://github.com/alphapapa/unpackaged.el#export-to-html-with-useful-anchor
> s
> https://orgmode.org/list/CA+G3_POCYTKR6M1K8XUPzUsg5EHd5Tv4FE4X-6MvadCSjSkHi
> A@mail.gmail.com/ (Tom Gillespie. Tue, 8 Dec 2020 20:39:08 -0500, Re:
> stability of toc links) -
> https://github.com/zzamboni/dot-doom/blob/master/doom.org#capturing-and-crea
> ting-internal-org-links
> https://orgmode.org/list/CAGY83EcFExvco6TuTOQiywgdDO0cXE+db828LeiDdimxBroVs
> g@mail.gmail.com/ (Diego Zamboni. Wed, 9 Dec 2020 09:45:52 +0100. Re:
> stability of toc links) -
> http://ivanmalison.github.io/dotfiles/#usemyowndefaultnamingschemefororghead
> ings
> https://orgmode.org/list/4698cfeb2e415f88bd25e71267f29168@isnotmyreal.name/
> (TRS-80. Sat, 12 Dec 2020 20:25:15 -0500. Re: Better heading links in
> org-mode exports)
> - https://writequit.org/articles/emacs-org-mode-generate-ids.html

The methods above are, as I understand it, all about making more beautiful 
links to export to HTML.
Not about the "translation table" devised in `ox.el` being broken when working 
with multiple org-files.
org-id is creating a neat framework for navigating between multiple org-files.
Also, if I remember correctly, when using `CUSTOM_ID` with several org-files, 
you have to specify the file, contrary to how org-id work, using a database to 
find all by itself, the correct file to jump to.









  reply	other threads:[~2021-09-07 15:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 22:28 org-id with ox-html inkbottle
2021-08-14  0:50 ` inkbottle
2021-08-14  4:20   ` inkbottle
2021-08-17  3:11     ` Internal link broken when publishing (was org-id with ox-html) inkbottle
2021-08-22 20:42       ` inkbottle
2021-08-24 15:23         ` Maxim Nikulin
2021-09-07 15:46           ` chris [this message]
2021-09-14 16:33             ` Max Nikulin
2021-09-20  0:05               ` chris
2021-09-20 14:13                 ` Max Nikulin
2021-09-20 15:26                   ` chris

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=4827285.5yCLvEFndJ@pluto \
    --to=inkbottle007@gmail.com \
    --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).