From 7e6f9992216157a10a64a86fe526f61f9f57e43f Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 12 Nov 2010 15:16:33 -0800 Subject: added remaining directives and search box. --- docs/collect.js | 20 +++++---- docs/directive.template | 2 + docs/docs-scenario.js | 4 +- docs/formatter.template | 2 + docs/index.html | 105 ++++++++++++++++++++++++++++++++++------------- docs/overview.template | 2 + docs/spec/collectSpec.js | 4 +- docs/validator.template | 2 + docs/widget.template | 2 + 9 files changed, 102 insertions(+), 41 deletions(-) (limited to 'docs') diff --git a/docs/collect.js b/docs/collect.js index 08bb6be3..29d2a33f 100644 --- a/docs/collect.js +++ b/docs/collect.js @@ -7,8 +7,7 @@ var fs = require('fs'), Showdown = require('showdown').Showdown; var documentation = { - section:{}, - all:[] + pages:[] }; var SRC_DIR = "docs/"; @@ -24,9 +23,7 @@ var work = callback.chain(function () { parseNgDoc(doc); if (doc.ngdoc) { delete doc.raw.text; - var section = documentation.section; - (section[doc.ngdoc] = section[doc.ngdoc] || []).push(doc); - documentation.all.push(doc); + documentation.pages.push(doc); console.log('Found:', doc.ngdoc + ':' + doc.shortName); mergeTemplate( doc.ngdoc + '.template', @@ -38,6 +35,7 @@ var work = callback.chain(function () { }).onError(function(err){ console.log('ERROR:', err.stack || err); }).onDone(function(){ + documentation.pages.sort(function(a,b){ return a.name == b.name ? 0:(a.name < b.name ? -1 : 1);}); mergeTemplate('docs-data.js', 'docs-data.js', {JSON:JSON.stringify(documentation)}, callback.chain()); mergeTemplate('docs-scenario.js', 'docs-scenario.js', documentation, callback.chain()); copy('docs-scenario.html', callback.chain()); @@ -128,12 +126,16 @@ function escapedHtmlTag(doc, name, value) { function markdownTag(doc, name, value) { doc[name] = markdown(value.replace(/^#/gm, '##')). - replace(/\/gmi, '
');
+    replace(/\/gmi, '
').
+    replace(/\<\/pre\>/gmi, '
'); } function markdown(text) { text = text.replace(//gm, '<angular/>'); - return new Showdown.converter().makeHtml(text); + text = text.replace(/(angular\.[\w\._\-:]+)/gm, '$1'); + text = text.replace(/(`(ng:[\w\._\-]+)`)/gm, '$1'); + text = new Showdown.converter().makeHtml(text); + return text; } function markdownNoP(text) { @@ -161,8 +163,8 @@ var TAG = { element: valueTag, name: function(doc, name, value) { doc.name = value; - var match = value.match(/^angular[\.\#](([^\.]+)\.(.*)|(.*))/); - doc.shortName = match[3] || match[4]; + doc.shortName = value.split(/\./).pop(); + doc.depth = value.split(/\./).length - 1; }, param: function(doc, name, value){ doc.param = doc.param || []; diff --git a/docs/directive.template b/docs/directive.template index 84b87ca7..a3a11056 100644 --- a/docs/directive.template +++ b/docs/directive.template @@ -35,3 +35,5 @@ {{{scenario}}} {{/example}} + + diff --git a/docs/docs-scenario.js b/docs/docs-scenario.js index 08d0e91b..7383bd7f 100644 --- a/docs/docs-scenario.js +++ b/docs/docs-scenario.js @@ -1,4 +1,4 @@ -{{#all}} +{{#pages}} describe('{{name}}', function(){ beforeEach(function(){ browser().navigateTo('index.html#{{name}}'); @@ -6,4 +6,4 @@ describe('{{name}}', function(){ // {{raw.file}}:{{raw.line}} {{{scenario}}} }); -{{/all}} +{{/pages}} diff --git a/docs/formatter.template b/docs/formatter.template index af95f729..b0871a2d 100644 --- a/docs/formatter.template +++ b/docs/formatter.template @@ -31,3 +31,5 @@ var modelValue = angular.formatter.{{shortName}}.parse(userInputString); {{{scenario}}} {{/example}} + + diff --git a/docs/index.html b/docs/index.html index b9dfebc0..2533caf3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -26,18 +26,22 @@ }; this.getCurrentPartial = function(){ - if ($location.hashPath.match(/^angular\./)) { - this.partialUrl = './' + $location.hashPath + '.html'; - } - return this.partialUrl; + return './' + this.getTitle() + '.html'; } this.getTitle = function(){ - if ($location.hashPath.match(/^angular\./)) { - this.partialTitle = $location.hashPath; + var hashPath = $location.hashPath || 'angular'; + if (hashPath.match(/^angular/)) { + this.partialTitle = hashPath; } return this.partialTitle; } + + this.getClass = function(page) { + return 'level-' + page.depth + + (page.name == this.getTitle() ? ' selected' : ''); + }; + } <angular/>: {{getTitle()}} @@ -133,14 +182,14 @@
diff --git a/docs/overview.template b/docs/overview.template index 7af05ff4..b05a9b1a 100644 --- a/docs/overview.template +++ b/docs/overview.template @@ -13,3 +13,5 @@ {{{scenario}}} {{/example}} + + diff --git a/docs/spec/collectSpec.js b/docs/spec/collectSpec.js index 4df04b9f..b810f823 100644 --- a/docs/spec/collectSpec.js +++ b/docs/spec/collectSpec.js @@ -43,8 +43,8 @@ describe('collect', function(){ describe('@describe', function(){ it('should support pre blocks', function(){ - TAG.description(doc, 'description', '
abc
'); - expect(doc.description).toEqual('
abc
'); + TAG.description(doc, 'description', '
abc
'); + expect(doc.description).toEqual('
abc
'); }); describe('@example', function(){ diff --git a/docs/validator.template b/docs/validator.template index 63d17072..f7b4e888 100644 --- a/docs/validator.template +++ b/docs/validator.template @@ -37,3 +37,5 @@ angular.validator.{{shortName}}({{paramFirst.name}}{{#paramRest}}{{^default}}, { {{{scenario}}} {{/example}} + + diff --git a/docs/widget.template b/docs/widget.template index 4a20629e..7ca3fcf4 100644 --- a/docs/widget.template +++ b/docs/widget.template @@ -37,3 +37,5 @@ {{{scenario}}} {{/example}} + + -- cgit v1.2.3