Beispiel #1
0
class Element(Node):
    tag = cobble.field()
    children = cobble.field()

    @property
    def tag_name(self):
        return self.tag.tag_name

    @property
    def tag_names(self):
        return self.tag.tag_names

    @property
    def attributes(self):
        return self.tag.attributes

    @property
    def collapsible(self):
        return self.tag.collapsible

    @property
    def separator(self):
        return self.tag.separator

    _VOID_TAG_NAMES = set(["br", "hr", "img"])

    def is_void(self):
        return not self.children and self.tag_name in self._VOID_TAG_NAMES
Beispiel #2
0
class Tag(object):
    tag_names = cobble.field()
    attributes = cobble.field()
    collapsible = cobble.field()
    separator = cobble.field()

    @property
    def tag_name(self):
        return self.tag_names[0]
class Run(HasChildren):
    style_id = cobble.field()
    style_name = cobble.field()
    is_bold = cobble.field()
    is_italic = cobble.field()
    is_underline = cobble.field()
    is_strikethrough = cobble.field()
    is_small_caps = cobble.field()
    vertical_alignment = cobble.field()
    font = cobble.field()
Beispiel #4
0
class XmlElement(object):
    name = cobble.field()
    attributes = cobble.field()
    children = cobble.field()

    def find_child_or_null(self, name):
        return self.find_child(name) or _null_xml_element

    def find_child(self, name):
        for child in self.children:
            if isinstance(child, XmlElement) and child.name == name:
                return child

    def find_children(self, name):
        return XmlElementList(
            filter(
                lambda child: child.node_type == node_types.element and child.
                name == name, self.children))
Beispiel #5
0
class HtmlPathElement(object):
    tag = cobble.field()

    def wrap(self, generate_nodes):
        return self.wrap_nodes(generate_nodes())

    def wrap_nodes(self, nodes):
        element = html.Element(self.tag, nodes)
        return [element]
Beispiel #6
0
class HtmlPath(object):
    elements = cobble.field()

    def wrap(self, generate_nodes):
        nodes = generate_nodes()

        for element in reversed(self.elements):
            nodes = element.wrap_nodes(nodes)

        return nodes
class _PartPaths(object):
    main_document = cobble.field()
    comments = cobble.field()
    endnotes = cobble.field()
    footnotes = cobble.field()
    numbering = cobble.field()
    styles = cobble.field()
class HasChildren(Element):
    children = cobble.field()
class TableCell(HasChildren):
    colspan = cobble.field()
    rowspan = cobble.field()
class _NumberingLevel(object):
    level_index = cobble.field()
    is_ordered = cobble.field()
class TableRow(HasChildren):
    is_header = cobble.field()
class _Num(object):
    abstract_num_id = cobble.field()
Beispiel #13
0
class _ConversionContext(object):
    is_table_header = cobble.field()

    def copy(self, **kwargs):
        return cobble.copy(self, **kwargs)
class Indent(object):
    left = cobble.field()
    right = cobble.field()
    first_line = cobble.field()
    hanging = cobble.field()
class Document(HasChildren):
    notes = cobble.field()
    comments = cobble.field()
class ParagraphIndent(object):
    start = cobble.field()
    end = cobble.field()
    first_line = cobble.field()
    hanging = cobble.field()
class CommentReference(Element):
    comment_id = cobble.field()
class Comment(object):
    comment_id = cobble.field()
    body = cobble.field()
    author_name = cobble.field()
    author_initials = cobble.field()
class NoteReference(Element):
    note_type = cobble.field()
    note_id = cobble.field()
class Note(Element):
    note_type = cobble.field()
    note_id = cobble.field()
    body = cobble.field()
class Break(Element):
    break_type = cobble.field()
class Paragraph(HasChildren):
    style_id = cobble.field()
    style_name = cobble.field()
    numbering = cobble.field()
    alignment = cobble.field()
    indent = cobble.field()
Beispiel #23
0
class XmlText(object):
    value = cobble.field()
class Text(Element):
    value = cobble.field()
class _AbstractNum(object):
    levels = cobble.field()
    num_style_link = cobble.field()
class Hyperlink(HasChildren):
    href = cobble.field()
    anchor = cobble.field()
    target_frame = cobble.field()
class Image(Element):
    alt_text = cobble.field()
    title_text = cobble.field()
    content_type = cobble.field()
    open = cobble.field()
class Table(HasChildren):
    style_id = cobble.field()
    style_name = cobble.field()
Beispiel #29
0
class TextNode(Node):
    value = cobble.field()
class Bookmark(Element):
    name = cobble.field()