10-23-2024, 02:05 PM | #526 |
Groupie
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
|
epubcheck error display is incomplete
Using Sigil 2.3.1 with epubcheck 0.4.7.1
I converted a 'no fault found' epub2 to epub3 using the plugin epub3-itizer v0.5.8 and then ran epubcheck again and was horrified to see vast numbers of pink errors, 25 of which concerned images : Code:
OEBPS/Text/chapter10.xhtml,18,1118,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter10.xhtml,30,2338,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter10.xhtml,68,3887,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter10.xhtml,86,4610,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter10.xhtml,118,6146,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter10.xhtml,132,7188,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter10.xhtml,140,7419,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter11.xhtml,16,705,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter4.xhtml,77,3766,Col: 89: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter4.xhtml,118,8009,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter5.xhtml,17,839,Col: 89: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter5.xhtml,22,1098,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter5.xhtml,32,2127,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter6.xhtml,20,1345,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter6.xhtml,36,2282,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter6.xhtml,46,2917,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter7.xhtml,60,3084,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter7.xhtml,82,4029,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter8.xhtml,20,1171,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter8.xhtml,34,2041,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter8.xhtml,58,3444,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter8.xhtml,68,4162,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter8.xhtml,90,4786,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter8.xhtml,102,5810,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer OEBPS/Text/chapter9.xhtml,24,2111,Col: 68: ERROR(RSC-005): Error while parsing file: value of attribute ""width"" is invalid; must be an integer Code:
<img alt="Image 7.1" src="../Images/image017.gif" width="50%"/> Subsequent tests showed that epubcheck only reports 25 of these errors at a time. Once I had corrected these 25, I ran the epubcheck plugin again and got another 25. I imagine this is a function of the EPUBCheck v5.1.0 rather than the plugin. Could the plugin capture and display all instances of an error on the first run through? |
10-23-2024, 03:04 PM | #527 |
A Hairy Wizard
Posts: 3,220
Karma: 19000635
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
In the meantime, you could just do a regex search and replace to get all of the same errors:
Find: <img (.*?) width="(.*?)%"/> Replace: <img \1 width="\2"/> That should fix them all. The error comes from the % sign is no longer a thing for inline image styling. |
10-23-2024, 04:48 PM | #528 |
Bibliophagist
Posts: 40,449
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
As far as I know, epubcheck will only return 25 errors of a type. For me, that is more than enough since I tend to hit regex to correct the error and that will clean up all the instances of that error.
|
10-23-2024, 05:53 PM | #529 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
But I doubt you want to convert width="50%" to width="50" as 50 pixels is much different from 50% of the screen.
Much more likely, is to remove the width attribute and replace it with either a new "class" attribute or even an inline style attribute such as style="width:50%;" or something else that sets the limit for the width of the resulting image. |
10-23-2024, 06:19 PM | #530 | |
Groupie
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
|
Quote:
<img\s+(alt="Image .+?")\s+(src="../Images/image\d+\.gif")\s+width="(\d+)%"\s*/> [ this also worked <img\s+(alt="[^"]*")\s+(src="[^"]*")\s+width="(\d+)%"\s*/> ] with a REPLACE: <img class="w\3" \2 \1/> [This put the alt entry at the end keeping it out of the way visually when checking images later.] Since many of the images had width=50%, I started with an additional CSS class in the style sheet : .w50 {height: auto;width: 50%} and then did a find/replace one at a time. This was a little tedious but pretty quick. When I came to an image with a different width %, if I then decided it would be better to keep it at that width, I just created an additional CSS style entry. Afterwards, I was curious to find out why all the image entries were not displayed as errors by the epubcheck plugin. So I redid the epub3 conversion and investigated. I also had a look at the log and saw that it had a line: Code:
"message" : "Error while parsing file: value of attribute \"width\" is invalid; must be an integer", "additionalLocations" : 50, Last edited by philja; 10-23-2024 at 06:27 PM. |
|
10-24-2024, 02:33 AM | #531 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
The plugin runs EPUBCheck in JSON output mode, and in that mode only the first 25 occurrences are shown. I.e., there's nothing I can do about it.
|
10-24-2024, 08:59 AM | #532 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
And since the user typically reruns the plugin repeatedly until no more errors are reported, that works just fine. As others have pointed out, you do not need to have an error "reported" to "fix" things once an ealier error shows you a repeated general error class. That is one of the primary uses for regular expression find and replace.
|
10-24-2024, 09:46 AM | #533 | |
Resident Curmudgeon
Posts: 76,354
Karma: 136006198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
10-24-2024, 04:32 PM | #534 | |
Groupie
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
|
Quote:
Had I been a bit more competent, I'd have found a way to automate the creation of each new class. As it was, I wrote the first one, (.w50) and copy / pasted 3 copies which just needed the number changing in the name and width. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] PunctuationSmarten Sigil plugin | DiapDealer | Plugins | 138 | 07-11-2023 12:22 PM |
[Plugin] KindleImport Sigil plugin | DiapDealer | Plugins | 187 | 07-04-2022 11:11 AM |
Sigil Plugin Index | Thasaidon | Plugins | 0 | 10-04-2014 08:41 AM |
FC and Sigil 0.5.3 ePUBcheck failure | Hitch | Sigil | 32 | 04-17-2012 03:56 AM |
Web-based epubcheck upgraded to epubcheck 1.0.5 | kjk | ePub | 4 | 02-09-2010 10:53 PM |