Skip to content

Commit

Permalink
Upgrade metacolon dependency
Browse files Browse the repository at this point in the history
note that this requires Node v22
  • Loading branch information
FND committed Jan 17, 2025
1 parent 6281c3e commit 992f3dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
strategy:
matrix:
node-version:
- 18.x
- 20.x
- 22.x
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
21 changes: 11 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 { colonParse } = require("metacolon");

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

let { headers, body } = await colonParse(this.sourcePath);
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"url": "https://github.com/faucet-pipeline/aiur/issues"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"commonmark": "^0.31.2",
Expand All @@ -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.1",
"minimist": "^1.2.5",
"mkdirp": "^3.0.1",
"parse5": "^7.1.2",
Expand Down

0 comments on commit 992f3dd

Please sign in to comment.