# HG changeset patch # User Paul Boddie # Date 1654286077 -7200 # Node ID 171156732536d47db20722427dc2ffe20a33df2e # Parent a1a322d095bde2f7df143971a84bca4dd02cdd44 Fixed the table of contents macro to handle an absence of section entries. diff -r a1a322d095bd -r 171156732536 moinformat/macros/toc.py --- a/moinformat/macros/toc.py Fri Jun 03 21:54:30 2022 +0200 +++ b/moinformat/macros/toc.py Fri Jun 03 21:54:37 2022 +0200 @@ -3,7 +3,7 @@ """ Table of contents macro. -Copyright (C) 2018, 2019 Paul Boddie +Copyright (C) 2018, 2019, 2022 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 @@ -177,7 +177,7 @@ # Augment the macro node with the top-level list. - self.insert_table(lists[0]) + self.insert_table(lists and lists[0] or None) def insert_table(self, content): @@ -189,7 +189,7 @@ # Set the children of this macro with the generated content. - macro.nodes = [content] + macro.nodes = content and [content] macro.inline = False # Split any block containing the macro into preceding and following