Skip to content

Commit

Permalink
fix: sanitize file title #234
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohongxuan committed Dec 30, 2023
1 parent 9767418 commit b0fa5ae
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-weread-plugin",
"name": "Weread Plugin",
"version": "0.7.0",
"version": "0.7.1",
"minAppVersion": "0.12.0",
"description": "This is obsidian plugin for Tencent weread.",
"author": "hankzhao",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-weread-plugin",
"version": "0.7.0",
"version": "0.7.1",
"description": "This is a community plugin for tencent weread (https://r.qq.com)",
"main": "main.ts",
"scripts": {
Expand Down
9 changes: 4 additions & 5 deletions src/utils/dateUtil.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
export const formatTimeDuration = (duration: number): string => {
const hours = Math.floor(duration / 60);
const minutes = duration % 60;

export const formatTimeDuration = (durationInSeconds: number): string => {
const hours: number = Math.floor(durationInSeconds / 3600);
const minutes: number = Math.floor((durationInSeconds % 3600) / 60);
const formattedDuration = `${hours}小时${minutes}分钟`;

return formattedDuration;
};

export const formatTimestampToDate = (readingBookDate: number): string => {
return window.moment(readingBookDate * 1000).format('YYYY-MM-DD');
};
};
1 change: 1 addition & 0 deletions src/utils/sanitizeTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const sanitizeTitleExcess = (title: string): string => {
const santizedTitle = title
.replace(/ *\([^)]*\) */g, '')
.replace(/:.*/g, '')
.replace(/\|/g, '')
.trim();

return sanitize(santizedTitle);
Expand Down

0 comments on commit b0fa5ae

Please sign in to comment.