org-id with ox-html

2021-08-13 Thread inkbottle
Hi,

I want an `org-id / :ID:` publishing workflow.

To eliminate "xy-case" I first describe what I've been trying to do.

First I've added an `:ID:` to many headlines through `M-x org-id-get-create`.

Then I've added one `#+INDEX: word` under one of those headlines.

Then I've executed that (I do not have org-mode related configuration in my 
init.el for now):

#+begin_src emacs-lisp :tangle no
  (progn
(use-package org-id)
(setq org-id-link-to-org-use-id t)
;; (setq org-html-link-org-files-as-html nil)
(setq org-publish-project-alist
  '(("project-name"
 :base-directory "~/note_taking"
 :publishing-directory "~/note_taking/html"
 :publishing-function org-html-publish-to-html
 :makeindex t)
("all" :components ("project-name")
 
#+end_src

then `C-c C-e P a`

At this point I have both `misc.html` and `theindex.html` created, 
`theindex.html`.

The links in `theindex.html` are like: `misc.html#ID-9ca0bb24-407e-4d23-863b-
b3ff8afb90db`, as they should, I would say.

There really is: `:ID: 9ca0bb24-407e-4d23-863b-b3ff8afb90db` in `misc.org`.
But it is not translated in `misc.html`. So the link is not working. All the 
anchors in `misc.html` are in the form: `...`. No 
`:ID:` is used.

Oh, and I also did, `M-x org-id-update-id-locations`, in case it would bring 
me any luck.


The subject has already been talked about twice at least, but I can't apply or 
understand, what have been said.

In https://lists.gnu.org/archive/html/emacs-orgmode/2009-03/msg00012.html, we 
can read this, which seems to completely address my question, though I really 
don't know how to reproduce it, and I'm not sure it's even possible:

>>> Could the org-id be added when publishing?
>>
>>> Like
>>> HEADLINE
>>> THE-ORG-ID-ITSELF>> span>
>>>
>>> or similar?
>>
>> They already are in the HTML, I am surprised you never noticed.
>
>
> ... because I didn't use IDs in my publishing projects yet :-D


The subject has also been brought up by Karl Voit with different specifications 
though. I, myself, am perfectly fine with the default function generating 
`:ID:`. The discussion however is very interesting:

https://karl-voit.at/2019/11/16/UOMF-Linking-Headings/
https://lists.gnu.org/archive/html/emacs-orgmode/2016-12/msg00423.html


Another way to put the question could be:
Is it possible, to have `:ID: 9ca0bb24-407e-4d23-863b-b3ff8afb90db`, translated 
into `id="ID-9ca0bb24-407e-4d23-863b-b3ff8afb90db"` (or sth), when exporting to 
html?

Thanks,
Chris






Re: org-id with ox-html

2021-08-13 Thread inkbottle
Just adding one element. When I open `theindex.inc` in emacs,  then do `M-x 
org-mode`, then go on one of the links and do `M-x org-open-at-point`, the 
link is correctly followed.

But when exported to html, the link from `theindex.html` is broken, because no 
target has been actually created using

  :PROPERTIES:
  :ID:   9ca0bb24-407e-4d23-863b-b3ff8afb90db
  :END:

Instead, I only have a target:
``
in `misc.html`, for the considered headline.

It's correct that I do not _need_ a target named after 
`9ca0bb24-407e-4d23-863b-b3ff8afb90db`,

But I do need the link and the target to agree.



On Saturday, August 14, 2021 12:28:35 AM CEST you wrote:
> Hi,
> 
> I want an `org-id / :ID:` publishing workflow.
> 
> To eliminate "xy-case" I first describe what I've been trying to do.
> 
> First I've added an `:ID:` to many headlines through `M-x
> org-id-get-create`.
> 
> Then I've added one `#+INDEX: word` under one of those headlines.
> 
> Then I've executed that (I do not have org-mode related configuration in my
> init.el for now):
> 
> #+begin_src emacs-lisp :tangle no
>   (progn
> (use-package org-id)
> (setq org-id-link-to-org-use-id t)
> ;; (setq org-html-link-org-files-as-html nil)
> (setq org-publish-project-alist
>   '(("project-name"
>  :base-directory "~/note_taking"
>  :publishing-directory "~/note_taking/html"
>  :publishing-function org-html-publish-to-html
>  :makeindex t)
> 
> ("all" :components ("project-name")
>  
> #+end_src
> 
> then `C-c C-e P a`
> 
> At this point I have both `misc.html` and `theindex.html` created,
> `theindex.html`.
> 
> The links in `theindex.html` are like:
> `misc.html#ID-9ca0bb24-407e-4d23-863b- b3ff8afb90db`, as they should, I
> would say.
> 
> There really is: `:ID: 9ca0bb24-407e-4d23-863b-b3ff8afb90db` in `misc.org`.
> But it is not translated in `misc.html`. So the link is not working. All the
> anchors in `misc.html` are in the form: `...`. No
> `:ID:` is used.
> 
> Oh, and I also did, `M-x org-id-update-id-locations`, in case it would bring
> me any luck.
> 
> 
> The subject has already been talked about twice at least, but I can't apply
> or understand, what have been said.
> 
> In https://lists.gnu.org/archive/html/emacs-orgmode/2009-03/msg00012.html,
> we can read this, which seems to completely address my question, though I
> really
> don't know how to reproduce it, and I'm not sure it's even possible:
> >>> Could the org-id be added when publishing?
> >>> 
> >>> Like
> >>> 
> >>> HEADLINE
> >>>
> >>> THE-ORG-ID-ITSELF >>> 
> >>> span>
> >>> 
> >>>
> >>> 
> >>> or similar?
> >> 
> >> They already are in the HTML, I am surprised you never noticed.
> > 
> > ... because I didn't use IDs in my publishing projects yet :-D
> 
> The subject has also been brought up by Karl Voit with different
> specifications though. I, myself, am perfectly fine with the default
> function generating `:ID:`. The discussion however is very interesting:
> 
> https://karl-voit.at/2019/11/16/UOMF-Linking-Headings/
> https://lists.gnu.org/archive/html/emacs-orgmode/2016-12/msg00423.html
> 
> 
> Another way to put the question could be:
> Is it possible, to have `:ID: 9ca0bb24-407e-4d23-863b-b3ff8afb90db`,
> translated into `id="ID-9ca0bb24-407e-4d23-863b-b3ff8afb90db"` (or sth),
> when exporting to html?
> 
> Thanks,
> Chris







Re: org-id with ox-html

2021-08-13 Thread inkbottle
I cannot have the following minimal example working consistently:

$ cat hello.org

* hello
  :PROPERTIES:
  :ID:   e54113f9-2ad7-4a86-94be-68ffc696de0b
  :END:

  #+INDEX: hello-keyword

  #+begin_src emacs-lisp 
(org-id-update-id-locations '("hello.org" "bye.org" "theindex.org"))
  #+end_src

  #+begin_src emacs-lisp
(use-package org-id)
(setq org-id-link-to-org-use-id t)
;; (setq org-html-link-org-files-as-html t)
(setq org-publish-project-alist
  '(("project-name"
 :base-directory "~/20210814_minex"
 :publishing-directory "~/20210814_minex/html"
 :publishing-function org-html-publish-to-html
 :makeindex t
 )
("all" :components ("project-name")
 )
))
  #+end_src

  [[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]

  Some hello paragraph.


$ cat bye.org 

#+HTML_HEAD:  .bottom-three {margin-bottom: 5cm;}

* some long section

  #+BEGIN_EXPORT html
  
 A line.
  
  
 Another.
  
  
 Another.
  
  
 Another.
  
  
 Another.
  
  
 Another.
  
  
 Another.
  
  
 Another.
  
  #+END_EXPORT


* bye
  :PROPERTIES:
  :ID:   3c5997f1-205a-437e-8722-d5f52239a207
  :END:

  #+INDEX: bye-keyword



  #+begin_example
  [[id:e54113f9-2ad7-4a86-94be-68ffc696de0b][hello]]
  #+end_example


  Some bye paragraph.


Initially it worked, without the `makeindex` and without 
`[[id:e54113f9-2ad7-4a86-94be-68ffc696de0b][hello]]` commented out.

Then with `makeindex` it stopped working consistently. The links became 
broken.

Then, the files `bye.html` and `hello.html` were not generated anymore when 
doing `C-e C-e P a`. Only `theindex.html` was still generated.

So I just definitely have no clue of what is the correct workflow to have that 
project exported correctly to html.


On Saturday, August 14, 2021 2:50:46 AM CEST you wrote:
> Just adding one element. When I open `theindex.inc` in emacs,  then do `M-x
> org-mode`, then go on one of the links and do `M-x org-open-at-point`, the
> link is correctly followed.
> 
> But when exported to html, the link from `theindex.html` is broken, because
> no target has been actually created using
> 
>   :PROPERTIES:
>   :ID:   9ca0bb24-407e-4d23-863b-b3ff8afb90db
> 
>   :END:
> Instead, I only have a target:
> ``
> in `misc.html`, for the considered headline.
> 
> It's correct that I do not _need_ a target named after
> `9ca0bb24-407e-4d23-863b-b3ff8afb90db`,
> 
> But I do need the link and the target to agree.
> 
> On Saturday, August 14, 2021 12:28:35 AM CEST you wrote:
> > Hi,
> > 
> > I want an `org-id / :ID:` publishing workflow.
> > 
> > To eliminate "xy-case" I first describe what I've been trying to do.
> > 
> > First I've added an `:ID:` to many headlines through `M-x
> > org-id-get-create`.
> > 
> > Then I've added one `#+INDEX: word` under one of those headlines.
> > 
> > Then I've executed that (I do not have org-mode related configuration in
> > my
> > init.el for now):
> > 
> > #+begin_src emacs-lisp :tangle no
> > 
> >   (progn
> >   
> > (use-package org-id)
> > (setq org-id-link-to-org-use-id t)
> > ;; (setq org-html-link-org-files-as-html nil)
> > (setq org-publish-project-alist
> > 
> >   '(("project-name"
> >   
> >  :base-directory "~/note_taking"
> >  :publishing-directory "~/note_taking/html"
> >  :publishing-function org-html-publish-to-html
> >  :makeindex t)
> > 
> > ("all" :components ("project-name")
> > 
> >  
> > 
> > #+end_src
> > 
> > then `C-c C-e P a`
> > 
> > At this point I have both `misc.html` and `theindex.html` created,
> > `theindex.html`.
> > 
> > The links in `theindex.html` are like:
> > `misc.html#ID-9ca0bb24-407e-4d23-863b- b3ff8afb90db`, as they should, I
> > would say.
> > 
> > There really is: `:ID: 9ca0bb24-407e-4d23-863b-b3ff8afb90db` in
> > `misc.org`.
> > But it is not translated in `misc.html`. So the link is not working. All
> > the anchors in `misc.html` are in the form: ` > id="org1ddafea">...`. No `:ID:` is used.
> > 
> > Oh, and I also did, `M-x org-id-update-id-locations`, in case it would
> > bring me any luck.
> > 
> > 
> > The subject has already been talked about twice at least, but I can't
> > apply
> > or understand, what have been said.
> > 
> > In https://lists.gnu.org/archive/html/emacs-orgmode/2009-03/msg00012.html,
> > we can read this, which seems to completely address my question, though I
> > really
> > 
> > don't know how to reproduce it, and I'm not sure it's even possible:
> > >>> Could the org-id be added when publishing?
> > >>> 
> > >>> Like
> > >>> 
> > >>> HEADLINE
> > >>>
> > >>> THE-ORG-ID-ITSELF > >>> 
> > >>> span>
> > >>> 
> > >>>
> > >>> 
> > >>> or similar?
> > >> 
> > >> They already are in the HTML, I am surprised you never noticed.
> > > 
> > > ... because I didn't use IDs i

Internal link broken when publishing (was org-id with ox-html)

2021-08-16 Thread inkbottle
I've done a lot of investigation.

I totally agree with internal links not being stable through publishing:
`3c5997f1-205a-437e-8722-d5f52239a207` => `"bye.org#orgfa9c151"`

I totally agree with what Nicolas Goaziou says there:
https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg01254.html

However, I do have an _internal link_ in the form:
`[[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]`
(This link is not hand made at all, it is the result of: `org-id-get-create` 
`org-store-link` `org-insert-link`.)

Which is translated into:
`bye`

But no target of the corresponding form is created, and that somewhat in 
accordance with the cited post above. But it breaks the link.

As I understand it, in accordance with the cited post, the internal link 
should be "interpreted" as:
`bye`
(from: `[[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]`).

For that, there should be some "translation table":
`3c5997f1-205a-437e-8722-d5f52239a207 => bye.org#orgfa9c151`
(there might already such translation table somewhere).
(Actually it is `cache`, in
https://github.com/emacsmirror/org/blob/master/lisp/ox.el#L4442)

The obvious workaround would be to use `CUSTOM_ID`, which is stable through 
publishing. But it's not at all a functionality I'm looking for.
I've thought of a function using `org-map-entries`, creating a `:CUSTOM_ID:` 
as a duplicate of `:ID:` everywhere, creating the `:ID:` if necessary. Always 
using `org-id-get-create`.

But maybe there is an _obvious way_ to have it working out of the box.
Here is a minimal example:

## file: hello.org

* hello
  :PROPERTIES:
  :ID:   e54113f9-2ad7-4a86-94be-68ffc696de0b
  :END:

  [[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]

## file: bye.org

* bye
  :PROPERTIES:
  :ID:   3c5997f1-205a-437e-8722-d5f52239a207
  :END:

Thanks,
Chris

P.S. I'm pretty sure the minimal example above can work right out of the box 
with someone, who unlike me, knows how to correctly configure the publishing. 
However, I mention two other leads, the first one I prefer by far: (to be 
honest this first one it is not about internal links not breaking at publishing 
time, which was a "given", but to form more "meaningful" publishing id)
1. Suggestions have been made by Nicolas Goaziou to look in the direction of 
`org-export-get-reference` (at the level of the "translation table"?)
https://github.com/emacsmirror/org/blob/master/lisp/ox.el#L4443
2. Another suggestion is from org-roam
https://github.com/org-roam/org-roam/wiki/Hitchhiker's-Rough-Guide-to-Org-roam-V2#export
https://gist.github.com/jethrokuan/d6f80caaec7f49dedffac7c4fe41d132





Re: Internal link broken when publishing (was org-id with ox-html)

2021-08-22 Thread inkbottle
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.