I couldn't find this in search, but I'm basically wondering if there's a way to basically do the inverse of the "Delete unused stylesheet selectors" function.
I'm converting over a detailed game guide that originally consisted of several hundred Google docs, which I had downloaded as html and imported to Sigil. I've done a lot of the work in converting over headers, tables, and whatnot, but nearly every paragraph is either classed, or has classed spans that are unneeded due to the conversion process. I can't just do a quick S&R because the class names are named differently in each of those files, and there are some that colour the text that I'd like to keep.
So what I would ideally like to do is go through the styles, which are currently in the file header, rename the ones that don't change the text colour (i.e. from "c\d+", to "XXDELETEXX" or somesuch), then use a function to find any <p>, <span>, etc that call a now-disconnected class and remove it.
For a more specific example, lets say I have:
Code:
<head>
<style type="text/css">
.c2 {
color: #000000;
font-weight: 400;
}
.c26 {
color: #ff0000;
}
.c73 {
font-weight: 400;
}
</style>
</head>
<body>
<p class="c26">red</span></p>
<p><span class="c2 c73 c26">red and others</span></p>
<li class="c2">only others</li>
</body>
Rename unwanted classes a la:
Code:
<head>
<style type="text/css">
.DELETEME {
color: #000000;
font-weight: 400;
}
.c26 {
color: #ff0000;
}
.DELETEME {
font-weight: 400;
}
</style>
</head>
<body>
<p class="c26">red</span></p>
<p><span class="c2 c73 c26">red and others</span></p>
<li class="c2">only others</li>
</body>
Then do a sort of reverse-"Delete unused stylesheet selectors" function that would leave me with:
Code:
<head>
<style type="text/css">
.DELETEME {
color: #000000;
font-weight: 400;
}
.c26 {
color: #ff0000;
}
.DELETEME {
font-weight: 400;
}
</style>
</head>
<body>
<p class="c26">red</span></p>
<p><span class="c26">red and others</span></p>
<li>only others</li>
</body>
I could then do an actual "Delete unused stylesheet selectors" to get rid of the DELETEME classes.
Thanks in advance for any help!