예제 #1
0
 def build_dom_table(self, rows, head=None, cls=None):
     """
     Build a DOM table with data from <rows>.
     """
     table = moin_page.table()
     if cls is not None:
         table.attrib[moin_page('class')] = cls
     if head is not None:
         table_head = moin_page.table_header()
         table_row = moin_page.table_row()
         for idx, cell in enumerate(head):
             table_cell = moin_page.table_cell(children=[cell, ],)
             if rows:
                 # add "align: right" to heading cell if cell in first data row is numeric
                 self.add_numeric_class(rows[0][idx], table_cell)
             table_row.append(table_cell)
         table_head.append(table_row)
         table.append(table_head)
     table_body = moin_page.table_body()
     for row in rows:
         table_row = moin_page.table_row()
         for cell in row:
             if isinstance(cell, ET.Node) and isinstance(cell[0], unicode) and \
                 len(cell[0].split()) == 1 and len(cell[0]) > WORDBREAK_LEN:
                 # avoid destroying table layout by applying special styling to cells with long file name hyperlinks
                 table_cell = moin_page.table_cell(children=[cell, ], attrib={moin_page.class_: 'moin-wordbreak'})
             else:
                 table_cell = moin_page.table_cell(children=[cell, ],)
                 self.add_numeric_class(cell, table_cell)
             table_row.append(table_cell)
         table_body.append(table_row)
     table.append(table_body)
     return table
예제 #2
0
    def macro(self):
        request = self.request

        groups = []
        for groupname in defaultconfig.options:
            groups.append((groupname, True, defaultconfig.options))
        for groupname in defaultconfig.options_no_group_name:
            groups.append(
                (groupname, False, defaultconfig.options_no_group_name))
        groups.sort()

        result = moin_page.div()

        for groupname, addgroup, optsdict in groups:
            heading, desc, opts = optsdict[groupname]
            result.append(
                moin_page.h(attrib={moin_page.outline_level: '1'},
                            children=[heading]))
            if desc:
                result.append(moin_page.p(children=[desc]))
            table = moin_page.table()
            result.append(table)

            header = moin_page.table_header()
            table.append(header)

            row = moin_page.table_row()
            header.append(row)
            for text in [
                    _('Variable name'),
                    _('Default'),
                    _('Description'),
            ]:
                strong_text = moin_page.strong(children=[text])
                row.append(moin_page.table_cell(children=[strong_text]))

            body = moin_page.table_body()
            table.append(body)

            opts = list(opts)
            opts.sort()
            for name, default, description in opts:
                if addgroup:
                    name = groupname + '_' + name
                if isinstance(default, defaultconfig.DefaultExpression):
                    default_txt = default.text
                else:
                    default_txt = '%r' % (default, )
                    if len(default_txt) > 30:
                        default_txt = moin_page.span(
                            attrib={moin_page.title: default_txt},
                            children=['...'])
                    description = _(description or '')
                row = moin_page.table_row()
                body.append(row)
                row.append(moin_page.table_cell(children=[name]))
                default = moin_page.code(children=[default_txt])
                row.append(moin_page.table_cell(children=[default]))
                row.append(moin_page.table_cell(children=[description]))
        return result
예제 #3
0
 def visit_version(self, node):
     self.open_moin_page_node(moin_page.table_row())
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     # TODO: i18n for docutils:
     self.open_moin_page_node(u"Version:")
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.open_moin_page_node(moin_page.table_cell())
예제 #4
0
 def visit_author(self, node):
     self.open_moin_page_node(moin_page.table_row())
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     # TODO: i18n for docutils:
     self.open_moin_page_node(u"Author:")
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.open_moin_page_node(moin_page.table_cell())
예제 #5
0
 def visit_version(self, node):
     self.open_moin_page_node(moin_page.table_row())
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     # TODO: i18n for docutils:
     self.open_moin_page_node(u"Version:")
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.open_moin_page_node(moin_page.table_cell())
예제 #6
0
 def visit_copyright(self, node):
     self.open_moin_page_node(moin_page.table_row())
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     # TODO: i18n for docutils:
     self.open_moin_page_node(u"Copyright:")
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.open_moin_page_node(moin_page.table_cell())
예제 #7
0
 def visit_author(self, node):
     self.open_moin_page_node(moin_page.table_row())
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     # TODO: i18n for docutils:
     self.open_moin_page_node(u"Author:")
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.open_moin_page_node(moin_page.table_cell())
예제 #8
0
 def visit_copyright(self, node):
     self.open_moin_page_node(moin_page.table_row())
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     # TODO: i18n for docutils:
     self.open_moin_page_node(u"Copyright:")
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.close_moin_page_node()
     self.open_moin_page_node(moin_page.table_cell())
