diff options
| author | Misko Hevery | 2011-02-18 10:24:30 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-18 11:52:57 -0800 |
| commit | 65243b7d60328fab970aa2000786ab415b92b99e (patch) | |
| tree | 2724a7e381b49df1e073af8052d5af2d89c7525c | |
| parent | 9e30baad3feafc82fb2f2011fd3f21909f4ba29e (diff) | |
| download | angular.js-65243b7d60328fab970aa2000786ab415b92b99e.tar.bz2 | |
corrected new lines in @link
| -rw-r--r-- | docs/spec/ngdocSpec.js | 8 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 35dcc4cb..b4a301a7 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -340,6 +340,14 @@ describe('ngdoc', function(){ toContain('<a href="./static.html">./static.html</a>'); }); + it('shoul support line breaks in @link', function(){ + var doc = new Doc("@description " + + '{@link\nurl\na\nb}'); + doc.parse(); + expect(doc.description). + toContain('<a href="#!url">a b</a>'); + }); + }); describe('@example', function(){ diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 7c4d9d1d..93d5c43e 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -86,11 +86,11 @@ Doc.prototype = { }); } else { text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>'); - text = text.replace(/{@link ([^\s}]+)((\s|\n)+(.+?))?\s*}/gm, - function(_all, url, _2, _3, title){ + text = text.replace(/{@link\s+([^\s}]+)\s*([^}]*?)\s*}/g, + function(_all, url, title){ return '<a href="' + (url.match(IS_URL) ? '' : '#!') + url + '">' + (url.match(IS_ANGULAR) ? '<code>' : '') - + (title || url) + + (title || url).replace(/\n/g, ' ') + (url.match(IS_ANGULAR) ? '</code>' : '') + '</a>'; }); |
