![]() |
#586 |
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
|
|
![]() |
![]() |
![]() |
#587 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
|
![]() |
![]() |
Advert | |
|
![]() |
#588 |
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)
|
One thing I did for a Sigil plugin (written in Python), that would delete empty spans, was to cycle through storing all the tags and text, giving each a number, and a pir number (initialised at 0), then run through and when it came to an end span, work backward to find the previous unpaired span, then continuing on through to end of file.
Then remove all the empty spans and their end tags, then rewrite the file back in order. You could do something similar to remove *your* desired spans. the plugin was in the post here if you want to see what I did. [And see better than how it's worded here ![]() |
![]() |
![]() |
![]() |
#589 | |
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:
Code:
<span class="koboSpan" id="koboxxx">content</span> |
|
![]() |
![]() |
![]() |
#590 | ||
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Quote:
![]() Code:
<span{ kobo-specific info goes here}[^<>]*>((?:(?!<(?:span|/span)).)*)</span> Last edited by eschwartz; 04-02-2014 at 03:06 PM. Reason: (classes) or ids |
||
![]() |
![]() |
Advert | |
|
![]() |
#591 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,302
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Actually Rev. Bob, the Kobo span's (at least in the books I examined) were of the form
<span id="kobo.114.1">...</span>, so my approach to looking for those was Code:
<span ## look for <span [^>]+? ## then one or more character that is not the closing > ## (there will always be at least one; the space after ## the <span ) id="kobo ## the start of the Kobo id assigned to this span [\d.]+ ## the numeric and dotted span number [^>]+? ## then everything up to the the > ## (always at least one; the " after the id) > ## the closing symbol of the <span tag Last edited by PeterT; 04-02-2014 at 03:07 PM. |
![]() |
![]() |
![]() |
#592 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
@PeterT, how does my regex do?
|
![]() |
![]() |
![]() |
#593 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,302
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
When I tried it in calibre ebook-edit it failed
![]() ----- Retried with Code:
<span[^<>]*>((?:(?!<(?:span|/span)).)*)</span> Code:
<span id="kobo.114.1">I don’t go in for ‘lawn maintenance’, though — all that weeding and feeding.</span> and <span id="kobo.114.3"> As Vita Sackville-West said, ‘A weed is only a plant in the wrong place.’ To which we should add: ‘or one for which we haven’t yet discovered the use’.</span> Code:
<span id="kobo.114.2"> I prefer my ‘weeds’: the clover, which keeps the grass naturally green with its nitrogen-fixing nodules; the daisy, opening and closing each day (its name comes from the Old English <em>daeges <span class="ent1">ē</span>age</em>, meaning ‘the day’s eye’); the little blue-purple <em>Prunella</em>, known as ‘self-heal’, used to treat sore throats, mouth <a id="page_184"></a>ulcers and open wounds — and still used in modern herbal medicine as an astringent for external or internal wounds.</span> Code:
<span class="ent1">ē</span> Last edited by PeterT; 04-02-2014 at 03:36 PM. |
![]() |
![]() |
![]() |
#594 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Then we just keep passing over the book till no results are found. |
|
![]() |
![]() |
![]() |
#595 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,302
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
ugh.. correct!
Of course, the issue is now that you actually don't want to remove those inner spans for the original requirements; only the Kobo added ones that exist to provide bookmarking support within the ACCESS engine. |
![]() |
![]() |
![]() |
#596 | |
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:
Code:
if entity == '<span>': Code:
if entity == '<span>' or entity[:17] == '<span class="kobo' or entity[:15] == '<span id="kobo.': If that'll do the trick, it should match the Kobo books I've seen (class first), those PeterT's got (id first), and it'll strip out empty spans in the bargain. Not bad for one changed line... ![]() ETA: Never mind; the further enhancement I had in mind wouldn't work. Ignore this ETA line. Last edited by Rev. Bob; 04-02-2014 at 04:01 PM. |
|
![]() |
![]() |
![]() |
#597 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
How is this? Code:
<span{ kobo-specific info goes here}[^<>]*>((?:(?!<(?:span|/span){ kobo-specific info goes here}).)*)</span> |
|
![]() |
![]() |
![]() |
#598 | |
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:
IIRC - When doing it originally (ages ago) I was going to add a few other cases that may have been useful, but left it as it was as it worked as needed at the time. |
|
![]() |
![]() |
![]() |
#599 | |
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:
![]() |
|
![]() |
![]() |
![]() |
#600 |
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)
|
All I can think of at present (not in a programming frame of mind at moment) is...
Either look through and see if you can 'piggy-back' one of this (or other) plug-in functions, or add your own function, or do the same to one of the editor functions, or wait for Kovid to add PI functionality into editor. I suppose it will need to be a function that receives the raw html file(s) that need to be worked on, unless you can adapt it yourself. I haven't done much programming over the last 6+ months, switched over to a mac and haven't got into coding on it yet, and am not currently 'with it'. Hope this gives you an idea, and it's work/do-able. |
![]() |
![]() |
![]() |
Tags |
modify epub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Quality Check | kiwidude | Plugins | 1184 | 04-17-2024 06:17 PM |
[GUI Plugin] Open With | kiwidude | Plugins | 403 | 04-01-2024 08:39 AM |
[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 |