mirror of
https://github.com/taskgenius/taskgenius-plugin.git
synced 2026-07-22 06:40:25 +00:00
fix(write): sanitize spaces in project and context tags for Tasks format
Replace spaces with hyphens in project and context tags when using Tasks format to ensure proper tag parsing. Dataview format preserves original spaces as intended.
This commit is contained in:
parent
f770126e33
commit
33629685fc
1 changed files with 12 additions and 2 deletions
|
|
@ -1786,11 +1786,16 @@ export class WriteAPI {
|
|||
const projectPrefix =
|
||||
this.plugin.settings.projectTagPrefix?.dataview ||
|
||||
"project";
|
||||
// Dataview 格式保留原始空格
|
||||
metadata.push(`[${projectPrefix}:: ${args.project}]`);
|
||||
} else {
|
||||
const projectPrefix =
|
||||
this.plugin.settings.projectTagPrefix?.tasks || "project";
|
||||
metadata.push(`#${projectPrefix}/${args.project}`);
|
||||
// Tasks 格式:空格使用 "-" 连接
|
||||
const sanitizedProject = String(args.project)
|
||||
.trim()
|
||||
.replace(/\s+/g, "-");
|
||||
metadata.push(`#${projectPrefix}/${sanitizedProject}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1800,11 +1805,16 @@ export class WriteAPI {
|
|||
const contextPrefix =
|
||||
this.plugin.settings.contextTagPrefix?.dataview ||
|
||||
"context";
|
||||
// Dataview 格式保留原始空格
|
||||
metadata.push(`[${contextPrefix}:: ${args.context}]`);
|
||||
} else {
|
||||
const contextPrefix =
|
||||
this.plugin.settings.contextTagPrefix?.tasks || "@";
|
||||
metadata.push(`${contextPrefix}${args.context}`);
|
||||
// Tasks 格式:空格使用 "-" 连接
|
||||
const sanitizedContext = String(args.context)
|
||||
.trim()
|
||||
.replace(/\s+/g, "-");
|
||||
metadata.push(`${contextPrefix}${sanitizedContext}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue