# HG changeset patch # User Paul Boddie # Date 1555190733 -7200 # Node ID 641603937eeca29834ab7a07f5549cbb8959de3f # Parent ef121c7337c750894266c9e34a57544a44e2ed2b Simplified List initialisation. diff -r ef121c7337c7 -r 641603937eec moinformat/macros/toc.py --- a/moinformat/macros/toc.py Sat Apr 13 22:41:54 2019 +0200 +++ b/moinformat/macros/toc.py Sat Apr 13 23:25:33 2019 +0200 @@ -127,7 +127,7 @@ else: new_items = [] - new_list = List(new_items, indent, marker, num) + new_list = List(new_items) # Add the list to the current item, if any. diff -r ef121c7337c7 -r 641603937eec moinformat/parsers/moin.py --- a/moinformat/parsers/moin.py Sat Apr 13 22:41:54 2019 +0200 +++ b/moinformat/parsers/moin.py Sat Apr 13 23:25:33 2019 +0200 @@ -327,7 +327,7 @@ "Create a list, starting with 'item'." - list = List([item], item.indent, item.marker, item.num) + list = List([item]) self.parse_region_details(list, self.list_pattern_names, True) return list diff -r ef121c7337c7 -r 641603937eec moinformat/tree/moin.py --- a/moinformat/tree/moin.py Sat Apr 13 22:41:54 2019 +0200 +++ b/moinformat/tree/moin.py Sat Apr 13 23:25:33 2019 +0200 @@ -3,7 +3,7 @@ """ Moin wiki format document tree nodes. -Copyright (C) 2017, 2018 Paul Boddie +Copyright (C) 2017, 2018, 2019 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -404,14 +404,15 @@ "A list." - def __init__(self, nodes, indent, marker, num): + def __init__(self, nodes): Container.__init__(self, nodes) - self.indent = indent - self.marker = marker - self.num = num + first = nodes and nodes[0] or None + self.indent = first and first.indent + self.marker = first and first.marker + self.num = first and first.num def __repr__(self): - return "List(%r, %r, %r, %r)" % (self.nodes, self.indent, self.marker, self.num) + return "List(%r)" % self.nodes def prettyprint(self, indent=""): l = ["%sList: indent=%d marker=%r num=%r" % (indent, self.indent, self.marker, self.num)]