File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -307,21 +307,21 @@ describe('ngdoc', function(){
307307
308308 describe ( '@description' , function ( ) {
309309 it ( 'should support pre blocks' , function ( ) {
310- var doc = new Doc ( "@description <pre>abc</pre>" ) ;
310+ var doc = new Doc ( "@description <pre><b> abc</b> </pre>" ) ;
311311 doc . parse ( ) ;
312312 expect ( doc . description ) .
313- toBe ( '<div ng:non-bindable><pre class="brush: js; html-script: true;">abc</pre></div>' ) ;
313+ toBe ( '<div ng:non-bindable><pre class="brush: js; html-script: true;"><b> abc</b> </pre></div>' ) ;
314314 } ) ;
315315
316316 it ( 'should support multiple pre blocks' , function ( ) {
317317 var doc = new Doc ( "@description foo \n<pre>abc</pre>\n#bah\nfoo \n<pre>cba</pre>" ) ;
318318 doc . parse ( ) ;
319319 expect ( doc . description ) .
320320 toBe ( '<p>foo </p>' +
321- '<div ng:non-bindable><pre class="brush: js; html-script: true; ">abc</pre></div>' +
321+ '<div ng:non-bindable><pre class="brush: js;">abc</pre></div>' +
322322 '<h1>bah</h1>\n\n' +
323323 '<p>foo </p>' +
324- '<div ng:non-bindable><pre class="brush: js; html-script: true; ">cba</pre></div>' ) ;
324+ '<div ng:non-bindable><pre class="brush: js;">cba</pre></div>' ) ;
325325
326326 } ) ;
327327
Original file line number Diff line number Diff line change @@ -70,7 +70,12 @@ Doc.prototype = {
7070 parts . forEach ( function ( text , i ) {
7171 if ( text . match ( / ^ < p r e > / ) ) {
7272 text = text . replace ( / ^ < p r e > ( [ \s \S ] * ) < \/ p r e > / mi, function ( _ , content ) {
73- return '<div ng:non-bindable><pre class="brush: js; html-script: true;">' +
73+ var clazz = 'brush: js;'
74+ if ( content . match ( / \< \w / ) ) {
75+ // we are HTML
76+ clazz += ' html-script: true;' ;
77+ }
78+ return '<div ng:non-bindable><pre class="' + clazz + '">' +
7479 content . replace ( / < / g, '<' ) . replace ( / > / g, '>' ) +
7580 '</pre></div>' ;
7681 } ) ;
You can’t perform that action at this time.
0 commit comments