Hi. I'm a dev and I worked on PN2 scripts before. I had this praticularry usefull script that added tags around selected text. I'm hoping maybe you could use my code to implement this feature in TextFX or other plugin.
How the feature:
User selects text (multiline or singleline).
User is pressing some shortcut (e.g. CTRL+SHIFT+T).
User type in tag name and attributes (e.g. td align="right"
) .
The text is sorrounded with tags (each line separately).
Example
Just before adding tags:
Result:
Potatos <td align=right>1 kg</td> Tomatos <td align=right>2 kg</td> Carrots <td align=right>5</td>
About the Tag.py
The main function of Tag.py
is SurroundWithMultiTag
.
I added a CC-BY-SA license there, but you can use it on a more flexible CC-BY or MIT license.
There is also a helper for selections, but I guess you already have something like that already in TextFX plugin.
https://f.enux.pl/pn2/Selections.py