I've been thinking about exposing the internals of Sigil to an embedded version of Python (or Lua, or C# through embedded Mono). This should let you do what your asking, and much more.
What do others think of this?
JGSoft makes an excellent text clip manager and editor.
The operation is straight foward and simple and requires no knowledge of any programming language. The price is reasonable and they provide full interface data. A fullup trial version is availabe with full documentation.
By following instructions any text string can be inserted at the caret or before/after any highlighted text. AceText works with SIGIL as it stands (by naming SIGIL in the Peferences) and changing the HTML becomes simplicity itself. All text clips can be saved in named Collections to be used any time. A fullup CSS can be saved and inserted into the HTML with a simple placement of the caret in the editor and a double-click on the named Clip. Preformatted tags can be saved and inserted as desired. Repetitive programming becomes a simple PLACE CARET - DOUBLE CLICK. Sharing of Clip Collections is simple.
It would be nice if the interface were explicit to preclude any problems with future changes to SIGIL.
I am in no way connected to JGSoft other than as a very satisfied user of their tools for a very long time. Being sometimes very slow, I especially appreciate their excellent documentation.