Elektrine lite

โ† Feed

@sminez@hachyderm.io

Post #2280777

2025-11-01 16:22 UTC

@jbert@hachyderm.io OK, still very much a work in progress but I've pushed it up to crates.io in order to nab the "structex" name while I finish things off. https://github.com/sminez/structex This example shows how to use it alongside something like handlebars in order to get string templated printing working as an action ๐Ÿ˜„ https://github.com/sminez/structex/blob/main/examples/fancy_impl_blocks.rs It's only had minimal testing so far and I suspect there's a bunch of things that don't work quite right but I think as a proof of concept it gets the idea across? The idea is to split the problem into two parts in order to avoid a bunch of issues with how actions interleave with the regex search: 1. Apply the structural regular expression terms to an input in order to locate sub-strings. Each match may then be assigned a tag with optional content that will be emitted along with matches when they are found. 2. Consume that stream of tagged matches and handle the actions as needed. I have some more ideas on making the construction of a structex more robust (setting allowed tags etc) which I'll add once I've sorted out the testing and docs. (@oac@fosstodon.org you might find this fun as well!)

Replies (1)

  • @sminez@hachyderm.io 2025-11-01 16:24

    @jbert@hachyderm.io @oac@fosstodon.org Oh, and Oliver: I'll definitely be writing up all of this nonsense in a blog post when I've tidied it up a bit ๐Ÿ˜… Pretty sure I can get this set up to work as a structex grep, sed and _maybe_ awk, but proper awk would require a full scripting language so maybe that's one for another time...! Hooking this in to ad is then just a case of wrapping this in an outer parser that handles the address expressions for setting the initial dot I think ๐Ÿคž

    Open ##2280778