diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/collect.js | 20 | ||||
| -rw-r--r-- | docs/directive.template | 2 | ||||
| -rw-r--r-- | docs/docs-scenario.js | 4 | ||||
| -rw-r--r-- | docs/formatter.template | 2 | ||||
| -rw-r--r-- | docs/index.html | 105 | ||||
| -rw-r--r-- | docs/overview.template | 2 | ||||
| -rw-r--r-- | docs/spec/collectSpec.js | 4 | ||||
| -rw-r--r-- | docs/validator.template | 2 | ||||
| -rw-r--r-- | docs/widget.template | 2 |
9 files changed, 102 insertions, 41 deletions
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(/\<pre\>/gmi, '<pre class="brush: xml; brush: js;" ng:non-bindable>'); + replace(/\<pre\>/gmi, '<div ng:non-bindable><pre class="brush: js; html-script: true; toolbar: false;">'). + replace(/\<\/pre\>/gmi, '</pre></div>'); } function markdown(text) { text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>'); - return new Showdown.converter().makeHtml(text); + text = text.replace(/(angular\.[\w\._\-:]+)/gm, '<a href="#$1">$1</a>'); + text = text.replace(/(`(ng:[\w\._\-]+)`)/gm, '<a href="#angular.directive.$2">$1</a>'); + 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 @@ <doc:scenario>{{{scenario}}}</doc:scenario> </doc:example> {{/example}} + +<script>SyntaxHighlighter.highlight();</script> 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); <doc:scenario>{{{scenario}}}</doc:scenario> </doc:example> {{/example}} + +<script>SyntaxHighlighter.highlight();</script> 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' : ''); + }; + } </script> <style type="text/css" media="screen"> @@ -47,12 +51,20 @@ margin: 0; padding: 0; } - - #sidebar { - width: 15em; - float: left; + + a { + color: blue; } - + + .nav-section { + margin-left: 1em; + margin-top: 0.5em; + } + + .section-title { + float: right; + } + #header { background-color: #F2C200; margin-bottom: 1em; @@ -95,11 +107,27 @@ #section h1 { font-family: monospace; margin-top: 0; + padding-bottom: 5px; + border-bottom: 1px solid #CCC; } - #sidebar h2 { - font-size: 1.2em; - margin: 5px 5px 5px 0.8em; + #sidebar { + width: 180px; + float: left; + padding-left: 1em; + } + + #sidebar a { + text-decoration: none; + } + + #sidebar a:hover { + text-decoration: underline; + } + + #sidebar input { + width: 175px; + margin-bottom: 1em; } #sidebar ul { @@ -110,18 +138,39 @@ } #sidebar ul li { - margin: 0; - padding: 1px 1px 1px 1.5em; } + + #sidebar ul li a { + display: block; + padding: 2px 2px 2px 4px; + } - .nav-section { + #sidebar ul li.selected a { + background-color: #DDD; + border-radius: 5px; + -moz-border-radius: 5px; + border: 1px solid #CCC; + padding: 1px 1px 1px 3px; + } + + #sidebar ul li.level-0 { + margin-left: 0em; + font-weight: bold; + font-size: 1.2em; + } + + #sidebar ul li.level-1 { margin-left: 1em; - margin-top: 0.5em; + margin-top: 5px; + font-size: 1.1em; + font-weight: bold; } - .section-title { - float: right; + #sidebar ul li.level-2 { + margin-left: 2em; + font-family: monospace; } + </style> <title><angular/>: {{getTitle()}}</title> </head> @@ -133,14 +182,14 @@ </h1> </div> <div id="sidebar" class="nav"> - <div ng:repeat="(name, type) in docs.section" class="nav-section"> - <h2>{{name}}</h2> - <ul> - <li ng:repeat="page in type.$orderBy('shortName')"> - <a href="{{getUrl(page)}}" ng:click="">{{page.shortName}}</a> - </li> - </ul> - </div> + <div> + <input type="text" name="filterText" placeholder="search documentaiton"/> + <ul> + <li ng:repeat="page in docs.pages.$filter(filterText)" ng:class="getClass(page)"> + <a href="{{getUrl(page)}}" ng:click="">{{page.shortName}}</a> + </li> + </ul> + </div> </div> <div id="section"> <ng:include src="getCurrentPartial()"></ng:include> 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 @@ <doc:scenario>{{{scenario}}}</doc:scenario> </doc:example> {{/example}} + +<script>SyntaxHighlighter.highlight();</script> 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', '<pre class="brush: xml;" ng:non-bindable>abc</pre>'); - expect(doc.description).toEqual('<pre class="brush: xml;" ng:non-bindable>abc</pre>'); + TAG.description(doc, 'description', '<pre>abc</pre>'); + expect(doc.description).toEqual('<div ng:non-bindable><pre class="brush: js; html-script: true; toolbar: false;">abc</pre></div>'); }); 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}}, { <doc:scenario>{{{scenario}}}</doc:scenario> </doc:example> {{/example}} + +<script>SyntaxHighlighter.highlight();</script> 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 @@ <doc:scenario>{{{scenario}}}</doc:scenario> </doc:example> {{/example}} + +<script>SyntaxHighlighter.highlight();</script> |