예제 #9
0
    def tablerow_cell_repl(self, stack, cell, cell_text, cell_head=None):
        element = moin_page.table_cell()
        stack.push(element)

        # TODO: support table headings
        self.parse_inline(cell_text, stack)

        stack.pop_name("table-cell")
예제 #10
0
    def tablerow_cell_repl(self, stack, cell, cell_text, cell_head=None):
        element = moin_page.table_cell()
        stack.push(element)

        # TODO: How to handle table headings
        self.parse_inline(cell_text, stack)

        stack.pop_name('table-cell')
예제 #11
0
    def block_table_repl(self, iter_content, stack, table, table_args=''):
        stack.clear()
        # TODO: table attributes
        elem = moin_page.table()
        stack.push(elem)
        if table_args:
            table_args = _TableArguments()(table_args)
            for key, value in table_args.keyword.iteritems():
                attrib = elem.attrib
                if key in ('class', 'style', 'number-columns-spanned',
                           'number-rows-spanned'):
                    attrib[moin_page(key)] = value

        element = moin_page.table_body()
        stack.push(element)
        lines = _Iter(self.block_table_lines(iter_content),
                      startno=iter_content.lineno)
        element = moin_page.table_row()
        stack.push(element)
        preprocessor_status = []
        for line in lines:
            m = self.tablerow_re.match(line)
            if not m:
                return
            if m.group('newrow'):
                stack.pop_name('table-row')
                element = moin_page.table_row()
                stack.push(element)
            cells = m.group('cells')
            if cells:
                cells = cells.split('||')
                for cell in cells:
                    if stack.top_check('table-cell'):
                        stack.pop()

                    cell = re.split(r'\s*\|\s*', cell)
                    element = moin_page.table_cell()
                    if len(cell) > 1:
                        cell_args = _TableArguments()(cell[0])
                        for key, value in cell_args.keyword.iteritems():
                            attrib = element.attrib
                            if key in ('class', 'style',
                                       'number-columns-spanned',
                                       'number-rows-spanned'):
                                attrib[moin_page(key)] = value
                        cell = cell[1]
                    else:
                        cell = cell[0]
                    stack.push(element)
                    self.preprocessor.push()
                    self.parse_inline(cell, stack, self.inline_re)
                    preprocessor_status = self.preprocessor.pop()
            elif m.group('text'):
                self.preprocessor.push(preprocessor_status)
                self.parse_inline('\n{0}'.format(m.group('text')), stack,
                                  self.inline_re)
                preprocessor_status = self.preprocessor.pop()
        stack.pop_name('table')
예제 #12
0
 def build_dom_table(self, rows, head=None, cls=None):
     """
     Build a DOM table with data from <rows>.
     """
     table = moin_page.table()
     if cls is not None:
         table.attrib[moin_page('class')] = cls
     if head is not None:
         table_head = moin_page.table_header()
         table_row = moin_page.table_row()
         for idx, cell in enumerate(head):
             table_cell = moin_page.table_cell(children=[
                 cell,
             ], )
             if rows and len(rows[0]) == len(head):
                 # add "align: right" to heading cell if cell in first data row is numeric
                 self.add_numeric_class(rows[0][idx], table_cell)
             table_row.append(table_cell)
         table_head.append(table_row)
         table.append(table_head)
     table_body = moin_page.table_body()
     for row in rows:
         table_row = moin_page.table_row()
         for cell in row:
             if isinstance(cell, ET.Node) and len(cell) and isinstance(cell[0], unicode) and \
                 len(cell[0].split()) == 1 and len(cell[0]) > WORDBREAK_LEN:
                 # avoid destroying table layout by applying special styling to cells with long file name hyperlinks
                 table_cell = moin_page.table_cell(
                     children=[
                         cell,
                     ],
                     attrib={moin_page.class_: 'moin-wordbreak'})
             elif isinstance(cell, ET.Node):
                 table_cell = moin_page.table_cell(children=[
                     cell,
                 ])
             else:
                 table_cell = moin_page.table_cell(children=[
                     cell,
                 ], )
                 self.add_numeric_class(cell, table_cell)
             table_row.append(table_cell)
         table_body.append(table_row)
     table.append(table_body)
     return table
예제 #13
0
 def visit_entry(self, node):
     new_element = moin_page.table_cell()
     if 'morerows' in node.attributes:
         new_element.set(moin_page.number_rows_spanned,
                         repr(int(node['morerows']) + 1))
     if 'morecols' in node.attributes:
         new_element.set(moin_page.number_cols_spanned,
                         repr(int(node['morecols']) + 1))
     self.open_moin_page_node(new_element)
예제 #14
0
 def visit_entry(self, node):
     new_element = moin_page.table_cell()
     if 'morerows' in node.attributes:
         new_element.set(moin_page.number_rows_spanned,
                         repr(int(node['morerows']) + 1))
     if 'morecols' in node.attributes:
         new_element.set(moin_page.number_cols_spanned,
                         repr(int(node['morecols']) + 1))
     self.open_moin_page_node(new_element)
예제 #15
0
    def block_table_repl(self, iter_content, stack, table, table_args=""):
        stack.clear()
        # TODO: table attributes
        elem = moin_page.table()
        stack.push(elem)
        if table_args:
            table_args = _TableArguments()(table_args)
            for key, value in table_args.keyword.iteritems():
                attrib = elem.attrib
                if key in ("class", "style", "number-columns-spanned", "number-rows-spanned"):
                    attrib[moin_page(key)] = value

        element = moin_page.table_body()
        stack.push(element)
        lines = _Iter(self.block_table_lines(iter_content))
        element = moin_page.table_row()
        stack.push(element)
        preprocessor_status = []
        for line in lines:
            m = self.tablerow_re.match(line)
            if not m:
                return
            if m.group("newrow"):
                stack.pop_name("table-row")
                element = moin_page.table_row()
                stack.push(element)
            cells = m.group("cells")
            if cells:
                cells = cells.split("||")
                for cell in cells:
                    if stack.top_check("table-cell"):
                        stack.pop()

                    cell = re.split(r"\s*\|\s*", cell)
                    element = moin_page.table_cell()
                    if len(cell) > 1:
                        cell_args = _TableArguments()(cell[0])
                        for key, value in cell_args.keyword.iteritems():
                            attrib = element.attrib
                            if key in ("class", "style", "number-columns-spanned", "number-rows-spanned"):
                                attrib[moin_page(key)] = value
                        cell = cell[1]
                    else:
                        cell = cell[0]
                    stack.push(element)
                    self.preprocessor.push()
                    self.parse_inline(cell, stack, self.inline_re)
                    preprocessor_status = self.preprocessor.pop()
            elif m.group("text"):
                self.preprocessor.push(preprocessor_status)
                self.parse_inline("\n{0}".format(m.group("text")), stack, self.inline_re)
                preprocessor_status = self.preprocessor.pop()
        stack.pop_name("table")
예제 #16
0
    def block_table_repl(self, iter_content, stack, table, table_args=''):
        stack.clear()
        # TODO: table attributes
        elem = moin_page.table()
        stack.push(elem)
        if table_args:
            table_args = _TableArguments()(table_args)
            for key, value in table_args.keyword.iteritems():
                attrib = elem.attrib
                if key in ('class', 'style', 'number-columns-spanned', 'number-rows-spanned'):
                    attrib[moin_page(key)] = value

        element = moin_page.table_body()
        stack.push(element)
        lines = _Iter(self.block_table_lines(iter_content), startno=iter_content.lineno)
        element = moin_page.table_row()
        stack.push(element)
        preprocessor_status = []
        for line in lines:
            m = self.tablerow_re.match(line)
            if not m:
                return
            if m.group('newrow'):
                stack.pop_name('table-row')
                element = moin_page.table_row()
                stack.push(element)
            cells = m.group('cells')
            if cells:
                cells = cells.split('||')
                for cell in cells:
                    if stack.top_check('table-cell'):
                        stack.pop()

                    cell = re.split(r'\s*\|\s*', cell)
                    element = moin_page.table_cell()
                    if len(cell) > 1:
                        cell_args = _TableArguments()(cell[0])
                        for key, value in cell_args.keyword.iteritems():
                            attrib = element.attrib
                            if key in ('class', 'style', 'number-columns-spanned', 'number-rows-spanned'):
                                attrib[moin_page(key)] = value
                        cell = cell[1]
                    else:
                        cell = cell[0]
                    stack.push(element)
                    self.preprocessor.push()
                    self.parse_inline(cell, stack, self.inline_re)
                    preprocessor_status = self.preprocessor.pop()
            elif m.group('text'):
                self.preprocessor.push(preprocessor_status)
                self.parse_inline('\n{0}'.format(m.group('text')), stack, self.inline_re)
                preprocessor_status = self.preprocessor.pop()
        stack.pop_name('table')
예제 #17
0
 def build_dom_table(self, rows):
     """
     Build a DOM table with data from <rows>.
     """
     table_body = moin_page.table_body()
     for row in rows:
         table_row = moin_page.table_row()
         for cell in row:
             table_cell = moin_page.table_cell(children=[cell, ])
             table_row.append(table_cell)
         table_body.append(table_row)
     return moin_page.table(children=[table_body, ])
예제 #18
0
    def tablerow_cell_repl(self, stack, cell, cell_text, cell_head=None):
        """
        Creole has feature that allows table headings to be either row based or column based.

        We avoid use of HTML5 row based thead tag and apply CSS styling to any cell marked as a heading.
        """
        attrib = {}
        if cell_head:
            attrib[moin_page.class_] = 'moin-thead'
        element = moin_page.table_cell(attrib=attrib)
        stack.push(element)
        self.parse_inline(cell_text, stack)
        stack.pop_name('table-cell')
예제 #19
0
    def tablerow_cell_repl(self, stack, cell, cell_text, cell_head=None):
        """
        Creole has feature that allows table headings to be either row based or column based.

        We avoid use of HTML5 row based thead tag and apply CSS styling to any cell marked as a heading.
        """
        attrib = {}
        if cell_head:
            attrib[moin_page.class_] = 'moin-thead'
        element = moin_page.table_cell(attrib=attrib)
        stack.push(element)
        self.parse_inline(cell_text, stack)
        stack.pop_name('table-cell')
예제 #20
0
파일: _table.py 프로젝트: pombredanne/moin2
 def build_dom_table(self, rows, head=None, cls=None):
     """
     Build a DOM table with data from <rows>.
     """
     table = moin_page.table()
     if cls is not None:
         table.attrib[moin_page('class')] = cls
     if head is not None:
         table_head = moin_page.table_header()
         table_row = moin_page.table_row()
         for cell in head:
             table_cell = moin_page.table_cell(children=[cell, ])
             table_row.append(table_cell)
         table_head.append(table_row)
         table.append(table_head)
     table_body = moin_page.table_body()
     for row in rows:
         table_row = moin_page.table_row()
         for cell in row:
             table_cell = moin_page.table_cell(children=[cell, ])
             table_row.append(table_cell)
         table_body.append(table_row)
     table.append(table_body)
     return table
예제 #21
0
 def visit_field_name(self, node):
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     self.open_moin_page_node(u'%s:' % node.astext())
     node.children = []
     self.close_moin_page_node()
예제 #22
0
    def macro(self):
        if not flaskg.user or not flaskg.user.isSuperUser():
            return ''

        settings = {}
        for groupname in defaultconfig.options:
            heading, desc, opts = defaultconfig.options[groupname]
            for name, default, description in opts:
                name = groupname + '_' + name
                if isinstance(default, defaultconfig.DefaultExpression):
                    default = default.value
                settings[name] = default
        for groupname in defaultconfig.options_no_group_name:
            heading, desc, opts = defaultconfig.options_no_group_name[
                groupname]
            for name, default, description in opts:
                if isinstance(default, defaultconfig.DefaultExpression):
                    default = default.value
                settings[name] = default

        result = moin_page.div()

        result.append(
            moin_page.h(attrib={moin_page.outline_level: '1'},
                        children=[_("Wiki configuration")]))

        desc = _(
            "This table shows all settings in this wiki that do not have default values. "
            "Settings that the configuration system doesn't know about are shown in italic, "
            "those may be due to third-party extensions needing configuration or settings that "
            "were removed from Moin.")
        result.append(moin_page.p(children=[desc]))

        table = moin_page.table()
        result.append(table)

        header = moin_page.table_header()
        table.append(header)

        row = moin_page.table_row()
        header.append(row)
        for text in [
                _('Variable name'),
                _('Setting'),
        ]:
            strong_text = moin_page.strong(children=[text])
            row.append(moin_page.table_cell(children=[strong_text]))

        body = moin_page.table_body()
        table.append(body)

        def iter_vnames(cfg):
            dedup = {}
            for name in cfg.__dict__:
                dedup[name] = True
                yield name, cfg.__dict__[name]
            for cls in cfg.__class__.mro():
                if cls == defaultconfig.ConfigFunctionality:
                    break
                for name in cls.__dict__:
                    if not name in dedup:
                        dedup[name] = True
                        yield name, cls.__dict__[name]

        found = []
        for vname, value in iter_vnames(app.cfg):
            if hasattr(defaultconfig.ConfigFunctionality, vname):
                continue
            if vname in settings and settings[vname] == value:
                continue
            found.append((vname, value))

        found.sort()
        for vname, value in found:
            if not vname in settings:
                vname = moin_page.emphasis(children=[vname])
            vtxt = '%r' % (value, )
            row = moin_page.table_row()
            body.append(row)
            row.append(moin_page.table_cell(children=[vname]))
            vtxt_code = moin_page.code(children=[vtxt])
            row.append(moin_page.table_cell(children=[vtxt_code]))
        return result
예제 #23
0
    def tablerow_cell_repl(self, stack, table, row, cell, cell_marker, cell_text, cell_args=None):

        def add_attr_to_style(attrib, attr):
            attr = attr.strip().decode('unicode-escape')
            if not attr.endswith(';'):
                attr += ';'
            if attrib.get(moin_page('style'), ""):
                attrib[moin_page('style')] = attrib.get(moin_page('style'), "") + " " + attr
            else:
                attrib[moin_page('style')] = attr

        element = moin_page.table_cell()
        stack.push(element)

        if len(cell_marker) // 2 > 1:
            element.set(moin_page.number_columns_spanned, len(cell_marker) // 2)

        if cell_args:
            cell_args = _TableArguments()(cell_args)
            no_errors = True

            # any positional parameters will be errors;  retrieved as (key=None, value="some-positional-param");
            for key, value in cell_args.items():
                if key == 'bgcolor':
                    if no_errors:
                        # avoid overriding error highlighting
                        add_attr_to_style(element.attrib, 'background-color: {0};'.format(value))
                elif key == 'rowbgcolor':
                    add_attr_to_style(row.attrib, 'background-color: {0};'.format(value))
                elif key == 'tablebgcolor':
                    add_attr_to_style(table.attrib, 'background-color: {0};'.format(value))
                elif key == 'width':
                    add_attr_to_style(element.attrib, 'width: {0};'.format(value))
                elif key == 'tablewidth':
                    add_attr_to_style(table.attrib, 'width: {0};'.format(value))
                elif key == 'tableclass':
                    table.attrib[moin_page('class')] = value
                elif key == 'rowclass':
                    row.attrib[moin_page('class')] = value
                elif key == 'class':
                    element.attrib[moin_page('class')] = value
                elif key == 'tablestyle':
                    add_attr_to_style(table.attrib, value)
                elif key == 'rowstyle':
                    add_attr_to_style(row.attrib, value)
                elif key == 'style':
                    if no_errors:
                        add_attr_to_style(element.attrib, value)
                elif key == 'tableid':
                    table.attrib[moin_page('id')] = value
                elif key == 'rowid':
                    row.attrib[moin_page('id')] = value
                elif key == 'id':
                    element.attrib[moin_page('id')] = value
                elif key == 'number-columns-spanned':
                    element.attrib[moin_page(key)] = value
                elif key == 'number-rows-spanned':
                    element.attrib[moin_page(key)] = value
                else:
                    if key == 'error' or key is None:
                        error = value
                    else:
                        error = key
                    cell_markup = cell.split('>')[0]
                    cell_markup = cell_markup.split('<')[1]
                    msg1 = _('Error:')
                    msg2 = _('is invalid within')
                    cell_text = '[ {0} "{1}" {2} <{3}>&nbsp;]<<BR>>{4}'.format(
                        msg1, error, msg2, cell_markup, cell_text)
                    if no_errors:
                        add_attr_to_style(element.attrib, 'background-color: pink; color: black;')
                    no_errors = False

        self.parse_inline(cell_text, stack, self.inline_re)

        stack.pop_name('table-cell')
예제 #24
0
 def visit_field_body(self, node):
     self.open_moin_page_node(moin_page.table_cell())
예제 #25
0
 def visit_field_body(self, node):
     self.open_moin_page_node(moin_page.table_cell())
예제 #26
0
 def visit_field_name(self, node):
     self.open_moin_page_node(moin_page.table_cell())
     self.open_moin_page_node(moin_page.strong())
     self.open_moin_page_node(u'{0}:'.format(node.astext()))
     node.children = []
     self.close_moin_page_node()
예제 #27
0
    def tablerow_cell_repl(self, stack, table, row, cell, cell_marker, cell_text, cell_args=None):

        def add_attr_to_style(attrib, attr):
            attr = attr.strip().decode('unicode-escape')
            if not attr.endswith(';'):
                attr += ';'
            if attrib.get(moin_page('style'), ""):
                attrib[moin_page('style')] = attrib.get(moin_page('style'), "") + " " + attr
            else:
                attrib[moin_page('style')] = attr

        element = moin_page.table_cell()
        stack.push(element)

        if len(cell_marker) // 2 > 1:
            element.set(moin_page.number_columns_spanned, len(cell_marker) // 2)

        if cell_args:
            cell_args = _TableArguments()(cell_args)
            no_errors = True

            # any positional parameters will be errors;  retrieved as (key=None, value="some-positional-param");
            for key, value in cell_args.items():
                if key == 'bgcolor':
                    if no_errors:
                        # avoid overriding error highlighting
                        add_attr_to_style(element.attrib, 'background-color: {0};'.format(value))
                elif key == 'rowbgcolor':
                    add_attr_to_style(row.attrib, 'background-color: {0};'.format(value))
                elif key == 'tablebgcolor':
                    add_attr_to_style(table.attrib, 'background-color: {0};'.format(value))
                elif key == 'width':
                    add_attr_to_style(element.attrib, 'width: {0};'.format(value))
                elif key == 'tablewidth':
                    add_attr_to_style(table.attrib, 'width: {0};'.format(value))
                elif key == 'caption':
                    table.insert(0, moin_page.caption(children=[value, ]))
                elif key == 'tableclass':
                    table.attrib[moin_page('class')] = value + u' moin-wiki-table'
                elif key == 'rowclass':
                    row.attrib[moin_page('class')] = value
                elif key == 'class':
                    element.attrib[moin_page('class')] = value
                elif key == 'tablestyle':
                    add_attr_to_style(table.attrib, value)
                elif key == 'rowstyle':
                    add_attr_to_style(row.attrib, value)
                elif key == 'style':
                    if no_errors:
                        add_attr_to_style(element.attrib, value)
                elif key == 'tableid':
                    table.attrib[moin_page('id')] = value
                elif key == 'rowid':
                    row.attrib[moin_page('id')] = value
                elif key == 'id':
                    element.attrib[moin_page('id')] = value
                elif key == 'number-columns-spanned':
                    element.attrib[moin_page(key)] = value
                elif key == 'number-rows-spanned':
                    element.attrib[moin_page(key)] = value
                else:
                    if key == 'error' or key is None:
                        error = value
                    else:
                        error = key
                    cell_markup = cell.split('>')[0]
                    cell_markup = cell_markup.split('<')[1]
                    msg1 = _('Error:')
                    msg2 = _('is invalid within')
                    cell_text = '[ {0} "{1}" {2} <{3}>&nbsp;]<<BR>>{4}'.format(
                        msg1, error, msg2, cell_markup, cell_text)
                    if no_errors:
                        add_attr_to_style(element.attrib, 'background-color: pink; color: black;')
                    no_errors = False

        self.parse_inline(cell_text, stack, self.inline_re)

        stack.pop_name('table-cell')
예제 #28
0
 def visit_option(self, node):
     self.open_moin_page_node(moin_page.table_cell())