Skip to content

Commit

Permalink
Added href and destination to table cells.
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Dec 20, 2012
1 parent 5e468da commit 306bbf1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ CHANGES
- Implemented ``plugInGraphic`` which allows inserting graphics rendered in
Python.

- Added `href` and `destination` to table cells.

- Bug: Due to a logic error, bad directives were never properly detected and
logged about.

Expand Down
9 changes: 5 additions & 4 deletions RML-DIFFERENCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Incompatibilies
- ``<keepTogether>``: This directive is not implemented in RML2PDF, but there
exists an API flowable for it and it seems obviously useful.

- ``catchForms``: This feature requires PageCatcher, which is a ReportLab
commercial product and there is no Open Source alternative.


To be Done
----------

Expand Down Expand Up @@ -64,8 +68,6 @@ naming.

- includePdfPages

- plugInGraphic (Test 037)

- figure

- imageFigure
Expand All @@ -81,7 +83,6 @@ naming.

- form

- catchForms

- lineMode: -miterLimit

Expand Down Expand Up @@ -135,6 +136,6 @@ naming.

- -pdfInclude

- rectangle, table row, table cell, etc.: href and/or destination (Test 038)
- rectangle.: href and/or destination (Test 038)

- -addMapping
14 changes: 14 additions & 0 deletions src/z3c/rml/flowable.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,18 @@ class ITableCell(interfaces.IRMLDirectiveSignature):
description=u'The space of the line right of the cell.',
required=False)

href = attr.Text(
title=u'Link URL',
description=u'When specified, the cell becomes a link to that URL.',
required=False)

destination = attr.Text(
title=u'Link Destination',
description=(u'When specified, the cell becomes a link to that '
u'destination.'),
required=False)


class TableCell(directive.RMLDirective):
signature = ITableCell
styleAttributesMapping = (
Expand All @@ -545,6 +557,8 @@ class TableCell(directive.RMLDirective):
'lineLeftCap', 'lineLeftCount', 'lineLeftSpace')),
('LINEAFTER', ('lineRightThickness', 'lineRightColor',
'lineRightCap', 'lineRightCount', 'lineRightSpace')),
('HREF', ('href',)),
('DESTINATION', ('destination',)),
)

def processStyle(self):
Expand Down
Binary file added src/z3c/rml/tests/expected/tag-blockTable-10.pdf
Binary file not shown.
34 changes: 34 additions & 0 deletions src/z3c/rml/tests/input/tag-blockTable-10.rml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE document SYSTEM "rml.dtd">
<document
filename="tag-blockTable-10.pdf"
xmlns:doc="http://namespaces.zope.org/rml/doc">

<template>
<pageTemplate id="main">
<frame id="first" x1="72" y1="72" width="451" height="698"/>
</pageTemplate>
</template>

<story>

<title>
<font face="Courier">&lt;blockTable&gt;</font> Tag Demo with Links
</title>

<bookmarkPage
name="top" fitType="fitv" zoom="2"
left="2cm" right="10cm" top="20cm"
/>
<para>Table on the next page.</para>

<nextPage />

<blockTable colWidths="50% 50%" rowHeights="1cm">
<tr>
<td href="http://google.com">Google</td>
<td destination="top">TOP</td>
</tr>
</blockTable>

</story>
</document>

0 comments on commit 306bbf1

Please sign in to comment.