Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-24-2012, 08:43 AM   #1
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 297
Karma: 56788
Join Date: Jun 2011
Device: Kindle
Removing all <div> tags?

How do I remove all the <div> tags in a document?
ElMiko is offline   Reply With Quote
Old 01-24-2012, 09:26 AM   #2
huebi
Zealot
huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!
 
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.
huebi is offline   Reply With Quote
 
Enthusiast
Old 01-24-2012, 09:27 AM   #3
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,101
Karma: 5468860
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by ElMiko View Post
How do I remove all the <div> tags in a document?
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>
could be combined into
<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.)
theducks is online now   Reply With Quote
Old 01-24-2012, 10:14 AM   #4
Whackatagin
Tweaker
Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.Whackatagin ought to be getting tired of karma fortunes by now.
 
Whackatagin's Avatar
 
Posts: 102
Karma: 324366
Join Date: Jan 2012
Location: Scotland
Device: Kindle / KOBO / PC
Hmmm! sounds a bit complicate. Simple is best when you plan to convert an epub to mobi.

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>&nbsp;</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.
Whackatagin is offline   Reply With Quote
Old 01-24-2012, 02:41 PM   #5
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 297
Karma: 56788
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.
ElMiko is offline   Reply With Quote
Old 01-24-2012, 05:31 PM   #6
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
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
Serpentine is offline   Reply With Quote
Old 01-24-2012, 05:51 PM   #7
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 297
Karma: 56788
Join Date: Jun 2011
Device: Kindle
thanks, Serpentine. You're on top of it, as always.
ElMiko is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 02:54 PM.


MobileRead.com is a privately owned, operated and funded community.