Re: Link versus XRef
Posted by
mojavelinux on
Jun 10, 2013; 11:09pm
URL: https://discuss.asciidoctor.org/Re-Link-versus-XRef-tp327p328.html
This is use case that can be satisfied once GitHub upgrades to Asciidoctor 0.1.3. The reason we can't solve it now is because Asciidoctor 0.1.0 (currently on GitHub) didn't have enough tools to be able do the solution.
So here's the solution:
In the header, you define an attribute for the extension of relative documents, guarded by the environment in which the document is being viewed. Something like:
ifdef::host-github[:ext-relative: .asciidoc]
ifndef::host-github[:ext-relative: {outfilesuffix}]
(outfilesuffix is set automatically based on the backend in use).
Then you create your relative links like:
* index{ext-relative}
* Creating-a-Source-Module{ext-relative}
I'm really itching to be able to use this setup because we need it for the
asciidoctor.org site as well. I'll add this to the wiki as a tip, but it's not available for use just yet.
Btw, there are other ways to check for the host environment...but again, you can't do those types of conditionals until Asciidoctor is upgraded on GitHub.
-Dan