Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-05-2021, 12:02 AM   #1
AlanHK
Fanatic
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 599
Karma: 308286
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".
AlanHK is offline   Reply With Quote
Old 08-05-2021, 12:23 AM   #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: 5,858
Karma: 3571874
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.
KevinH is offline   Reply With Quote
Advert
Old 08-05-2021, 02:15 AM   #3
AlanHK
Fanatic
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 599
Karma: 308286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by KevinH View Post
In xhtml for epub2, type is required according to the spec.
Epubcheck didn't mind.

Quote:
Originally Posted by KevinH View Post
Sigil always assumes it should be used and when linking in a stylesheet, it will add it.
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.
AlanHK is offline   Reply With Quote
Old 08-05-2021, 06:04 AM   #4
BeckyEbook
Evangelist
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 466
Karma: 1497025
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
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:

Insert before comment "# other special cases"
Code:
        # BECKY START
        if tname == "link":
            if "rel=\"stylesheet\"" in s:
                if "type=\"text/css\"" not in s:
                    error_msg = 'Missing type="text/css" in css link tag'
                    self.errors.append((self.tag_start[0], self.tag_start[1], error_msg))
                    self.has_error = True
                    return None, None, None
        # BECKY END


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:

File: \src\BookManipulation\CleanSource.cpp
Insert after line 208, before return newsource;
Code:
    // Becky START
    QString css_before = " rel=\"stylesheet\"";
    QString css_after  = " type=\"text/css\" rel=\"stylesheet\"";
    newsource.replace(css_before, css_after);
    // Becky END


Personally, I use options b and c.
BeckyEbook is offline   Reply With Quote
Old 08-05-2021, 09:31 AM   #5
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: 24,684
Karma: 169420718
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)?
DiapDealer is online now   Reply With Quote
Advert
Old 08-05-2021, 10:24 AM   #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: 5,858
Karma: 3571874
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.
KevinH is offline   Reply With Quote
Old 08-05-2021, 11:41 AM   #7
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: 5,858
Karma: 3571874
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 11:44 AM.
KevinH is offline   Reply With Quote
Old 08-05-2021, 12:02 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: 5,858
Karma: 3571874
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!
KevinH is offline   Reply With Quote
Old 08-05-2021, 02:36 PM   #9
BeckyEbook
Evangelist
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 466
Karma: 1497025
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
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!
BeckyEbook is offline   Reply With Quote
Old 08-05-2021, 03:05 PM   #10
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: 5,858
Karma: 3571874
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
KevinH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone here ever seen csCF6BBF71 type style classes? Hitch ePub 64 04-20-2016 09:40 PM
list-style-type bullet odedta ePub 14 06-18-2014 10:53 AM
A problem with my link to the style sheet Warbird Books Sigil 4 04-10-2014 05:18 PM
Where To Put <style type="text/css"> Code SeaCanary Sigil 4 01-28-2014 09:33 PM
iBooks ignoring a:link css style Alan Newson ePub 9 03-19-2012 08:49 AM


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


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