In `int a = n++` the ++ disappears

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

In `int a = n++` the ++ disappears

denkspuren
Hi,

in a document of mine there is a sentence (in German) with some Java code in it:

"""
Erläutern Sie den Unterschied von `int a = n++;` zu `int a = ++n;`!
"""

The backticks seem to interfere with the Asciidoctor parser. In the HTML output the double plus characters disappeared.

Is there a workaround for this? I did some experiments but couldn't find a solution.

Thanks a lot!

Cheers, Dominikus
Twitter: @denkspuren
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: In `int a = n++` the ++ disappears

mojavelinux
Administrator
The backticks aren't the problem. ++ has special meaning in AsciiDoc, which means "passthrough" without constraint. If you mean to write a literal ++, you should almost always use a reference to the built-in attribute plus (i.e., {plus}).

Erläutern Sie den Unterschied von `int a = n{plus}{plus};` zu `int a = {plus}{plus}n;`! 

To make this simpler, you can define the attribute "pp" to mean ++.

:pp: ++

Erläutern Sie den Unterschied von `int a = n{pp};` zu `int a = {pp}n;`!

Alternatively, it's possible to escape the ++ using backslashes, but escaping in AsciiDoc is context-sensitive and thus much trickier to get right. I recommend using the attribute reference instead.

-Dan



On Wed, Mar 15, 2017 at 8:27 AM, denkspuren [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

in a document of mine there is a sentence (in German) with some Java code in it:

"""
Erläutern Sie den Unterschied von `int a = n++;` zu `int a = ++n;`!
"""

The backticks seem to interfere with the Asciidoctor parser. In the HTML output the double plus characters disappeared.

Is there a workaround for this? I did some experiments but couldn't find a solution.

Thanks a lot!

Cheers, Dominikus


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/In-int-a-n-the-disappears-tp5385.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
|  
Report Content as Inappropriate

Re: In `int a = n++` the ++ disappears

mojavelinux
Administrator
In reply to this post by denkspuren
Your message made me realize that the converter is introducing stray characters when handling an escaped uncontrained passthrough. The following should work, but won't until 1.5.6 is released.

Erläutern Sie den Unterschied von `int a = n\++;` zu `int a = ++n;`! 

-Dan

On Wed, Mar 15, 2017 at 2:54 PM, Dan Allen <[hidden email]> wrote:
The backticks aren't the problem. ++ has special meaning in AsciiDoc, which means "passthrough" without constraint. If you mean to write a literal ++, you should almost always use a reference to the built-in attribute plus (i.e., {plus}).

Erläutern Sie den Unterschied von `int a = n{plus}{plus};` zu `int a = {plus}{plus}n;`! 

To make this simpler, you can define the attribute "pp" to mean ++.

:pp: ++

Erläutern Sie den Unterschied von `int a = n{pp};` zu `int a = {pp}n;`!

Alternatively, it's possible to escape the ++ using backslashes, but escaping in AsciiDoc is context-sensitive and thus much trickier to get right. I recommend using the attribute reference instead.

-Dan



On Wed, Mar 15, 2017 at 8:27 AM, denkspuren [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

in a document of mine there is a sentence (in German) with some Java code in it:

"""
Erläutern Sie den Unterschied von `int a = n++;` zu `int a = ++n;`!
"""

The backticks seem to interfere with the Asciidoctor parser. In the HTML output the double plus characters disappeared.

Is there a workaround for this? I did some experiments but couldn't find a solution.

Thanks a lot!

Cheers, Dominikus


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/In-int-a-n-the-disappears-tp5385.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



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: In `int a = n++` the ++ disappears

denkspuren
In reply to this post by mojavelinux
Thanks a lot for the workaround, Dan!

I tried escaping ++ with a backslash but that didn't work either. As you mentioned in your follow-up email, you are going to change that. Thx! Your workaround is a great fix for the time being.

BTW, I'm using asciidoctor almost daily. It's a really great tool I love working with!

/Dominikus
Twitter: @denkspuren
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: In `int a = n++` the ++ disappears

mojavelinux
Administrator
Great to here you got it working!

I tried escaping ++ with a backslash but that didn't work either. As you mentioned in your follow-up email, you are going to change that. Thx!

Yep, fixed in master.
 

BTW, I'm using asciidoctor almost daily. It's a really great tool I love working with!

Thanks for the praise! I really enjoy hearing these stories from users. It's what keeps me motivated to make progress every day!

Cheers,

-Dan


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Loading...