Implementing attrs directive

21 views
Skip to first unread message

Cédric Krier

unread,
Sep 4, 2014, 5:31:31 AM9/4/14
to relatorio
Hi,

To solve the colspan issue when looping on column, I plan to implement
the attrs[1] directive from Genshi.

I'm thinking about this syntax:


attrs table:table-cell="{'table:number-columns-spanned': len(loop)}"

which will means:

- find the first parent tag named: 'table:table-cell'
- set as attribute: py:attrs="{…}"

In the same idea, we we could implement: content, replace and strip.

Questions:

- should the first part be a xpath expression like:

attrs ../../table:table-cell="…"

or the generic version:

attrs .::ancestor-or-self/table:table-cell="…¨

the xpath usage will be more expensif than a simple parent
searching.

- should we instead use a dedicated directive to update span of
table-cell like:

span=len(loop)

[1] http://genshi.edgewall.org/wiki/Documentation/0.6.x/xml-templates.html#id6
--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Cédric Krier

unread,
Sep 4, 2014, 9:36:41 AM9/4/14
to relatorio
On 04 Sep 11:31, Cédric Krier wrote:
> Hi,
>
> To solve the colspan issue when looping on column, I plan to implement
> the attrs[1] directive from Genshi.
>
> I'm thinking about this syntax:
>
>
> attrs table:table-cell="{'table:number-columns-spanned': len(loop)}"
>
> which will means:
>
> - find the first parent tag named: 'table:table-cell'
> - set as attribute: py:attrs="{…}"
>
> In the same idea, we we could implement: content, replace and strip.

Here is the review: http://codereview.appspot.com/134430043
and the issue with the odt example:
https://code.google.com/p/python-relatorio/issues/detail?id=5

Cédric Krier

unread,
Sep 21, 2014, 10:09:43 AM9/21/14
to relatorio
On 04 Sep 15:36, Cédric Krier wrote:
> On 04 Sep 11:31, Cédric Krier wrote:
> > Hi,
> >
> > To solve the colspan issue when looping on column, I plan to implement
> > the attrs[1] directive from Genshi.
> >
> > I'm thinking about this syntax:
> >
> >
> > attrs table:table-cell="{'table:number-columns-spanned': len(loop)}"
> >
> > which will means:
> >
> > - find the first parent tag named: 'table:table-cell'
> > - set as attribute: py:attrs="{…}"
> >
> > In the same idea, we we could implement: content, replace and strip.
>
> Here is the review: http://codereview.appspot.com/134430043
> and the issue with the odt example:
> https://code.google.com/p/python-relatorio/issues/detail?id=5

I will be very glade to get feedback on this new feature.
It it important to get the right API to prevent non-backward compatible
change in the future.
Reply all
Reply to author
Forward
0 new messages