View Single Post
Old 12-10-2016, 06:09 PM   #11
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,741
Karma: 24031403
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by signum View Post
If you decide to proceed, I have some tiny corrections that enable smoothRemove to deal with < b >, < blockquote > and < i > correctly. As it stands, the "bold" tag doesn't get closed and blockquote is just deleted entirely. I forget what's wrong with the "italic" tag. I'll be watching my inbox here at least once a day.
IMHO, the plugin author took some shortcuts and missed at least one typo. The relevant code is:

Code:
self.OPENTAG = ['<p','<b','<i','<u','<h1','<h2','<h3','<h4','<h5','<h6','<ol','<ul','<li','<body']
The highlighted expression matches <b> tags, but also all other tags that start with a b, e.g. <blockquote>.

Code:
self.CLOSETAG = ['</p>','</b>','</i>','</u>','</h1>','</h2>','</h3>','</h4>','</h5>','</h6>','</ol>','</ul>','</li>','</body>','</html>']
The closing right angle bracket of </b> is missing.

IMHO, pretty much everything that this plugin does, can be achieved by a simple regex search:

Find:<(p|b|i|u|h[1-6]|ol|ul|li|body) [^>]+>
Replace:<\1>

(My regex search string isn't perfect either, but it's slightly more robust than the one used in the plugin code.)
Doitsu is offline   Reply With Quote