all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Org-mode-publish: link to dedicated target accross files
@ 2013-12-29 16:20 Sébastien Brisard
  2013-12-29 18:53 ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Brisard @ 2013-12-29 16:20 UTC (permalink / raw)
  To: emacs-orgmode

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

I'm facing a problem with links accross multiple org files, when I publish
to HTML. Here is a minimal working example. file1.org looks like

<<target1>> Target 1

[[target1][Go to target #1]]

[[file:./file2.org::target2][Go to target #2]]

while file2.org looks like

<<target2>> Target 2

In emacs, when I click on the second link, it opens file2.org all right.
However, when I export to html, here is what file1.html looks like

<body>
  <div id="content">
    <h1 class="title">file1</h1>
    <p>
      <a id="target1" name="target1"></a> Target 1
    </p>

    <p>
      <a href="#target1">Go to target #1</a>
    </p>

    <p>
      <a href="./file2.html">Go to target #2</a>
    </p>
  </div>
  <div id="postamble" class="status">
    ...
  </div></body>

The second link should read (I believe)

<a href="./file2.html#target2">Go to target #2</a>

Is there something I'm missing? Thanks for your help!

NOTA: my emacs setup is such that

(setq org-link-search-must-match-exact-headline nil)

[-- Attachment #2: Type: text/html, Size: 4077 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-29 16:20 Org-mode-publish: link to dedicated target accross files Sébastien Brisard
@ 2013-12-29 18:53 ` Nicolas Goaziou
  2013-12-29 19:17   ` Sébastien Brisard
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2013-12-29 18:53 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: emacs-orgmode

Hello,

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> I'm facing a problem with links accross multiple org files, when I publish
> to HTML. Here is a minimal working example. file1.org looks like
>
> <<target1>> Target 1
>
> [[target1][Go to target #1]]
>
> [[file:./file2.org::target2][Go to target #2]]
>
> while file2.org looks like
>
> <<target2>> Target 2
>
> In emacs, when I click on the second link, it opens file2.org all right.
> However, when I export to html, here is what file1.html looks like
>
> <body>
>   <div id="content">
>     <h1 class="title">file1</h1>
>     <p>
>       <a id="target1" name="target1"></a> Target 1
>     </p>
>
>     <p>
>       <a href="#target1">Go to target #1</a>
>     </p>
>
>     <p>
>       <a href="./file2.html">Go to target #2</a>
>     </p>
>   </div>
>   <div id="postamble" class="status">
>     ...
>   </div></body>
>
> The second link should read (I believe)
>
> <a href="./file2.html#target2">Go to target #2</a>

There's no support for exporting links to targets across files. You can
only target a headline, through its custom-id, e.g.,

  [[file:./file2.org::#custom-id][...]]

or through its title

  [[file:/file2.org::*Headline title][...]] 


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-29 18:53 ` Nicolas Goaziou
@ 2013-12-29 19:17   ` Sébastien Brisard
  2013-12-30  9:43     ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Brisard @ 2013-12-29 19:17 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,
that's what I feared... I know it works with the CUSTOM_ID property.
Unfortunately, I'd like to link to an item in a list.
Is there a (possibly dirty) work around?

Best regards,
Sébastien


2013/12/29 Nicolas Goaziou <n.goaziou@gmail.com>

> Hello,
>
> Sébastien Brisard <sebastien.brisard@m4x.org> writes:
>
> > I'm facing a problem with links accross multiple org files, when I
> publish
> > to HTML. Here is a minimal working example. file1.org looks like
> >
> > <<target1>> Target 1
> >
> > [[target1][Go to target #1]]
> >
> > [[file:./file2.org::target2][Go to target #2]]
> >
> > while file2.org looks like
> >
> > <<target2>> Target 2
> >
> > In emacs, when I click on the second link, it opens file2.org all right.
> > However, when I export to html, here is what file1.html looks like
> >
> > <body>
> >   <div id="content">
> >     <h1 class="title">file1</h1>
> >     <p>
> >       <a id="target1" name="target1"></a> Target 1
> >     </p>
> >
> >     <p>
> >       <a href="#target1">Go to target #1</a>
> >     </p>
> >
> >     <p>
> >       <a href="./file2.html">Go to target #2</a>
> >     </p>
> >   </div>
> >   <div id="postamble" class="status">
> >     ...
> >   </div></body>
> >
> > The second link should read (I believe)
> >
> > <a href="./file2.html#target2">Go to target #2</a>
>
> There's no support for exporting links to targets across files. You can
> only target a headline, through its custom-id, e.g.,
>
>   [[file:./file2.org::#custom-id][...]]
>
> or through its title
>
>   [[file:/file2.org::*Headline title][...]]
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 2791 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-29 19:17   ` Sébastien Brisard
@ 2013-12-30  9:43     ` Nicolas Goaziou
  2013-12-30 17:00       ` Sébastien Brisard
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2013-12-30  9:43 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: emacs-orgmode

Hello,

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> that's what I feared... I know it works with the CUSTOM_ID property.
> Unfortunately, I'd like to link to an item in a list.
> Is there a (possibly dirty) work around?

You may use a custom-id syntax pointing to your target:

  [[file:./file2.org::#item-target][...]]

Though, you will not get item number if you do not provide
a description.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-30  9:43     ` Nicolas Goaziou
@ 2013-12-30 17:00       ` Sébastien Brisard
  2013-12-30 17:16         ` Sébastien Brisard
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Brisard @ 2013-12-30 17:00 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,
thanks for your answer. This indeed works. Is was sure I had already tested
this solution, with no success... Thanks a lot!!!

Sébastien


2013/12/30 Nicolas Goaziou <n.goaziou@gmail.com>

> Hello,
>
> Sébastien Brisard <sebastien.brisard@m4x.org> writes:
>
> > that's what I feared... I know it works with the CUSTOM_ID property.
> > Unfortunately, I'd like to link to an item in a list.
> > Is there a (possibly dirty) work around?
>
> You may use a custom-id syntax pointing to your target:
>
>   [[file:./file2.org::#item-target][...]]
>
> Though, you will not get item number if you do not provide
> a description.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1239 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-30 17:00       ` Sébastien Brisard
@ 2013-12-30 17:16         ` Sébastien Brisard
  2013-12-30 19:46           ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Brisard @ 2013-12-30 17:16 UTC (permalink / raw)
  To: emacs-orgmode

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

Correction: CUSTOM_ID does not seem to work with description lists (it
seems it only works with headings, *, **, ***, ...).
Sébastien


2013/12/30 Sébastien Brisard <sebastien.brisard@m4x.org>

> Hi,
> thanks for your answer. This indeed works. Is was sure I had already
> tested this solution, with no success... Thanks a lot!!!
>
> Sébastien
>
>
> 2013/12/30 Nicolas Goaziou <n.goaziou@gmail.com>
>
>> Hello,
>>
>> Sébastien Brisard <sebastien.brisard@m4x.org> writes:
>>
>> > that's what I feared... I know it works with the CUSTOM_ID property.
>> > Unfortunately, I'd like to link to an item in a list.
>> > Is there a (possibly dirty) work around?
>>
>> You may use a custom-id syntax pointing to your target:
>>
>>   [[file:./file2.org::#item-target][...]]
>>
>> Though, you will not get item number if you do not provide
>> a description.
>>
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>
>

[-- Attachment #2: Type: text/html, Size: 1818 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-30 17:16         ` Sébastien Brisard
@ 2013-12-30 19:46           ` Nicolas Goaziou
  2013-12-30 20:28             ` Sébastien Brisard
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2013-12-30 19:46 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: emacs-orgmode

Hello,

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> Correction: CUSTOM_ID does not seem to work with description lists (it
> seems it only works with headings, *, **, ***, ...).

It would be useful to know what you wrote in your Org file, what the
output is, and what you expected.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-30 19:46           ` Nicolas Goaziou
@ 2013-12-30 20:28             ` Sébastien Brisard
  2013-12-30 22:05               ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Brisard @ 2013-12-30 20:28 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

yes, that might help. Org-file =references.org= is a list of bibliographic
references. Each entry is actually an item in a description list, like so

#+BEGIN_SRC
  - <<HASH1962>>
[[http://dx.doi.org/10.1016/0022-5096(62)90004-2][Hashinand Shtrikman
(1962)]] :: Z. Hashin and S. Shtrikman, /On some variational
principles in anisotropic and nonhomogeneous elasticity/, Journal of the
Mechanics and Physics of Solids 10(4):335-342, 1962
#+END_SRC

Then, in other org files, I'd like to refer to one of the items in the
list. For example, I would like to write something like

Using the energy principle of Hashin and Shtrikman (1962), an upper bound
on the elastic moduli can be derived.

Once exported to html, I would like the text 'Hashin [...] (1962)' to be a
hyperlink which should point to references.html#HASH1962.

Do you need more details? How can I achieve that result?

Sébastien

2013/12/30 Nicolas Goaziou <n.goaziou@gmail.com>

> Hello,
>
> Sébastien Brisard <sebastien.brisard@m4x.org> writes:
>
> > Correction: CUSTOM_ID does not seem to work with description lists (it
> > seems it only works with headings, *, **, ***, ...).
>
> It would be useful to know what you wrote in your Org file, what the
> output is, and what you expected.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 2196 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-30 20:28             ` Sébastien Brisard
@ 2013-12-30 22:05               ` Nicolas Goaziou
  2013-12-31 17:44                 ` Sébastien Brisard
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2013-12-30 22:05 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: emacs-orgmode

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> yes, that might help. Org-file =references.org= is a list of bibliographic
> references. Each entry is actually an item in a description list, like so
>
> #+BEGIN_SRC
>   - <<HASH1962>>
> [[http://dx.doi.org/10.1016/0022-5096(62)90004-2][Hashinand Shtrikman
> (1962)]] :: Z. Hashin and S. Shtrikman, /On some variational
> principles in anisotropic and nonhomogeneous elasticity/, Journal of the
> Mechanics and Physics of Solids 10(4):335-342, 1962
> #+END_SRC
>
> Then, in other org files, I'd like to refer to one of the items in the
> list. For example, I would like to write something like
>
> Using the energy principle of Hashin and Shtrikman (1962), an upper bound
> on the elastic moduli can be derived.
>
> Once exported to html, I would like the text 'Hashin [...] (1962)' to be a
> hyperlink which should point to references.html#HASH1962.
>
> Do you need more details? How can I achieve that result?

What happens if you write

  [[file:./references.org::#HASH1962][Hashin and Shtrikman (1962)]]

in other Org files?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-30 22:05               ` Nicolas Goaziou
@ 2013-12-31 17:44                 ` Sébastien Brisard
  2014-01-01 18:13                   ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Brisard @ 2013-12-31 17:44 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,



> yes, that might help. Org-file =references.org= is a list of bibliographic
> > references. Each entry is actually an item in a description list, like so
> >
> > #+BEGIN_SRC
> >   - <<HASH1962>>
> > [[http://dx.doi.org/10.1016/0022-5096(62)90004-2][Hashinand Shtrikman
> > (1962)]] :: Z. Hashin and S. Shtrikman, /On some variational
> > principles in anisotropic and nonhomogeneous elasticity/, Journal of the
> > Mechanics and Physics of Solids 10(4):335-342, 1962
> > #+END_SRC
> >
> > Then, in other org files, I'd like to refer to one of the items in the
> > list. For example, I would like to write something like
> >
> > Using the energy principle of Hashin and Shtrikman (1962), an upper bound
> > on the elastic moduli can be derived.
> >
> > Once exported to html, I would like the text 'Hashin [...] (1962)' to be
> a
> > hyperlink which should point to references.html#HASH1962.
> >
> > Do you need more details? How can I achieve that result?
>
> What happens if you write
>
>   [[file:./references.org::#HASH1962][Hashin and Shtrikman (1962)]]
>
> in other Org files?
>

There are two answers
1. in Emacs, clicking on the link opens the file references.org, but I get
"No match" in the minibuffer
2. in the exported HTML file, the link is correct (something like <a
href="./references.html#HASH1962">...</a>)

If I instead write

 [[file:./references.org::HASH1962][Hashin and Shtrikman (1962)]]

(without the #), then the behaviour is the exact opposite
3. in Emacs, the link (including the dedicated target) is found
4. in the exported HTML file, the link is incomplete (<a
href="./references.html">...</a>)

What I would like is 2 + 3...

Sébastien

[-- Attachment #2: Type: text/html, Size: 2550 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2013-12-31 17:44                 ` Sébastien Brisard
@ 2014-01-01 18:13                   ` Nicolas Goaziou
  2014-01-03 13:51                     ` Sébastien Brisard
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2014-01-01 18:13 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: Rick Frankel, emacs-orgmode

Hello,

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> If I instead write
>
>  [[file:./references.org::HASH1962][Hashin and Shtrikman (1962)]]
>
> (without the #), then the behaviour is the exact opposite
> 3. in Emacs, the link (including the dedicated target) is found
> 4. in the exported HTML file, the link is incomplete (<a
> href="./references.html">...</a>)
>
> What I would like is 2 + 3...

I have pushed a change to html back-end (in master branch) so that an
unresolved option should still appear in the exported link. IOW,

  [[file:./file.org::target][...]]

will become

  <a href="./file.html#target">...</a>

This is slightly different from link resolution in a single buffer,
because, in the case above, a headline named "* target" will have
priority over a "<<target>>".


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Org-mode-publish: link to dedicated target accross files
  2014-01-01 18:13                   ` Nicolas Goaziou
@ 2014-01-03 13:51                     ` Sébastien Brisard
  0 siblings, 0 replies; 12+ messages in thread
From: Sébastien Brisard @ 2014-01-03 13:51 UTC (permalink / raw)
  To: emacs-orgmode

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

Thanks for this quick answer. I have never built Org-mode myself (always
relied on ELPA), but will give it a go and will report.

Anyway, thank you for your dedication. Org is really a great tool !

Sébastien


2014/1/1 Nicolas Goaziou <n.goaziou@gmail.com>

> Hello,
>
> Sébastien Brisard <sebastien.brisard@m4x.org> writes:
>
> > If I instead write
> >
> >  [[file:./references.org::HASH1962][Hashin and Shtrikman (1962)]]
> >
> > (without the #), then the behaviour is the exact opposite
> > 3. in Emacs, the link (including the dedicated target) is found
> > 4. in the exported HTML file, the link is incomplete (<a
> > href="./references.html">...</a>)
> >
> > What I would like is 2 + 3...
>
> I have pushed a change to html back-end (in master branch) so that an
> unresolved option should still appear in the exported link. IOW,
>
>   [[file:./file.org::target][...]]
>
> will become
>
>   <a href="./file.html#target">...</a>
>
> This is slightly different from link resolution in a single buffer,
> because, in the case above, a headline named "* target" will have
> priority over a "<<target>>".
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1855 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-01-03 13:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 16:20 Org-mode-publish: link to dedicated target accross files Sébastien Brisard
2013-12-29 18:53 ` Nicolas Goaziou
2013-12-29 19:17   ` Sébastien Brisard
2013-12-30  9:43     ` Nicolas Goaziou
2013-12-30 17:00       ` Sébastien Brisard
2013-12-30 17:16         ` Sébastien Brisard
2013-12-30 19:46           ` Nicolas Goaziou
2013-12-30 20:28             ` Sébastien Brisard
2013-12-30 22:05               ` Nicolas Goaziou
2013-12-31 17:44                 ` Sébastien Brisard
2014-01-01 18:13                   ` Nicolas Goaziou
2014-01-03 13:51                     ` Sébastien Brisard

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.