diff options
| author | Misko Hevery | 2010-11-10 12:02:49 -0800 |
|---|---|---|
| committer | Misko Hevery | 2010-11-10 12:02:49 -0800 |
| commit | 6b8ed42670039f53d2b20dc1079f742840f62ae9 (patch) | |
| tree | 4fe8b80e2d3245a388921a05cbbb1c1f82744d76 /docs | |
| parent | c57df3dc776f8a35aaad35fc399960f0d7fee06d (diff) | |
| download | angular.js-6b8ed42670039f53d2b20dc1079f742840f62ae9.tar.bz2 | |
Added Directives
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/collect.js | 14 | ||||
| -rw-r--r-- | docs/directive.template | 37 | ||||
| -rw-r--r-- | docs/doc_widgets.js | 4 | ||||
| -rw-r--r-- | docs/index.html | 30 | ||||
| -rw-r--r-- | docs/spec/collectSpec.js | 4 |
5 files changed, 69 insertions, 20 deletions
diff --git a/docs/collect.js b/docs/collect.js index 2d43669a..08bb6be3 100644 --- a/docs/collect.js +++ b/docs/collect.js @@ -127,7 +127,8 @@ function escapedHtmlTag(doc, name, value) { } function markdownTag(doc, name, value) { - doc[name] = markdown(value.replace(/^#/gm, '##')); + doc[name] = markdown(value.replace(/^#/gm, '##')). + replace(/\<pre\>/gmi, '<pre class="brush: xml; brush: js;" ng:non-bindable>'); } function markdown(text) { @@ -135,6 +136,14 @@ function markdown(text) { return new Showdown.converter().makeHtml(text); } +function markdownNoP(text) { + var lines = markdown(text).split(NEW_LINE); + var last = lines.length - 1; + lines[0] = lines[0].replace(/^<p>/, ''); + lines[last] = lines[last].replace(/<\/p>$/, ''); + return lines.join('\n'); +} + var TAG = { ngdoc: valueTag, example: escapedHtmlTag, @@ -149,6 +158,7 @@ var TAG = { returns: markdownTag, paramDescription: markdownTag, exampleDescription: markdownTag, + element: valueTag, name: function(doc, name, value) { doc.name = value; var match = value.match(/^angular[\.\#](([^\.]+)\.(.*)|(.*))/); @@ -163,7 +173,7 @@ var TAG = { type: match[2], name: match[6] || match[5], 'default':match[7], - description:value.replace(match[0], match[8]) + description:markdownNoP(value.replace(match[0], match[8])) }; doc.param.push(param); if (!doc.paramFirst) { diff --git a/docs/directive.template b/docs/directive.template new file mode 100644 index 00000000..84b87ca7 --- /dev/null +++ b/docs/directive.template @@ -0,0 +1,37 @@ +<h1>{{name}}</h1> +<h2>Description</h2> +{{{description}}} + +<h2>Usage</h2> +<h3>In HTML Template Binding</h3> +<tt> + <pre> +<{{element}} {{shortName}}="{{paramFirst.name}}"> + ... +</{{element}}> + </pre> +</tt> + +<h3>Parameters</h3> +<ul> + {{#param}} + <li><tt>{{name}}:{{#type}}{{type}}{{/type}}{{^type}}:*{{/type}}{{#default}}={{default}}{{/default}}</tt>: {{{description}}}</li> + {{/param}} +</ul> +{{{paramDescription}}} + +{{#css}}<h3>CSS</h3>{{/css}} +{{{css}}} + +{{#example}} +<h2>Example</h2> +{{{exampleDescription}}} +<doc:example> + <doc:source> +{{/example}} + {{{example}}} +{{#example}} + </doc:source> + <doc:scenario>{{{scenario}}}</doc:scenario> +</doc:example> +{{/example}} diff --git a/docs/doc_widgets.js b/docs/doc_widgets.js index 7d723bb3..f865548c 100644 --- a/docs/doc_widgets.js +++ b/docs/doc_widgets.js @@ -23,7 +23,7 @@ var tabs = angular.element( '<ul class="doc-example">' + '<li class="doc-example-heading"><h3>Source</h3></li>' + - '<li class="doc-example-source" ng:non-bindable><pre class="brush: js"></pre></li>' + + '<li class="doc-example-source" ng:non-bindable><pre class="brush: js; brush: xml;"></pre></li>' + '<li class="doc-example-heading"><h3>Live Preview</h3></li>' + '<li class="doc-example-live">' + exampleSrc +'</li>' + '<li class="doc-example-heading"><h3>Scenario Test</h3></li>' + @@ -44,6 +44,6 @@ return function() { SyntaxHighlighter.highlight(); - } + }; }); })();
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 4939dc9c..b9dfebc0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ <!DOCTYPE HTML> -<html xmlns:ng="http://angularjs.org/" xmlns:doc="http://docs.angularjs.org/"> +<html xmlns:ng="http://angularjs.org/" xmlns:doc="http://docs.angularjs.org/" ng:controller="DocsController"> <head> <title><Angular/> Docs</title> <link rel="stylesheet" href="wiki_widgets.css" type="text/css" media="screen"> @@ -11,32 +11,33 @@ <script type="text/javascript" src="doc_widgets.js"></script> <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script> <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script> + <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script> <script type="text/javascript" src="docs-data.js"></script> <script type="text/javascript"> SyntaxHighlighter['defaults'].toolbar = false; - DocsController.$inject = ['$location'] - function DocsController($location) { + DocsController.$inject = ['$location', '$browser'] + function DocsController($location, $browser) { this.docs = NG_DOC; window.$root = this.$root; - + this.getUrl = function(page){ return '#' + encodeURIComponent(page.name); }; - this.getTitle = function() { - if ($location.hashPath.match(/^angular\./)) { - return $location.hashPath; - } - return ''; - }; - this.getCurrentPartial = function(){ if ($location.hashPath.match(/^angular\./)) { this.partialUrl = './' + $location.hashPath + '.html'; } return this.partialUrl; - }; + } + + this.getTitle = function(){ + if ($location.hashPath.match(/^angular\./)) { + this.partialTitle = $location.hashPath; + } + return this.partialTitle; + } } </script> <style type="text/css" media="screen"> @@ -122,8 +123,9 @@ float: right; } </style> + <title><angular/>: {{getTitle()}}</title> </head> -<body ng:controller="DocsController"> +<body> <div id="header"> <h1> <span class="section-title">{{getTitle()}}</span> @@ -134,7 +136,7 @@ <div ng:repeat="(name, type) in docs.section" class="nav-section"> <h2>{{name}}</h2> <ul> - <li ng:repeat="page in type"> + <li ng:repeat="page in type.$orderBy('shortName')"> <a href="{{getUrl(page)}}" ng:click="">{{page.shortName}}</a> </li> </ul> diff --git a/docs/spec/collectSpec.js b/docs/spec/collectSpec.js index fbc6c489..4df04b9f 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>abc</pre>'); - expect(doc.description).toEqual('<pre>abc</pre>'); + 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>'); }); describe('@example', function(){ |
