View Single Post
Old 08-05-2021, 05:04 AM   #4
BeckyEbook
Guru
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: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
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