Skip to content

Commit

Permalink
refactor: add docHash variable to assets description in language files
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed Aug 29, 2024
1 parent 7e6e4d6 commit 7d575a8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/renderer/services/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function upload (file: File, belongDoc: Pick<Doc, 'repo' | 'path'>,
.replaceAll('{docName}', parentName.startsWith('.') ? 'upload' : filenamify(parentName))
.replaceAll('{docBasename}', parentName.startsWith('.') ? 'upload' : filenamify(parentNameWithoutMdExt))
.replaceAll('{date}', dayjs().format('YYYY-MM-DD'))
.replaceAll('{docHash}', binMd5(parentNameWithoutMdExt).slice(0, 8))

const path: string = resolve(parentPath, assetsDir, filename)

Expand Down
2 changes: 1 addition & 1 deletion src/share/i18n/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ const data = {
'language': 'Language',
'custom-css': 'Custom CSS',
'assets-dir': 'Image Dir',
'assets-desc': 'Relative or absolute path (in document repository). Variables: docName, docBasename, docSlug, date.',
'assets-desc': 'Relative or absolute path (in document repository). Variables: docName, docBasename, docSlug, docHash, date.',
'assets': {
'path-type': 'Path Type',
},
Expand Down
2 changes: 1 addition & 1 deletion src/share/i18n/languages/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ const data: BaseLanguage = {
'language': '语言',
'custom-css': '自定义 CSS',
'assets-dir': '图片存放目录',
'assets-desc': '支持相对路径和绝对路径(限于仓库内部),可用变量:docName, docBasename, docSlug, date',
'assets-desc': '支持相对路径和绝对路径(限于仓库内部),可用变量:docName, docBasename, docSlug, docHash, date',
'assets': {
'path-type': '路径类型',
},
Expand Down
2 changes: 1 addition & 1 deletion src/share/i18n/languages/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ const data: BaseLanguage = {
'language': '語言',
'custom-css': '自訂 CSS',
'assets-dir': '圖片存放目錄',
'assets-desc': '支援相對路徑和絕對路徑(限於倉庫內部),可用變數:docName, docBasename, docSlug, date',
'assets-desc': '支援相對路徑和絕對路徑(限於倉庫內部),可用變數:docName, docBasename, docSlug, docHash, date',
'assets': {
'path-type': '路徑類型',
},
Expand Down

0 comments on commit 7d575a8

Please sign in to comment.