As for how to go about this, I attached a bundle with a macro and a script, the macro does:
- replace all in selection, adding 0xFFFC as the first/last
character (this is the unicode object replacement character, so I’d be surprised if your script already have such characters) 2) select all 3) call transform.rb with input set to document and output to insert as snippet
The transform.rb script then reads stdin, does a split on 0xFFFC (resulting in an array with the before/selection/after), snippet- escapes each of the 3 parts, and then inserts a snippet which puts
and <<< around the selection, but leaves those added characters
unselected, when replacing the document.
Nice!! +2 for Allan :D