View Single Post
Old 02-24-2013, 11:51 AM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Dybbuk View Post
In that case, why does Sigil - whose whole purpose is editing HTML - use regex? (Not complaining, Sigil is awesome. Just curious.)
Because there's a difference between editing and parsing. And the Find & Replace feature in most editing software really has nothing to do with parsing code. F&R doesn't even know what "code" is. It's simply searching text for patterns you specify. Regex just happens to be one of the most flexible/powerful and common ways to achieve this.

What you want to do goes beyond the normal definition of editing or even Searching & Replacing. You're looking for something that automatically transforms code into new code—new code whose conventions you want to be able to specify (and preferably with no data-loss). That's a whole different ball o' wax.. and not something that's easily incorporated into a program (not without hard-coding the transformation rules, anyway; which would seriously limit the feature's usefulness to an end-user).

Quote:
I don't want to strip the style. I want to keep the style and formatting, and remove everything outside of the paragraphs, such as <div>, <script>, etc
What about headers? Blockquotes? There's all kinds of situations that can arise in ePubs where text you definitely don't want to lose occurs outside of the <p> tags.

Last edited by DiapDealer; 02-24-2013 at 12:03 PM.
DiapDealer is offline   Reply With Quote