From 65243b7d60328fab970aa2000786ab415b92b99e Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Fri, 18 Feb 2011 10:24:30 -0800
Subject: corrected new lines in @link
---
docs/spec/ngdocSpec.js | 8 ++++++++
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('./static.html');
});
+ it('shoul support line breaks in @link', function(){
+ var doc = new Doc("@description " +
+ '{@link\nurl\na\nb}');
+ doc.parse();
+ expect(doc.description).
+ toContain('a b');
+ });
+
});
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(//gm, '<angular/>');
- 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 ''
+ (url.match(IS_ANGULAR) ? '' : '')
- + (title || url)
+ + (title || url).replace(/\n/g, ' ')
+ (url.match(IS_ANGULAR) ? '' : '')
+ '';
});
--
cgit v1.2.3