07-22-2023, 05:54 AM | #1 |
Enthusiast
Posts: 43
Karma: 10
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 |
07-22-2023, 08:04 AM | #2 |
Sigil Developer
Posts: 7,654
Karma: 5433388
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. |
Advert | |
|
07-22-2023, 05:22 PM | #3 |
Wizard
Posts: 2,297
Karma: 12126329
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: |
07-24-2023, 02:31 PM | #4 | |
Evangelist
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
|
Quote:
Being able to find a tag by one or more of:
|
|
07-24-2023, 04:10 PM | #5 |
Sigil Developer
Posts: 7,654
Karma: 5433388
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?
|
Advert | |
|
07-24-2023, 05:05 PM | #6 |
Bibliophagist
Posts: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, 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.
|
07-25-2023, 10:39 AM | #7 | ||
Evangelist
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
|
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. |
||
07-25-2023, 11:24 AM | #8 |
Sigil Developer
Posts: 7,654
Karma: 5433388
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. |
07-26-2023, 10:31 AM | #9 | |
Evangelist
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
|
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. |
|
07-26-2023, 11:40 AM | #10 |
Sigil Developer
Posts: 7,654
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Or you could just use the external XEditor interface in Sigil that PageEdit uses.
|
07-26-2023, 11:47 AM | #11 |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
|
Similar Threads | ||||
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 |