From ed768ebc53ef6746ca83d81892c22d2e9c3afeef Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 31 Jan 2011 11:55:44 -0800 Subject: Developer guide documentation --- docs/src/ngdoc.js | 12 +++++++----- docs/src/templates/doc_widgets.js | 1 + docs/src/templates/docs.js | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'docs/src') diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index e01d9ccf..a3a037cd 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -114,7 +114,7 @@ Doc.prototype = { description: markdown(text.replace(match[0], match[2])) }; } else if(atName == 'description') { - text.replace(/([\s\S]*)<\/doc:scenario>/mi, + text.replace(/([\s\S]*?)<\/doc:scenario>/gmi, function(_, scenario){ self.scenarios.push(scenario); }); @@ -154,7 +154,7 @@ Doc.prototype = { throw new Error("Don't know how to format @ngdoc: " + self.ngdoc); }).call(self, dom); - dom.example(self.exampleDescription, self.example, self.scenario); + dom.example(self.exampleDescription, self.example, self.scenarios[0]); }); return dom.toString(); @@ -438,6 +438,8 @@ Doc.prototype = { ////////////////////////////////////////////////////////// function markdown (text) { + var IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:)/; + var IS_ANGULAR = /^angular\./; if (!text) return text; var parts = text.split(/(
[\s\S]*?<\/pre>|[\s\S]*?<\/doc:example>)/),
       match;
@@ -462,10 +464,10 @@ function markdown (text) {
       text = text.replace(//gm, '<angular/>');
       text = text.replace(/{@link ([^\s}]+)((\s|\n)+(.+?))?\s*}/gm,
         function(_all, url, _2, _3, title){
-          return ''
-            + (url.match(/^angular\./) ? '' : '')
+          return ''
+            + (url.match(IS_ANGULAR) ? '' : '')
             + (title || url)
-            + (url.match(/^angular\./) ? '' : '')
+            + (url.match(IS_ANGULAR) ? '' : '')
             + '';
         });
       text = new Showdown.converter().makeHtml(text);
diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js
index 39b9ff48..bfa8e5d0 100644
--- a/docs/src/templates/doc_widgets.js
+++ b/docs/src/templates/doc_widgets.js
@@ -56,6 +56,7 @@
   });
 
   function indent(text) {
+    if (!text) return text;
     var lines = text.split(/\n/);
     var lineNo = [];
     // remove any leading blank lines
diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js
index aaea8c9d..ab96a699 100644
--- a/docs/src/templates/docs.js
+++ b/docs/src/templates/docs.js
@@ -40,4 +40,9 @@ function DocsController($location, $browser, $window) {
 
 }
 
+// prevent compilation of code
+angular.widget('code', function(element){
+  element.attr('ng:non-bindable', 'true');
+});
+
 SyntaxHighlighter['defaults'].toolbar = false;
-- 
cgit v1.2.3