add support for @deprecated ng:doc annotation + show warnings in templates

This commit is contained in:
Igor Minar 2010-11-15 22:51:16 -08:00
parent 7d6f5f986e
commit c7052f098d
11 changed files with 86 additions and 8 deletions

View file

@ -212,6 +212,7 @@ var TAG = {
namespace: valueTag,
css: valueTag,
see: valueTag,
deprecated: valueTag,
usageContent: valueTag,
'function': valueTag,
description: markdownTag,

View file

@ -1,4 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}

View file

@ -130,3 +130,12 @@ a {
margin-left: 3em;
font-family: monospace;
}
.deprecated {
border: 2px solid red;
}
.deprecated legend {
font-weight: bold;
color: red;
}

View file

@ -1,4 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}

View file

@ -1,4 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}

View file

@ -1,4 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}

View file

@ -1,4 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
{{{description}}}
{{#example}}

View file

@ -1,4 +1,12 @@
<h1><tt>{{name}}</tt></h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}

View file

@ -182,21 +182,27 @@ describe('collect', function(){
});
});
describe('@describe', function(){
describe('@description', function(){
it('should support pre blocks', function(){
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(){
it('should not remove {{}}', function(){
TAG.example(doc, 'example', 'text {{ abc }}');
expect(doc.example).toEqual('text {{ abc }}');
});
});
describe('@example', function(){
it('should not remove {{}}', function(){
TAG.example(doc, 'example', 'text {{ abc }}');
expect(doc.example).toEqual('text {{ abc }}');
});
});
describe('@deprecated', function() {
it('should parse @deprecated', function() {
TAG.deprecated(doc, 'deprecated', 'Replaced with foo.');
expect(doc.deprecated).toBe('Replaced with foo.');
})
});
});
describe('trim', function(){

View file

@ -1,5 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}

View file

@ -1,5 +1,12 @@
<h1>{{name}}</h1>
{{#deprecated}}
<fieldset class="deprecated">
<legend>Deprecated API</legend>
{{deprecated}}
</fieldset>
{{/deprecated}}
<h2>Description</h2>
{{{description}}}