Is there any way to add two content CSS selectors in the same chapter?
Hello
I would like to know if you could make a feature that would allow us to add two CSS selectors for the content in one chapter.
I will put an example below
@mrclfr
I would like to know if you could make a feature that would allow us to add two CSS selectors for the content in one chapter.
While such a change could be done, I'm not willing to do it. Mostly because I think it would make this interface more difficult for people to understand and use, for the small number of users it would benefit.
That said, I can tell you how to achieve what you're after.
The steps are:
- In WebToEpub, provide the CSS selector for an element that is a parent of both the elements you're actually interested in.
- Create the epub. Each chapter in the epub will now have both elements you want. (Along with some garbage.)
- You can now use a script with EpubEditor to process the epub and remove the garbage.
Example script. Assume the parent selector is div.article, then the script would be something like
let parent = dom.querySelector("div.article");
let review = dom.querySelector("div.review-item");
let author = dom.querySelector("div.author-info");
if (review) {
parent.replaceWith(review);
if (author) {
review.appendChild(author);
}
return true;
} else if (author) {
parent.replaceWith(author);
return true;
}
return false;
Note, if you can provide me with URL of story you want processed, I'll be able to test the script.
Notes Time taken: 18 minutes
Closing, due to lack of response