This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 3 files changed +14
-4
lines changed
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,14 @@ describe('ngdoc', function(){
89
89
'<pre class="doc-source">\n<>\n</pre></doc:example><p>after</p>' ) ;
90
90
} ) ;
91
91
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
+
92
100
it ( 'should escape <doc:scenario> element' , function ( ) {
93
101
var doc = new Doc ( '@description before <doc:example>' +
94
102
'<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 = {
111
111
'</pre></div>' ;
112
112
} ) ;
113
113
} 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>' ;
117
119
} ) ;
118
120
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,
119
121
function ( _ , before , content , after ) {
Original file line number Diff line number Diff line change 28
28
//jqlite instead. jqlite's find() method currently supports onlt getElementsByTagName!
29
29
var example = element . find ( 'pre' ) . eq ( 0 ) , //doc-source
30
30
exampleSrc = example . text ( ) ,
31
- jsfiddle = element . find ( 'doc:source' ) . attr ( 'jsfiddle' ) || true ,
31
+ jsfiddle = example . attr ( 'jsfiddle' ) || true ,
32
32
scenario = element . find ( 'pre' ) . eq ( 1 ) ; //doc-scenario
33
33
34
34
var code = indent ( exampleSrc ) ;
You can’t perform that action at this time.
0 commit comments