diff --git a/CHANGES.txt b/CHANGES.txt index 15b303c..575354a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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. diff --git a/RML-DIFFERENCES.txt b/RML-DIFFERENCES.txt index 116e3da..7a85a6b 100644 --- a/RML-DIFFERENCES.txt +++ b/RML-DIFFERENCES.txt @@ -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. + - ```` * Most barcode attributes available via the API and the flowable are not @@ -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. -- ````: 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. + +- ````: 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 ---------- @@ -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 @@ -85,16 +94,11 @@ naming. - form - - lineMode: -miterLimit -- initialize - * color - - paraStyle: fontName -> fontname, fontSize -> fontsize, -keepWithNext, -wordWrap, -border* - - blockTableStyle: -keepWtihNext - blockBackground: -colorsByRow, -colorsByCol @@ -111,9 +115,5 @@ naming. - frame: -*Padding, -showBoundary -- join - -- length - - -pdfInclude diff --git a/src/z3c/rml/document.py b/src/z3c/rml/document.py index 068bdde..c3e526d 100644 --- a/src/z3c/rml/document.py +++ b/src/z3c/rml/document.py @@ -263,6 +263,14 @@ def process(self): return raise ValueError('At least one color definition must be specified.') +# Initialize also supports the 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.""" diff --git a/src/z3c/rml/tests/expected/tag-color.pdf b/src/z3c/rml/tests/expected/tag-color.pdf index 523312d..fdd3d67 100644 Binary files a/src/z3c/rml/tests/expected/tag-color.pdf and b/src/z3c/rml/tests/expected/tag-color.pdf differ diff --git a/src/z3c/rml/tests/input/tag-color.rml b/src/z3c/rml/tests/input/tag-color.rml index 1c10b8d..03cbdd9 100644 --- a/src/z3c/rml/tests/input/tag-color.rml +++ b/src/z3c/rml/tests/input/tag-color.rml @@ -13,9 +13,19 @@ + + + + + + + - + This is my favorite color! + + This is an important color. + diff --git a/src/z3c/rml/tests/test_rml.py b/src/z3c/rml/tests/test_rml.py index 44e9198..85e71d5 100644 --- a/src/z3c/rml/tests/test_rml.py +++ b/src/z3c/rml/tests/test_rml.py @@ -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], @@ -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)