Linking to relative asciidoc files not working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking to relative asciidoc files not working

aalmiray
Hello fellow doc writers,

According to the User Manual you may link to relative files using the following syntax

    link:name_of_your_file/[caption]

I see this syntax being used in Asciidoctor's User Manual itself (https://github.com/asciidoctor/asciidoctor.org/blob/master/docs/user-manual.adoc) so I gave it a try. Problem is that it's not working for me.

I have several .adoc files under the same source directory, linking some of them like so

    link:resources-resource-resolver-configuration/[configuration]

where resources-resource-resolver-configuration.adoc is a local file to the current document. The generated HTML link points to "build/asciidoc/resources-resource-resolver-configuration/" as is, no .html suffix. If I write the link in the following fashion instead

    link:resources-resource-resolver-configuration.adoc/[configuration]

then the generated HTML link points to "build/asciidoc/resources-resource-resolver-configuration.adoc/". So I gather the link is taken verbatim. So question is, how can I make relative links work? I'm using asciidoctor-gradle 0.7 based on asciidoctorj 0.1.4 btw.

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: Linking to relative asciidoc files not working

asotobu
In theory it should be supported as described in https://github.com/asciidoctor/asciidoctor/issues/417?source=cc.

I used something similar to reference an external document, you can see in this link
https://raw.github.com/lordofthejars/foobank/master/src/main/resources/com/lordofthejars/bank/customer/srs.adoc

hope it works for you too.

Alex.
Reply | Threaded
Open this post in threaded view
|

Re: Linking to relative asciidoc files not working

aalmiray
Hi Alex,

Sadly the link: macro does not work for .adoc files but it does for any other content. I switched to doc references such as <<ref,caption>> which works for single page docs (or an aggregating index.html) but will certainly fail with a multi-page approach (a page per chapter for example). Oh well, there's always room for improvement ;-)

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: Linking to relative asciidoc files not working

mojavelinux
Administrator

On Tue, Jan 21, 2014 at 12:22 PM, aalmiray [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I switched to doc references such as <<ref,caption>> which works for single page docs (or an aggregating index.html) but will certainly fail with a multi-page approach (a page per chapter for example). Oh well, there's always room for improvement ;-)

Actually, you should be using the <<ref,caption>> syntax for any links that refer to related documents in your own repo.  It will handle the case that the documents are standalone or aggregated. Plus, it communicates intent much better. There's information about how it works for the use case in the user manual.


Cheers,

Reply | Threaded
Open this post in threaded view
|

Re: Linking to relative asciidoc files not working

davidgamba
I had problems using the <<adoc_file.adoc#_ref,caption>> style when it refers to other files that get included into a master file. I have been meaning to create an issue report on github.

Asciidoctor should be able to notice that "adoc_file.adoc" is part of "doc.references[:includes]" and strip the "adoc_file.adoc#" part, instead of me having to use only <<ref,caption>> when building with the master file.

Reply | Threaded
Open this post in threaded view
|

Re: Linking to relative asciidoc files not working

mojavelinux
Administrator

On Wed, Oct 29, 2014 at 9:16 AM, davidgamba [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Asciidoctor should be able to notice that "adoc_file.adoc" is part of "doc.references[:includes]" and strip the "adoc_file.adoc#" part, instead of me having to use only <<ref,caption>> when building with the master file.

That's the whole idea of this feature. If there's a case where it's not working, let's get it fixed.