doc: skip type parsing inside code blocks
authorVladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
Wed, 25 Dec 2013 15:59:25 +0000 (19:59 +0400)
committerTrevor Norris <trev.norris@gmail.com>
Wed, 22 Jan 2014 20:27:58 +0000 (12:27 -0800)
Since types are denoted with curly braces it can cause erroneous
replaces in code blocks.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
tools/doc/html.js

index 087f726..088eb44 100644 (file)
@@ -122,9 +122,15 @@ function parseLists(input) {
 
 
 function parseListItem(text) {
-  text = text.replace(/\{([^\}]+)\}/, '<span class="type">$1</span>');
+  var parts = text.split('`');
+  var i;
+
+  for (i = 0; i < parts.length; i += 2) {
+    parts[i] = parts[i].replace(/\{([^\}]+)\}/, '<span class="type">$1</span>');
+  }
+
   //XXX maybe put more stuff here?
-  return text;
+  return parts.join('`');
 }
 
 function parseAPIHeader(text) {