On Sun, 2008-12-21 at 19:07 -0500, Doug Hellmann wrote:
> 
> On Dec 21, 2008, at 3:07 PM, Gerard Flanagan wrote:
> 
> >
> > On Sat, 2008-12-20 at 23:24 +0100, Georg Brandl wrote:
> >> As I've announced a few times in the past, I want to add proper
> >> theming support to Sphinx 0.6.
> >>
> >> I've written a proposal outlining my intended implementation, below.
> >> I'm glad about every comment and criticism.
> >>
> >> Thanks,
> >> Georg
> >>
> >>
> > [...]
> >
> > Maybe consider YUI grids css:
> >
> > http://developer.yahoo.com/yui/grids/
> 
> While theme developers could use YUI or similar libraries or  
> frameworks, I don't think Sphinx's default theme should depend on them.
> 
> Doug
> 

Any particular reason? It is BSD licensed. I like it a lot, I have to
say.

In any case, I don't know if it fits with the Sphinx theming goals, but
i wrote a small module which is good for exploring YUI grids markup if
nothing else:

http://bazaar.launchpad.net/~grflanagan/python-rattlebag/trunk/annotate/head%3A/src/yuibuilder.py

Each 'PageUnit' ( a HTML div ), has a 'content' attribute and a
speculative thought was that this could hold a template or the result of
a processed template. Just an idea. Not very designer friendly, I know.

The doctests are copied below.

All the best.

G.

>>> doc = YUIDoc(750,160,'left')
>>> print(doc)
YUIDoc: <div id="doc" class="t1">, children=2
>>> print(doc.main)
YUIBlock: <div class="yui-b">, children=0
>>> doc.main.id = 'content'
>>> print(doc.main)
YUIBlock: <div id="content" class="yui-b">, children=0
>>> print(doc.secondary)
YUIBlock: <div class="yui-b">, children=0
>>> doc.secondary.id = 'navbar'
>>> print(doc.secondary)
YUIBlock: <div id="navbar" class="yui-b">, children=0

`tostring()` method:
++++++++++++++++++++

>>> print(doc.main.tostring())
<BLANKLINE>
    <div id="content" class="yui-b">
    </div>

>>> print(doc.secondary.tostring())
<BLANKLINE>
    <div id="navbar" class="yui-b">
    </div>

>>> print(doc.tostring())
<BLANKLINE>
    <div id="doc" class="t1">
        <div id="yui-main">
            <div id="content" class="yui-b">
            </div>
        </div>
        <div id="navbar" class="yui-b">
        </div>
    </div>

Divide into columns:
++++++++++++++++++++

Only certain ratios are supported:

>>> doc.main.divide(ratio='1:4')
Traceback (most recent call last):
    ...
InvalidGridRatioError: 1:4 is not a valid ratio.
Valid ratios:
['1:1', '1:1:1', '1:2', '1:3', '2:1', '3:1']

If no ratio is specified, two equally-spaced columns are assumed (ie.
1:1)

>>> doc.main.divide()
YUIGrid: <div class="yui-g">, children=2
>>> print(doc.main.tostring())
<BLANKLINE>
    <div id="content" class="yui-b">
        <div class="yui-g">
            <div class="yui-u first">
            </div>
            <div class="yui-u">
            </div>
        </div>
    </div>

Dividing again gives four equally-spaced columns (then six, eight etc.):

>>> doc.main.divide()
YUIGrid: <div class="yui-g">, children=2
>>> print(doc.main.tostring())
<BLANKLINE>
    <div id="content" class="yui-b">
        <div class="yui-g">
            <div class="yui-g first">
                <div class="yui-u first">
                </div>
                <div class="yui-u">
                </div>
            </div>
            <div class="yui-g">
                <div class="yui-u first">
                </div>
                <div class="yui-u">
                </div>
            </div>
        </div>
    </div>

CSS Rules
+++++++++

>>> unit = YUIUnit()
>>> print(unit)
YUIUnit: <div class="yui-u">, children=0
>>> unit.css.color = 'orangered'
>>> unit.css.background_color = 'skyblue'
>>> print(sorted(list(unit.css)))
[('background-color', 'skyblue'), ('color', 'orangered')]
>>> print unit.csstostring()
<BLANKLINE>
.yui-u {
    background-color: skyblue;
    color: orangered;
}

The YUIDoc we defined above has no css rules:

>>> len(doc.csstostring()) == 0
True

Before adding some rules we divide the secondary section:

>>> navbar = doc.secondary.divide('1:1:1')
>>> navbar
YUIGrid: <div class="yui-gb">, children=3
>>> print doc.tostring()
<BLANKLINE>
    <div id="doc" class="t1">
        <div id="yui-main">
            <div id="content" class="yui-b">
                <div class="yui-g">
                    <div class="yui-g first">
                        <div class="yui-u first">
                        </div>
                        <div class="yui-u">
                        </div>
                    </div>
                    <div class="yui-g">
                        <div class="yui-u first">
                        </div>
                        <div class="yui-u">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="navbar" class="yui-b">
            <div class="yui-gb">
                <div class="yui-u first">
                </div>
                <div class="yui-u">
                </div>
                <div class="yui-u">
                </div>
            </div>
        </div>
    </div>

>>> firstcol = navbar[0]
>>> firstcol.css.border = 'solid 1px #333'
>>> firstcol.css.margin = 0
>>> print(doc.csstostring())
<BLANKLINE>
.t1 .yui-b .yui-gb .yui-u.first {
    border: solid 1px #333;
    margin: 0;
}
<BLANKLINE>

But if a unit has an id, use it:

>>> firstcol.id = 'firstcol'
>>> print(doc.csstostring())
<BLANKLINE>
#firstcol {
    border: solid 1px #333;
    margin: 0;
}
<BLANKLINE>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" 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/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to