Skip to content

Commit

Permalink
Upgrade metacolon dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
FND authored and moonglum committed Jan 30, 2025
1 parent b94ee6c commit 4e9b74f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions lib/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let { repr } = require("faucet-pipeline-core/lib/util");
let colonParse = require("metacolon");
let metacolon = import("metacolon");

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

let { headers, body } = await colonParse(this.sourcePath);
let { colonParse } = await metacolon;
let { headers, body } = await colonParse(this.sourcePath, { trim: true });
if(this.dataPath) {
this.data = require(this.dataPath);
}
this.language = headers.language || this.config.language;
this.heading = headers.title;
this.title = [headers.title, this.config.title].filter(x => x).join(" | ");
this.description = headers.description || this.config.description;
let title = headers.get("title");
this.language = headers.get("language") || this.config.language;
this.heading = title;
this.title = [title, this.config.title].filter(x => x).join(" | ");
this.description = headers.get("description") || this.config.description;
this.meta = this.buildMeta();
this.status = headers.status;
this.version = headers.version;
this.tags = headers.tags;
this.body = body;
this.status = headers.get("status");
this.version = headers.get("version");
this.tags = headers.get("tags");
this.body = body.trim();
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"faucet-pipeline-sass": "^1.7.0",
"faucet-pipeline-static": "^2.0.0",
"handlebars": "^4.7.7",
"metacolon": "^1.1.1",
"metacolon": "^2.0.2",
"minimist": "^1.2.5",
"mkdirp": "^3.0.1",
"parse5": "^7.1.2",
Expand Down

0 comments on commit 4e9b74f

Please sign in to comment.