Browse Source

Implemented example cross-referencing from docs

Casey Grun 10 years ago
parent
commit
66ce3bafff
1 changed files with 4 additions and 0 deletions
  1. 4 0
      docs/page.js

+ 4 - 0
docs/page.js

@@ -33,6 +33,10 @@ var onDocumentLoad = function ( event ) {
 	text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_|\(|\)]+) ([\w|\:|\/|\.|\-|\_ ]+)\]/gi, "<a href=\"$1\"  target=\"_blank\">$2</a>" ); // [link:url title]
 	text = text.replace(/\*([\w|\d|\"|\-|\(][\w|\d|\ |\-|\/|\+|\-|\(|\)|\=|\,|\.\"]*[\w|\d|\"|\)]|\w)\*/gi, "<strong>$1</strong>" ); // *
 
+	text = text.replace(/\[example:([\w\_]+)\]/gi, "[example:$1 $1]" ); // [example:name] to [example:name title]
+	text = text.replace(/\[example:([\w\_]+) ([\w\_]+)\]/gi, "<a href=\"../../../examples/#$1\"  target=\"_blank\">$2</a>" ); // [example:name title]
+
+
 	document.body.innerHTML = text;
 
 	// handle code snippets formatting