Quantcast

macro: URL parameter, problem with single quote

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

macro: URL parameter, problem with single quote

Jeremie Bresson
I am doing some testing with a small asciidoctorj macro: asciidoctorj-gh-edit 
(API Change based on the feedback I got from Dan in the other thread on the mailing is work in progress).

For the example, I am using Version 2.0.1 of the plugin inside a Maven build.

Now consider this example:

=== Example 1

The article is open-source: gh:view[repository="asciidoctor/asciidoctor.org", path="news/debuter-avec-asciidoctor.adoc", server="https://www.github.com/"].

=== Example 2

The article is open-source: gh:view[repository='asciidoctor/asciidoctor.org', path='news/debuter-avec-asciidoctor.adoc', server='https://www.github.com/'].

The first example is correctly rendered. The second one (single quote instead of double quote) is not.

The output I got:
<h3 id="example-1"><a class="anchor" href="#example-1"></a>Example 1</h3>
<div class="paragraph">
<p>The article is open-source: <a href="https://www.github.com/asciidoctor/asciidoctor.org/blob/master/news/debuter-avec-asciidoctor.adoc">view on GitHub</a>.</p>
</div>
</div>
<div class="sect2">
<h3 id="example-2"><a class="anchor" href="#example-2"></a>Example 2</h3>
<div class="paragraph">
<p>The article is open-source: <a href="<a href=" https:="" www.github.com="" "="" class="bare"></a><a href="https://www.github.com/" class="bare">https://www.github.com/</a>/asciidoctor/asciidoctor.org/blob/master/news/debuter-avec-asciidoctor.adoc"&gt;view on GitHub.</p>

Putting an URL as single-quoted parameter does not seems to be supported by Asciidoctor.

Is this a known issue?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: macro: URL parameter, problem with single quote

mojavelinux
Administrator
Jérémie,

I believe the problem you are encountering is that double quotes and single quotes around attributes are not the same in AsciiDoc. Single quotes around an attribute (in most places) enables interpolation (aka substitutions). What's happening is that the URL is being converted to a link before it gets to your macro.

Generally, it is bad practice to use single quotes around attributes unless your intention is to enable substitutions. I'm pretty sure in this case that is not the intention, so you'd want to stick to double quotes.

Cheers,

-Dan

On Tue, Jun 14, 2016 at 8:56 AM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I am doing some testing with a small asciidoctorj macro: asciidoctorj-gh-edit 
(API Change based on the feedback I got from Dan in the other thread on the mailing is work in progress).

For the example, I am using Version 2.0.1 of the plugin inside a Maven build.

Now consider this example:

=== Example 1

The article is open-source: gh:view[repository="asciidoctor/asciidoctor.org", path="news/debuter-avec-asciidoctor.adoc", server="https://www.github.com/"].

=== Example 2

The article is open-source: gh:view[repository='asciidoctor/asciidoctor.org', path='news/debuter-avec-asciidoctor.adoc', server='https://www.github.com/'].

The first example is correctly rendered. The second one (single quote instead of double quote) is not.

The output I got:
<h3 id="example-1"><a class="anchor" href="#example-1"></a>Example 1</h3>
<div class="paragraph">
<p>The article is open-source: <a href="https://www.github.com/asciidoctor/asciidoctor.org/blob/master/news/debuter-avec-asciidoctor.adoc">view on GitHub</a>.</p>
</div>
</div>
<div class="sect2">
<h3 id="example-2"><a class="anchor" href="#example-2"></a>Example 2</h3>
<div class="paragraph">
<p>The article is open-source: <a href="<a href=" https:="" www.github.com="" "="" class="bare"></a><a href="https://www.github.com/" class="bare">https://www.github.com/</a>/asciidoctor/asciidoctor.org/blob/master/news/debuter-avec-asciidoctor.adoc"&gt;view on GitHub.</p>

Putting an URL as single-quoted parameter does not seems to be supported by Asciidoctor.

Is this a known issue?



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/macro-URL-parameter-problem-with-single-quote-tp4776.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
Loading...