Btw, I think this would be good additional info to add to FAQ #55.

http://asciidoc.org/faq.html#_how_can_i_format_text_inside_a_listing_block

-Dan

On Sat, Mar 9, 2013 at 8:11 PM, Dan Allen <[email protected]> wrote:

> When you set the subs options explicitly, it no longer executes the
> standard set of substitutions. Thus, <module> is not being escaped as it
> normally would since the only subs you have enabled are quotes. That can be
> solved by adding the specialcharacters substitutions in the subs option.
>
> [subs="specialcharacters,quotes"]
>
> In your case, you want some quotes, but not all of them. You can get more
> fine-grained quoting using the inline pass macro. First, enable macros:
>
> [subs="specialcharacters,macros"]
>
> Then wrap the text you want quoted in pass:quotes[].
>
> Here's the result:
>
> [subs="specialcharacters,macros"]
> ----
> $ pass:quotes[*python functional_tests.py*]
> Traceback (most recent call last):
>   File "functional_tests.py", line 4, in <module>
>     assert 'Django' in browser.title
> AssertionError
> ----
>
> That should give you the output you want.
>
> Another approach to the problem is to separate the text that the user
> enters from the output. Then, you can style the text using css (via a role)
>
> [role="user-input"]
> ----
> $ python functional_tests.py
> ----
>
> ...
> Traceback (most recent call last):
>   File "functional_tests.py", line 4, in <module>
>     assert 'Django' in browser.title
> AssertionError
> ...
>
> I always prefer to use the literal block for console output.
>
> Hope that helps!
>
> Cheers,
>
> -Dan
>
>
> On Sat, Mar 9, 2013 at 4:05 PM, Harry Percival 
> <[email protected]>wrote:
>
>> I'm trying to add bold to some listings, to show commands the user has
>> to type in, eg:
>>
>> [subs="quotes"]
>> ----
>> $ *python functional_tests.py*
>> Traceback (most recent call last):
>>   File "functional_tests.py", line 4, in <module>
>>     assert 'Django' in browser.title
>> AssertionError
>> ----
>>
>> That works up to a point, except that [subs="quotes"], although it
>> nicely makes my "python functional_tests.py" bold, unfortunately
>> breaks the <module> (because it now thinks it's an XML element of some
>> kind), and it puts my 'Django' into italics.
>>
>> Is there any way of telling asciidoc something like
>> [subs="asterisks"], so that it only applies the bold, and doesn't mess
>> with anything else?  Alternatively, is there an alternative way of
>> achieving my objective?  I want to avoid having to escape all the
>> angle-brackets and single quotes:
>>
>> [subs="quotes"]
>> ----
>> $ *python functional_tests.py*
>> Traceback (most recent call last):
>>   File "functional_tests.py", line 4, in &lt;module&gt;
>>     assert \'Django\' in browser.title
>> AssertionError
>> ----
>>
>> is a bit heavyweight... is there a way of writing some kind of custom
>> [subs=] directive or something?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "asciidoc" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/asciidoc?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> --
> Dan Allen
> Principal Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://google.com/profiles/dan.j.allen
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
>



-- 
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://google.com/profiles/dan.j.allen
http://mojavelinux.com
http://mojavelinux.com/seaminaction

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to