🐛 Fix Broken Stats
This commit is contained in:
parent
992ff69040
commit
03989d6b7a
3 changed files with 5 additions and 2 deletions
|
@ -9,4 +9,5 @@ export const MATCH_HTML_COMMENT = new RegExp(
|
||||||
"|<[?][^>]*>?",
|
"|<[?][^>]*>?",
|
||||||
"g"
|
"g"
|
||||||
);
|
);
|
||||||
|
export const MATCH_COMMENT = new RegExp("%%[^%%]+%%", "g");
|
||||||
export const MATCH_PARAGRAPH = new RegExp("\n([^\n]+)\n", "g");
|
export const MATCH_PARAGRAPH = new RegExp("\n([^\n]+)\n", "g");
|
||||||
|
|
|
@ -37,6 +37,5 @@ export function getSentenceCount(text: string): number {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cleanComments(text: string): string {
|
export function cleanComments(text: string): string {
|
||||||
console.log(text.match(MATCH_COMMENT));
|
|
||||||
return text.replace(MATCH_COMMENT, "").replace(MATCH_HTML_COMMENT, "");
|
return text.replace(MATCH_COMMENT, "").replace(MATCH_HTML_COMMENT, "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,10 @@ export class BarManager {
|
||||||
async updateStatusBar(text: string): Promise<void> {
|
async updateStatusBar(text: string): Promise<void> {
|
||||||
let newText = "";
|
let newText = "";
|
||||||
const expression: Expression = parse(this.settings.statusBarQuery);
|
const expression: Expression = parse(this.settings.statusBarQuery);
|
||||||
if (this.settings.collectStats) this.dataManager.updateTodayCounts();
|
if (this.settings.collectStats) {
|
||||||
|
this.dataManager.updateToday();
|
||||||
|
this.dataManager.updateTodayCounts();
|
||||||
|
}
|
||||||
const todayCounts: TodayCounts = this.settings.collectStats
|
const todayCounts: TodayCounts = this.settings.collectStats
|
||||||
? this.dataManager.getTodayCounts()
|
? this.dataManager.getTodayCounts()
|
||||||
: { words: 0, characters: 0, sentences: 0 };
|
: { words: 0, characters: 0, sentences: 0 };
|
||||||
|
|
Loading…
Reference in a new issue