def replace(instance: WikiTextHtml, wikitext: wikitextparser.WikiText): for table in reversed(wikitext.get_tables(recursive=True)): # Resolve all lists inside the table next list_.replace(instance, table) # Now render the table and replace it with a marker _render_table(instance, table)
def _is_page_useful(wiki_text: WikiText) -> bool: # ignore pages without any lists and pages with very small lists (e.g. redirect pages have a list with length of 1) return len(wiki_text.get_lists(VALID_ENUM_PATTERNS)) + len( wiki_text.get_tables()) > 0