aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorMisko Hevery2010-11-04 17:41:14 -0700
committerMisko Hevery2010-11-05 13:32:37 -0700
commit3d6a099d6e40f1e12f6349843218987d472d0f3c (patch)
tree5adf8b44fb57767ab6fcb3a046b3e421217dfdb2 /docs
parent8767e766d13b7d3a1e3b6b06f3030c843d3b19ba (diff)
downloadangular.js-3d6a099d6e40f1e12f6349843218987d472d0f3c.tar.bz2
changed to showdown from markup. added validator overview
Diffstat (limited to 'docs')
-rw-r--r--docs/collect.js14
-rw-r--r--docs/filter.template6
-rw-r--r--docs/index.html4
-rw-r--r--docs/overview.template2
-rw-r--r--docs/spec/collectSpec.js38
-rw-r--r--docs/validator.template27
-rw-r--r--docs/widget.template7
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>&lt;angular/&gt;</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>&lt;angular/&gt;</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>
+ &lt;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