From f16150d5f1b20b3d633b4402095ea89baa4be042 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 11 Jun 2012 23:49:24 -0700 Subject: docs(*): simplify doc urls we now have two types of namespaces: - true namespace: angular.* - used for all global apis - virtual namespace: ng.*, ngMock.*, ... - used for all DI modules the virual namespaces have services under the second namespace level (e.g. ng.) and filters and directives prefixed with filter: and directive: respectively (e.g. ng.filter:orderBy, ng.directive:ngRepeat) this simplifies urls and makes them a lot shorter while still avoiding name collisions --- docs/src/ngdoc.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'docs/src/ngdoc.js') diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 441ea2c8..5517fa93 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -101,7 +101,7 @@ Doc.prototype = { var self = this, IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:|\.|\/)/, - IS_ANGULAR = /^(api\/)?angular\./, + IS_ANGULAR = /^(api\/)?(angular|ng|AUTO)\./, IS_HASH = /^#/, parts = trim(text).split(/(
[\s\S]*?<\/pre>|[\s\S]*?<\/doc:example>|]*>[\s\S]*?<\/example>)/),
       seq = 0,
@@ -201,7 +201,7 @@ Doc.prototype = {
       }
     });
     flush();
-    this.shortName = this.name.split(this.name.match(/#/) ? /#/ : /\./ ).pop();
+    this.shortName = this.name.split(/[\.:#]/).pop();
     this.id = this.id || // if we have an id just use it
       (((this.file||'').match(/.*\/([^\/]*)\.ngdoc/)||{})[1]) || // try to extract it from file name
       this.name; // default to name
@@ -277,7 +277,7 @@ Doc.prototype = {
       }
       dom.h('Dependencies', self.requires, function(require){
         dom.tag('code', function() {
-          dom.tag('a', {href: 'api/angular.module.ng.' + require.name}, require.name);
+          dom.tag('a', {href: 'api/ng.' + require.name}, require.name);
         });
         dom.html(require.text);
       });
@@ -622,14 +622,15 @@ Doc.prototype = {
 
 
 //////////////////////////////////////////////////////////
-var GLOBALS = /^angular\.([^\.]*)$/,
-  MODULE = /^angular\.module\.([^\.]*)$/,
-  MODULE_MOCK = /^angular\.mock\.([^\.]*)$/,
-  MODULE_DIRECTIVE = /^angular\.module\.([^\.]*)(?:\.\$compileProvider)?\.directive\.([^\.]*)$/,
-  MODULE_DIRECTIVE_INPUT = /^angular\.module\.([^\.]*)\.\$compileProvider\.directive\.input\.([^\.]*)$/,
-  MODULE_FILTER = /^angular\.module\.([^\.]*)\.\$?filter\.([^\.]*)$/,
-  MODULE_SERVICE = /^angular\.module\.([^\.]*)\.([^\.]*?)(Provider)?$/,
-  MODULE_TYPE = /^angular\.module\.([^\.]*)\..*\.([A-Z][^\.]*)$/;
+var GLOBALS = /^angular\.([^\.]+)$/,
+    MODULE = /^((?:(?!^angular\.)[^\.])+)$/,
+    MODULE_MOCK = /^angular\.mock\.([^\.]+)$/,
+    MODULE_DIRECTIVE = /^((?:(?!^angular\.)[^\.])+)\.directive:([^\.]+)$/,
+    MODULE_DIRECTIVE_INPUT = /^((?:(?!^angular\.)[^\.])+)\.directive:input\.([^\.]+)$/,
+    MODULE_FILTER = /^((?:(?!^angular\.)[^\.])+)\.filter:([^\.]+)$/,
+    MODULE_SERVICE = /^((?:(?!^angular\.)[^\.])+)\.([^\.]+?)(Provider)?$/,
+    MODULE_TYPE = /^((?:(?!^angular\.)[^\.])+)\..+\.([A-Z][^\.]+)$/;
+
 
 function title(text) {
   if (!text) return text;
@@ -728,7 +729,7 @@ function scenarios(docs){
 function metadata(docs){
   var pages = [];
   docs.forEach(function(doc){
-    var path = (doc.name || '').split(/(\.|\:\s+)/);
+    var path = (doc.name || '').split(/(\.|\:)/);
     for ( var i = 1; i < path.length; i++) {
       path.splice(i, 1);
     }
-- 
cgit v1.2.3