diff --git a/web/dart/reorganize_html.dart b/web/dart/reorganize_html.dart index d3a4021..0f45114 100644 --- a/web/dart/reorganize_html.dart +++ b/web/dart/reorganize_html.dart @@ -32,8 +32,6 @@ Future wrapTables() async { // All images that are not nested inside a link will be linkified to themselves. void linkifyImg() { querySelectorAll('img').forEach((img) { - print(img.attributes['src']); - print(img.parent.tagName); if (img.parent.tagName == 'P') { final link = Element.a()..attributes['href'] = img.attributes['src']; img.insertAdjacentElement('beforeBegin', link); @@ -65,8 +63,11 @@ Future reorganizeHtml() async { linkifyImg(); // Add correct class to TOC - querySelector('#toc-drop') - .append(querySelector('#table-of-contents')..classes.add('dropdown')); + final toc = (querySelector('#table-of-contents') ?? Element.div() + ..attributes['id'] = 'table-of-contents') + ..classes.add('dropdown') + ..innerText = "Table of Contents Unavailable"; + querySelector('#toc-drop').append(toc); // Remove all
tags from HTML querySelectorAll('br').forEach((br) => br.remove());