From: Simon Tatham Date: Sat, 23 Dec 2023 20:35:50 +0000 (+0000) Subject: OK, now it doesn't. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=117e501ba8c02ed60e240710b250706d7d6a9491;p=mastodonochrome.git OK, now it doesn't. Looks as if the only problem there was trying to link the document root to itself. --- diff --git a/src/html.rs b/src/html.rs index 6a01cd8..3952578 100644 --- a/src/html.rs +++ b/src/html.rs @@ -153,6 +153,7 @@ impl TreeSink for Tree { fn append(&mut self, parent: &Handle, child: NodeOrText) { let parent = *parent; let child = self.not2handle(child); + if parent == child { return } let check_index = { let children = match self.nodes[parent].contents { TreeNodeContents::Element { @@ -290,6 +291,5 @@ fn render_read(mut input: impl std::io::Read) -> Tree { pub fn render(html: &str, receiver: &mut R) { let tree = render_read(html.as_bytes()); - dbg!(&tree); tree.walk_recurse(0, receiver); }