04-03-2014, 06:12 PM | #616 |
Grand Sorcerer
Posts: 12,119
Karma: 73448614
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Just tried the plugin on a genuine kEpub and then loaded it into Edit and did a check which reported several occurences opening and ending tag mismatches.
If you'd like to PM me an eMail address I'll supply a copy of the book I am testing with. |
04-03-2014, 06:28 PM | #617 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
PM sent, and I've updated the plugin code in my original message.
|
Advert | |
|
04-05-2014, 06:24 PM | #618 | ||||
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
Quote:
Quote:
Quote:
Quote:
|
||||
04-06-2014, 05:22 AM | #619 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
The self closing tags should have been caught in the elif clauses
change the -1 to a -2 in the line Code:
elif entity[-1:] == '/>': Last edited by Perkin; 04-06-2014 at 05:46 AM. |
04-06-2014, 06:07 AM | #620 |
Grand Sorcerer
Posts: 6,211
Karma: 11766195
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
I'm testing this because the <span></span> are among the things I most dislike in a html file. Thank you very much.
|
Advert | |
|
04-06-2014, 11:30 PM | #621 | |
Grand Sorcerer
Posts: 12,119
Karma: 73448614
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Quote:
I can't help but wonder if you might also want to remove the Code:
<a id="page_44"/> Last edited by PeterT; 04-06-2014 at 11:33 PM. |
|
04-07-2014, 12:34 AM | #622 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
Those actually have a function; they correspond to the print book's pages. They don't do any harm, might do some good (depending on the NCX structure), and can't easily be restored if deleted, so I'm inclined to leave 'em alone.
|
04-07-2014, 05:18 AM | #623 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
They could also be removed fairly simply with a s&r if they're not wanted, not as difficult as why these additions were being done.
Are they consistently declared across ebooks with their 'page_###'? Anyone who is offended by them would be editing a book, so would be able to do the simple s&r: Regex search Code:
<a id="page_\d+"/> |
04-07-2014, 11:45 AM | #624 | |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
Quote:
In other words, <hr></hr> is truncated to a bad <hr> instead of converted to a correct <hr/>. The culprit seems to be the logic in lines 590-591 of the attached version's modify.py, in which those elements are always assumed to be self-closing: Code:
elif entity[:3] == '<hr' or entity[:3] == '<br' or entity[:4] == '<img': this_entity.e_type = 3 Last edited by Rev. Bob; 04-07-2014 at 11:47 AM. |
|
04-07-2014, 12:27 PM | #625 | |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Quote:
Code:
#!/usr/bin/env python import re result = re.sub(r'(<(.*)[^>]+)></\2>', r'\1/>', '<foo a="x" b="y"></foo>') print result |
|
04-07-2014, 12:38 PM | #626 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
I also meant to say regarding the non self-closing tags.
IIRC A lot of the elif's were to reduce length of processing time in pairing routine, be removing a lot of the elements needed to check, those (HR BR IMG) as you say should be self closing The previous elif would be catching the non-self-closing tags but not the end tag, thus causing the mismatch (which you probably realise) One way to change it to not catch them would be add a 1 and a space to each of the tests... Code:
elif entity[:4] == '<hr ' or entity[:4] == '<br ' or entity[:5] == '<img ': this_entity.e_type = 3 Last edited by Perkin; 04-07-2014 at 12:42 PM. |
04-07-2014, 01:00 PM | #627 | |||
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
Quote:
Quote:
Quote:
|
|||
04-07-2014, 01:04 PM | #628 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
|
04-07-2014, 01:08 PM | #629 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
|
04-07-2014, 02:27 PM | #630 | |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Just been re-reading the last few pages of the thread.
This was from post #574 made on 30-March Quote:
Say you had Code:
<i class="something">Here's</i><i> some text</i> Also thought about removing the empty tags i.e. '<i/>' or even '<i></i>' Could there be a reason not to remove them ~ maybe they could be changing the layout somehow, that if they're removed the layout may be different ~ Somewhere in my mind there's a niggle - something to do with seeing an empty tag that caused an alteration of linespacing or widths or ????. Anyway maybe it's more of a 'Do them by hand' rather than automated. |
|
Tags |
modify epub |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Quality Check | kiwidude | Plugins | 1171 | 03-23-2024 05:18 AM |
[GUI Plugin] Open With | kiwidude | Plugins | 402 | 03-16-2024 11:44 PM |
[GUI Plugin] Manage Series | kiwidude | Plugins | 166 | 02-13-2024 11:31 AM |
Modify ePub plugin dev thread | kiwidude | Development | 346 | 09-02-2013 05:14 PM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 12:27 PM |