:nowrap: gets to div while in order to work -- it should get to pre:

<div class="code python nowrap highlight-python"><pre>for i in range(5): test 
test test test test test test test test test test test test test test test test 
test test test test test test test test test test test</pre></div>

rst:

.. code:: python
   :class: nowrap 

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

Actually I solved the problem using post-processing: I have code wraped by 
default, and I add html comments to mark the to be wrapped regions:

.. raw:: html

   <!-- nowrap -->

.. code-block:: python

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

.. raw:: html

   <!-- /nowrap -->

then I use the build script:

make html

if $noWrap; then
    if ! [ -e "sphinx_nowrap.el" ]; then
        cp `dirname $0`/sphinx_nowrap.el .
    fi
    find ./_build/html -type f -name '*.html' | while read myFile; do
        MyFile=`readlink -f "$myFile"`
        perl -ne "s!setq myFile .+!setq myFile \"$MyFile\")!" 
sphinx_nowrap.el
        emacs --no-site-file --no-init-file --batch -script sphinx_nowrap.el
    done
fi

(only part of the script is shown)

it all works, and works with a single command, but I thought it might be 
possible -- just to add the :nowrap: class. Actually code-block don't 
accept classes at all, so a better solution currently might not be possible 
at all.


On Thursday, August 30, 2012 3:36:29 PM UTC+4, Guenter Milde wrote:
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/3dwXhT-BpggJ.
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