Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross references don't jump to linked section #56

Closed
cfeddersen opened this issue Sep 26, 2014 · 15 comments
Closed

Cross references don't jump to linked section #56

cfeddersen opened this issue Sep 26, 2014 · 15 comments
Assignees

Comments

@cfeddersen
Copy link

I tried asciidoctor-pdf today. It's looking really nice on my sample document!
One thing I noticed is that cross references are clickable within the pdf, but the user isn't taken to the target. I'm not 100% sure if cross references should already work or not.

Using asciidoctor-pdf-1.5.0.alpha.5 and a slightly modified example.adoc, see below.

= Document Title
Doc Writer <doc@example.com>
:doctype: book
:source-highlighter: coderay
:listing-caption: Listing

A simple cross reference <<Introduction>>.



== Introduction

A paragraph followed by a simple list with square bullets.

[square]
* item 1
* item 2


Here's how you say "`Hello, World!`" in Prawn:

.Create a basic PDF document using Prawn
[source,ruby]
----
require 'prawn'

Prawn::Document.generate 'example.pdf' do
  text 'Hello, World!'
end
----
@mojavelinux
Copy link
Member

One thing I noticed is that cross references are clickable within the pdf, but the user isn't taken to the target. I'm not 100% sure if cross references should already work or not.

I don't think this is implemented yet, or it has gaps if it is.

@mojavelinux mojavelinux added this to the v1.5.0 milestone Sep 26, 2014
@mojavelinux mojavelinux self-assigned this Sep 26, 2014
@cfeddersen
Copy link
Author

Ok, wasn't sure because cross references are mentioned in the notable features section of the readme

@mojavelinux
Copy link
Member

Aha, I remember what it is. I think cross references to sections works, but not to custom anchor points. The reason is, we add an anchor for sections when producing the toc and outline. However, I haven't yet implemented the logic to insert an inline anchor.

@ghost
Copy link

ghost commented Nov 21, 2014

But the example above is trying to link to a (non-custom) section, is it not? I'm having the same issue: cross references to sections appear as links but do not function in converted pdfs. Is it really the case that cross references to sections works, and if so - what is the required preamble and "code" for the .adoc?

PS. Great project you've got going here!

@mojavelinux
Copy link
Member

@NewtSalamander I have to dig into the code again to figure out where we stand. When I fix it, I'll be sure to implement it fully.

@plaindocs
Copy link

I just ran into this also using

Asciidoctor 1.5.2 [http://asciidoctor.org]
Runtime Environment (ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII)

So here is a +1 for a fix. ;-)

@plaindocs
Copy link

In fact, linking to section IDs does not work for me either.

@rlopez133
Copy link

The David Gamba's quick fix works for the most part except it doesn't work if you make a cross reference to a table. The link to the table shows but when you click it, it doesn't work.

@mojavelinux
Copy link
Member

We'll need to implement the same anchor logic for blocks as we are currently doing for sections. Then, with the fix by @DavidGamba, all the xrefs should start working. Definitely a top priority item to get addressed as soon as I get into Asciidoctor PDF work again (soonish).

@mojavelinux
Copy link
Member

In fact, linking to section IDs does not work for me either.

David's patch made me realize that we are using the wrong attribute to get the xref target. We have to use a combination of what we use for the DocBook and HTML5 backend to get what we want. I'll submit a patch shortly.

@mojavelinux
Copy link
Member

I'd like to scope this issue to xrefs to sections and deal with the xrefs to arbitrary blocks in a separate issue.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue May 11, 2015
- retrieve the anchor name from the fragment attribute
- handle inter-document xrefs by consulting the path attribute
- honor the reftext of the destination
- warn if an xref cannot be resolved
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue May 11, 2015
- retrieve the anchor name from the fragment attribute
- handle inter-document xrefs by consulting the path attribute
- honor the reftext of the destination
- warn if an xref cannot be resolved
- don't inherit when resolving attributes on anchor node
mojavelinux added a commit that referenced this issue May 11, 2015
resolves #56 fix xref to sections
@mojavelinux
Copy link
Member

I believe this is now fixed (for sections). Please check using git master. Feel free to reopen if there are still issues.

@saleemjaffer
Copy link

I am still facing some issues with this. #809

@gueggel
Copy link

gueggel commented Jun 6, 2018

Same issue here...

Asciidoctor 1.5.7.1 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]) (lc:CP850 fs:Windows-1252 in:CP850 ex:CP850)

@mojavelinux
Copy link
Member

This issue has already been resolved. Therefore, if you feel that you have found a case that it doesn't cover, you'll need to provide the details in a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants