def visit_moinpage_list(self, elem): attrib = Attributes(elem) attrib_new = attrib.convert() generate = attrib.get('item-label-generate') if generate: if generate == 'ordered': style = attrib.get('list-style-type') if style: if style == 'upper-alpha': attrib_new[html('class')] = 'moin-upperalpha-list' elif style == 'upper-roman': attrib_new[html('class')] = 'moin-upperroman-list' elif style == 'lower-roman': attrib_new[html('class')] = 'moin-lowerroman-list' elif style == 'lower-alpha': attrib_new[html('class')] = 'moin-loweralpha-list' start_number = attrib.get('list-start') if start_number: attrib_new[html('start')] = start_number ret = html.ol(attrib_new) elif generate == 'unordered': style = attrib.get('list-style-type') if style and style == 'no-bullet': attrib_new[html('class')] = 'moin-nobullet-list' ret = html.ul(attrib=attrib_new) else: raise ElementException( 'page:item-label-generate does not support "{0}"'.format( generate)) else: ret = html.dl(attrib=attrib_new) # TODO: ReST parser creates definition list classifiers but they are ignored here. # TODO: An extraneous "<dd></dd>" is created given " object::\n :: desc 1\n :: desc 2\n" -- moinwiki_in error? for item in elem: if isinstance(item, ET.Element): if item.tag.uri == moin_page and item.tag.name == 'list-item': if not generate: for label in item: if isinstance(label, ET.Element): if label.tag.uri == moin_page and label.tag.name == 'list-item-label': ret_label = self.new_copy(html.dt, label) ret.append(ret_label) for body in item: if isinstance(body, ET.Element): if body.tag.uri == moin_page and body.tag.name == 'list-item-body': if generate: ret_body = self.new_copy(html.li, body) else: ret_body = self.new_copy(html.dd, body) ret.append(ret_body) break return ret
def visit_moinpage_list(self, elem): attrib = Attributes(elem) attrib_new = attrib.convert() generate = attrib.get('item-label-generate') if generate: if generate == 'ordered': style = attrib.get('list-style-type') if style: if style == 'upper-alpha': attrib_new[html('class')] = 'moin-upperalpha-list' elif style == 'upper-roman': attrib_new[html('class')] = 'moin-upperroman-list' elif style == 'lower-roman': attrib_new[html('class')] = 'moin-lowerroman-list' elif style == 'lower-alpha': attrib_new[html('class')] = 'moin-loweralpha-list' start_number = attrib.get('list-start') if start_number: attrib_new[html('start')] = start_number ret = html.ol(attrib_new) elif generate == 'unordered': style = attrib.get('list-style-type') if style and style == 'no-bullet': attrib_new[html('class')] = 'moin-nobullet-list' ret = html.ul(attrib=attrib_new) else: raise ElementException('page:item-label-generate does not support "{0}"'.format(generate)) else: ret = html.dl(attrib=attrib_new) # TODO: ReST parser creates definition list classifiers but they are ignored here. # TODO: An extraneous "<dd></dd>" is created given " object::\n :: desc 1\n :: desc 2\n" -- moinwiki_in error? for item in elem: if isinstance(item, ET.Element): if item.tag.uri == moin_page and item.tag.name == 'list-item': if not generate: for label in item: if isinstance(label, ET.Element): if label.tag.uri == moin_page and label.tag.name == 'list-item-label': ret_label = self.new_copy(html.dt, label) ret.append(ret_label) for body in item: if isinstance(body, ET.Element): if body.tag.uri == moin_page and body.tag.name == 'list-item-body': if generate: ret_body = self.new_copy(html.li, body) else: ret_body = self.new_copy(html.dd, body) ret.append(ret_body) break return ret
def visit_moinpage_list(self, elem): attrib = Attributes(elem) attrib_new = attrib.convert() generate = attrib.get('item-label-generate') if generate: if generate == 'ordered': style = attrib.get('list-style-type') if style: if style == 'upper-alpha': attrib_new[html('class')] = 'moin-upperalpha-list' elif style == 'upper-roman': attrib_new[html('class')] = 'moin-upperroman-list' elif style == 'lower-roman': attrib_new[html('class')] = 'moin-lowerroman-list' elif style == 'lower-alpha': attrib_new[html('class')] = 'moin-loweralpha-list' start_number = attrib.get('list-start') if start_number: attrib_new[html('start')] = start_number ret = html.ol(attrib_new) elif generate == 'unordered': style = attrib.get('list-style-type') if style and style == 'no-bullet': attrib_new[html('class')] = 'moin-nobullet-list' ret = html.ul(attrib=attrib_new) else: raise ElementException( 'page:item-label-generate does not support "{0}"'.format( generate)) else: ret = html.dl(attrib=attrib_new) for item in elem: if isinstance(item, ET.Element): if item.tag.uri == moin_page and item.tag.name == 'list-item': if not generate: for label in item: if isinstance(label, ET.Element): if label.tag.uri == moin_page and label.tag.name == 'list-item-label': ret_label = self.new_copy(html.dt, label) ret.append(ret_label) for body in item: if isinstance(body, ET.Element): if body.tag.uri == moin_page and body.tag.name == 'list-item-body': if generate: ret_body = self.new_copy(html.li, body) else: ret_body = self.new_copy(html.dd, body) ret.append(ret_body) break return ret
def visit_moinpage_list(self, elem): attrib = Attributes(elem) attrib_new = attrib.convert() generate = attrib.get('item-label-generate') if generate: if generate == 'ordered': style = attrib.get('list-style-type') if style: if style == 'upper-alpha': attrib_new[html('class')] = 'moin-upperalpha-list' elif style == 'upper-roman': attrib_new[html('class')] = 'moin-upperroman-list' elif style == 'lower-roman': attrib_new[html('class')] = 'moin-lowerroman-list' elif style == 'lower-alpha': attrib_new[html('class')] = 'moin-loweralpha-list' start_number = attrib.get('list-start') if start_number: attrib_new[html('start')] = start_number ret = html.ol(attrib_new) elif generate == 'unordered': style = attrib.get('list-style-type') if style and style == 'no-bullet': attrib_new[html('class')] = 'moin-nobullet-list' ret = html.ul(attrib=attrib_new) else: raise ElementException('page:item-label-generate does not support "{0}"'.format(generate)) else: ret = html.dl(attrib=attrib_new) for item in elem: if isinstance(item, ET.Element): if item.tag.uri == moin_page and item.tag.name == 'list-item': if not generate: for label in item: if isinstance(label, ET.Element): if label.tag.uri == moin_page and label.tag.name == 'list-item-label': ret_label = self.new_copy(html.dt, label) ret.append(ret_label) for body in item: if isinstance(body, ET.Element): if body.tag.uri == moin_page and body.tag.name == 'list-item-body': if generate: ret_body = self.new_copy(html.li, body) else: ret_body = self.new_copy(html.dd, body) ret.append(ret_body) break return ret
def visit_moinpage_list(self, elem): attrib = Attributes(elem) attrib_new = attrib.convert() generate = attrib.get("item-label-generate") if generate: if generate == "ordered": style = attrib.get("list-style-type") if style: if style == "upper-alpha": attrib_new[html("class")] = "moin-upperalpha-list" elif style == "upper-roman": attrib_new[html("class")] = "moin-upperroman-list" elif style == "lower-roman": attrib_new[html("class")] = "moin-lowerroman-list" elif style == "lower-alpha": attrib_new[html("class")] = "moin-loweralpha-list" start_number = attrib.get("list-start") if start_number: attrib_new[html("start")] = start_number ret = html.ol(attrib_new) elif generate == "unordered": style = attrib.get("list-style-type") if style and style == "no-bullet": attrib_new[html("class")] = "moin-nobullet-list" ret = html.ul(attrib=attrib_new) else: raise ElementException('page:item-label-generate does not support "{0}"'.format(generate)) else: ret = html.dl(attrib=attrib_new) for item in elem: if isinstance(item, ET.Element): if item.tag.uri == moin_page and item.tag.name == "list-item": if not generate: for label in item: if isinstance(label, ET.Element): if label.tag.uri == moin_page and label.tag.name == "list-item-label": ret_label = self.new_copy(html.dt, label) ret.append(ret_label) for body in item: if isinstance(body, ET.Element): if body.tag.uri == moin_page and body.tag.name == "list-item-body": if generate: ret_body = self.new_copy(html.li, body) else: ret_body = self.new_copy(html.dd, body) ret.append(ret_body) break return ret