What steps will reproduce the problem?
1. call prettyPrintOne
What is the expected output? What do you see instead?
Expect pretty markup to be returned. Instead, get the following error in a
stack trace (truncated):
TypeError: Cannot read property 'className' of undefined
at recombineTagsAndDecorations (http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js:1117:37)
What version are you using? On what browser?
Trunk, on any browser
Please provide any additional information below.
I am using this syntax highlighter in a project, and I need to be able to use
the prettyPrintOne function to highlight things on demand. I was able to fix
this with the following patch, and added a line number parameter as well:
--- prettify.js.orig 2010-10-14 02:31:10.126216000 -0700
+++ prettify.js.new 2010-10-14 02:30:34.828585000 -0700
@@ -1380,6 +1380,7 @@
- function prettyPrintOne(sourceCodeHtml, opt_langExtension) {
+ function prettyPrintOne(sourceCodeHtml, opt_langExtension, opt_lineNum) {
var job = {
sourceCodeHtml: sourceCodeHtml,
- langExtension: opt_langExtension
+ langExtension: opt_langExtension,
+ sourceNode: { className: opt_lineNum ? "linenums:"+Math.max(opt_lineNum,
1) : "" }
};
Original issue reported on code.google.com by kgan...@gmail.com on 14 Oct 2010 at 9:44
Original issue reported on code.google.com by
kgan...@gmail.com
on 14 Oct 2010 at 9:44