mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-16 18:51:06 +00:00
add support for @deprecated ng:doc annotation + show warnings in templates
This commit is contained in:
parent
7d6f5f986e
commit
c7052f098d
11 changed files with 86 additions and 8 deletions
|
|
@ -212,6 +212,7 @@ var TAG = {
|
||||||
namespace: valueTag,
|
namespace: valueTag,
|
||||||
css: valueTag,
|
css: valueTag,
|
||||||
see: valueTag,
|
see: valueTag,
|
||||||
|
deprecated: valueTag,
|
||||||
usageContent: valueTag,
|
usageContent: valueTag,
|
||||||
'function': valueTag,
|
'function': valueTag,
|
||||||
description: markdownTag,
|
description: markdownTag,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,3 +130,12 @@ a {
|
||||||
margin-left: 3em;
|
margin-left: 3em;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.deprecated {
|
||||||
|
border: 2px solid red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deprecated legend {
|
||||||
|
font-weight: bold;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
{{#example}}
|
{{#example}}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
<h1><tt>{{name}}</tt></h1>
|
<h1><tt>{{name}}</tt></h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,21 +182,27 @@ describe('collect', function(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('@describe', function(){
|
describe('@description', function(){
|
||||||
it('should support pre blocks', function(){
|
it('should support pre blocks', function(){
|
||||||
TAG.description(doc, 'description', '<pre>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>');
|
expect(doc.description).toEqual('<div ng:non-bindable><pre class="brush: js; html-script: true; toolbar: false;">abc</pre></div>');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('@example', function(){
|
describe('@example', function(){
|
||||||
it('should not remove {{}}', function(){
|
it('should not remove {{}}', function(){
|
||||||
TAG.example(doc, 'example', 'text {{ abc }}');
|
TAG.example(doc, 'example', 'text {{ abc }}');
|
||||||
expect(doc.example).toEqual('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(){
|
describe('trim', function(){
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
|
|
||||||
|
{{#deprecated}}
|
||||||
|
<fieldset class="deprecated">
|
||||||
|
<legend>Deprecated API</legend>
|
||||||
|
{{deprecated}}
|
||||||
|
</fieldset>
|
||||||
|
{{/deprecated}}
|
||||||
|
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
{{{description}}}
|
{{{description}}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue