Пример #1
0
    def on_enter_attributes(self, text, content):
        self.parser = attributes_parser
        if isinstance(content, int):
            if text is not None and len(text):
                attribute = Attribute.create_from_paragraph(
                    content, self._paragraphs[content])
                if attribute is not None:
                    self.attributes.add(attribute)

                last = self.attributes[-1] if len(self.attributes) else None
                if last is None:
                    raise KeyError(
                        'Unable to decode initial attribute: class_id: {}'.
                        format(self))

                last.parse_attribute_settings_from_text(
                    content, self._paragraphs[content])
        elif isinstance(content, Table):
            last = self.attributes[-1] if len(self.attributes) else None
            if last is None:
                raise KeyError(
                    'Unable to decode initial attribute: class_id: {}'.format(
                        self))

            last.parse_attribute_settings_from_text(content, None)