From 4afad1da299cadf6761604d42ceb069158201170 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Fri, 11 Nov 2011 16:40:43 -0800 Subject: feat(docs): allow custom attributes on Allow any attributes, not only jsfiddle... --- docs/spec/ngdocSpec.js | 8 ++++++++ docs/src/ngdoc.js | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 72ad69ff..367f91b4 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -89,6 +89,14 @@ describe('ngdoc', function() { '
\n<>\n

after

'); }); + it('should preserve the source attribute', function() { + var doc = new Doc('@description before ' + + 'lala after'); + doc.parse(); + expect(doc.description).toContain('

before

' + + '
lala

after

'); + }); + it('should preserve the jsfiddle attribute', function() { var doc = new Doc('@description before ' + 'lala after'); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index c5da18e6..3ed9198a 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -117,9 +117,9 @@ Doc.prototype = { ''; }); } else if (isDocWidget('example')) { - text = text.replace(/([\s\S]*)<\/doc:source>/mi, - function(_, jsfiddle, content){ - return '
' +
+        text = text.replace(/]*)?>([\s\S]*)<\/doc:source>/mi,
+          function(_, attrs, content){
+            return '
' +
                       htmlEscape(content) +
                    '
'; }); -- cgit v1.2.3