Workaround required (using ++ in link:)

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

Workaround required (using ++ in link:)

maartenvandewaarsenburg
This post was updated on .
In some places I generate Asciidoc files out of miscellaneous data.

From the following generated Asciidoc link, Ascidoctor generates an HTML paragraph in stead of an HTML anchor.

Asciidoc link: "link:/Support/Tutorials/Code_Integration_Tutorial/Using_Dezyne_in_your_C++_environment.html[Using Dezyne in your C++ environment]"

HTML text: "link:/Support/Tutorials/Code_Integration_Tutorial/Using_Dezyne_in_your_C_environment.html[Using Dezyne in your C environment]"

As you can see, Asciidoctor interpretes the plusses in the URL as well as in the link text.

How do I need to format the Asciidoc link to get the correct HTML anchor tag? I can manipulate the URL differently from the link text.

For your information; I use Asciidoctor 1.5.5 on Ubuntu 18.04.
Reply | Threaded
Open this post in threaded view
|

Re: Workaround required (using link:)

abelsromero
Not sure this is the most appropriate solution, but this is the only that worked for me.

Using the passthrough instead of + notation like this:

link:pass:[/Support/Tutorials/Code_Integration_Tutorial/Using_Dezyne_in_your_C++_environment.html][pass:[Using Dezyne in your C++ environment]]
Reply | Threaded
Open this post in threaded view
|

Re: Workaround required (using link:)

maartenvandewaarsenburg
Perfect!
Reply | Threaded
Open this post in threaded view
|

Re: Workaround required (using link:)

mojavelinux
Administrator
In reply to this post by maartenvandewaarsenburg
++ is a reserved character sequence in AsciiDoc (and a very strong one). The solution is to an attribute reference.

Since C++ is such a common term in tech, there's a built-in attribute for it named cpp.

link:/Support/Tutorials/Code_Integration_Tutorial/Using_Dezyne_in_your_{cpp}_environment.html[Using Dezyne in your {cpp} environment]

The reason this works is because attribute substitutions happen after ++ is interpreted. For other strategies, see https://asciidoctor.org/docs/user-manual/#complex-urls

If you're writing about some other ++ language, such as SQL++, then what I recommend is defining ++ as the attribute pp.

:pp: ++

Now I can write about SQL{pp}.

(we might consider just making this a built-in attribute).

-Dan

On Mon, May 28, 2018 at 2:08 AM, maartenvandewaarsenburg [via Asciidoctor :: Discussion] <[hidden email]> wrote:
In some places I generate Asciidoc files out of miscellaneous data.

From the following generated Asciidoc link, Ascidoctor generates an HTML paragraph in stead of an HTML anchor.

Asciidoc link: "link:/Support/Tutorials/Code_Integration_Tutorial/Using_Dezyne_in_your_C++_environment.html[Using Dezyne in your C++ environment]"

HTML text: "link:/Support/Tutorials/Code_Integration_Tutorial/Using_Dezyne_in_your_C_environment.html[Using Dezyne in your C environment]"

As you can see, Asciidoctor interpretes the plusses in the URL as well as in the link text.

How do I need to format the Asciidoc link to get the correct HTML anchor tag? I can manipulate the URL differently from the link text.

For your information; I use Asciidoctor 1.5.5 on Ubuntu 18.04.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Workaround-required-using-link-tp6354.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
Reply | Threaded
Open this post in threaded view
|

Re: Workaround required (using link:)

maartenvandewaarsenburg
@mojavelinux (Dan):
That's a very valuable remark you make. And I will certainly use it in handwritten Asciidoc.

But as, in this case, the Asciidoc is generated from data I have to deal with, I'll use abelsromero's suggestion.

Do you agree or can I get into trouble?
Reply | Threaded
Open this post in threaded view
|

Re: Workaround required (using link:)

mojavelinux
Administrator
For generated content, the pass macro is a very handy tool. You can't go wrong.

-Dan

On Mon, May 28, 2018 at 3:37 AM, maartenvandewaarsenburg [via Asciidoctor :: Discussion] <[hidden email]> wrote:
@mojavelinux (Dan):
That's a very valuable remark you make. And I will certainly use it in handwritten Asciidoc.

But as, in this case, the Asciidoc is generated from data I have to deal with, I'll use abelsromero's suggestion.

Do you agree or can I get into trouble?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Workaround-required-using-link-tp6354p6359.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