![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 358
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Removing all <div> tags?
How do I remove all the <div> tags in a document?
|
![]() |
![]() |
![]() |
#2 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 121
Karma: 5070
Join Date: Dec 2010
Device: none
|
find all <div> and replace them by nothing. Goto book view, tidy will do the rest.
|
![]() |
![]() |
![]() |
#3 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Why?
![]() BTW Replace might be a better term, especially if you want to pass Flightcrew ![]() You can't have naked text, so be careful Code:
<div class="first"><p class="normal">Text</p></div> <p class="normal first">Text</p>[/CODE] I have trouble getting matching tag pairs to only Match in my REGEX (same problem with excessive Span removal, It needs to match the correct partner.) |
![]() |
![]() |
![]() |
#4 |
Tweaker
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 102
Karma: 324366
Join Date: Jan 2012
Location: Scotland
Device: Kindle / KOBO / PC
|
Hmmm! sounds a bit complicate.
![]() You only really need <div> to open and close each xhtml file if it's basic fiction prose. i.e. one before the first <p> section, and one after the last. Note: not the cover page .htm, that's a bit different. Actual paragraphs only need...<p class=MsoNormal> text in here </p> & <p> </p> for a paragraph break, i.e. blank line. Simple coding yeilds better results for mobi conversion. ![]() ps the little brush button (Tidy) will more often than not add superfluous tags and other bits and peices. Working with it off, if your making a file to convert, is advised. If you make a boo-boo you will get a "not well formed" error which will highlight the problem. You can then fix it manually, or automatic and clean up as required. |
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 358
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
I don't want to replace <div>, I want to delete them. As it stands, they're merely coding clutter. Naked text won't be a problem.
Thanks to huebi for the simple solution. Same as Whackatagin, I'm usually reticent to let Sigil automagically fix "malformed code", but in this case it worked without a hitch. |
![]() |
![]() |
![]() |
#6 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
Div's are also annoying in a lot of places since some readers like to default to page-breaking on them, if they are used sparsely. Never really understood why they're useful in most cases. Anyway removing them is easy enough with something like
Code:
</?div\b[^<>]*> Last edited by Serpentine; 01-24-2012 at 05:43 PM. Reason: oops |
![]() |
![]() |
![]() |
#7 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 358
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
thanks, Serpentine. You're on top of it, as always.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changing or removing <div class="calibrenavbar"> | ptsefton | Recipes | 3 | 05-28-2011 08:30 AM |
Regular expression for matching div tags? | kiwidude | Sigil | 11 | 12-12-2010 06:11 AM |
keeping or removing a div with multiple classes | JohnsonZA | Recipes | 1 | 09-25-2010 10:33 AM |
Remove spacing between paragraphs - what about div tags ? | NASCARaddicted | Calibre | 5 | 11-07-2009 05:47 AM |
Line indents using "<div>" tags | HarryT | Kindle Formats | 11 | 04-29-2009 10:18 PM |