|
|
What steps will reproduce the problem?
1. Run prettyprint() twice: the 2nd run causes previous rendered <pre> or <code> blocks to
loose there formatting.
2.
3.
(Please include HTML, not just your source code)
What is the expected output? What do you see instead?
I would expect prettify to skip the blocks which already have been formatted.
This is especially useful when running prettify after eg ajax calls.
What version are you using? On what browser?
vs 31 Aug 2007
Please provide any additional information below.
Suggeted implementation::
I changed prettify.js to add a 'prettified' class to each block when rendered.
//mark the element as converted
cs.className = cs.className+' prettified';
Then added a simply check of this classname when entereing the doWork loop
/* added classname 'prettified' to avoid double processing */
if (cs.className
&& cs.className.indexOf('prettyprint') >= 0
&& cs.className.indexOf('prettified') == -1 ) {
|