![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 21870
Join Date: Apr 2021
Location: Spain
Device: Kobo Libra 2
|
Nested span, clean
Please, how can I, using regex, select the text between an opening tag of a div or span and its corresponding closing tag, without confusing it with the closing of another element nested inside it?
I would like to remove "span" tags without causing errors, i.e. taking into account other "span" tags nested inside them, for example in: Code:
<span class="txt">Lorem <span class="italic">ipsum</span> dolor</span> The best I know how to do so far is: Search: <span class="txt">([^<]+)</span> Thanks for your help.
Replace: \1 |
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,764
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Use the TagMechanic plugin that is set up to handle just that.
https://www.mobileread.com/forums/sh...d.php?t=270639 You can find a set of useful free plugins here: https://www.mobileread.com/forums/sh...d.php?t=247431 Last edited by KevinH; 07-22-2023 at 10:08 AM. |
![]() |
![]() |
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Yes, TagMechanic is the best way to clean up all that HTML + <span> cruft.
I wrote multiple TagMechanic tutorials and linked to many more helpful topics of mine a few months ago in: |
![]() |
![]() |
![]() |
#4 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 521
Karma: 8500000
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe, Kindle 4 Touch
|
Quote:
Being able to find a tag by one or more of:
|
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,764
Karma: 6000000
Join Date: Nov 2009
Device: many
|
I think the op was looking for a Sigil based solution according his/her query. Can you use Microsoft Expression Web with Sigil's OpenWith or does it need access to all files in the epub at the same time?
|
![]() |
![]() |
![]() |
#6 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,206
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
For what it may be worth, Microsoft Expression Web was discontinued over a decade ago. I vaguely remember some of the web devs using it for web page development before they moved on to better tools with fewer oddities.
|
![]() |
![]() |
![]() |
#7 | ||
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 521
Karma: 8500000
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe, Kindle 4 Touch
|
Quote:
Quote:
But, as a standalone HTML and CSS editor, it has better features than the more recent MS releases (Visual Studio and Visual Studio Code). In particular, it is much better at not needing a "project" to have features like HTML/CSS linking. This makes it much better for touch-ups of ePub. I use the Calibre editor, Microsoft Expression Web ("Unpack Book" from within Calibre), and Sigil. All have their strengths and weaknesses, but if I had to stop using any one of them, it would be a pain for my editing chain. |
||
![]() |
![]() |
![]() |
#8 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,764
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Actually, If you are changing files via OpenWith outside of the current file, to guarantee it to work properly, Sigil must install a filewatcher on each file. Right now Sigil only does that for the target file. That is why a separate interface for PageEdit (External XHTML Editor) was developed.
If you do not need or use PageEdit, you may want to use that method to better/safer run Microsoft Expression from Sigil. |
![]() |
![]() |
![]() |
#9 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 521
Karma: 8500000
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe, Kindle 4 Touch
|
Quote:
If someone wanted to use the power of Expression's search and replace on all files in an ePub, I'd always recommend using "Unpack Book" from Calibre. |
|
![]() |
![]() |
![]() |
#10 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,764
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Or you could just use the external XEditor interface in Sigil that PageEdit uses.
|
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,570
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Span Span Span Sigil cleaning up indesign | blackest | Sigil | 31 | 12-06-2017 10:16 AM |
KT3: nested (or even un-nested) document collections? | milo1984 | Amazon Kindle | 1 | 12-24-2016 02:09 PM |
Nested Span? | Turtle91 | ePub | 4 | 05-20-2013 02:47 PM |
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. 13th Dec 2010 | BrianMartinez | Kindle Books | 0 | 12-13-2010 09:25 PM |
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. 13th Dec 2010 | BrianMartinez | ePub Books | 0 | 12-13-2010 09:23 PM |