chiark / gitweb /
Support listing the URLs in a post.
authorSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 14:09:59 +0000 (14:09 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 14:57:11 +0000 (14:57 +0000)
commitfccfc2fadc3f97760aa981b707723ddf4e9fc86c
tree1e68a400e2ce3844e03bfe92dfd417325760e013
parentc312ae6fe782f20fbe58ddd23a3d6e672f475fe1
Support listing the URLs in a post.

I didn't have to trawl RcDom after all (as my TODO item suggested).
All I had to do was to put a mutable reference to a Vec<String> into
OurDecorator, and then that could push URLs on to the vector.

Or rather: firstly I had to do that using a &RefCell<Vec<String>>,
because the same Vec<String> reference had to be passed to the
separate decorator instance spawned for sub-blocks. Secondly that
meant I had to bake a lifetime into the type of OurDecorator (since
the call site must know that the reference to the RefCell went away
when the config object is dropped).

Also, I wanted to exclude the URLs that come from mentions and
hashtags, which meant tracking whether a colour annotation had been
applied to anything inside the link - whether it was already live at
the call to decorate_link_start or was turned on immediately
afterwards.
TODO.md
src/html.rs
src/text.rs