Login  Register

Re: Link versus XRef

Posted by Eric Bottard on Jun 11, 2013; 8:06am
URL: https://discuss.asciidoctor.org/Re-Link-versus-XRef-tp327p333.html

Hi, working with Gunnar on the very same issue.

The problem is even more complicated and I guess has been encountered by many, but I did not find a solution for it.
The thing is, we use several asciidoc documents included together to generate a full guide.

So basically, what we'd need is some macro that behaves like a link: when documents are separated, and like an xref (<<anchor>>) when they've been concatenated together.

At first, I thought about redefining the link: macro for the html and docbook backend to capture the anchor part (in link:document#anchor[Label]) together with the template for it (to render eg. Label in the html backend) but sadly, macro definitions don't seem to work in our toolchain (gradle plugin).

I'm curious, what is the usual solution to this, as I'm sure people have encountered that?

PS: One other option, and I guess I'll try that now, would be to rewrite links at the source level (ie. sed equivalent) before processing with asciidoctor.