MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   [Suggestion] Sigil validator should check missing type="text/css" attribute (https://www.mobileread.com/forums/showthread.php?t=229308)

quiris 12-17-2013 04:24 AM

[Suggestion] Sigil validator should check missing type="text/css" attribute
 
I have noticed that kindlegen 2.9 tool ignores stylesheets that are improperly linked to html files inside ePub files.

For example this case is incorrect and will be ignored by kindlegen during conversion:
Code:

<link rel="stylesheet" href="../Styles/styles.css">
A correct code is:

Code:

<link rel="stylesheet" type="text/css" href="../Styles/styles.css">
So it would be very useful if Sigil validator would check also missing type="text/css".

Is it possible to implement?

Toxaris 12-17-2013 05:17 AM

It is possible, but it will probably not happen for three reasons.
1. Maintenance on Sigil and also FlightCrew is very, very limited at the moment due to lack of developers
2. The usage of type is not required, but recommended. The type only specifies the language the stylesheet is in to prevent the reader from reading unsupported stylesheets. The 'rel="stylesheet"' is more important in this case, since that identifies the file as a stylesheet.
3. It is not required and the main goal of Sigil is ePUB2 and thus not mobi or any other e-reader format.

radius 12-17-2013 04:56 PM

What issue is actually fixed by ignoring the stylesheet in such a case?

eschwartz 12-17-2013 05:34 PM

Quote:

Originally Posted by radius (Post 2715183)
What issue is actually fixed by ignoring the stylesheet in such a case?

According to the OP, KindleGen ignores the stylesheet altogether.

@quiris, you can try editing with calibre. If the book is in calibre, the Tweak Book setting has been replaced with the all-new Edit Book, or you can run it as the standalone program ebook-edit.exe.

The editor has all the basic functionality down, although it is not yet as smooth as Sigil Kovid is working on it and has basically duplicated the basics of Sigil in only 1 & 1/2 months; given just a little time it will be far better I am thinking.

calibre is actively supported, unlike Sigil, and is meant to edit azw3 as well as ePub so fixing for KindleGen fits within the design parameters.

If you can't do this yet, add a request for it and it will most likely be implemented.

quiris 12-17-2013 05:36 PM

Quote:

Originally Posted by Toxaris (Post 2714596)
2. The usage of type is not required, but recommended. The type only specifies the language the stylesheet is in to prevent the reader from reading unsupported stylesheets. The 'rel="stylesheet"' is more important in this case, since that identifies the file as a stylesheet.

The attribute is not required in HTML5 but it's required for HTML 4.01 and I think it would be nice to keep as far as possible similarity in client experience between ePub files produced by Sigil and Mobi files generated by kindlegen from that ePub.

quiris 12-17-2013 05:41 PM

Quote:

Originally Posted by eschwartz (Post 2715222)
@quiris, you can try editing with calibre. If the book is in calibre, the Tweak Book setting has been replaced with the all-new Edit Book, or you can run it as the standalone program ebook-edit.exe.

I don't use Calibre at all since it drastically modifies original source HTML code inside ebooks. So it's evil app for me.

I like to have almost entire control of source code in my own hands ;) Sigil isn't perfect but I don't found better similar program.

eschwartz 12-17-2013 05:48 PM

Quote:

Originally Posted by quiris (Post 2715236)
I don't use Calibre at all since it drastically modifies original source HTML code inside ebooks. So it's evil app for me.

I like to have almost entire control of source code in my own hands ;) Sigil isn't perfect but I don't found better similar program.

If you were using ebook-convert.exe which is meant to do automated conversion, then yes.

ebook-edit.exe is a replacement for the old Tweak Book, which was just a GUI for unpacking the .epub and editing the source code. It still uses the same code as that, but adds a Sigil-like GUI editor designed to give you the same control over every last byte of your book.

I am not suggesting give it a run through the calibre converter. But I understand your confusion -- this editor is brand-new and was only introduced in the most recent release.

Doitsu 12-17-2013 05:49 PM

@quiris:

BTW, if you enable Edit > Preferences > Clean Source > Open/Save, Sigil will automatically add the missing type="text/css" attribute if you open/save your file, even if only Pretty Print Tidy is enabled.

quiris 12-17-2013 05:53 PM

Quote:

Originally Posted by eschwartz (Post 2715249)
ebook-edit.exe is a replacement for the old Tweak Book

Hm… Interesting… I'll dig into it in a spare time. Thank you for the tip :)

quiris 12-17-2013 05:56 PM

Quote:

Originally Posted by Doitsu (Post 2715253)
@quiris:

BTW, if you enable Edit > Preferences > Clean Source > Open/Save, Sigil will automatically add the missing type="text/css" attribute if you open/save your file, even if only Pretty Print Tidy is enabled.

I found that Pretty Print Tidy can introduce really bad code modifications especially into not valid html code, so I have turned it off.

Doitsu 12-17-2013 06:03 PM

Quote:

Originally Posted by quiris (Post 2715265)
I found that Pretty Print Tidy can introduce really bad code modifications especially into not valid html code, so I have turned it off.

Are you sure that don't mix up Pretty Print Tidy with HTML Tidy? HTML Tidy can mess up HTML code and adds those annoying sgc classes, but Pretty Print Tidy only adds white-space to make HTML code more readable.

odedta 12-24-2013 03:49 AM

quiris, Calibre doesn't drastically modifies original source HTML, look in options.

Anyway, like Doitsu said, just disable code modifications... HTML tidy worked fine for me.

BeckyEbook 01-21-2018 01:55 PM

I know, that this is old thread, but...

If the type="text/css" is missing, the "Go To Link or Style" function does not work.
Maybe Sigil could check it during opening the file?

KevinH 01-21-2018 03:00 PM

This may be a good job for a validator plugin, if epubcheck does not already complain about it.


All times are GMT -4. The time now is 10:13 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.