From f1440baa4d14ca6f4b3864621a5f06a309443b89 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Thu, 8 Jul 2021 22:42:07 +0200 Subject: [PATCH 1/3] add stats syntax --- src/settings/settings-tab.ts | 18 ++++++++++++++++++ src/status/parse.ts | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/settings/settings-tab.ts b/src/settings/settings-tab.ts index 6b9f4e4..90bf772 100644 --- a/src/settings/settings-tab.ts +++ b/src/settings/settings-tab.ts @@ -96,5 +96,23 @@ export class BetterWordCountSettingsTab extends PluginSettingTab { this.plugin.saveSettings(); }); }); + + this.containerEl.createEl("p", { + text: + "Syntax for the status bars works like this: \n" + + "- To get a stat input the name of the stat in between `{}` eg. `{word_count}`.\n" + + "- All other words remain.\n\n" + + "Available Stats:\n" + + "- word_count\n" + + "- character_count\n" + + "- sentence_count\n" + + "- total_word_count\n" + + "- total_character_count\n" + + "- total_sentence_count\n" + + "- file_count\n" + + "- words_today\n" + + "- characters_today\n" + + "- sentences_today\n", + }); } } diff --git a/src/status/parse.ts b/src/status/parse.ts index f21808f..6e619c0 100644 --- a/src/status/parse.ts +++ b/src/status/parse.ts @@ -43,7 +43,7 @@ export function parse(query: string): Expression { break; default: - parsed.push(s); + parsed.push("{" + s + "}"); break; } }); From f9e3f467a17facc72000a2239edf0471370d4618 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Thu, 8 Jul 2021 22:54:59 +0200 Subject: [PATCH 2/3] fix syntax --- src/settings/settings-tab.ts | 42 ++++++++++++++++++++++++------------ src/status/parse.ts | 2 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/settings/settings-tab.ts b/src/settings/settings-tab.ts index 90bf772..c46f1ed 100644 --- a/src/settings/settings-tab.ts +++ b/src/settings/settings-tab.ts @@ -97,22 +97,36 @@ export class BetterWordCountSettingsTab extends PluginSettingTab { }); }); + this.containerEl.createEl("h3", { + text: "Syntax for the status bars works like this: ", + }); + + this.containerEl.createEl("li", { + text: "To get a stat input the name of the stat in between `{}` eg. `{word_count}`.", + }); + + this.containerEl.createEl("li", { + text: "All other words remain.", + }); + + this.containerEl.createEl("br"); + + this.containerEl.createEl("h4", { + text: "Available Stats:", + }); + this.containerEl.createEl("p", { text: - "Syntax for the status bars works like this: \n" + - "- To get a stat input the name of the stat in between `{}` eg. `{word_count}`.\n" + - "- All other words remain.\n\n" + - "Available Stats:\n" + - "- word_count\n" + - "- character_count\n" + - "- sentence_count\n" + - "- total_word_count\n" + - "- total_character_count\n" + - "- total_sentence_count\n" + - "- file_count\n" + - "- words_today\n" + - "- characters_today\n" + - "- sentences_today\n", + "word_count, " + + "character_count, " + + "sentence_count, " + + "total_word_count, " + + "total_character_count, " + + "total_sentence_count, " + + "file_count, " + + "words_today, " + + "characters_today, " + + "sentences_today, ", }); } } diff --git a/src/status/parse.ts b/src/status/parse.ts index 6e619c0..f21808f 100644 --- a/src/status/parse.ts +++ b/src/status/parse.ts @@ -43,7 +43,7 @@ export function parse(query: string): Expression { break; default: - parsed.push("{" + s + "}"); + parsed.push(s); break; } }); From cc7eb1ad5d3878eeaaf180c3506c4bc607a56fd3 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Thu, 8 Jul 2021 22:57:29 +0200 Subject: [PATCH 3/3] bump --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 5cf7934..5809491 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "better-word-count", "name": "Better Word Count", - "version": "0.6.2", + "version": "0.7.0", "description": "Counts the words of selected text in the editor.", "author": "Luke Leppan", "authorUrl": "https://lukeleppan.com", diff --git a/package.json b/package.json index c444c31..f4dcdd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-word-count", - "version": "0.6.2", + "version": "0.7.0", "description": "Counts the words of selected text in the editor.", "main": "main.js", "scripts": {