Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
songkg7 committed Jun 28, 2024
1 parent eb1cd0c commit 91c8ec8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/jekyll/FrontMatterConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function convertImageFrontMatter(
isEnable: boolean,
fileName: string,
resourcePath: string,
frontMatter: FrontMatter
frontMatter: FrontMatter,
) {
if (!isEnable) {
return frontMatter;
Expand Down Expand Up @@ -147,21 +147,17 @@ function replaceDateFrontMatter(frontMatter: FrontMatter, isEnable: boolean): Fr
return frontMatter;
}

// TODO: "tag: mise, something" -> "tag: [mise, something]"
export const convertFrontMatter = (input: string) => {
const [frontMatter, body] = parseFrontMatter(input);
if (Object.keys(frontMatter).length === 0) {
return input;

Check warning on line 153 in src/jekyll/FrontMatterConverter.ts

View check run for this annotation

Codecov / codecov/patch

src/jekyll/FrontMatterConverter.ts#L153

Added line #L153 was not covered by tests
}

// remove unnecessary frontMatter like `aliases: ""`
delete frontMatter['aliases'];
// Object.keys(frontMatter).forEach((key) => {
// if (frontMatter[key] === 'aliases') {
// delete frontMatter[key];
// }
// });

return join(frontMatter, body);
return join(
convert({ ...frontMatter }),
body,
);
};

2 changes: 1 addition & 1 deletion src/tests/FrontMatterConverter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ title: "test"
date: 2021-01-01 12:00:00 +0900
categories: [test]
---
# test
`;
const result = convertFrontMatter(mockContents);
Expand Down

0 comments on commit 91c8ec8

Please sign in to comment.