Smart quotes and variable declaration.

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

Smart quotes and variable declaration.

Jeremie Bresson
Given this example:

[source,asciidoc]
----
:myvar: this "`is`" a variable

Some text to test "`double quoted`" test.

And {myvar} as second test.
---

I expect to get smart quote in both cases, but this doesn’t seems to work.

I got:

[source,txt]
----
Some text to test “double quoted” test.
And this "`is`" a variable as second test.
----

When I expect:

[source,txt]
----
Some text to test “double quoted” test.
And this “is” a variable as second test.
----

Reply | Threaded
Open this post in threaded view
|

Re: Smart quotes and variable declaration.

mojavelinux
Administrator
Jeremie,

The behavior you are seeing happens because of the order of normal substitutions. The inline formatting substitution (named "quotes") occurs before the attributes substitution. As a result, the inline formatting has already been applied by the time the attribute value is replaced.

One way to solve the problem is to force the substitutions to occur preemptively when the attribute value is saved. This can be accomplished using the inline pass macro around the attribute value:

----
:myvar: pass:q[this "`is`" a variable]
----

This is documented in the user manual here:


(There may be a better place for it and certainly it would help if it appeared in the TOC. If you have ideas, I'd love to hear them).

Another solution is to simply use smart quotes in the value. Once you learn to type them, it's actually quite a bit easier IMO.

----
:myvar: this “is” a variable
----

Cheers,

-Dan

On Wed, Apr 22, 2015 at 7:58 AM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Given this example:

[source,asciidoc]
----
:myvar: this "`is`" a variable

Some text to test "`double quoted`" test.

And {myvar} as second test.
---

I expect to get smart quote in both cases, but this doesn’t seems to work.

I got:

[source,txt]
----
Some text to test “double quoted” test.
And this "`is`" a variable as second test.
----

When I expect:

[source,txt]
----
Some text to test “double quoted” test.
And this “is” a variable as second test.
----




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Smart-quotes-and-variable-declaration-tp3015.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--