mirror of
https://github.com/vannamhh/progress-tracker.git
synced 2026-07-22 05:43:38 +00:00
fix: Exclude code blocks from task counting in the progress bar view and update the plugin version to 1.5.2.
This commit is contained in:
parent
f4312b46bd
commit
90113adbe8
3 changed files with 18 additions and 9 deletions
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"id": "progress-tracker",
|
||||
"name": "ProgressTracker",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"minAppVersion": "1.1.0",
|
||||
"description": "Track task completion with a visual progress bar in your sidebar, auto update column Kanban",
|
||||
"author": "VN",
|
||||
"authorUrl": "https://github.com/vannamhh/",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
}
|
||||
11
package.json
11
package.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "progress-tracker",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"description": "Track task completion with a visual progress bar in your sidebar",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
@ -8,7 +8,12 @@
|
|||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||
},
|
||||
"keywords": ["obsidian", "dataview", "progress", "task"],
|
||||
"keywords": [
|
||||
"obsidian",
|
||||
"dataview",
|
||||
"progress",
|
||||
"task"
|
||||
],
|
||||
"author": "VN",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
|
|
@ -21,4 +26,4 @@
|
|||
"tslib": "2.4.0",
|
||||
"typescript": "4.7.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -277,8 +277,10 @@ export class TaskProgressBarView extends ItemView {
|
|||
);
|
||||
} else {
|
||||
// Legacy counting - only [ ] and [x]
|
||||
incompleteTasks = (content.match(/- \[ \]/g) || []).length;
|
||||
completedTasks = (content.match(/- \[x\]/gi) || []).length;
|
||||
// Remove code blocks before counting to avoid counting tasks inside code blocks
|
||||
const contentWithoutCodeBlocks = removeCodeBlocks(content);
|
||||
incompleteTasks = (contentWithoutCodeBlocks.match(/- \[ \]/g) || []).length;
|
||||
completedTasks = (contentWithoutCodeBlocks.match(/- \[x\]/gi) || []).length;
|
||||
}
|
||||
|
||||
let totalTasks = incompleteTasks + completedTasks + customStateTasks;
|
||||
|
|
@ -287,8 +289,10 @@ export class TaskProgressBarView extends ItemView {
|
|||
let relaxedIncompleteTasks = 0;
|
||||
let relaxedCompletedTasks = 0;
|
||||
if (totalTasks === 0) {
|
||||
relaxedIncompleteTasks = (content.match(/[-*] \[ \]/g) || []).length;
|
||||
relaxedCompletedTasks = (content.match(/[-*] \[x\]/gi) || []).length;
|
||||
// Also remove code blocks when using relaxed regex
|
||||
const contentWithoutCodeBlocks = removeCodeBlocks(content);
|
||||
relaxedIncompleteTasks = (contentWithoutCodeBlocks.match(/[-*] \[ \]/g) || []).length;
|
||||
relaxedCompletedTasks = (contentWithoutCodeBlocks.match(/[-*] \[x\]/gi) || []).length;
|
||||
totalTasks = relaxedIncompleteTasks + relaxedCompletedTasks;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue