diff options
| author | Igor Minar | 2012-06-11 23:49:24 -0700 | 
|---|---|---|
| committer | Igor Minar | 2012-06-12 00:10:18 -0700 | 
| commit | f16150d5f1b20b3d633b4402095ea89baa4be042 (patch) | |
| tree | 9d5c570348264884174ecca52b958da7a821fcf8 /docs/src/templates/js | |
| parent | fc0b2b5715655a05cbb4c8e79969c95d7e7ce8b7 (diff) | |
| download | angular.js-f16150d5f1b20b3d633b4402095ea89baa4be042.tar.bz2 | |
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
Diffstat (limited to 'docs/src/templates/js')
| -rw-r--r-- | docs/src/templates/js/docs.js | 46 | 
1 files changed, 24 insertions, 22 deletions
diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js index 5bcb9f6d..2eaa7c29 100644 --- a/docs/src/templates/js/docs.js +++ b/docs/src/templates/js/docs.js @@ -229,18 +229,18 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie    var OFFLINE_COOKIE_NAME = 'ng-offline',        DOCS_PATH = /^\/(api)|(guide)|(cookbook)|(misc)|(tutorial)/,        INDEX_PATH = /^(\/|\/index[^\.]*.html)$/, -      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][^\.]*)$/, +      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][^\.]+)$/,        URL = {          module: 'guide/module',          directive: 'guide/directive', -        input: 'api/angular.module.ng.$compileProvider.directive.input', +        input: 'api/ng.directive:input',          filter: 'guide/dev_guide.templates.filters',          service: 'guide/dev_guide.services',          type: 'guide/types' @@ -325,22 +325,22 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie            breadcrumb.push({ name: partialId });          } else if (match = partialId.match(MODULE)) {            breadcrumb.push({ name: match[1] }); -        } else if (match = partialId.match(MODULE_SERVICE)) { -          breadcrumb.push({ name: match[1], url: sectionId + '/angular.module.' + match[1] }); -          breadcrumb.push({ name: match[2] });          } else if (match = partialId.match(MODULE_FILTER)) { -          breadcrumb.push({ name: match[1], url: sectionId + '/angular.module.' + match[1] }); +          breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] });            breadcrumb.push({ name: match[2] });          } else if (match = partialId.match(MODULE_DIRECTIVE)) { -          breadcrumb.push({ name: match[1], url: sectionId + '/angular.module.' + match[1] }); +          breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] });            breadcrumb.push({ name: match[2] });          } else if (match = partialId.match(MODULE_DIRECTIVE_INPUT)) { -          breadcrumb.push({ name: match[1], url: sectionId + '/angular.module.' + match[1] }); +          breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] });            breadcrumb.push({ name: 'input', url: URL.input });            breadcrumb.push({ name: match[2] });          } else if (match = partialId.match(MODULE_TYPE)) { -          breadcrumb.push({ name: match[1], url: sectionId + '/angular.module.' + match[1] }); +          breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] });            breadcrumb.push({ name: match[2] }); +        }  else if (match = partialId.match(MODULE_SERVICE)) { +          breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); +          breadcrumb.push({ name: match[2] + (match[3] || '') });          } else if (match = partialId.match(MODULE_MOCK)) {            breadcrumb.push({ name: 'angular.mock.' + match[1] });          } else { @@ -405,26 +405,28 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie          bestMatch = match;        } -      if (id == 'angular.Module') { +      if (page.id == 'index') { +        //skip +      } else if (page.section != 'api') { +        otherPages.push(page); +      } else if (id == 'angular.Module') {          module('ng').types.push(page);        } else if (match = id.match(GLOBALS)) {          module('ng').globals.push(page);        } else if (match = id.match(MODULE)) {          module(match[1]); -      } else if (match = id.match(MODULE_SERVICE)) { -        module(match[1]).service(match[2])[match[3] ? 'provider' : 'instance'] = page;        } else if (match = id.match(MODULE_FILTER)) {          module(match[1]).filters.push(page);        } else if (match = id.match(MODULE_DIRECTIVE)) {          module(match[1]).directives.push(page);        } else if (match = id.match(MODULE_DIRECTIVE_INPUT)) {          module(match[1]).directives.push(page); +      } else if (match = id.match(MODULE_SERVICE)) { +        module(match[1]).service(match[2])[match[3] ? 'provider' : 'instance'] = page;        } else if (match = id.match(MODULE_TYPE)) {          module(match[1]).types.push(page);        } else if (match = id.match(MODULE_MOCK)) {          module('ngMock').globals.push(page); -      } else if (page.section != 'api' && page.id != 'index'){ -        otherPages.push(page);        }      }); @@ -438,7 +440,7 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie        if (!module) {          module = cache[name] = {            name: name, -          url: 'api/angular.module.' + name, +          url: 'api/' + name,            globals: [],            directives: [],            services: [],  | 
