mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
corrected new lines in @link
This commit is contained in:
parent
9e30baad3f
commit
65243b7d60
2 changed files with 11 additions and 3 deletions
|
|
@ -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(){
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue