Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
feat(ngdocs): provide support for inline variable hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
matsko authored and mhevery committed May 31, 2013
1 parent e46100f commit 21c7072
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions docs/spec/ngdocSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ describe('ngdoc', function() {
toMatch('</pre>\n\n<h1 id="one">One</h1>\n\n<pre');
});

it('should replace inline variable type hints', function() {
expect(new Doc().markdown('{@type string}')).
toMatch(/<a\s+.*?class=".*?type-hint type-hint-string.*?".*?>/);
});

it('should ignore nested doc widgets', function() {
expect(new Doc().markdown(
'before<div class="tabbable">\n' +
Expand Down
4 changes: 4 additions & 0 deletions docs/src/ngdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ Doc.prototype = {
(title || url).replace(/^#/g, '').replace(/\n/g, ' ') +
(isAngular ? '</code>' : '') +
'</a>';
}).
replace(/{@type\s+(\S+)(?:\s+(\S+))?}/g, function(_, type, url) {
url = url || '#';
return '<a href="' + url + '" class="' + self.prepare_type_hint_class_name(type) + '">' + type + '</a>';
});
});
text = parts.join('');
Expand Down
10 changes: 6 additions & 4 deletions src/ng/directive/ngRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
*
* Special properties are exposed on the local scope of each template instance, including:
*
* * `$index` – `{number}` – iterator offset of the repeated element (0..length-1)
* * `$first` – `{boolean}` – true if the repeated element is first in the iterator.
* * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator.
* * `$last` – `{boolean}` – true if the repeated element is last in the iterator.
* | Variable | Type | Details |
* |===========|=================|=============================================================================|
* | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) |
* | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |
* | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
* | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |
*
* Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**,
* **leave** and **move** effects.
Expand Down

0 comments on commit 21c7072

Please sign in to comment.