Skip to content

Commit 4e9b74f

Browse files
FNDmoonglum
authored andcommitted
Upgrade metacolon dependency
1 parent b94ee6c commit 4e9b74f

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/page.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let { repr } = require("faucet-pipeline-core/lib/util");
2-
let colonParse = require("metacolon");
2+
let metacolon = import("metacolon");
33

44
module.exports = class Page {
55
constructor(slug, sourcePath, children, { language, title, description, meta }, dataPath) {
@@ -19,19 +19,21 @@ module.exports = class Page {
1919
return Promise.resolve(this);
2020
}
2121

22-
let { headers, body } = await colonParse(this.sourcePath);
22+
let { colonParse } = await metacolon;
23+
let { headers, body } = await colonParse(this.sourcePath, { trim: true });
2324
if(this.dataPath) {
2425
this.data = require(this.dataPath);
2526
}
26-
this.language = headers.language || this.config.language;
27-
this.heading = headers.title;
28-
this.title = [headers.title, this.config.title].filter(x => x).join(" | ");
29-
this.description = headers.description || this.config.description;
27+
let title = headers.get("title");
28+
this.language = headers.get("language") || this.config.language;
29+
this.heading = title;
30+
this.title = [title, this.config.title].filter(x => x).join(" | ");
31+
this.description = headers.get("description") || this.config.description;
3032
this.meta = this.buildMeta();
31-
this.status = headers.status;
32-
this.version = headers.version;
33-
this.tags = headers.tags;
34-
this.body = body;
33+
this.status = headers.get("status");
34+
this.version = headers.get("version");
35+
this.tags = headers.get("tags");
36+
this.body = body.trim();
3537
return this;
3638
}
3739

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"faucet-pipeline-sass": "^1.7.0",
3232
"faucet-pipeline-static": "^2.0.0",
3333
"handlebars": "^4.7.7",
34-
"metacolon": "^1.1.1",
34+
"metacolon": "^2.0.2",
3535
"minimist": "^1.2.5",
3636
"mkdirp": "^3.0.1",
3737
"parse5": "^7.1.2",

0 commit comments

Comments
 (0)