Skip to content

Commit

Permalink
- Implemented color directive inside the initialize directive.
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Dec 21, 2012
1 parent 4ee7767 commit f2f5c7c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ CHANGES

- Implemented all logging related directives.

- Implemented ``color`` directive inside the ``initialize`` directive.

- Don't show "doc" namespace in reference snippets.

- Create a list of RML2PDF and z3c.rml differences.
Expand Down
44 changes: 22 additions & 22 deletions RML-DIFFERENCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ library and z3c.rml.
Incompatibilies
---------------

- ``addMapping``: This is a useful API function that was supported in earlier
versions of RML2PDF. It is now gone, but this library still supports it.

- ``<barCode>``

* Most barcode attributes available via the API and the flowable are not
Expand All @@ -27,21 +30,35 @@ Incompatibilies
* `tracking`: This is only used for USPS4S and the API actually uses the
`value` argument for this. Thus this attribute is omitted.

- ``<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.

- ``addMapping``: This is a useful API function that was supported in earlier
versions of RML2PDF. It is now gone, but this library still supports it.
- ``docinit``:

* ``outlineAdd`` directive really does not make much sense here. The API
docs claim its availability but the hand-written docs state it must be
within a story.

* ``alias`` directive is completely undocumented in this context.

- ``drawing``: There is no documentation for this tag and I do not know what
it is supposed to do. Thus z3c.rml does not implement it.

- ``join``: This directive is not implemented due to lack of documentation.

- ``<keepTogether>``: This directive is not implemented in RML2PDF, but there
exists an API flowable for it and it seems obviously useful.

- ``length``: This directive is not implemented due to lack of documentation.

- ``template``: The `firstPageTemplate` attribute is not implemented, since it
belongs to the ``story`` directive. Several RML2PDF examples use it that way
too, so why is it documented differently?

- ``widget``: There is no documentation for this tag and I do not know what it
is supposed to do. Thus z3c.rml does not implement it.


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

Expand All @@ -50,14 +67,6 @@ missing attributes. A "-" (minus) sign in front of an element or attribute
denotes a feature not in RML2PDF. The "->" arrow designates a difference in
naming.

- docinit:
* alias
* outlineAdd
* logConfig

- template: firstPageTemplate

- story: -firstPageTemplate

- pre/xpre: -bulletText, -dedent, -text

Expand Down Expand Up @@ -85,16 +94,11 @@ naming.

- form


- lineMode: -miterLimit

- initialize
* color

- paraStyle: fontName -> fontname, fontSize -> fontsize, -keepWithNext,
-wordWrap, -border*


- blockTableStyle: -keepWtihNext

- blockBackground: -colorsByRow, -colorsByCol
Expand All @@ -111,9 +115,5 @@ naming.

- frame: -*Padding, -showBoundary

- join

- length

- -pdfInclude

8 changes: 8 additions & 0 deletions src/z3c/rml/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ def process(self):
return
raise ValueError('At least one color definition must be specified.')

# Initialize also supports the <color> tag.
stylesheet.Initialize.factories['color'] = ColorDefinition
stylesheet.IInitialize.setTaggedValue(
'directives',
stylesheet.IInitialize.getTaggedValue('directives') +
(occurence.ZeroOrMore('color', IColorDefinition),)
)


class IStartIndex(interfaces.IRMLDirectiveSignature):
"""Start a new index."""
Expand Down
Binary file modified src/z3c/rml/tests/expected/tag-color.pdf
Binary file not shown.
12 changes: 11 additions & 1 deletion src/z3c/rml/tests/input/tag-color.rml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@
<frame id="first" x1="1cm" y1="1cm" width="19cm" height="26cm"/>
</pageTemplate>
</template>

<stylesheet>
<initialize>
<color id="important" value="red" />
</initialize>
</stylesheet>

<story>
<para fontSize="40" textColor="favorite-color">
<para fontSize="40" spaceAfter="45" textColor="favorite-color">
This is my favorite color!
</para>
<para fontSize="40" textColor="important">
This is an important color.
</para>
</story>
</document>
7 changes: 4 additions & 3 deletions src/z3c/rml/tests/test_rml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
except ImportError:
from PIL import Image

LOG_FILE = os.path.join(os.path.dirname(__file__), 'render.log')

def gs_command(path):
return ('gs', '-q', '-sNOPAUSE', '-sDEVICE=png256',
'-sOutputFile=%s[Page-%%d].png' % path[:-4],
Expand Down Expand Up @@ -60,9 +62,8 @@ def tearDown(self):
attr.File.open = self._fileOpen
del sys.modules['module']
del sys.modules['mymodule']
os.remove(
os.path.join(os.path.dirname(__file__), 'render.log'))

if os.path.exists(LOG_FILE):
os.remove(LOG_FILE)

def runTest(self):
rml2pdf.go(self._inPath, self._outPath)
Expand Down

0 comments on commit f2f5c7c

Please sign in to comment.