to-wiki/wikiconv2.py | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-)
New commits: commit 7e67bfc7ab1f013826154d1fef66cbcfc3d92892 Author: Andras Timar <[email protected]> Date: Sun Apr 5 19:28:57 2015 +0200 wikihelp: support note/tip/warning in table cells Change-Id: Ib70a16166e73ef3ffcff09588ea8fb93523cee17 diff --git a/to-wiki/wikiconv2.py b/to-wiki/wikiconv2.py index 48143f1..a04e2da 100755 --- a/to-wiki/wikiconv2.py +++ b/to-wiki/wikiconv2.py @@ -52,9 +52,15 @@ replace_paragraph_role = \ 'sup' : '', 'tablecontent': '| | ', 'tablecontentcode': '| | <code>', + 'tablecontentnote': '| |{{Note|', + 'tablecontenttip': '| |{{Tip|', + 'tablecontentwarning': '| |{{Warning|', 'tablehead': '! scope="col" | ', + 'tablenextnote': '\n{{Note|', 'tablenextpara': '\n', 'tablenextparacode': '\n<code>', + 'tablenexttip': '\n{{Tip|', + 'tablenextwarning': '\n{{Warning|', 'tip': '{{Tip|', 'variable': '', 'warning': '{{Warning|', @@ -82,9 +88,15 @@ replace_paragraph_role = \ 'sup' : '', 'tablecontent': '\n', 'tablecontentcode': '</code>\n', + 'tablecontentnote': '}}\n\n', + 'tablecontenttip': '}}\n\n', + 'tablecontentwarning': '}}\n\n', 'tablehead': '\n', + 'tablenextnote': '}}\n\n', 'tablenextpara': '\n', 'tablenextparacode': '</code>\n', + 'tablenexttip': '}}\n\n', + 'tablenextwarning': '}}\n\n', 'tip': '}}\n\n', 'variable': '', 'warning': '}}\n\n', @@ -112,9 +124,15 @@ replace_paragraph_role = \ 'sup' : False, 'tablecontent': False, 'tablecontentcode': False, + 'tablecontentnote': True, + 'tablecontenttip': True, + 'tablecontentwarning': True, 'tablehead': False, + 'tablenextnote': True, 'tablenextpara': False, 'tablenextparacode': False, + 'tablenexttip': True, + 'tablenextwarning': True, 'tip': True, 'variable': False, 'warning': True, @@ -1122,6 +1140,12 @@ class Paragraph(ElementBase): if not self.is_first and role.find('table') == 0: if role == 'tablecontentcode': role = 'tablenextparacode' + elif role == 'tablecontentnote': + role = 'tablenextnote' + elif role == 'tablecontenttip': + role = 'tablenexttip' + elif role == 'tablecontentwarning': + role = 'tablenextwarning' else: role = 'tablenextpara' @@ -1224,6 +1248,12 @@ class TableContentParagraph(Paragraph): self.role = 'tablecontentcode' elif self.role == 'logocode': self.role = 'tablecontentcode' + elif self.role == 'note': + self.role = 'tablecontentnote' + elif self.role == 'tip': + self.role = 'tablecontenttip' + elif self.role == 'warning': + self.role = 'tablecontentwarning' else: self.role = 'tablecontent' if self.role == 'tablehead': commit c95a5afdf40bb9b86b702dd1ca6e6d5bcc51d2e6 Author: Andras Timar <[email protected]> Date: Sun Apr 5 19:02:17 2015 +0200 wikihelp: handle <bascode> in conditional text Change-Id: I79f90a78d26be8e81531de42d6bcd8c0c671f231 diff --git a/to-wiki/wikiconv2.py b/to-wiki/wikiconv2.py index 7964c28..48143f1 100755 --- a/to-wiki/wikiconv2.py +++ b/to-wiki/wikiconv2.py @@ -952,6 +952,8 @@ class Case(ElementBase): self.parse_child(Section(attrs, self)) elif name == 'table': self.parse_child(Table(attrs, self)) + elif name == 'bascode': + self.parse_child(BasicCode(attrs, self)) else: self.unhandled_element(parser, name) commit aed6b13162926773484af680b4d61acd0515508f Author: Andras Timar <[email protected]> Date: Sun Apr 5 10:49:54 2015 +0200 wikihelp: handle lists in table cells Change-Id: I29e5b742fee170c5202fcbc859dd8fd011965aac diff --git a/to-wiki/wikiconv2.py b/to-wiki/wikiconv2.py index b7397f2..7964c28 100755 --- a/to-wiki/wikiconv2.py +++ b/to-wiki/wikiconv2.py @@ -418,7 +418,7 @@ class XhpFile(ElementBase): # ignored, we flatten the structure pass elif name == 'list': - self.parse_child(List(attrs, self)) + self.parse_child(List(attrs, self, False)) elif name == 'meta': self.parse_child(Meta(attrs, self)) elif name == 'paragraph': @@ -558,6 +558,8 @@ class TableCell(ElementBase): elif name == 'bascode': # ignored, do not syntax highlight in table cells pass + elif name == 'list': + self.parse_child(List(attrs, self, True)) else: self.unhandled_element(parser, name) @@ -635,7 +637,7 @@ class ListItem(ElementBase): elif name == 'paragraph': parser.parse_localized_paragraph(ListItemParagraph, attrs, self) elif name == 'list': - self.parse_child(List(attrs, self)) + self.parse_child(List(attrs, self, False)) else: self.unhandled_element(parser, name) @@ -659,9 +661,10 @@ class ListItem(ElementBase): return text + postfix class List(ElementBase): - def __init__(self, attrs, parent): + def __init__(self, attrs, parent, isInTable): ElementBase.__init__(self, 'list', parent) + self.isInTable = isInTable self.type = attrs['type'] try: self.startwith = int(attrs['startwith']) @@ -676,6 +679,8 @@ class List(ElementBase): def get_all(self): text = "" + if self.isInTable: + text = '| |\n' if self.startwith > 0: text = text + '<ol start="%d">\n'% self.startwith @@ -748,7 +753,7 @@ class Section(ElementBase): if parser.follow_embed: self.embed_href(parser, fname, id) elif name == 'list': - self.parse_child(List(attrs, self)) + self.parse_child(List(attrs, self, False)) elif name == 'paragraph': parser.parse_paragraph(attrs, self) elif name == 'section': @@ -940,7 +945,7 @@ class Case(ElementBase): (fname, id) = href_to_fname_id(attrs['href']) self.embed_href(parser, fname, id) elif name == 'list': - self.parse_child(List(attrs, self)) + self.parse_child(List(attrs, self, False)) elif name == 'paragraph': parser.parse_paragraph(attrs, self) elif name == 'section': _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
