mirror of
https://github.com/lizard-heart/obsidian-to-omnifocus.git
synced 2026-07-22 07:30:26 +00:00
fix: Allow dash and asterisk marked tasks (#6)
Fix for issue #6 -- allows both "- [ ]" and "* [ ]" as task indicators.
This commit is contained in:
parent
69bd5fb946
commit
d7759d8552
1 changed files with 3 additions and 3 deletions
|
|
@ -44,10 +44,10 @@ export default class TasksToOmnifocus extends Plugin {
|
||||||
editorText = editor.getValue();
|
editorText = editor.getValue();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const tasks = editorText.match(/- \[ \] .*/g);
|
const tasks = editorText.match(/[-*] \[ \] .*/g);
|
||||||
|
|
||||||
for (const task of tasks) {
|
for (const task of tasks) {
|
||||||
const taskName = task.replace("- [ ] ", "");
|
const taskName = task.replace(/[-*] \[ \] /, "");
|
||||||
const taskNameEncoded = encodeURIComponent(taskName);
|
const taskNameEncoded = encodeURIComponent(taskName);
|
||||||
const noteURL = view.file.path.replace(/ /g, "%20").replace(/\//g, "%2F");
|
const noteURL = view.file.path.replace(/ /g, "%20").replace(/\//g, "%2F");
|
||||||
const vaultName = app.vault.getName().replace(/\s/g, "%20");
|
const vaultName = app.vault.getName().replace(/\s/g, "%20");
|
||||||
|
|
@ -59,7 +59,7 @@ export default class TasksToOmnifocus extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.settings.markComplete) {
|
if (this.settings.markComplete) {
|
||||||
const completedText = editorText.replace(/- \[ \]/g, "- [x]");
|
const completedText = editorText.replace(/([-*]) \[ \]/g, "$1 [x]");
|
||||||
if (isSelection) {
|
if (isSelection) {
|
||||||
editor.replaceSelection(completedText);
|
editor.replaceSelection(completedText);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue