@@ -17,39 +17,8 @@ function htmlEscape( text ) {
1717var cheerio = require ( "cheerio" ) ,
1818 hljs = require ( "highlight.js" ) ,
1919 he = require ( "he" ) ,
20- yaml = require ( "js-yaml" ) ,
2120 os = require ( "os" ) ;
2221
23- // Add a wrapper around wordpress-parse-post that supports YAML
24- grunt . registerHelper ( "wordpress-parse-post-flex" , function ( path ) {
25- var index ,
26- post = { } ,
27- content = grunt . file . read ( path ) ;
28-
29- // Normalize line endings
30- if ( os . EOL !== "\n" ) {
31- content = content . replace ( new RegExp ( os . EOL , "g" ) , "\n" ) ;
32- }
33-
34- // Check for YAML metadata
35- if ( content . substring ( 0 , 4 ) === "---\n" ) {
36- try {
37- index = content . indexOf ( "\n---\n" ) ;
38- post = yaml . safeLoad ( content . substr ( 4 , index - 4 ) ) ;
39- content = content . substr ( index + 5 ) ;
40- } catch ( error ) {
41- grunt . log . error ( "Invalid YAML metadata for " + path ) ;
42- return null ;
43- }
44-
45- post . content = content ;
46- return post ;
47- }
48-
49- // Fall back to standard JSON parsing
50- return grunt . helper ( "wordpress-parse-post" , path ) ;
51- } ) ;
52-
5322grunt . registerMultiTask ( "build-pages" , "Process html and markdown files as pages, include @partials and syntax higlight code snippets" , function ( ) {
5423 var task = this ,
5524 taskDone = task . async ( ) ,
@@ -60,7 +29,7 @@ grunt.registerMultiTask( "build-pages", "Process html and markdown files as page
6029
6130 grunt . utils . async . forEachSeries ( files , function ( fileName , fileDone ) {
6231 var content ,
63- post = grunt . helper ( "wordpress-parse-post-flex " , fileName ) ,
32+ post = grunt . helper ( "wordpress-parse-post" , fileName ) ,
6433 fileType = / \. ( \w + ) $ / . exec ( fileName ) [ 1 ] ,
6534 targetFileName = targetDir +
6635 fileName . replace ( / ^ .+ ?\/ ( .+ ) \. \w + $ / , "$1" ) + ".html" ;
0 commit comments