Itamar O skrev 25. mai 2010 21:16:
On Tue, May 25, 2010 at 7:09 PM, Eirik Schwenke
<[email protected]>wrote:

Itamar O skrev 19. mai 2010 17:36:
(...)


 In case this is not clear enough, let me explain exactly what I'm trying
to do:
The TocMacro creates a div with class="wiki-toc", that has "floating:
right;"
This is OK for pages that are left-to-right, but I would also like to
use the TocMacro for right-to-left pages, and for such pages I would
like the rendered div to have "float: left;"
Since I'm using {{{ #!div dir=rtl ... }}} as a top-most container for

That is, the top div has dir set to rtl ? Would it be possible to add a
class "rtl", like so: class="your,other,classes,and,rtl" to the css?


 content of right-to-left pages, my idea is to patch TocMacro so it
looks for the first containing element that defines the direction and
sets the floating values according to that element.

and then:

.rtl div#toc {
 float: right:
}

or something similar? I'm don't have the time to check now, if you could
use some really black-magic css3 selectors to select based on rtl, but as
far as I gather adding a simple class to the body/top div of rtl-pages
should work too?

There's apparently no "float: default-start-read-margin" or something for
css, or even a way to interpret left and right according to the text
direction.

But this *shouldn't* be that hard as long as you're able to mark text as
rtl somehow (and you have to, to get rtl in the first place, don't you?).

Best regards,

--
 .---.  Eirik Schwenke <[email protected]>
( NSD ) Harald Hårfagresgate 29            Rom 150
 '---'  N-5007 Bergen            tlf: (555) 889 13

 GPG-key at pgp.mit.edu  Id 0x8AA3392C


That's an interesting concept.
My knowledge in the ways of css and html styling is close-to-nothing,
so I didn't even think of the options you mention.
I'll look into it some time soon, hopefully.

Thanks,
Itamar O.


I didn't quite have the time to look this up yesterday, but depending on your userbase (and installed browsers) using css3 attribute selectors might work:

  http://www.w3.org/TR/css3-selectors/#attribute-selectors

Try this:

{{{
<html>
<body dir="rtl">
<style type="text/css">
.menu
{
    border: 1px solid black;
    float: left; /* or right?*/
    display: block;
}
span[dir="ltr"] > .menu
{
  float: right;
  border: 1px dashed red;
}
</style>
<!-- emulate local change of direction -->
<span dir="ltr">
<div class="menu">
<h1>Left to right:</h1>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
</div>
</span>

<div class="menu">
<h1>Right to left:</h1>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
</div>

</body>
</html>
}}}

Appears to work for me in firefox 3.5(?). I even think it does what I want it to do ;-) I also checked, wrapping the second div in a span, with explicit dir=rtl, and it still appears to work.


Best regards,

--
 .---.  Eirik Schwenke <[email protected]>
( NSD ) Harald Hårfagresgate 29            Rom 150
 '---'  N-5007 Bergen            tlf: (555) 889 13

  GPG-key at pgp.mit.edu  Id 0x8AA3392C

--
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to