callout in bash source code with line continuation

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

callout in bash source code with line continuation

gclaybur
If I create documentation like this:

[source,bash]
----
ls \
-lrt
----

asciidoctor will render html that can be copied and pasted into a bash shell.  It executes without errors.   Is there a way to add a callout for line 1 without causing errors when copied and pasted into a bash shell?  I have tried this:

[source,bash]
----
ls \ <1>
-lrt
----
<1> this is line 1

The issue it seems is that the callout mechanism requires a space to be added at the end of line 1 of the bash script in order for the <1> to be recognized.  The bash backslash character is intended to escape the newline and not the space character.  Is there a way to prevent the rendered html to exclude the literal space in line 1, for example?

Reply | Threaded
Open this post in threaded view
|

Re: callout in bash source code with line continuation

mojavelinux
Administrator
To my knowledge, there doesn't seem to be a way to add a callout without breaking the raw source. I was going to suggest using a trailing line comment, but that seems to break the behavior of bash as well.

You're probably going to need the feature where we define callout lines from the block attributes. See https://github.com/asciidoctor/asciidoctor/issues/598

Cheers,

-Dan

On Wed, Mar 22, 2017 at 12:15 PM, gclaybur [via Asciidoctor :: Discussion] <[hidden email]> wrote:
If I create documentation like this:

[source,bash]
----
ls \
-lrt
----

asciidoctor will render the html that an be copied and pasted into a bash shell.  It executes without errors.   Is there a way to add a callout for line 1 without causing errors when copied and pasted into a bash shell?  I have tried this:

[source,bash]
----
ls \ <1>
-lrt
----
<1> this is line 1

The issue it seems is that the callout mechanism requires a space to be added at the end of line 1 of the bash script in order for the <1> to be recognized.  The bash backslash character is intended to escape the newline and not the space character.  Is there a way to prevent the rendered html to exclude the literal space in line 1, for example?




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/callout-in-bash-source-code-with-line-continuation-tp5409.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: callout in bash source code with line continuation

gclaybur
Thanks for the quick response, Dan.  Great project here!  I'll track the github issue.