Skip to content

Commit 06f246d

Browse files
committed
Posts: Remove support for YAML front matter
1 parent 45dcee5 commit 06f246d

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"grunt-wordpress": "1.2.1",
2929
"he": "0.5.0",
3030
"highlight.js": "7.3.0",
31-
"js-yaml": "3.1.0",
3231
"marked": "0.3.2",
3332
"rimraf": "2.2.8",
3433
"which": "1.0.5"

tasks/build.js

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,8 @@ function htmlEscape( text ) {
1717
var 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-
5322
grunt.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

Comments
 (0)