From 8e7860d51082bd317a9212d78bdcaaa08cccf5d2 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Thu, 30 Mar 2023 01:14:00 +0200 Subject: [PATCH] add: should be able to remove those comments --- src/stats/StatsManager.ts | 4 ++++ src/status/StatusBar.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stats/StatsManager.ts b/src/stats/StatsManager.ts index 0e6b4d6..3b78cc4 100644 --- a/src/stats/StatsManager.ts +++ b/src/stats/StatsManager.ts @@ -10,6 +10,7 @@ import { getWordCount, getCitationCount, getFootnoteCount, + cleanComments, } from "../utils/StatUtils"; export default class StatsManager { @@ -108,6 +109,9 @@ export default class StatsManager { } public async change(text: string) { + if (this.plugin.settings.countComments) { + text = cleanComments(text); + } const fileName = this.workspace.getActiveFile().path; const currentWords = getWordCount(text); const currentCharacters = getCharacterCount(text); diff --git a/src/status/StatusBar.ts b/src/status/StatusBar.ts index 79c156d..1892a5f 100644 --- a/src/status/StatusBar.ts +++ b/src/status/StatusBar.ts @@ -7,6 +7,7 @@ import { getCitationCount, getFootnoteCount, getPageCount, + cleanComments, } from "src/utils/StatUtils"; import { debounce } from "obsidian"; @@ -25,7 +26,7 @@ export default class StatusBar { ); this.statusBarEl.classList.add("mod-clickable"); - this.statusBarEl.setAttribute("aria-label", "Coming Soon"); + this.statusBarEl.setAttribute("aria-label", "!!!"); this.statusBarEl.setAttribute("aria-label-position", "top"); this.statusBarEl.addEventListener("click", (ev: MouseEvent) => this.onClick(ev) @@ -44,6 +45,10 @@ export default class StatusBar { const sb = this.plugin.settings.statusBar; let display = ""; + if (!this.plugin.settings.countComments) { + text = cleanComments(text); + } + for (let i = 0; i < sb.length; i++) { const sbItem = sb[i];