05-11-2022, 05:14 PM | #1 |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
How to remove CSS styles completely?
Hello all! I'm usually creating e-books via the EPUB export of TextMaker (where I write the printed versions of the books). This generates lots of CSS styles that try to mimick the printed book. However, I pefer to format the e-book myself in a simple way (no custom fonts etc.) to make sure it looks good on all devices. So how can I remove all these styles completely? I only found the option to remove unused styles from the CSS file, but not something to remove all the style tags from the HTML. Of course I can delete the CSS file, which will remove the styles from the visual text, but the style references are still in the code.
|
05-11-2022, 05:40 PM | #2 |
Sigil Developer
Posts: 8,242
Karma: 5450818
Join Date: Nov 2009
Device: many
|
You can use Find and Replace to remove the class attributes from any and all tags if you so desire.
|
Advert | |
|
05-11-2022, 05:43 PM | #3 |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
Solved
I found that there's a plugin for that: https://www.mobileread.com/forums/sh...d.php?t=332317
I find this function quite essential, so it would be great if it was integrated into Sigil directly. I remember that Calibre has such a function, but I switched to Sigil due to its ability to use a WYSIWYG editor. |
05-11-2022, 05:48 PM | #4 | |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
Quote:
Anyway, I just discovered the "cssUndefinedClasses" plugin, which does the job. Would be nice to have that function in Sigil directly though, as I find it quite essential. |
|
05-11-2022, 06:03 PM | #5 |
Sigil Developer
Posts: 8,242
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Just use regular expressions find and replace. No plugin is needed.
Something along the lines of using Find set to: (<[^<>]+)(class\s*=\s*"[^"<>]+")([^<>]*)(>) and replace set to: \1\3\4 which should say look for the start of a tag < followed by one or more characters that are not a < or a >. Followed by a class with optional whitespace then an = then optional whitespace and a " followed by any number of characters that is not a " or < or > followed by an ending " plus any other characters before the ending tag symbol. I am away from my computer so I can not test that. But we have a sticky thread here about how to use regex plus access to many people much more knowledgable than I to help. Looks complicated but really it is not when you understand some basic regex. In addition: Plugins work just fine. And more importantly Sigil does not in any way consider its plugins to be second class citizens. So it is our policy to never pull existing plugins into the main Sigil codebase. We have a moderate but growing number of plugins and we want to do nothing that would discourage anyone from adding more. Basic Sigil already has too many features. Last edited by KevinH; 05-11-2022 at 07:29 PM. |
Advert | |
|
05-11-2022, 06:04 PM | #6 |
Sigil Developer
Posts: 8,242
Karma: 5450818
Join Date: Nov 2009
Device: many
|
BTW, PageEdit can be used with Calibre. I think BetterRed uses it that way.
|
05-11-2022, 06:08 PM | #7 |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
Okay, good to know. However, I assume that many users (like me) will not be familiar with regular expressions. Comments show that users are thankful for that plugin, as they previously had to revert to Calibre or other external solutions. Also, the plugin allows individual styles to be excluded from removal.
|
05-11-2022, 06:23 PM | #8 |
Sigil Developer
Posts: 8,242
Karma: 5450818
Join Date: Nov 2009
Device: many
|
You asked about removing them all.
|
05-11-2022, 06:35 PM | #9 |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
Thank you for all your suggestions. I have a solution I can work with. My suggestion to include this function into Sigil had non-technical users in mind. I'm an engineer and computer fan, but I think many Sigil users are "only" writers (which I am, too). And it seems like there is still no really user-friendly WYSIWYG e-book editor, so Sigil with PageEdit is the best they have.
|
05-11-2022, 06:40 PM | #10 |
Resident Curmudgeon
Posts: 76,956
Karma: 138256890
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You could export your eBook as text and use that with Sigil to create the eBook version. Start with plain text, split the chapters/sections, add in all the italics & bold. Create your CSS from scratch. That may be the easiest way to do it.
|
05-11-2022, 06:50 PM | #11 | |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
Quote:
Anyway, I now have a working solution with the plugin mentioned above, which even allowed me to retain a few styles that I could then adapt to my needs, while getting rid of all the unnecessary stuff. |
|
05-11-2022, 08:37 PM | #12 | |
Grand Sorcerer
Posts: 28,071
Karma: 199770456
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
And while writers are certainly welcome to use Sigil, it's not intended to be a turnkey solution for creating epubs by folks with no coding (or epub internals) experience whatsoever. Some technical knowledge is always going to be required. |
|
05-11-2022, 09:24 PM | #13 | |
null operator (he/him)
Posts: 21,114
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
FWIW: I'd rather have a Page Edit that could open and save an EPUB directly, but using it from Sigil is simple enough. Interestingly, if I unpack an EPUB to a folder and open the OPF from it, PageEdit works… at a superficial level at least. FTR: this is the error PageEdit emits if the OPF file is opened via Calibre's Book Editor->Open with feature: Code:
C:/_AppData/Calibre/Temp/calibre_j6plwq3p/fdwxp957-ee-ow/Text/preferences.xhtml: The system cannot find the path specified. |
|
05-12-2022, 07:03 AM | #14 |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
|
It really surprises me that no one ever developed a fully WYSIWIG e-book editor. I tink there would be a huge demand for it. Of course, many word processors like mine allow EPUB to be exported, but at least in the case of TextMaker, the options are far too limited to get what I want.
|
05-12-2022, 09:48 AM | #15 |
Sigil Developer
Posts: 8,242
Karma: 5450818
Join Date: Nov 2009
Device: many
|
There is iBooks for macOS, but then they add their own changes to it so it is not epub3 spec compliant. As far as I can tell, no one has nor will flock to it.
Live html code editing (the only wysiwyg editing for html) via a browser engine is simply not good enough in the code it generates to keep to the xhtml / epub specs. That is why we dropped BookView and added a more limited PageEdit. Those who care about how epubs actually look and work on multiple e-reading devices actually know the only way to really do things right is to directly edit the code. |
Tags |
css, styles, stylesheet |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Check non existent css styles | Terisa de morgan | Editor | 15 | 06-15-2014 11:24 AM |
Modding Calibre CSS styles | Olger | Recipes | 7 | 01-25-2012 06:08 AM |
CSS Table Styles: Does it work? | Alan Newson | ePub | 3 | 12-12-2011 04:54 PM |
Tool to centralise css styles? | snarkophilus | ePub | 7 | 07-01-2011 05:08 AM |
Sigil styles and CSS | View[+]Finder | Sigil | 4 | 05-27-2010 06:39 PM |