Skip to content

Commit d840f09

Browse files
committed
Update build-xml-entries task to also use sync syntax highligher helper
1 parent 9e51409 commit d840f09

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

tasks/build-xml.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ grunt.registerMultiTask( "build-xml-entries", "Process API xml files with xsl an
104104
grunt.utils.spawn({
105105
cmd: "xsltproc",
106106
args: [ "--xinclude", "entries2html.xsl", targetXMLFileName ]
107-
}, function( err, pass2result ) {
107+
}, function( err, content ) {
108108
if ( err ) {
109109
grunt.verbose.error();
110110
grunt.log.error( err );
@@ -116,21 +116,15 @@ grunt.registerMultiTask( "build-xml-entries", "Process API xml files with xsl an
116116
var targetHTMLFileName = targetDir + path.basename( fileName );
117117
targetHTMLFileName = targetHTMLFileName.substr( 0, targetHTMLFileName.length - "xml".length ) + "html";
118118

119-
grunt.verbose.write( "Syntax highlighting " + targetHTMLFileName + "..." );
120-
grunt.helper("syntax-highlight", { content: pass2result }, function( error, data ) {
121119

122-
if ( error ) {
123-
grunt.verbose.error();
124-
grunt.log.error( error );
125-
fileDone();
126-
return;
127-
}
128-
grunt.verbose.ok();
120+
// Syntax highlight code blocks
121+
if ( !grunt.option( "nohighlight" ) ) {
122+
content = grunt.helper( "syntax-highlight", { content: content } );
123+
}
129124

130-
grunt.file.write( targetHTMLFileName, data );
125+
grunt.file.write( targetHTMLFileName, content );
131126

132-
fileDone();
133-
});
127+
fileDone();
134128
});
135129
});
136130
}, function() {

0 commit comments

Comments
 (0)