Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-11-2022, 05:14 PM   #1
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-11-2022, 05:40 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is offline   Reply With Quote
Advert
Old 05-11-2022, 05:43 PM   #3
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-11-2022, 05:48 PM   #4
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
Quote:
Originally Posted by KevinH View Post
You can use Find and Replace to remove the class attributes from any and all tags if you so desire.
So is there a way to use wildcards in Find & Replace, allowing me to replace class = "<anything>"?

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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-11-2022, 06:03 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is offline   Reply With Quote
Advert
Old 05-11-2022, 06:04 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is offline   Reply With Quote
Old 05-11-2022, 06:08 PM   #7
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
Quote:
Originally Posted by KevinH View Post
Just use regular expressions find and replace. No plugin is needed.
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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-11-2022, 06:23 PM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,242
Karma: 5450818
Join Date: Nov 2009
Device: many
You asked about removing them all.
KevinH is offline   Reply With Quote
Old 05-11-2022, 06:35 PM   #9
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-11-2022, 06:40 PM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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.
JSWolf is offline   Reply With Quote
Old 05-11-2022, 06:50 PM   #11
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2022
Location: Germany
Device: likebook P78
Quote:
Originally Posted by JSWolf View Post
You could export your eBook as text and use that with Sigil to create the eBook version.
Starting with an exported EPUB is still useful, e.g. as it retains the headings (h1, h2 etc., important for the TOC), converts footnotes into end notes with links, etc.

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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-11-2022, 08:37 PM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,071
Karma: 199770456
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Joerg Starkmuth View Post
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).
In short: it's probably not going to happen. The plugin is easy enough to find/use if folks need it. No need to integrate it.

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.
DiapDealer is offline   Reply With Quote
Old 05-11-2022, 09:24 PM   #13
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,114
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by KevinH View Post
BTW, PageEdit can be used with Calibre. I think BetterRed uses it that way.
Page Edit (PE) can be invoked from the Calibre Book Editor's Open with feature, but only for a single XHTML file, not for the OPF file. For me, invoking PageEdit for a single file has limited utility.

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.
BR
BetterRed is offline   Reply With Quote
Old 05-12-2022, 07:03 AM   #14
Joerg Starkmuth
Junior Member
Joerg Starkmuth began at the beginning.
 
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.
Joerg Starkmuth is offline   Reply With Quote
Old 05-12-2022, 09:48 AM   #15
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is offline   Reply With Quote
Reply

Tags
css, styles, stylesheet


Forum Jump

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


All times are GMT -4. The time now is 08:03 AM.


MobileRead.com is a privately owned, operated and funded community.