Paragraph label breaks cross reference label in paragraph title

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

Paragraph label breaks cross reference label in paragraph title

jtkorb
See Test Document below.

With the "[[figurelabel]]" as shown, asciidoctor -v generates a warning message
("asciidoctor: WARNING: invalid reference: OtherLabel") and the rendered
text for <<OtherLabel>> in the title is "[OtherLabel]".  If I remove the
"[[figurelabel]]" line, then no warning is generated and the text renders
(correctly) as "Other Item".  (In both case, the underlying link is correct.)

Am I doing something wrong, or is there a workaround for this problem?  I tried moving the label to
other places (e.g., at the end of the title), but nothing I found worked.

= Test Document

This text refers to <<OtherLabel>> as does the title text below.

[[figurelabel]]
.Explanation of something that refers to <<OtherLabel>>.
Just plain text.

[[OtherLabel, Other Item]]
Here is an other item.
Reply | Threaded
Open this post in threaded view
|

Re: Paragraph label breaks cross reference label in paragraph title

TheElderCat
I'm no expert and still learning about AsciidDoctor, but I suspect the problem lies in the order in which your refs appear.
I think maybe when the adoc is parsed, AsciiDoctor comes across your <<OtherLabel>> tag and expects the [[OtherLabel, Other Item]] tag to which it refers to appear next. But actually it comes across the [[figurelabel]] tag instead.

It works correctly, when you swap the order in which they appear.

= Test Document

== Original version

This text refers to <<OtherLabel>> as does the title text below.

[[figurelabel]]
.Explanation of something that refers to <<OtherLabel>>.
Just plain text.

[[OtherLabel, Other Item]]
Here is an other item.


== Order in which they appear is swapped

This text refers to <<OtherLabel>> as does the title text below.

[[OtherLabel, Other Item]]
Here is an other item.

[[figurelabel]]
.Explanation of something that refers to <<OtherLabel>>.
Just plain text.

Reply | Threaded
Open this post in threaded view
|

Re: Paragraph label breaks cross reference label in paragraph title

jtkorb
Thanks for your response.  I still don't understand why this doesn't work (forward references in captions), but, for now, we have rewritten the text to remove them.
Reply | Threaded
Open this post in threaded view
|

Re: Paragraph label breaks cross reference label in paragraph title

mojavelinux
Administrator
The issue here is the block title. Both block and section titles are converted eagerly. That conversion can happen before the document is converted, and often before it's fully parsed. Since the target of <<OtherLabel>> comes after the reference to it in the block title, Asciidoctor can't validate that it exists. But that's also why the warning is hidden behind the -v flag, because in this case it's a false positive.


Cheers,

-Dan

On Mon, Aug 13, 2018 at 3:04 PM jtkorb [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks for your response.  I still don't understand why this doesn't work (forward references in captions), but, for now, we have rewritten the text to remove them.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Paragraph-label-breaks-cross-reference-label-in-paragraph-title-tp6414p6444.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux