[Checkins] SVN: z3c.rml/trunk/src/z3c/rml/ Got 3 more RML testsuite tests to pass. Yipee!

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Mar 16 14:47:45 EDT 2007


Log message for revision 73232:
  Got 3 more RML testsuite tests to pass. Yipee!
  

Changed:
  U   z3c.rml/trunk/src/z3c/rml/attr.py
  U   z3c.rml/trunk/src/z3c/rml/canvas.py
  U   z3c.rml/trunk/src/z3c/rml/chart.py
  U   z3c.rml/trunk/src/z3c/rml/document.py
  U   z3c.rml/trunk/src/z3c/rml/flowable.py
  U   z3c.rml/trunk/src/z3c/rml/interfaces.py
  U   z3c.rml/trunk/src/z3c/rml/page.py
  U   z3c.rml/trunk/src/z3c/rml/special.py
  U   z3c.rml/trunk/src/z3c/rml/stylesheet.py
  U   z3c.rml/trunk/src/z3c/rml/template.py
  U   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-001-hello.rml
  U   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-002-paras.rml
  A   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-029-keepinframe.rml
  A   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-031-japanese.rml
  A   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-034-cmyk.rml

-=-
Modified: z3c.rml/trunk/src/z3c/rml/attr.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/attr.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/attr.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -35,6 +35,15 @@
 DEFAULT = object()
 
 
+def getManager(context, interface):
+    while (not interface.providedBy(context) and context is not None):
+        context = context.parent
+    if context is None:
+        raise ValueError(
+            'Manager for %s could not be found.' %interface.getName())
+    return context
+
+
 class Attribute(object):
 
     def __init__(self, name=None, default=DEFAULT):
@@ -236,22 +245,20 @@
     def convert(self, value, context=None):
         if value == 'None':
             return None
+        manager = getManager(context, interfaces.IColorsManager)
+        if value in manager.colors:
+            return manager.colors[value]
         return reportlab.lib.colors.toColor(value)
 
 
 class Style(Text):
 
-    def __init__(self, name=None, type='para', default='Normal'):
+    def __init__(self, name=None, default='Normal'):
         super(Style, self).__init__(name, default)
-        self.type = type
 
     def convert(self, value, context=None):
-        # First, get the custom styles
-        proc = context
-        while (not interfaces.IStylesManager.providedBy(proc) and
-               proc is not None):
-            proc = proc.parent
-        for styles in (proc.styles.get(self.type, {}),
+        manager = getManager(context, interfaces.IStylesManager)
+        for styles in (manager.styles,
                        reportlab.lib.styles.getSampleStyleSheet().byName):
             if value in styles:
                 return styles[value]
@@ -385,4 +392,4 @@
 
     def get(self, element, default=DEFAULT, context=None):
         result = super(XMLContent, self).get(element, default, context)
-        return result.strip()
+        return result.strip().replace('\t', ' ')

Modified: z3c.rml/trunk/src/z3c/rml/canvas.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/canvas.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/canvas.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -394,8 +394,7 @@
 
 
 class Canvas(element.ContainerElement):
-    zope.interface.implements(
-        interfaces.IStylesManager, interfaces.IPostProcessorManager)
+    zope.interface.implements(interfaces.IPostProcessorManager)
 
     subElements = {
         'stylesheet': stylesheet.Stylesheet,
@@ -403,9 +402,8 @@
         'pageInfo': PageInfo,
         }
 
-    def __init__(self, element):
-        self.element = element
-        self.styles = {}
+    def __init__(self, element, parent, context):
+        super(Canvas, self).__init__(element, parent, context)
         self.postProcessors = []
 
     def process(self, outputFile):

Modified: z3c.rml/trunk/src/z3c/rml/chart.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/chart.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/chart.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -38,7 +38,7 @@
     attrs = None
 
     def process(self):
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         self.context.append(attrs)
 
 
@@ -50,7 +50,7 @@
     def processAttributes(self):
         prop = getattr(self.context, self.propertyName)
         # Get global properties
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         for name, value in attrs.items():
             setattr(prop, name, value)
 
@@ -80,7 +80,7 @@
         )
 
     def process(self):
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         string = shapes.String(
             attrs.pop('x'), attrs.pop('y'), attrs.pop('TEXT'))
         angle = attrs.pop('angle')
@@ -100,7 +100,8 @@
     attrList = None
 
     def process(self):
-        attrs = element.extractPositionalArguments(self.attrList, self.element)
+        attrs = element.extractPositionalArguments(
+            self.attrList, self.element, self)
         self.context.append(attrs[0])
 
 class Data(element.ContainerElement):
@@ -219,7 +220,7 @@
     attrs = (attr.TextNode(),)
 
     def process(self):
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         self.context.append(attrs['TEXT'])
 
 
@@ -320,7 +321,7 @@
     attrs = Label.attrs[2:]
 
     def process(self):
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         for name, value in attrs.items():
             self.context['label_'+name] = value
         # Now we do not have simple labels anymore
@@ -336,7 +337,7 @@
         )
 
     def process(self):
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         for name, value in attrs.items():
             self.context['label_pointer_'+name] = value
 
@@ -358,7 +359,7 @@
         'pointer': SlicePointer}
 
     def process(self):
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         self.processSubElements(attrs)
         self.context.append(attrs)
 
@@ -377,7 +378,7 @@
 
     def process(self):
         # Get global slice properties
-        attrs = element.extractAttributes(self.attrs, self.element)
+        attrs = element.extractAttributes(self.attrs, self.element, self)
         for name, value in attrs.items():
             setattr(self.context.slices, name, value)
         # Get slice specific properties
@@ -498,7 +499,7 @@
 
     def getAttributes(self):
         attrs = [(attr.name, attr) for attr in self.attrs]
-        return element.extractKeywordArguments(attrs, self.element)
+        return element.extractKeywordArguments(attrs, self.element, self)
 
     def createChart(self, attributes):
         raise NotImplementedError

Modified: z3c.rml/trunk/src/z3c/rml/document.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/document.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/document.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -17,9 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 import sys
-
-from reportlab.pdfbase import pdfmetrics, ttfonts
-from z3c.rml import attr, element, error
+import zope.interface
+from reportlab.pdfbase import pdfmetrics, ttfonts, cidfonts
+from z3c.rml import attr, element, error, interfaces
 from z3c.rml import canvas, stylesheet, template
 
 
@@ -27,7 +27,7 @@
     args = ( attr.Attribute('afmFile'), attr.Attribute('pfbFile') )
 
     def process(self):
-        args = element.extractPositionalArguments(self.args, self.element)
+        args = element.extractPositionalArguments(self.args, self.element, self)
         face = pdfmetrics.EmbeddedType1Face(*args)
         pdfmetrics.registerTypeFace(face)
 
@@ -39,7 +39,7 @@
         attr.Attribute('encName') )
 
     def process(self):
-        args = element.extractPositionalArguments(self.args, self.element)
+        args = element.extractPositionalArguments(self.args, self.element, self)
         font = pdfmetrics.Font(*args)
         pdfmetrics.registerFont(font)
 
@@ -50,21 +50,46 @@
         attr.Attribute('fileName') )
 
     def process(self):
-        args = element.extractPositionalArguments(self.args, self.element)
+        args = element.extractPositionalArguments(self.args, self.element, self)
         font = ttfonts.TTFont(*args)
         pdfmetrics.registerFont(font)
 
 
+class RegisterCidFont(element.Element):
+    args = ( attr.Attribute('faceName'), )
+
+    def process(self):
+        args = element.extractPositionalArguments(self.args, self.element, self)
+        pdfmetrics.registerFont(cidfonts.UnicodeCIDFont(*args))
+
+
+class ColorDefinition(element.FunctionElement):
+    args = (
+        attr.Text('id'),
+        attr.Color('RGB'), )
+
+    def process(self):
+        id, value = self.getPositionalArguments()
+        manager = attr.getManager(self, interfaces.IColorsManager)
+        manager.colors[id] = value
+
+
 class DocInit(element.ContainerElement):
 
     subElements = {
         'registerType1Face': RegisterType1Face,
         'registerFont': RegisterFont,
         'registerTTFont': RegisterTTFont,
+        'registerCidFont': RegisterCidFont,
+        'color': ColorDefinition,
         }
 
 
 class Document(element.ContainerElement):
+    zope.interface.implements(
+        interfaces.INamesManager,
+        interfaces.IStylesManager,
+        interfaces.IColorsManager)
 
     subElements = {
         'docinit': DocInit
@@ -72,6 +97,9 @@
 
     def __init__(self, element):
         self.element = element
+        self.names = {}
+        self.styles = {}
+        self.colors = {}
 
     def process(self, outputFile=None):
         """Process document"""
@@ -82,7 +110,7 @@
         self.processSubElements(None)
 
         if self.element.find('pageDrawing') is not None:
-            canvas.Canvas(self.element).process(outputFile)
+            canvas.Canvas(self.element, self, None).process(outputFile)
 
         if self.element.find('template') is not None:
-            template.Template(self.element).process(outputFile)
+            template.Template(self.element, self, None).process(outputFile)

Modified: z3c.rml/trunk/src/z3c/rml/flowable.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/flowable.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/flowable.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -61,11 +61,11 @@
 
 class Preformatted(Flowable):
     klass = reportlab.platypus.Preformatted
-    args = ( attr.RawXMLContent(u''), attr.Style('style', 'para', 'Normal') )
+    args = ( attr.RawXMLContent(u''), attr.Style('style', 'Normal') )
 
 class XPreformatted(Flowable):
     klass = reportlab.platypus.XPreformatted
-    args = ( attr.RawXMLContent(u''), attr.Style('style', 'para', 'Normal') )
+    args = ( attr.RawXMLContent(u''), attr.Style('style', 'Normal') )
 
 class PluginFlowable(Flowable):
     args = ( attr.Text('module'), attr.Text('function'), attr.TextNode())
@@ -82,20 +82,36 @@
 
 class Paragraph(Flowable):
     klass = reportlab.platypus.Paragraph
-    args = ( attr.XMLContent(u''), attr.Style('style', 'para', 'Normal') )
+    args = ( attr.XMLContent(u''), attr.Style('style', 'Normal') )
     kw = ( ('bulletText', attr.Attribute('bulletText')), )
 
+    styleAttrs = stylesheet.ParagraphStyle.attrs[3:]
+
+    def processStyle(self, style):
+        attrs = element.extractAttributes(self.styleAttrs, self.element, self)
+        if attrs:
+            style = copy.deepcopy(style)
+            for name, value in attrs.items():
+                setattr(style, name, value)
+        return style
+
+    def process(self):
+        args = self.getPositionalArguments()
+        kw = self.getKeywordArguments()
+        args[1] = self.processStyle(args[1])
+        self.parent.flow.append(self.klass(*args, **kw))
+
 class Title(Paragraph):
-    args = ( attr.XMLContent(u''), attr.Style('style', 'para', 'Title'), )
+    args = ( attr.XMLContent(u''), attr.Style('style', 'Title'), )
 
 class Heading1(Paragraph):
-    args = ( attr.XMLContent(u''), attr.Style('style', 'para', 'Heading1'), )
+    args = ( attr.XMLContent(u''), attr.Style('style', 'Heading1'), )
 
 class Heading2(Paragraph):
-    args = ( attr.XMLContent(u''), attr.Style('style', 'para', 'Heading2'), )
+    args = ( attr.XMLContent(u''), attr.Style('style', 'Heading2'), )
 
 class Heading3(Paragraph):
-    args = ( attr.XMLContent(u''), attr.Style('style', 'para', 'Heading3'), )
+    args = ( attr.XMLContent(u''), attr.Style('style', 'Heading3'), )
 
 class TableCell(element.Element):
 
@@ -147,12 +163,13 @@
         for styleName, attrs in self.styleAttrs:
             args = []
             for attribute in attrs:
-                value = attribute.get(self.element)
+                value = attribute.get(self.element, context=self)
                 if value is not attr.DEFAULT:
                     args.append(value)
             if args or len(attrs) == 0:
                 self.parent.parent.style.add(
                     styleName, [col, row], [col, row], *args)
+
     def process(self):
         # Produce style
         self.processStyle()
@@ -184,11 +201,14 @@
                 ))
         self.parent.rows = attribute.get(self.element)
 
+
 class BlockTableStyle(stylesheet.BlockTableStyle):
 
-    def setStyle(self, id, style):
-        self.parent.style = style
+    def process(self):
+        self.parent.style = copy.deepcopy(self.parent.style)
+        self.processSubElements(self.parent.style)
 
+
 class BlockTable(element.ContainerElement, Flowable):
     klass = reportlab.platypus.Table
     kw = (
@@ -250,20 +270,28 @@
 class KeepInFrame(Flowable):
     klass = reportlab.platypus.flowables.KeepInFrame
     args = (
-        attr.Measurement('maxWidth'),
-        attr.Measurement('maxHeight'), )
+        attr.Measurement('maxWidth', None),
+        attr.Measurement('maxHeight', None), )
     kw = (
         ('mergeSpace', attr.Bool('mergeSpace')),
         ('mode', attr.Choice('onOverflow',
                              ('error', 'overflow', 'shrink', 'truncate'))),
-        ('name', attr.Text('id')) )
+        ('name', attr.Text('id')),
+        ('frame', attr.StringOrInt('frame')), )
 
     def process(self):
+        args = self.getPositionalArguments()
+        kw = self.getKeywordArguments()
+        # If the frame was specifed, get us there
+        frame = kw.pop('frame', None)
+        if frame:
+            self.parent.flow.append(
+                reportlab.platypus.doctemplate.FrameBreak(frame))
+        # Create the content of the container
         flow = Flow(self.element, self.parent, self.context)
         flow.process()
-        args = self.getPositionalArguments()
-        kw = self.getKeywordArguments()
         kw['content'] = flow.flow
+        # Create the keep in frame container
         frame = self.klass(*args, **kw)
         self.parent.flow.append(frame)
 

Modified: z3c.rml/trunk/src/z3c/rml/interfaces.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/interfaces.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/interfaces.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -28,12 +28,23 @@
         ``outputFileName``.
         """
 
+class INamesManager(zope.interface.Interface):
+    """Manages custom names"""
+
+    names = zope.interface.Attribute("Names dict")
+
 class IStylesManager(zope.interface.Interface):
     """Manages custom styles"""
 
     styles = zope.interface.Attribute("Styles dict")
 
 
+class IColorsManager(zope.interface.Interface):
+    """Manages custom colors"""
+
+    colors = zope.interface.Attribute("Colors dict")
+
+
 class IPostProcessorManager(zope.interface.Interface):
     """Manages all post processors"""
 

Modified: z3c.rml/trunk/src/z3c/rml/page.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/page.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/page.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -52,14 +52,11 @@
     args = ( attr.File('filename'), attr.Int('page') )
 
     def getProcessor(self):
-        elem = self.parent
-        while (not interfaces.IPostProcessorManager.providedBy(elem)
-               and elem is not None):
-            elem = elem.parent
-        procs = dict(elem.postProcessors)
+        manager = attr.getManager(self, interfaces.IPostProcessorManager)
+        procs = dict(manager.postProcessors)
         if 'MERGE' not in procs:
             proc = MergePostProcessor()
-            elem.postProcessors.append(('MERGE', proc))
+            manager.postProcessors.append(('MERGE', proc))
             return proc
         return procs['MERGE']
 

Modified: z3c.rml/trunk/src/z3c/rml/special.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/special.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/special.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -25,21 +25,17 @@
         attr.Text('value'), )
 
     def process(self):
-        args = self.getPositionalArguments()
-        elem = self
-        while not hasattr(elem, 'names') and elem is not None:
-            elem = elem.parent
-        elem.names[args[0]] = args[1]
+        id, value = self.getPositionalArguments()
+        manager = attr.getManager(self, interfaces.INamesManager)
+        manager.names[id] = value
 
 
 class GetName(element.Element):
 
     def process(self):
         id = attr.Text('id').get(self.element)
-        elem = self
-        while not hasattr(elem, 'names') and elem is not None:
-            elem = elem.parent
-        text = elem.names[id] + (self.element.tail or u'')
+        manager = attr.getManager(self, interfaces.INamesManager)
+        text = manager.names[id] + (self.element.tail or u'')
         # Now replace the element with the text
         parent = self.element.getparent()
         if parent.text is None:
@@ -56,9 +52,5 @@
 
     def process(self):
         id, value = self.getPositionalArguments()
-        elem = self
-        while (not interfaces.IStylesManager.providedBy(elem) and
-               elem is not None):
-            elem = elem.parent
-        styles = elem.styles.setdefault('para', {})
-        styles[id] = value
+        manager = attr.getManager(self, interfaces.IStylesManager)
+        manager.styles[id] = value

Modified: z3c.rml/trunk/src/z3c/rml/stylesheet.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/stylesheet.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/stylesheet.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -20,7 +20,7 @@
 import reportlab.lib.styles
 import reportlab.lib.enums
 import reportlab.platypus
-from z3c.rml import attr, element, error, special
+from z3c.rml import attr, element, error, interfaces, special
 
 
 class Initialize(element.ContainerElement):
@@ -57,7 +57,7 @@
 
     def process(self):
         attrs = element.extractKeywordArguments(
-            [(attr.name, attr) for attr in self.attrs], self.element,
+            [(attrib.name, attrib) for attrib in self.attrs], self.element,
             self.parent)
 
         parent = attrs.pop(
@@ -67,7 +67,8 @@
         for name, value in attrs.items():
             setattr(style, name, value)
 
-        self.parent.parent.styles.setdefault('para', {})[style.name] = style
+        manager = attr.getManager(self, interfaces.IStylesManager)
+        manager.styles[style.name] = style
 
 
 class TableStyleCommand(element.Element):
@@ -85,7 +86,7 @@
     def process(self):
         args = [self.name]
         for attribute in self.attrs:
-            value = attribute.get(self.element)
+            value = attribute.get(self.element, context=self)
             if value is not attr.DEFAULT:
                 args.append(value)
         self.context.add(*args)
@@ -143,7 +144,7 @@
             args = [BlockColBackground.name]
 
         for attribute in self.attrs:
-            value = attribute.get(self.element)
+            value = attribute.get(self.element, context=self)
             if value is not attr.DEFAULT:
                 args.append(value)
         self.context.add(*args)
@@ -183,12 +184,12 @@
                 'LINEBELOW', 'LINEABOVE', 'LINEBEFORE', 'LINEAFTER']
         return attr.Choice(
             'kind', dict([(cmd.lower(), cmd) for cmd in cmds])
-            ).get(self.element)
+            ).get(self.element, context=self)
 
     def process(self):
         args = [self.name]
         for attribute in self.attrs:
-            value = attribute.get(self.element)
+            value = attribute.get(self.element, context=self)
             if value is not attr.DEFAULT:
                 args.append(value)
         self.context.add(*args)
@@ -212,14 +213,12 @@
         'lineStyle': LineStyle,
         }
 
-    def setStyle(self, id, style):
-        self.parent.parent.styles.setdefault('table', {})[id] = style
-
     def process(self):
-        id = attr.Text('id').get(self.element)
+        id = attr.Text('id').get(self.element, context=self)
         style = reportlab.platypus.tables.TableStyle()
         self.processSubElements(style)
-        self.setStyle(id, style)
+        manager = attr.getManager(self, interfaces.IStylesManager)
+        manager.styles[id] = style
 
 
 class Stylesheet(element.ContainerElement):

Modified: z3c.rml/trunk/src/z3c/rml/template.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/template.py	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/template.py	2007-03-16 18:47:44 UTC (rev 73232)
@@ -16,12 +16,10 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
-import zope.interface
 from reportlab import platypus
 from z3c.rml import attr, canvas, element, flowable, interfaces, stylesheet
 
 
-
 class Story(flowable.Flow):
 
     def getFirstPageTemplateIndex(self, doc):
@@ -35,10 +33,10 @@
 
 class Frame(element.FunctionElement):
     args = (
-        attr.Measurement('x1'),
-        attr.Measurement('y1'),
-        attr.Measurement('width'),
-        attr.Measurement('height'),
+        attr.Measurement('x1', allowPercentage=True),
+        attr.Measurement('y1', allowPercentage=True),
+        attr.Measurement('width', allowPercentage=True),
+        attr.Measurement('height', allowPercentage=True),
         )
     kw = (
         ('id', attr.Text('id')),
@@ -51,10 +49,24 @@
         )
 
     def process(self):
+        # get the page size
+        size = self.context.pagesize
+        if size is None:
+            size = self.parent.context.pagesize
+        # Get the arguments
         args = self.getPositionalArguments()
         kw = self.getKeywordArguments()
+        # Deal with percentages
+        if isinstance(args[0], basestring) and args[0].endswith('%'):
+            args[0] = float(args[0][:-1])/100*size[0]
+        if isinstance(args[1], basestring) and args[1].endswith('%'):
+            args[1] = float(args[1][:-1])/100*size[1]
+        if isinstance(args[2], basestring) and args[2].endswith('%'):
+            args[2] = float(args[2][:-1])/100*size[0]
+        if isinstance(args[3], basestring) and args[3].endswith('%'):
+            args[3] = float(args[3][:-1])/100*size[1]
         frame = platypus.Frame(*args, **kw)
-        self.context.frames.append(frame)
+        self.parent.frames.append(frame)
 
 
 class PageGraphics(element.Element):
@@ -82,20 +94,19 @@
 
     def process(self):
         args = self.getPositionalArguments()
-        # Pass in frames explicitely, since they have it as a keyword argument
-        # using an empty list; Sigh!
-        pt = platypus.PageTemplate(frames=[], *args)
+        self.frames = []
+        pt = platypus.PageTemplate(*args)
+        self.processSubElements(pt)
+        pt.frames = self.frames
 
         kw = self.getKeywordArguments()
         if 'pagesize' in kw:
             pt.pagesize = kw['pagesize']
 
-        self.processSubElements(pt)
         self.context.addPageTemplates(pt)
 
 
 class Template(element.ContainerElement):
-    zope.interface.implements(interfaces.IStylesManager)
 
     templateArgs = (
         ('pagesize', attr.PageSize('pageSize',)),
@@ -119,20 +130,16 @@
         'stylesheet': stylesheet.Stylesheet,
         }
 
-    def __init__(self, element):
-        self.element = element
-        self.names = {}
-        self.styles = {}
-
     def process(self, outputFile):
         docElement = self.element
         self.processSubElements(None)
 
         self.element = self.element.find('template')
 
-        kw = element.extractKeywordArguments(self.documentArgs, docElement)
+        kw = element.extractKeywordArguments(
+            self.documentArgs, docElement, self)
         kw.update(element.extractKeywordArguments(
-            self.templateArgs, self.element))
+            self.templateArgs, self.element, self))
         doc = platypus.BaseDocTemplate(outputFile, **kw)
 
         self.processSubElements(doc)

Modified: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-001-hello.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-001-hello.rml	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-001-hello.rml	2007-03-16 18:47:44 UTC (rev 73232)
@@ -17,7 +17,7 @@
 
 <stylesheet>
 	<initialize>
-	<alias id="style.Normal" value="style.normal"/>
+	<alias id="style.normal" value="style.Normal"/>
 	</initialize>
 	<paraStyle name="h1" fontName="Helvetica-BoldOblique" fontSize="32" leading="36"/>
 	<paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12"/>

Modified: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-002-paras.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-002-paras.rml	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-002-paras.rml	2007-03-16 18:47:44 UTC (rev 73232)
@@ -15,7 +15,7 @@
 
 <stylesheet>
 	<initialize>
-	<alias id="style.Normal" value="style.normal"/>
+	<alias id="style.normal" value="style.Normal"/>
 	</initialize>
 
 	<paraStyle name="h1"

Added: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-029-keepinframe.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-029-keepinframe.rml	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-029-keepinframe.rml	2007-03-16 18:47:44 UTC (rev 73232)
@@ -0,0 +1,577 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document filename="test_029_keepinframe.pdf" debug="0" invariant="0" compression="1">
+
+
+<template pageSize="(595, 842)" leftMargin="72" showBoundary="1">
+	<pageTemplate id="main">
+	<pageGraphics>
+		<setFont name="Helvetica-BoldOblique" size="18"/>
+		<drawRightString x="523" y="800">RML2PDF Test Suite - Test #029 keepInFrame</drawRightString>
+	</pageGraphics>
+	<frame id="F1" x1="2.5cm" y1="15.5cm" width="170" height="284"/>
+	<frame id="F2" x1="11.5cm" y1="15.5cm" width="170" height="284"/>
+	<frame id="F3" x1="2.5cm" y1="2.5cm" width="170" height="284"/>
+	<frame id="F4" x1="11.5cm" y1="2.5cm" width="170" height="284"/>
+	</pageTemplate>
+
+	<pageTemplate id="newsletter">
+	<pageGraphics>
+		<setFont name="Helvetica-BoldOblique" size="18"/>
+		<drawRightString x="523" y="800">RML2PDF Test Suite - Test #029 keepInFrame</drawRightString>
+	</pageGraphics>
+	<frame id="top" x1="10%" y1="80%" width="80%" height="10%"/>
+	<frame id="upper" x1="10%" y1="60%" width="55%" height="15%"/>
+	<frame id="middle" x1="10%" y1="35%" width="55%" height="20%"/>
+	<frame id="lowerleft" x1="10%" y1="10%" width="25%" height="20%"/>
+	<frame id="lowerright" x1="40%" y1="10%" width="25%" height="20%"/>
+	<frame id="sidebar" x1="70%" y1="10%" width="20%" height="65%"/>
+	</pageTemplate>
+
+
+</template>
+
+<stylesheet>
+	<initialize>
+		<alias id="bt" value="style.BodyText"/>
+	</initialize>
+	<paraStyle
+		name="h1"
+		parent="style.Normal"
+		fontName="Times-Bold"
+		fontSize="18"
+		leading="22"
+		spaceAfter="6"
+		pageBreakBefore="0"
+		keepWithNext="0"
+		/>
+
+	<paraStyle
+		name="h2"
+		parent="style.Normal"
+		fontName="Times-Bold"
+		fontSize="16"
+		leading="18"
+		spaceAfter="3"
+		pageBreakBefore="0"
+		keepWithNext="0"
+		/>
+
+	<paraStyle
+		name="keepInFrame"
+		parent="bt"
+		fontSize="9"
+		alignment="right"
+		/>
+
+	<!--this style used for a tablerow example later on in document-->
+		<blockTableStyle id="simple">
+			<blockValign start="0,0" stop="-1,-1" value="TOP"/>
+			<blockFont name="Helvetica" size="6" leading="7"/>
+			<blockBottomPadding length="1"/>
+			<blockTopPadding length="1"/>
+			<lineStyle kind="INNERGRID" colorName="gray" start="0,0" stop="-1,-1" thickness="0.25"/>
+			<lineStyle kind="BOX" colorName="black" start="0,0" stop="-1,-1" thickness="0.25"/>
+		</blockTableStyle>
+
+		<blockTableStyle id="summary" parent="simple">
+			<blockBackground colorName="cyan"/>
+			<blockFont name="Helvetica-Bold" size="6" leading="7"/>
+		</blockTableStyle>
+
+		<blockTableStyle id="continuation" parent="simple">
+			<blockBackground colorName="silver"/>
+			<blockFont name="Helvetica-Oblique" size="6" leading="7"/>
+		</blockTableStyle>
+
+</stylesheet>
+
+
+<story>
+	<keepInFrame onOverflow = "shrink" id="ff1">
+		<para style="h1">First Try at a keepInFrame</para>
+		<para style="bt">
+			This will behave just like part of a story, as long as it all
+			fits.
+		</para>
+		<para style="bt">
+			To characterize a linguistic level L,
+			this selectionally introduced contextual
+			feature delimits the requirement that
+			branching is not tolerated within the
+			dominance scope of a complex
+			symbol. <font color="red">Notice</font>, incidentally, that the
+			notion of level of grammaticalness
+			does not affect the structure of the
+			levels of acceptability from fairly high
+			(e.g. (99a)) to virtual gibberish (e.g.
+			(98d)). Suppose, for instance, that a
+			subset of English sentences interesting
+			on quite independent grounds appears
+			to correlate rather closely with an
+			important distinction in language use.
+			Presumably, this analysis of a
+			formative as a pair of sets of features is
+			not quite equivalent to the system of
+			base rules exclusive of the lexicon. We
+			have already seen that the appearance
+			of parasitic gaps in domains relatively
+			inaccessible to ordinary extraction
+			does not readily tolerate the strong
+			generative capacity of the theory.
+		</para>
+	</keepInFrame>
+	<nextFrame/>
+	<keepInFrame onOverflow = "shrink" id="ff2">
+		<para style="h1">keepInFrame with a table inside</para>
+		<blockTable>
+			<blockTableStyle id="tablestyle_000">
+				<blockValign start="0,0" stop="-1,-1" value="TOP"/>
+				<lineStyle kind="INNERGRID" colorName="black" start="0,0" stop="-1,-1" thickness="0.25"/>
+				<lineStyle kind="BOX" colorName="black" start="0,0" stop="-1,-1" thickness="0.25"/>
+			</blockTableStyle>
+			<tr><td>alignment</td><td>align
+alignment</td></tr>
+			<tr><td>bulletColor</td><td>bulletcolor
+bcolor</td></tr>
+			<tr><td>bulletFontName</td><td>bfont
+bulletfontname</td></tr>
+			<tr><td>bulletFontSize</td><td>bfontsize
+bulletfontsize</td></tr>
+			<tr><td>bulletIndent</td><td>bindent
+bulletindent</td></tr>
+			<tr><td>firstLineIndent</td><td>findent
+firstlineindent</td></tr>
+			<tr><td>fontName</td><td>face
+fontname
+font</td></tr>
+			<tr><td>fontSize</td><td>size
+fontsize</td></tr>
+			<tr><td>leading</td><td>leading</td></tr>
+			<tr><td>leftIndent</td><td>leftindent
+lindent</td></tr>
+			<tr><td>rightIndent</td><td>rightindent
+rindent</td></tr>
+			<tr><td>spaceAfter</td><td>spaceafter
+spacea</td></tr>
+			<tr><td>spaceBefore</td><td>spacebefore
+spaceb</td></tr>
+			<tr><td>textColor</td><td>fg
+textcolor
+color</td></tr>
+		</blockTable>
+	</keepInFrame>
+	<nextFrame/>
+	<keepInFrame onOverflow = "shrink" id="ff3">
+		<para style="h1">A long keepInFrame, shrinks</para>
+		<para style="bt">
+			To characterize a linguistic level L,
+			this selectionally introduced contextual
+			feature delimits the requirement that
+			branching is not tolerated within the
+			dominance scope of a complex
+			symbol. Notice, incidentally, that the
+			notion of level of grammaticalness
+			does not affect the structure of the
+			levels of acceptability from fairly high
+			(e.g. (99a)) to virtual gibberish (e.g.
+			(98d)). Suppose, for instance, that a
+			subset of English sentences interesting
+			on quite independent grounds appears
+			to correlate rather closely with an
+			important distinction in language use.
+			Presumably, this analysis of a
+			formative as a pair of sets of features is
+			not quite equivalent to the system of
+			base rules exclusive of the lexicon. We
+			have already seen that the appearance
+			of parasitic gaps in domains relatively
+			inaccessible to ordinary extraction
+			does not readily tolerate the strong
+			generative capacity of the theory.
+			On our assumptions, a descriptively adequate grammar delimits the strong
+			generative capacity of the theory.	For one thing, the fundamental error
+			of regarding functional notions as categorial is to be regarded as a
+			corpus of utterance tokens upon which conformity has been defined by the
+			paired utterance test.	A majority	of informed linguistic specialists
+			agree that the appearance of parasitic gaps in domains relatively
+			inaccessible to ordinary extraction is necessary to impose an
+			interpretation on the requirement that branching is not tolerated within
+			the dominance scope of a complex symbol.  It may be, then, that the
+			speaker-hearer's linguistic intuition appears to correlate rather
+			closely with the ultimate standard that determines the accuracy of any
+			proposed grammar.  Analogously, the notion of level of grammaticalness
+			may remedy and, at the same time, eliminate a general convention
+			regarding the forms of the grammar.
+		</para>
+	</keepInFrame>
+	<nextFrame/>
+	<keepInFrame onOverflow = "shrink" id="ff4">
+		<para style="h1">2 keepInFrame (inner split)</para>
+		<para style="bt" textColor="pink">
+			To characterize a linguistic level L,
+			this selectionally introduced contextual
+			feature delimits the requirement that
+			branching is not tolerated within the
+			dominance scope of a complex
+			symbol. Notice, incidentally, that the
+			notion of level of grammaticalness
+			does not affect the structure of the
+			levels of acceptability from fairly high
+			(e.g. (99a)) to virtual gibberish (e.g.
+			(98d)). Suppose, for instance, that a
+			subset of English sentences interesting
+			on quite independent grounds appears
+			to correlate rather closely with an
+			important distinction in language use.
+			Presumably, this analysis of a
+			formative as a pair of sets of features is
+			not quite equivalent to the system of
+			base rules exclusive of the lexicon. We
+			have already seen that the appearance
+			of parasitic gaps in domains relatively
+			inaccessible to ordinary extraction
+			does not readily tolerate the strong
+			generative capacity of the theory.
+		</para>
+		<keepInFrame maxHeight="100" onOverflow = "shrink" id="ff5">
+			<para style="h1">Inner Starts</para>
+			<para style="bt" textColor="yellow">
+				On our assumptions, a descriptively adequate grammar delimits the strong
+				generative capacity of the theory.	For one thing, the fundamental error
+				of regarding functional notions as categorial is to be regarded as a
+				corpus of utterance tokens upon which conformity has been defined by the
+				paired utterance test.	A majority	of informed linguistic specialists
+				agree that the appearance of parasitic gaps in domains relatively
+				inaccessible to ordinary extraction is necessary to impose an
+				interpretation on the requirement that branching is not tolerated within
+				the dominance scope of a complex symbol.  It may be, then, that the
+				speaker-hearer's linguistic intuition appears to correlate rather
+				closely with the ultimate standard that determines the accuracy of any
+				proposed grammar.  Analogously, the notion of level of grammaticalness
+				may remedy and, at the same time, eliminate a general convention
+				regarding the forms of the grammar.
+			</para>
+			<para style="h1">Inner Ends</para>
+		</keepInFrame>
+		<para style="bt" textColor="magenta">
+			We have already seen that the natural general principle that will
+			subsume this case cannot be arbitrary in the requirement that branching
+			is not tolerated within the dominance scope of a complex symbol.
+			Notice, incidentally, that the speaker-hearer's linguistic intuition is
+			to be regarded as the strong generative capacity of the theory.  A
+			consequence of the approach just outlined is that the descriptive power
+			of the base component does not affect the structure of the levels of
+			acceptability from fairly high (e.g. (99a)) to virtual gibberish (e.g.
+			(98d)).  By combining adjunctions and certain deformations, a
+			descriptively adequate grammar cannot be arbitrary in the strong
+			generative capacity of the theory.
+		</para>
+	</keepInFrame>
+	<nextPage/>
+	<nextFrame name="F4"/>
+	<keepInFrame onOverflow = "overflow" id="ff6">
+		<para style="h1">onOverflow = "overflow" in Frame F4</para>
+		<para style="bt">
+			This will behave just like part of a story, as long as it all
+			fits.
+		</para>
+		<para style="bt">
+			To characterize a linguistic level L,
+			this selectionally introduced contextual
+			feature delimits the requirement that
+			branching is not tolerated within the
+			dominance scope of a complex
+			symbol. <font color="red">Notice</font>, incidentally, that the
+			notion of level of grammaticalness
+			does not affect the structure of the
+			levels of acceptability from fairly high
+			(e.g. (99a)) to virtual gibberish (e.g.
+			(98d)). Suppose, for instance, that a
+			subset of English sentences interesting
+			on quite independent grounds appears
+			to correlate rather closely with an
+			important distinction in language use.
+			Presumably, this analysis of a
+			formative as a pair of sets of features is
+			not quite equivalent to the system of
+			base rules exclusive of the lexicon. We
+			have already seen that the appearance
+			of parasitic gaps in domains relatively
+			inaccessible to ordinary extraction
+			does not readily tolerate the strong
+			generative capacity of the theory.
+		</para>
+	</keepInFrame>
+	<keepInFrame onOverflow = "truncate" id="ff7" frame="F1">
+		<para style="h1">onOverflow = "truncate" in frame F1</para>
+		<para style="bt">
+			This will behave just like part of a story, as long as it all
+			fits.
+		</para>
+		<para style="bt">
+			To characterize a linguistic level L,
+			this selectionally introduced contextual
+			feature delimits the requirement that
+			branching is not tolerated within the
+			dominance scope of a complex
+			symbol. <font color="red">Notice</font>, incidentally, that the
+			notion of level of grammaticalness
+			does not affect the structure of the
+			levels of acceptability from fairly high
+			(e.g. (99a)) to virtual gibberish (e.g.
+			(98d)). Suppose, for instance, that a
+			subset of English sentences interesting
+			on quite independent grounds appears
+			to correlate rather closely with an
+			important distinction in language use.
+			Presumably, this analysis of a
+			formative as a pair of sets of features is
+			not quite equivalent to the system of
+			base rules exclusive of the lexicon. We
+			have already seen that the appearance
+			of parasitic gaps in domains relatively
+			inaccessible to ordinary extraction
+			does not readily tolerate the strong
+			generative capacity of the theory.
+		</para>
+	</keepInFrame>
+
+	<setNextTemplate name="newsletter"/>
+	<nextPage/>
+
+	<!-- from now on we can explore a totally different style of coding -
+	story says explicitly what goes where-->
+	<para style="h2">
+		A new way to lay things out....
+	</para>
+	<para>
+		This tag lets us handle layouts like newsletters and factsheets in a much more
+		natural style.  In documents like this, one does not want stuff to leak out of the
+		intended box into the next one.  You wrap your content in &lt;keepInFrame&gt; tags
+		and explicitly tell it where to go.  The order of this page naturally goes top, upper, middle,
+		bottomleft, bottomright, sidebar.
+	</para>
+
+	<keepInFrame frame="sidebar" onOverflow="error">
+		<para>
+			I drew this stuff second, out of the natural order, putting it within a tag saying
+			&lt;keepInFrame frame="sidebar" overflow="error"&gt;.
+		</para>
+		<para>
+			Havng done this, if I had too much content, there would an error warning me.  I can put
+			an ID in to identify it if I want.  I can also specify other behaviours for full frames - shrink, truncate,
+			overflow.
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="upper" onOverflow="error">
+		<para>
+			I drew this stuff third, out of the natural order.  This should be in the upper frame, below the top.
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="middle" onOverflow="error">
+		<para>
+			this goes in the middle frame.
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="lowerright" onOverflow="error">
+		<para>
+			this goes in the bottom right, and was drawn before the stuff on the left..
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="lowerleft" onOverflow="error">
+		<para>
+			and finally the bottom left.
+		</para>
+	</keepInFrame>
+
+	<nextPage/>
+	<para style="h2">
+		The Nonsense Journal
+	</para>
+	<para>
+		We now overfill with rubbish etc etc and use onOverflow="shrink"
+	</para>
+
+	<keepInFrame frame="sidebar" onOverflow="shrink">
+		<para>
+			I drew this stuff second, out of the natural order, putting it within a tag saying
+			&lt;keepInFrame frame="sidebar" overflow="shrink"&gt;.
+		</para>
+		<para>
+Of course, this analysis of a formative as a pair of sets of features
+can be defined in such a way as to impose an important distinction in
+language use.  Nevertheless, the speaker-hearer's linguistic intuition
+may remedy and, at the same time, eliminate the levels of acceptability
+from fairly high (e.g. (99a)) to virtual gibberish (e.g. (98d)).  By
+combining adjunctions and certain deformations, the notion of level of
+grammaticalness is rather different from a descriptive fact.  I
+suggested that these results would follow from the assumption that the
+speaker-hearer's linguistic intuition is to be regarded as the levels of
+acceptability from fairly high (e.g. (99a)) to virtual gibberish (e.g.
+(98d)).  A consequence of the approach just outlined is that this
+selectionally introduced contextual feature is not to be considered in
+determining irrelevant intervening contexts in selectional rules.
+		</para>
+		<spacer length="10"/>
+		<para>
+So far, the systematic use of complex symbols is necessary to impose an
+interpretation on nondistinctness in the sense of distinctive feature
+theory.  It must be emphasized, once again, that most of the
+methodological work in modern linguistics is rather different from the
+requirement that branching is not tolerated within the dominance scope
+of a complex symbol.  Conversely, a descriptively adequate grammar can
+be defined in such a way as to impose a stipulation to place the
+constructions into these various categories.  If the position of the
+trace in (99c) were only relatively inaccessible to movement, relational
+information does not affect the structure of the traditional practice of
+grammarians.  Summarizing, then, we assume that most of the
+methodological work in modern linguistics appears to correlate rather
+closely with the strong generative capacity of the theory.
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="upper" onOverflow="shrink">
+		<para>
+Suppose, for instance, that the natural general principle that will
+subsume this case is to be regarded as the ultimate standard that
+determines the accuracy of any proposed grammar.  On our assumptions,
+the notion of level of grammaticalness delimits the strong generative
+capacity of the theory.  Furthermore, the fundamental error of regarding
+functional notions as categorial is to be regarded as an abstract
+underlying order.  I suggested that these results would follow from the
+assumption that most of the methodological work in modern linguistics
+raises serious doubts about the requirement that branching is not
+tolerated within the dominance scope of a complex symbol.  Let us
+continue to suppose that the speaker-hearer's linguistic intuition does
+not affect the structure of a corpus of utterance tokens upon which
+conformity has been defined by the paired utterance test.
+		</para>
+		<spacer length="10"/>
+		<para>
+It must be emphasized, once again, that the earlier discussion of
+deviance raises serious doubts about a corpus of utterance tokens upon
+which conformity has been defined by the paired utterance test.  I
+suggested that these results would follow from the assumption that the
+systematic use of complex symbols does not affect the structure of the
+strong generative capacity of the theory.  To provide a constituent
+structure for T(Z,K), most of the methodological work in modern
+linguistics is not quite equivalent to the requirement that branching is
+not tolerated within the dominance scope of a complex symbol.  On our
+assumptions, the fundamental error of regarding functional notions as
+categorial is to be regarded as nondistinctness in the sense of
+distinctive feature theory.  A consequence of the approach just outlined
+is that this analysis of a formative as a pair of sets of features
+raises serious doubts about the system of base rules exclusive of the
+lexicon.
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="middle" onOverflow="shrink">
+		<para>
+If the position of the trace in (99c) were only relatively inaccessible
+to movement, the theory of syntactic features developed earlier delimits
+a corpus of utterance tokens upon which conformity has been defined by
+the paired utterance test.  By combining adjunctions and certain
+deformations, a case of semigrammaticalness of a different sort is not
+subject to an important distinction in language use.  Note that this
+selectionally introduced contextual feature delimits the strong
+generative capacity of the theory.  Analogously, a subset of English
+sentences interesting on quite independent grounds is not quite
+equivalent to an important distinction in language use.  To characterize
+a linguistic level L, a case of semigrammaticalness of a different sort
+is, apparently, determined by a descriptive fact.
+		</para>
+		<spacer length="10"/>
+
+		<para>
+Clearly, the descriptive power of the base component is necessary to
+impose an interpretation on the levels of acceptability from fairly high
+(e.g. (99a)) to virtual gibberish (e.g. (98d)).  Thus most of the
+methodological work in modern linguistics cannot be arbitrary in the
+requirement that branching is not tolerated within the dominance scope
+of a complex symbol.  We will bring evidence in favor of the following
+thesis:  this analysis of a formative as a pair of sets of features is
+unspecified with respect to nondistinctness in the sense of distinctive
+feature theory.  Nevertheless, this selectionally introduced contextual
+feature can be defined in such a way as to impose the ultimate standard
+that determines the accuracy of any proposed grammar.  To provide a
+constituent structure for T(Z,K), a case of semigrammaticalness of a
+different sort is not quite equivalent to the system of base rules
+exclusive of the lexicon.
+	</para>
+	</keepInFrame>
+
+	<keepInFrame frame="lowerright" onOverflow="shrink">
+		<para>
+Clearly, the descriptive power of the base component is not subject to
+the system of base rules exclusive of the lexicon.  It appears that the
+appearance of parasitic gaps in domains relatively inaccessible to
+ordinary extraction does not readily tolerate the traditional practice
+of grammarians.  To provide a constituent structure for T(Z,K), a subset
+of English sentences interesting on quite independent grounds is
+necessary to impose an interpretation on an abstract underlying order.
+Presumably, the notion of level of grammaticalness delimits a corpus of
+utterance tokens upon which conformity has been defined by the paired
+utterance test.  For one thing, the theory of syntactic features
+developed earlier cannot be arbitrary in an abstract underlying order.
+		</para>
+		<spacer length="10"/>
+		<para>
+To provide a constituent structure for T(Z,K), the systematic use of
+complex symbols does not readily tolerate nondistinctness in the sense
+of distinctive feature theory.  This suggests that the natural general
+principle that will subsume this case is not quite equivalent to the
+levels of acceptability from fairly high (e.g. (99a)) to virtual
+gibberish (e.g. (98d)).  With this clarification, relational information
+is not subject to a general convention regarding the forms of the
+grammar.  In the discussion of resumptive pronouns following (81), the
+speaker-hearer's linguistic intuition can be defined in such a way as to
+impose nondistinctness in the sense of distinctive feature theory.  On
+the other hand, the appearance of parasitic gaps in domains relatively
+inaccessible to ordinary extraction is not quite equivalent to a
+stipulation to place the constructions into these various categories.
+		</para>
+	</keepInFrame>
+
+	<keepInFrame frame="lowerleft" onOverflow="shrink">
+		<para>
+Note that this selectionally introduced contextual feature can be
+defined in such a way as to impose the ultimate standard that determines
+the accuracy of any proposed grammar.  To provide a constituent
+structure for T(Z,K), the theory of syntactic features developed earlier
+is rather different from an important distinction in language use.  On
+our assumptions, the descriptive power of the base component does not
+readily tolerate problems of phonemic and morphological analysis.
+Summarizing, then, we assume that most of the methodological work in
+modern linguistics does not affect the structure of the ultimate
+standard that determines the accuracy of any proposed grammar.  It must
+be emphasized, once again, that the systematic use of complex symbols
+is, apparently, determined by the system of base rules exclusive of the
+lexicon.
+		</para>
+		<spacer length="10"/>
+		<para>
+A consequence of the approach just outlined is that the notion of level
+of grammaticalness is not to be considered in determining the system of
+base rules exclusive of the lexicon.  If the position of the trace in
+(99c) were only relatively inaccessible to movement, the systematic use
+of complex symbols appears to correlate rather closely with
+nondistinctness in the sense of distinctive feature theory.  With this
+clarification, the appearance of parasitic gaps in domains relatively
+inaccessible to ordinary extraction is not subject to a parasitic gap
+construction.  Conversely, the systematic use of complex symbols is
+unspecified with respect to a corpus of utterance tokens upon which
+conformity has been defined by the paired utterance test.  In the
+discussion of resumptive pronouns following (81), the earlier discussion
+of deviance does not affect the structure of problems of phonemic and
+morphological analysis.
+		</para>
+	</keepInFrame>
+</story>
+
+</document>

Added: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-031-japanese.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-031-japanese.rml	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-031-japanese.rml	2007-03-16 18:47:44 UTC (rev 73232)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="test_031_japanese.pdf" invariant="1">
+  <docinit>
+    <registerCidFont faceName="HeiseiMin-W3" />
+  </docinit>
+
+<template pageSize="letter" leftMargin="72" showBoundary="1">
+	<pageTemplate id="main" pageSize="(595,842)">
+	<pageGraphics>
+		<setFont name="Helvetica-BoldOblique" size="18"/>
+		<drawRightString x="504" y="800">RML2PDF Test Suite #31 - Japanese Output</drawRightString>
+		<setFont name="HeiseiMin-W3" size="18"/>
+		<drawRightString x="504" y="750">日本語は難しいですね!</drawRightString>
+	</pageGraphics>
+	<frame id="first" x1="1in" y1="1in" width="6in" height="9in"/>
+	</pageTemplate>
+</template>
+
+<stylesheet>
+	<paraStyle name="h1" fontName="Helvetica-Bold" fontSize="32" leading="36"/>
+	<paraStyle name="h2" fontName="Helvetica-Bold" fontSize="16" leading="20" spaceBefore="12"/>
+	<paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12" spaceBefore="6"/>
+	<paraStyle name="jbody" fontName="HeiseiMin-W3" fontSize="10" leading="12" spaceBefore="6" wordWrap="CJK"/>
+	<paraStyle name="jbackright" fontName="HeiseiMin-W3" fontSize="10" leading="12" spaceBefore="6" alignment="RIGHT" backColor="yellow"/>
+
+	<blockTableStyle id="jnumeric">
+		<!--top row - centre and bold, easy-->
+		<blockFont name="HeiseiMin-W3"/>
+		<blockAlignment value="center" start="0,0" stop="-1,0"/>
+		<lineStyle kind="LINEABOVE" colorName="purple" start="0,0" stop="-1,0"/>
+		<lineStyle kind="LINEBELOW" colorName="purple" start="0,0" stop="-1,0"/>
+		<!--numeric region - decimal align and set right padding-->
+		<blockAlignment value="right" start="1,1" stop="-1,-1"/>
+		<!--bottom row - double underline-->
+		<blockFont name="Times-Bold" start="0,-1" stop="-1,-1"/>
+		<lineStyle kind="LINEABOVE" colorName="purple" start="0,-1" stop="-1,-1"/>
+		<lineStyle kind="LINEBELOW" colorName="purple" start="0,-1" stop="-1,-1" count="2"/>
+	</blockTableStyle>
+
+
+</stylesheet>
+
+<story>
+<para style="h1">Japanese Language Tests</para>
+<para style="normal">This test tries to display Japanese characters in several realistic situations.  We'll start with a paragraph:</para>
+
+<para style="h2">Basic output and text alignment</para>
+
+<para style="jbody">says "Hilton Tokyo:" ヒルトン東京</para>
+
+<para style="jbody">Gatwick Name: ヒルトン・ロンドン・ガトウィック・エアポート</para>
+
+
+
+
+<para style="normal">
+The words below the title at the top should be right-aligned with the frame border.
+If not, we've got our string widths wrong.  If too far into the page, likelihood is
+we are counting bytes not characters.  Similar things apply to the paragraph below
+whose Japanese portion should be underlined and right-aligned; if the underline is different in length
+and text does not run to edge, we goofed.
+</para>
+
+<para style="jbackright">begin <u>日本語は難しいですね</u> end</para>
+
+
+<para style="h2">Text wrapping</para>
+
+<para style="jbody">
+Gatwick Description: ガトウィック空港と連絡通路で直結されている唯一のホテルである当ホテルは、街の中心部から30分の場所にございます。全客室に高速インターネット環境を完備しております。ファミリールームは5名様までお泊りいただけます。また、エグゼクティブルームのお客様は、エグゼクティブラウンジをご利用いただけます。事前にご予約いただけるタイムトゥフライ・パッケージには、空港の駐車料金が含まれております。
+</para>
+
+<para style="h2">Other contexts</para>
+
+<para style="normal">There are some other non-paragraph contexts for text display -
+drawing strings directly, and placing strings (not paragraphs) in table cells.  The title
+at the top should have a &#174; symbol at the right, and all three should appear in
+the table below:</para>
+<spacer length="24"/>
+
+<blockTable>
+    <blockTableStyle id="0001">
+	<lineStyle kind="GRID" colorName="black"/>
+	<blockFont name="HeiseiMin-W3"/>
+    </blockTableStyle>
+    <tr><td>Symbol Name</td><td>Displays</td></tr>
+    <tr><td>Copyright</td><td>&#169;</td></tr>
+    <tr><td>Registered</td><td>&#174;</td></tr>
+    <tr><td>Trademark</td><td>&#x2122;</td></tr>
+    <tr><td>Tokyo (as entities)</td><td>&#x6771;&#x4EAC;</td></tr>
+    <tr><td>Tokyo (au naturelle)</td><td>東京</td></tr>
+</blockTable>
+
+
+<para style="h2">Charts</para>
+<para style="normal">Drawing source should be Nikkei</para>
+
+<drawing module="test_014_slidebox" function="SlideBoxDrawing">
+  <param name="SlideBox.sourceLabelFontName">HeiseiMin-W3</param>
+  <param name="SlideBox.sourceLabelText">source: 日本経済新聞</param>
+</drawing>
+
+
+<para style="normal">This should split over the page break onto page two</para>
+
+<para style="jbody">
+ガトウィック空港と連絡通路で直結されている唯一のホテルである当ホテルは、街の中心部から30分の場所にございます。全客室に高速インターネット環境を完備しております。ファミリールームは5名様までお泊りいただけます。また、エグゼクティブルームのお客様は、エグゼクティブラウンジをご利用いただけます。事前にご予約いただけるタイムトゥフライ・パッケージには、空港の駐車料金が含まれております。
+</para> 
+<para style="normal">Text After</para>
+
+
+<para style="h2">Table</para>
+		<blockTable style="jnumeric">
+                       <bulkData><![CDATA[
+日本語は難しいですね!,Profit
+Sprockets,26
+場所,34
+Thingummies,217
+何でも,23
+Total,277
+        ]]></bulkData>
+		</blockTable>
+
+
+
+
+
+</story>
+</document>

Added: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-034-cmyk.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-034-cmyk.rml	2007-03-16 18:37:24 UTC (rev 73231)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-034-cmyk.rml	2007-03-16 18:47:44 UTC (rev 73232)
@@ -0,0 +1,80 @@
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="test_034_cmyk.pdf" invariant="1">
+<docinit>
+	<color id="CMYK_WHITE" RGB="PCMYKColor(100, 100, 100, 0)"/>
+	<color id="CMYK_BLACK" RGB="PCMYKColor(0, 0, 0, 100)"/>
+</docinit>
+
+<template pageSize="letter" leftMargin="72" showBoundary="1">
+	<pageTemplate id="main" pageSize="A4">
+	<pageGraphics>
+		<setFont name="Helvetica-BoldOblique" size="18"/>
+		<drawRightString x="523" y="800">RML2PDF Test Suite</drawRightString>
+		<fill color="[1,0,0,0]"/>
+		<rect x="100" y="600" width="50" height="50" fill="1"/>
+		<fill color="[0,1,0,0]"/>
+		<rect x="200" y="600" width="50" height="50" fill="1"/>
+		<fill color="[0,0,1,0]"/>
+		<rect x="300" y="600" width="50" height="50" fill="1"/>
+		<fill color="PCMYKColor(0,50,85,20,spotName='PANTONE 288 CV')"/>
+		<rect x="400" y="600" width="50" height="50" fill="1"/>
+	</pageGraphics>
+	<frame id="first" x1="1in" y1="3in" width="6.27in" height="3in"/>
+	</pageTemplate>
+</template>
+
+<stylesheet>
+	<paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12" textColor="[0,0,0,1]"/>
+	<paraStyle name="h1" parent="normal" fontName="Helvetica-BoldOblique" fontSize="32" leading="36"/>
+	<paraStyle name="spaced" parent="normal" spaceBefore="12" spaceAfter="12"/>
+</stylesheet>
+
+<story>
+	<para style="normal">This is a test of CMYK support.
+	</para>
+	<para style="normal">The four swatches above should be in the CMYK primaries, and the paragraph carefully
+	declares the text color to be process black (k=1).
+	</para>
+	<spacer length="6"/>
+	<para style="normal">This is cmyk white text on cmyk black rectangle</para>
+	<spacer length="6"/>
+	<illustration height="15" width="144">
+		<setFont name="Helvetica-Bold" size="12"/>
+		<fill color="CMYK_BLACK"/>
+		<rect x="0" y="0" width="144" height="15" fill="yes" stroke="no"/>
+		<fill color="CMYK_WHITE"/>
+		<drawString x="1" y="4">Hello World</drawString>
+	</illustration>
+	<spacer length="6"/>
+	<para style="normal">This is rgb white text on rgb black rectangle</para>
+	<spacer length="6"/>
+	<illustration height="15" width="144">
+		<setFont name="Helvetica-Bold" size="12"/>
+		<fill color="black"/>
+		<rect x="0" y="0" width="144" height="15" fill="yes" stroke="no"/>
+		<fill color="white"/>
+		<drawString x="1" y="4">Hello World</drawString>
+	</illustration>
+	<spacer length="6"/>
+	<para style="normal">This is rgb white text on cmyk black rectangle</para>
+	<spacer length="6"/>
+	<illustration height="15" width="144">
+		<setFont name="Helvetica-Bold" size="12"/>
+		<fill color="CMYK_BLACK"/>
+		<rect x="0" y="0" width="144" height="15" fill="yes" stroke="no"/>
+		<fill color="white"/>
+		<drawString x="1" y="4">Hello World</drawString>
+	</illustration>
+	<spacer length="6"/>
+	<para style="normal">This is cmyk white text on rgb black rectangle</para>
+	<spacer length="6"/>
+	<illustration height="15" width="144">
+		<setFont name="Helvetica-Bold" size="12"/>
+		<fill color="black"/>
+		<rect x="0" y="0" width="144" height="15" fill="yes" stroke="no"/>
+		<fill color="CMYK_WHITE"/>
+		<drawString x="1" y="4">Hello World</drawString>
+	</illustration>
+</story>
+
+</document>



More information about the Checkins mailing list