Line wrapping in source block - bug?

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

Line wrapping in source block - bug?

torngat
I've run into something that might be a bug.  The following code generates a source listing with line wrapping off and a horizontal scroll bar appears as expected:

[source,bash,options="nowrap"]
----
$ curl http://localhost:8080/my/rather/long/url/bb283468-7db4-4754-8908-8bcbe0ebfe63 -i -H "Accept: */*" -H "User-Agent: Apache-HttpClient/4.3.6 (java 1.5)" -H "Host: localhost:8080" -H "Proxy-Connection: Keep-Alive"
----

However, if this same code is in an external file that I include using this:

include::{generated}/logs/curl-request.adoc[]

Everything is rendered exactly the same except the wrap.  The "nowrap" style is not applied on the <pre> element and the source code is wrapped with no scrollbar.

As an aside, I didn't see any way to style a source listing so that it doesn't take too much space and a vertical scrollbar is displayed in case of overflow.  Would it be an easy enhancement?

Thanks,

Sebastien
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in source block - bug?

mojavelinux
Administrator


On Wed, Jun 3, 2015 at 1:09 PM, torngat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
If this same code is in an external file that I include using this:

include::{generated}/logs/curl-request.adoc[]

Everything is rendered exactly the same except the wrap.  The "nowrap" style is not applied on the <pre> element and the source code is wrapped with no scrollbar.

Something else has to be going on here. I can't think of any way that the include would mess with the nowrap option on a block. Test case? (i.e., sample project)
 

As an aside, I didn't see any way to style a source listing so that it doesn't take too much space and a vertical scrollbar is displayed in case of overflow.  Would it be an easy enhancement?

My recommendation here is to add a role to your listing block:

[source.short]
----
long
source
code
block
here
...
----

Then add some CSS via docinfo to the output so that it fixes the height. This is really a theme issue, IMO.

Cheers,

-Dan

--