![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
style link type=css
I imported a KF8 into Sigil using the KindleImport plugin to make an epub2.
This looked OK, but when I started checking out styles, clicking on any style in the code window to "Go to link or style" gave the message "No CSS style named ".Center" found, or stylesheet not linked". But the style clearly was being applied in the preview. The inspector showed the relevant line in the style file. Epubcheck showed no errors. Eventually I looked at the Book Browser list and clicked "Link stylesheets", to see no stylesheet was linked. Though it was, and the styles were working. Used the link popup to add the stylesheet and saw that the new link was <link href="../Styles/style.css" type="text/css" rel="stylesheet"/> the original link was <link rel="stylesheet" href="../Styles/style.css"/> i.e., the original link had no type="text/css". So either Sigil should recognise this as a valid style link, or add the "type" code on opening or with "mend code". |
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,761
Karma: 5706256
Join Date: Nov 2009
Device: many
|
In xhtml for epub2, type is required according to the spec.
For html5, type is not required according to the html living spec. Not sure about xhtml version of html5 for epub3. Sigil always assumes it should be used and when linking in a stylesheet, it will add it. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Epubcheck didn't mind.
The problems arise when it opens a file without the type. It can't work with it properly, but doesn't raise any flag that there is a problem. |
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 839
Karma: 2657572
Join Date: Jan 2017
Location: Poland
Device: Various
|
I really understand this problem and encounter it relatively often, so for me, finding a working solution was crucial.
There was already a discussion on this topic: https://www.mobileread.com/forums/sh...d.php?t=229308 The problem can be solved in several ways. a) As suggested by @KevinH – create a validation plugin that will check and report on this issue. b) Patch for the sanitychecker built into Sigil (\python3lib\sanitycheck.py), which will report the problem when checking (F7). Spoiler:
c) Quick-and-dirty patch to clean the code (Mend). Of course, this only applies to those two people who will want to build their own version of Sigil ![]() I know that this is not a perfect solution, but it works fine for my needs. Spoiler:
Personally, I use options b and c. |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,569
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Are you guys running into this in a lot of epubs found out in the wild, or this mainly limited to epubs being generated by KindleUnpack (which includes the KindleImport plugin)?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,761
Karma: 5706256
Join Date: Nov 2009
Device: many
|
If only from KindleImport we can fix it in KindleUnpack. If you are seeing this in the wild, I can try to update GumboInterface.cpp to make sure type is properly added to link that have rel="stylesheet" so that Mend will work.
|
![]() |
![]() |
![]() |
#7 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,761
Karma: 5706256
Join Date: Nov 2009
Device: many
|
I have updated GumboInterface.cpp both Mend and Mend and Prettify to now "fix" these cases by adding in the type="text/css" if missing. That way it is correct for html4, epub2, html5, and epub3.
I have just pushed this to master. Last edited by KevinH; 08-05-2021 at 10:44 AM. |
![]() |
![]() |
![]() |
#8 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,761
Karma: 5706256
Join Date: Nov 2009
Device: many
|
I also added a variant of BeckyEbook's sanitycheck.py patch so it can be caught easily.
Thank you BeckyEbook! |
![]() |
![]() |
![]() |
#9 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 839
Karma: 2657572
Join Date: Jan 2017
Location: Poland
Device: Various
|
To clarify: I really see a lot of such files in the wild. If it were rare, I wouldn't bother with it.
I just built the master version and I'm happy. So I can say THANK YOU! |
![]() |
![]() |
![]() |
#10 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,761
Karma: 5706256
Join Date: Nov 2009
Device: many
|
@BeckyEbook
If you have any additional Sigil/PageEdit patches that you typically apply when you build your own tree that might be of use to others, please post them and we will consider integrating them into master for the next release. Thanks! KevinH |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Anyone here ever seen csCF6BBF71 type style classes? | Hitch | ePub | 64 | 04-20-2016 08:40 PM |
list-style-type bullet | odedta | ePub | 14 | 06-18-2014 09:53 AM |
A problem with my link to the style sheet | Warbird Books | Sigil | 4 | 04-10-2014 04:18 PM |
Where To Put <style type="text/css"> Code | SeaCanary | Sigil | 4 | 01-28-2014 08:33 PM |
iBooks ignoring a:link css style | Alan Newson | ePub | 9 | 03-19-2012 07:49 AM |