On 2012-08-28, Boris Kheyfets wrote:

> [-- Type: text/plain, Encoding: quoted-printable --]

> Doesn't work:

> rst file:

> .. code:: python
>    :class: nowrap 

>    for i in range(5): test test test test test test test test test test 
> test test test test

> css file:
> I tried:

> pre.nowrap {
>         white-space: nowrap;
> }

> div.nowrap {
>         white-space: nowrap;
> }

> span.nowrap {
>         white-space: nowrap;
> }

> none wraps the code.

If you have "nowrap" in the class argument and CSS rule, this is to be
expected... This only makes sense, if the default CSS rule for code wraps!

The point is that you should be able to distinguish between a default case
(without class argument) and a "classified" case.

Next, look in the generated HTML what elements and classes are generated
from your examples and write rules to style them. 

(In my experiments, I often temporarily add a "background: green;" or
similar line to CSS rules, so that I can see which elements are matched
by the rule.)

Hope this gets you going,

Günter





> On Monday, August 27, 2012 5:31:40 PM UTC+4, Guenter Milde wrote:

>> On 2012-08-27, Boris Kheyfets wrote: 

>> > [-- Type: text/plain, Encoding:  --] 

>> > I wont to cite code word-wraped in code-block. I can turn on the line 
>> > numbers to preserve the integrity. This can be done by adding 

>> >     white-space: pre-wrap; 

>> > to pre in css. 

>> > However sometimes I cite csv files -- and I don't want them to wrapped. 

>> > It would be nice to have :nowrap: and :pre-wrap: options of code block. 

>> > Do You think I can currently emulate this option -- that is to have pre 
>> > wrapped at one parts of rst file, and no-wraped in other parts? (while 
>> both 
>> > in code-block) 

>> You can always add a class argument, either via:: 

>>    .. code::  <language> 
>>       :class: wrapped 

>>       code that wraps in language <language> 

>> The "class" directive option can also be given to the "include" directive 
>> (e.g. for included cvs files):: 

>>    .. include myfile.cvs 
>>       :code: text 
>>       :class: nowrap 

>> A literal block, can be preceded with a "class" directive:: 

>>    Now some literal block: 

>>    .. class:: wrapped 

>>    :: 

>>       literal block with the "wrapped" class 

>> See http://docutils.sourceforge.net/docs/ref/rst/directives.htmlespecially 
>> http://docutils.sourceforge.net/docs/ref/rst/directives.html#class 
>> for details. 

>> I'd style the default to use the more often required wrapping mode and 
>> use either "wrap" or "nowrap" class argument (with another rule in the 
>> custom CSS sheet) for the exceptions. 

>> Günter

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to