Quote:
Originally Posted by Terisa de morgan
But you have a plugin for calibre editor which does exactly that (and more).
|
There's a Sigil version of the very same plugin.
Quote:
Originally Posted by nabsltd
With just a regex, there's nothing simple about a search for a tag with a specific "class=" and then removing that tag (and it's closing tag). For example, build a general-purpose regex that successfully deletes the tag with class "deleteme", along with the matching closing tag:
Code:
<span class="keep01">Here <span class="deleteme">is <span class="alsokeep">the</span> text <span class="dontdelete">in the</span> book</span> that should all remain intact.</span>
This operation is trivial with a real HTML editor (I use Expression Web), but Sigil (and Calibre) don't have anything that can do this, and that's a simple operation compared to what you can do with a real editor.
|
First off: you're right. Regex is not the best tool for removing tags based on attribute values. But I don't think that's what the OP was asking for (nor what Toxaris was suggesting using regex
for). The OP is asking for something that removes classes (classes that are no longer being used by CSS) from attribute strings. For this purpose, regex is quite safe/sufficient (as Toxaris noted).
By the way: both the
TagMechanic plugin for Sigil, and "
Diap's Editing Toolbag" for calibre make it trivial to successfully remove the tag with the class "deleteme" (along with the matching closing tag), per your example.