diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/collect.js | 14 | ||||
| -rw-r--r-- | docs/filter.template | 6 | ||||
| -rw-r--r-- | docs/index.html | 4 | ||||
| -rw-r--r-- | docs/overview.template | 2 | ||||
| -rw-r--r-- | docs/spec/collectSpec.js | 38 | ||||
| -rw-r--r-- | docs/validator.template | 27 | ||||
| -rw-r--r-- | docs/widget.template | 7 |
7 files changed, 80 insertions, 18 deletions
diff --git a/docs/collect.js b/docs/collect.js index c16366ab..04735985 100644 --- a/docs/collect.js +++ b/docs/collect.js @@ -4,7 +4,7 @@ var fs = require('fs'), spawn = require('child_process').spawn, mustache = require('mustache'), callback = require('callback'), - markdown = require('markdown'); + Showdown = require('showdown').Showdown; var documentation = { section:{}, @@ -99,7 +99,12 @@ function escapedHtmlTag(doc, name, value) { } function markdownTag(doc, name, value) { - doc[name] = markdown.toHTML(value.replace(/^#/gm, '##')); + doc[name] = markdown(value.replace(/^#/gm, '##')); +} + +function markdown(text) { + text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>'); + return new Showdown.converter().makeHtml(text); } var TAG = { @@ -114,6 +119,8 @@ var TAG = { description: markdownTag, TODO: markdownTag, returns: markdownTag, + paramDescription: markdownTag, + exampleDescription: markdownTag, name: function(doc, name, value) { doc.name = value; doc.shortName = value.split(/\./).pop(); @@ -127,7 +134,8 @@ var TAG = { type: match[2], name: match[6] || match[5], 'default':match[7], - description:match[8]}; + description:value.replace(match[0], match[8]) + }; doc.param.push(param); if (!doc.paramFirst) { doc.paramFirst = param; diff --git a/docs/filter.template b/docs/filter.template index 0602aff9..9375f422 100644 --- a/docs/filter.template +++ b/docs/filter.template @@ -1,4 +1,7 @@ <h1><tt>{{name}}</tt></h1> +<h2>Description</h2> +{{{description}}} + <h2>Usage</h2> <h3>In HTML Template Binding</h3> <tt> @@ -25,9 +28,6 @@ angular.filter.{{shortName}}({{paramFirst.name}}{{#paramRest}}, {{name}}{{/param <h3>CSS</h3> {{{css}}} -<h2>Description</h2> -{{{description}}} - <WIKI:SOURCE style="display:block;"> {{{example}}} </WIKI:SOURCE>
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index a2cad87e..2f5a8234 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,8 +4,8 @@ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript" src="docs-data.js"></script> <script type="text/javascript" src="../angular.min.js" ng:autobind></script> - <script type="text/javascript" src="http://angularjs.org/extensions/wiki_widgets.js"></script> - <link rel="stylesheet" href="http://angularjs.org/extensions/wiki_widgets.css" type="text/css" media="screen" /> + <script type="text/javascript" src="wiki_widgets.js"></script> + <link rel="stylesheet" href="wiki_widgets.css" type="text/css" media="screen" /> <script type="text/javascript"> function DocsController() { this.docs = NG_DOC; diff --git a/docs/overview.template b/docs/overview.template index c4c899e2..61fd426f 100644 --- a/docs/overview.template +++ b/docs/overview.template @@ -3,4 +3,4 @@ <WIKI:SOURCE style="display:block;"> {{{example}}} -</WIKI:SOURCE>
\ No newline at end of file +</WIKI:SOURCE> diff --git a/docs/spec/collectSpec.js b/docs/spec/collectSpec.js index 2d1b559c..371438f5 100644 --- a/docs/spec/collectSpec.js +++ b/docs/spec/collectSpec.js @@ -6,21 +6,29 @@ var Script = process.binding('evals').Script; var collect = load('docs/collect.js'); describe('collect', function(){ + describe('markdown', function(){ + it('should replace angular in markdown', function(){ + expect(collect.markdown('<angular/>')). + toEqual('<p><tt><angular/></tt></p>'); + }); + }); + describe('TAG', function(){ var TAG = collect.TAG; + var doc; + beforeEach(function(){ + doc = {}; + }); + describe('@param', function(){ - var doc; - beforeEach(function(){ - doc = {}; - }); it('should parse with no default', function(){ TAG.param(doc, 'param', - '{(number|string)} number Number to format.'); + '{(number|string)} number Number \n to format.'); expect(doc.param).toEqual([{ type : '(number|string)', name : 'number', 'default' : undefined, - description : 'Number to format.' }]); + description : 'Number \n to format.' }]); }); it('should parse with default', function(){ TAG.param(doc, 'param', @@ -32,7 +40,25 @@ describe('collect', function(){ description : 'desc' }]); }); }); + + describe('@describe', function(){ + it('should support pre blocks', function(){ + TAG.description(doc, 'description', '<pre>abc</pre>'); + expect(doc.description).toEqual('<pre>abc</pre>'); + }); + + describe('@example', function(){ + it('should not remove {{}}', function(){ + TAG.example(doc, 'example', 'text {{ abc }}'); + expect(doc.example).toEqual('text {{ abc }}'); + }); + + }); + }); + }); + + }); function load(path){ diff --git a/docs/validator.template b/docs/validator.template new file mode 100644 index 00000000..0d1a04f2 --- /dev/null +++ b/docs/validator.template @@ -0,0 +1,27 @@ +<h1><tt>{{name}}</tt></h1> + +<h2>Description</h2> +{{{description}}} + +<h2>Usage</h2> +<h3>In HTML Template Binding</h3> +<tt> + <input type="text" ng:validate="{{shortName}}{{#paramRest}}{{^default}}:{{name}}{{/default}}{{#default}}<i>[:{{name}}]</i>{{/default}}{{/paramRest}}"/> +</tt> + +<h3>Parameters</h3> +<ul> + {{#param}} + <li><tt>{{name}}:{{#type}}{{type}}{{/type}}{{^type}}:*{{/type}}{{#default}}={{default}}{{/default}}</tt>: {{{description}}}</li> + {{/param}} +</ul> +{{{paramDescription}}} + +<h3>CSS</h3> +{{{css}}} + +<h2>Example</h2> +{{{exampleDescription}}} +<WIKI:SOURCE style="display:block;"> +{{{example}}} +</WIKI:SOURCE>
\ No newline at end of file diff --git a/docs/widget.template b/docs/widget.template index cf82eac9..b26bfb1c 100644 --- a/docs/widget.template +++ b/docs/widget.template @@ -1,4 +1,8 @@ <h1><tt>{{name}}</tt></h1> + +<h2>Description</h2> +{{{description}}} + <h2>Usage</h2> <h3>In HTML Template Binding</h3> <tt> @@ -20,9 +24,6 @@ <h3>CSS</h3> {{{css}}} -<h2>Description</h2> -{{{description}}} - <WIKI:SOURCE style="display:block;"> {{{example}}} </WIKI:SOURCE>
\ No newline at end of file |
