File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,14 @@ describe('ngdoc', function(){
8989 '<pre class="doc-source">\n<>\n</pre></doc:example><p>after</p>' ) ;
9090 } ) ;
9191
92+ it ( 'should preserve the jsfiddle attribute' , function ( ) {
93+ var doc = new Doc ( '@description before <doc:example>' +
94+ '<doc:source jsfiddle="foo">lala</doc:source></doc:example> after' ) ;
95+ doc . parse ( ) ;
96+ expect ( doc . description ) . toContain ( '<p>before </p><doc:example>' +
97+ '<pre class="doc-source" jsfiddle="foo">lala</pre></doc:example><p>after</p>' ) ;
98+ } ) ;
99+
92100 it ( 'should escape <doc:scenario> element' , function ( ) {
93101 var doc = new Doc ( '@description before <doc:example>' +
94102 '<doc:scenario>\n<>\n</doc:scenario></doc:example> after' ) ;
Original file line number Diff line number Diff line change @@ -111,9 +111,11 @@ Doc.prototype = {
111111 '</pre></div>' ;
112112 } ) ;
113113 } else if ( isDocWidget ( 'example' ) ) {
114- text = text . replace ( / ( < d o c : s o u r c e > ) ( [ \s \S ] * ) ( < \/ d o c : s o u r c e > ) / mi,
115- function ( _ , before , content , after ) {
116- return '<pre class="doc-source">' + htmlEscape ( content ) + '</pre>' ;
114+ text = text . replace ( / < d o c : s o u r c e ( \s + j s f i d d l e = " [ ^ " ] + " ) ? > ( [ \s \S ] * ) < \/ d o c : s o u r c e > / mi,
115+ function ( _ , jsfiddle , content ) {
116+ return '<pre class="doc-source"' + ( jsfiddle || '' ) + '>' +
117+ htmlEscape ( content ) +
118+ '</pre>' ;
117119 } ) ;
118120 text = text . replace ( / ( < d o c : s c e n a r i o > ) ( [ \s \S ] * ) ( < \/ d o c : s c e n a r i o > ) / mi,
119121 function ( _ , before , content , after ) {
Original file line number Diff line number Diff line change 2828 //jqlite instead. jqlite's find() method currently supports onlt getElementsByTagName!
2929 var example = element . find ( 'pre' ) . eq ( 0 ) , //doc-source
3030 exampleSrc = example . text ( ) ,
31- jsfiddle = element . find ( 'doc:source' ) . attr ( 'jsfiddle' ) || true ,
31+ jsfiddle = example . attr ( 'jsfiddle' ) || true ,
3232 scenario = element . find ( 'pre' ) . eq ( 1 ) ; //doc-scenario
3333
3434 var code = indent ( exampleSrc ) ;
You can’t perform that action at this time.
0 commit comments