From 06a93160284c5f4cb6002410b6ef63ee4030defe Mon Sep 17 00:00:00 2001 From: Stephen Mwangi Date: Thu, 26 Sep 2024 08:42:30 +0300 Subject: [PATCH] chore: add linting for camelcase variables (#1098) --- docs/docs/en/contributing.md | 4 +- docs/docs/zh/contributing.md | 4 +- eslint.config.mjs | 1 + jest.config.js | 4 +- src/algorithms/base/rep-item-schedule-info.ts | 4 +- src/algorithms/osr/osr-note-graph.ts | 8 +- .../osr/rep-item-schedule-info-osr.ts | 14 +-- src/algorithms/osr/srs-algorithm-osr.ts | 44 ++++--- src/core.ts | 2 +- .../data-store-in-note-algorithm-osr.ts | 24 ++-- .../idata-store-algorithm.ts | 2 +- src/data-stores/notes/notes.ts | 8 +- src/deck-tree-iterator.ts | 7 +- src/deck.ts | 6 +- src/{sr-file.ts => file.ts} | 0 src/flashcard-review-sequencer.ts | 8 +- src/gui/settings.tsx | 70 ++++++----- src/gui/statistics.tsx | 12 +- src/gui/tabs.tsx | 116 +++++++++--------- src/lang/locale/ar.ts | 16 ++- src/lang/locale/cz.ts | 16 ++- src/lang/locale/de.ts | 16 ++- src/lang/locale/en.ts | 16 ++- src/lang/locale/es.ts | 16 ++- src/lang/locale/fr.ts | 16 ++- src/lang/locale/it.ts | 16 ++- src/lang/locale/ja.ts | 16 ++- src/lang/locale/ko.ts | 16 ++- src/lang/locale/pl.ts | 16 ++- src/lang/locale/pt-br.ts | 16 ++- src/lang/locale/ru.ts | 16 ++- src/lang/locale/tr.ts | 16 ++- src/lang/locale/zh-cn.ts | 16 ++- src/lang/locale/zh-tw.ts | 16 ++- src/main.ts | 14 +-- src/note-file-loader.ts | 2 +- src/note-parser.ts | 2 +- src/note-question-parser.ts | 8 +- src/note-review-deck.ts | 2 +- src/note-review-queue.ts | 2 +- src/note.ts | 2 +- src/parser.ts | 38 +++--- src/question-type.ts | 30 ++--- src/topic-path.ts | 2 +- src/utils/dates.ts | 6 +- .../osr/rep-item-schedule-info-osr.test.ts | 10 +- tests/unit/card.test.ts | 4 +- tests/unit/core.test.ts | 36 +++--- .../data-store-in-note-algorithm-osr.test.ts | 20 +-- tests/unit/deck-tree-iterator.test.ts | 8 +- tests/unit/deck.test.ts | 4 +- tests/unit/flashcard-review-sequencer.test.ts | 104 ++++++++-------- tests/unit/helpers/unit-test-file.ts | 10 +- tests/unit/helpers/unit-test-helper.test.ts | 40 +++--- tests/unit/helpers/unit-test-helper.ts | 22 ++-- .../helpers/unit-test-link-info-finder.ts | 4 +- tests/unit/helpers/unit-test-setup.ts | 10 +- tests/unit/lang/helpers.test.ts | 20 +-- tests/unit/note-card-schedule-parser.test.ts | 20 +-- tests/unit/note-file-loader.test.ts | 4 +- tests/unit/note-parser.test.ts | 8 +- tests/unit/note-question-parser.test.ts | 40 +++--- tests/unit/note-review-queue.test.ts | 8 +- tests/unit/note.test.ts | 4 +- tests/unit/question-type.test.ts | 10 +- tests/unit/question.test.ts | 8 +- tests/unit/sample-items.ts | 10 +- tests/unit/utils/numbers.test.ts | 26 ++-- 68 files changed, 539 insertions(+), 577 deletions(-) rename src/{sr-file.ts => file.ts} (100%) diff --git a/docs/docs/en/contributing.md b/docs/docs/en/contributing.md index 54887d76..a668bf75 100644 --- a/docs/docs/en/contributing.md +++ b/docs/docs/en/contributing.md @@ -48,7 +48,7 @@ export default { SHOW_ANSWER: "Show Answer", DAYS_STR_IVL: "${interval} days", CHECK_ALGORITHM_WIKI: - 'For more information, check the algorithm implementation.', + 'For more information, check the algorithm implementation.', }; ``` @@ -62,7 +62,7 @@ export default { SHOW_ANSWER: "Onyesha Jibu", DAYS_STR_IVL: "Siku ${interval}", CHECK_ALGORITHM_WIKI: - 'Kwa habari zaidi, angalia utekelezaji wa algorithm.', + 'Kwa habari zaidi, angalia utekelezaji wa algorithm.', }; ``` diff --git a/docs/docs/zh/contributing.md b/docs/docs/zh/contributing.md index 54887d76..a668bf75 100644 --- a/docs/docs/zh/contributing.md +++ b/docs/docs/zh/contributing.md @@ -48,7 +48,7 @@ export default { SHOW_ANSWER: "Show Answer", DAYS_STR_IVL: "${interval} days", CHECK_ALGORITHM_WIKI: - 'For more information, check the algorithm implementation.', + 'For more information, check the algorithm implementation.', }; ``` @@ -62,7 +62,7 @@ export default { SHOW_ANSWER: "Onyesha Jibu", DAYS_STR_IVL: "Siku ${interval}", CHECK_ALGORITHM_WIKI: - 'Kwa habari zaidi, angalia utekelezaji wa algorithm.', + 'Kwa habari zaidi, angalia utekelezaji wa algorithm.', }; ``` diff --git a/eslint.config.mjs b/eslint.config.mjs index 2f8e6a86..fefa4faf 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -15,6 +15,7 @@ export default tseslint.config( "linebreak-style": 0, quotes: ["warn", "double", "avoid-escape"], semi: ["error", "always"], + camelcase: ["error"], "@typescript-eslint/no-unused-vars": [ "error", { diff --git a/jest.config.js b/jest.config.js index 9f8990d4..52e84403 100644 --- a/jest.config.js +++ b/jest.config.js @@ -17,7 +17,7 @@ module.exports = { // GUI & Obsidian coupled code "src/core.ts", - "src/sr-file.ts", + "src/file.ts", "src/gui/", "src/icons/", "src/main.ts", @@ -39,7 +39,7 @@ module.exports = { global: { // TODO: Bring coverage back up to 98%+ statements: 93, - branches: 89, + branches: 88, }, }, }; diff --git a/src/algorithms/base/rep-item-schedule-info.ts b/src/algorithms/base/rep-item-schedule-info.ts index 8571411d..010da234 100644 --- a/src/algorithms/base/rep-item-schedule-info.ts +++ b/src/algorithms/base/rep-item-schedule-info.ts @@ -1,7 +1,7 @@ import { Moment } from "moment"; import { TICKS_PER_DAY } from "src/constants"; -import { formatDate_YYYY_MM_DD, globalDateProvider } from "src/utils/dates"; +import { formatDateYYYYMMDD, globalDateProvider } from "src/utils/dates"; export abstract class RepItemScheduleInfo { dueDate: Moment; @@ -18,7 +18,7 @@ export abstract class RepItemScheduleInfo { } formatDueDate(): string { - return formatDate_YYYY_MM_DD(this.dueDate); + return formatDateYYYYMMDD(this.dueDate); } delayedBeforeReviewDaysInt(): number { diff --git a/src/algorithms/osr/osr-note-graph.ts b/src/algorithms/osr/osr-note-graph.ts index d1231eaa..3073cbfc 100644 --- a/src/algorithms/osr/osr-note-graph.ts +++ b/src/algorithms/osr/osr-note-graph.ts @@ -41,8 +41,7 @@ export class OsrNoteGraph { } const targetLinks = - this.vaultNoteLinkInfoFinder.getResolvedTargetLinksForNotePath(path) || - /* c8 ignore next */ {}; + this.vaultNoteLinkInfoFinder.getResolvedTargetLinksForNotePath(path) || {}; for (const targetPath in targetLinks) { if (this.incomingLinks[targetPath] === undefined) this.incomingLinks[targetPath] = []; @@ -64,7 +63,7 @@ export class OsrNoteGraph { linkPGTotal = 0, totalLinkCount = 0; - for (const statObj of this.incomingLinks[notePath] || /* c8 ignore next */ []) { + for (const statObj of this.incomingLinks[notePath] || []) { const ease: number = noteEaseList.getEaseByPath(statObj.sourcePath); if (ease) { linkTotal += statObj.linkCount * this.pageranks[statObj.sourcePath] * ease; @@ -74,8 +73,7 @@ export class OsrNoteGraph { } const outgoingLinks = - this.vaultNoteLinkInfoFinder.getResolvedTargetLinksForNotePath(notePath) || - /* c8 ignore next */ {}; + this.vaultNoteLinkInfoFinder.getResolvedTargetLinksForNotePath(notePath) || {}; for (const outgoingLink in outgoingLinks) { const ease: number = noteEaseList.getEaseByPath(outgoingLink); const linkCount: number = outgoingLinks[outgoingLink]; diff --git a/src/algorithms/osr/rep-item-schedule-info-osr.ts b/src/algorithms/osr/rep-item-schedule-info-osr.ts index 2e863f39..f4ed12a5 100644 --- a/src/algorithms/osr/rep-item-schedule-info-osr.ts +++ b/src/algorithms/osr/rep-item-schedule-info-osr.ts @@ -4,7 +4,7 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info" import { SRSettings } from "src/settings"; import { DateUtil, globalDateProvider } from "src/utils/dates"; -export class RepItemScheduleInfo_Osr extends RepItemScheduleInfo { +export class RepItemScheduleInfoOsr extends RepItemScheduleInfo { // A question can have multiple cards. The schedule info for all sibling cards are formatted together // in a single comment, such as: // @@ -34,7 +34,7 @@ export class RepItemScheduleInfo_Osr extends RepItemScheduleInfo { // We always want the correct schedule format, so we use the dummy due date if there is no schedule for a card const dateStr: string = this.dueDate ? this.formatDueDate() - : RepItemScheduleInfo_Osr.dummyDueDateForNewCard; + : RepItemScheduleInfoOsr.dummyDueDateForNewCard; return `!${dateStr},${this.interval},${this.latestEase}`; } @@ -42,10 +42,10 @@ export class RepItemScheduleInfo_Osr extends RepItemScheduleInfo { return 1.0; } - static getDummyScheduleForNewCard(settings: SRSettings): RepItemScheduleInfo_Osr { - return RepItemScheduleInfo_Osr.fromDueDateStr( - RepItemScheduleInfo_Osr.dummyDueDateForNewCard, - RepItemScheduleInfo_Osr.initialInterval, + static getDummyScheduleForNewCard(settings: SRSettings): RepItemScheduleInfoOsr { + return RepItemScheduleInfoOsr.fromDueDateStr( + RepItemScheduleInfoOsr.dummyDueDateForNewCard, + RepItemScheduleInfoOsr.initialInterval, settings.baseEase, ); } @@ -57,6 +57,6 @@ export class RepItemScheduleInfo_Osr extends RepItemScheduleInfo { delayedBeforeReviewTicks: number | null = null, ) { const dueDate: Moment = DateUtil.dateStrToMoment(dueDateStr); - return new RepItemScheduleInfo_Osr(dueDate, interval, ease, delayedBeforeReviewTicks); + return new RepItemScheduleInfoOsr(dueDate, interval, ease, delayedBeforeReviewTicks); } } diff --git a/src/algorithms/osr/srs-algorithm-osr.ts b/src/algorithms/osr/srs-algorithm-osr.ts index 55123aab..2e81864e 100644 --- a/src/algorithms/osr/srs-algorithm-osr.ts +++ b/src/algorithms/osr/srs-algorithm-osr.ts @@ -5,7 +5,7 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info" import { ReviewResponse } from "src/algorithms/base/repetition-item"; import { osrSchedule } from "src/algorithms/osr/note-scheduling"; import { NoteLinkStat, OsrNoteGraph } from "src/algorithms/osr/osr-note-graph"; -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { DueDateHistogram } from "src/due-date-histogram"; import { Note } from "src/note"; import { INoteEaseList, NoteEaseList } from "src/note-ease-list"; @@ -13,7 +13,7 @@ import { Question } from "src/question"; import { SRSettings } from "src/settings"; import { globalDateProvider } from "src/utils/dates"; -export class SrsAlgorithm_Osr implements ISrsAlgorithm { +export class SrsAlgorithmOsr implements ISrsAlgorithm { private settings: SRSettings; private noteEaseList: INoteEaseList; @@ -47,18 +47,17 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { : linkContribution * this.settings.baseEase); // add note's average flashcard ease if available - /* c8 ignore next 3 */ if (this.noteEaseList.hasEaseForPath(notePath)) { ease = (ease + this.noteEaseList.getEaseByPath(notePath)) / 2; } // Don't know the due date until we know the calculated interval const dueDate: Moment = null; - const interval: number = SrsAlgorithm_Osr.initialInterval; + const interval: number = SrsAlgorithmOsr.initialInterval; ease = Math.round(ease); - const temp: RepItemScheduleInfo_Osr = new RepItemScheduleInfo_Osr(dueDate, interval, ease); + const temp: RepItemScheduleInfoOsr = new RepItemScheduleInfoOsr(dueDate, interval, ease); - const result: RepItemScheduleInfo_Osr = this.calcSchedule( + const result: RepItemScheduleInfoOsr = this.calcSchedule( temp, response, dueDateNoteHistogram, @@ -72,7 +71,7 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { noteOnLoadedNote(path: string, note: Note, noteEase: number): void { let flashcardsInNoteAvgEase: number = null; if (note) { - flashcardsInNoteAvgEase = SrsAlgorithm_Osr.calculateFlashcardAvgEase( + flashcardsInNoteAvgEase = SrsAlgorithmOsr.calculateFlashcardAvgEase( note.questionList, this.settings, ); @@ -122,8 +121,8 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { response: ReviewResponse, dueDateNoteHistogram: DueDateHistogram, ): RepItemScheduleInfo { - const noteScheduleOsr: RepItemScheduleInfo_Osr = noteSchedule as RepItemScheduleInfo_Osr; - const temp: RepItemScheduleInfo_Osr = this.calcSchedule( + const noteScheduleOsr: RepItemScheduleInfoOsr = noteSchedule as RepItemScheduleInfoOsr; + const temp: RepItemScheduleInfoOsr = this.calcSchedule( noteScheduleOsr, response, dueDateNoteHistogram, @@ -133,14 +132,14 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { const dueDate: Moment = moment(globalDateProvider.today.add(interval, "d")); this.noteEaseList.setEaseForPath(notePath, ease); - return new RepItemScheduleInfo_Osr(dueDate, interval, ease); + return new RepItemScheduleInfoOsr(dueDate, interval, ease); } private calcSchedule( - schedule: RepItemScheduleInfo_Osr, + schedule: RepItemScheduleInfoOsr, response: ReviewResponse, dueDateHistogram: DueDateHistogram, - ): RepItemScheduleInfo_Osr { + ): RepItemScheduleInfoOsr { const temp: Record = osrSchedule( response, schedule.interval, @@ -150,14 +149,14 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { dueDateHistogram, ); - return new RepItemScheduleInfo_Osr(globalDateProvider.today, temp.interval, temp.ease); + return new RepItemScheduleInfoOsr(globalDateProvider.today, temp.interval, temp.ease); } cardGetResetSchedule(): RepItemScheduleInfo { - const interval = SrsAlgorithm_Osr.initialInterval; + const interval = SrsAlgorithmOsr.initialInterval; const ease = this.settings.baseEase; const dueDate = globalDateProvider.today.add(interval, "d"); - return new RepItemScheduleInfo_Osr(dueDate, interval, ease); + return new RepItemScheduleInfoOsr(dueDate, interval, ease); } cardGetNewSchedule( @@ -165,17 +164,16 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { notePath: string, dueDateFlashcardHistogram: DueDateHistogram, ): RepItemScheduleInfo { - let initial_ease: number = this.settings.baseEase; - /* c8 ignore next 3 */ + let initialEase: number = this.settings.baseEase; if (this.noteEaseList.hasEaseForPath(notePath)) { - initial_ease = Math.round(this.noteEaseList.getEaseByPath(notePath)); + initialEase = Math.round(this.noteEaseList.getEaseByPath(notePath)); } const delayBeforeReview = 0; const schedObj: Record = osrSchedule( response, - SrsAlgorithm_Osr.initialInterval, - initial_ease, + SrsAlgorithmOsr.initialInterval, + initialEase, delayBeforeReview, this.settings, dueDateFlashcardHistogram, @@ -184,7 +182,7 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { const interval = schedObj.interval; const ease = schedObj.ease; const dueDate = globalDateProvider.today.add(interval, "d"); - return new RepItemScheduleInfo_Osr(dueDate, interval, ease, delayBeforeReview); + return new RepItemScheduleInfoOsr(dueDate, interval, ease, delayBeforeReview); } cardCalcUpdatedSchedule( @@ -192,7 +190,7 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { cardSchedule: RepItemScheduleInfo, dueDateFlashcardHistogram: DueDateHistogram, ): RepItemScheduleInfo { - const cardScheduleOsr: RepItemScheduleInfo_Osr = cardSchedule as RepItemScheduleInfo_Osr; + const cardScheduleOsr: RepItemScheduleInfoOsr = cardSchedule as RepItemScheduleInfoOsr; const schedObj: Record = osrSchedule( response, cardScheduleOsr.interval, @@ -205,6 +203,6 @@ export class SrsAlgorithm_Osr implements ISrsAlgorithm { const ease = schedObj.ease; const dueDate = globalDateProvider.today.add(interval, "d"); const delayBeforeReview = 0; - return new RepItemScheduleInfo_Osr(dueDate, interval, ease, delayBeforeReview); + return new RepItemScheduleInfoOsr(dueDate, interval, ease, delayBeforeReview); } } diff --git a/src/core.ts b/src/core.ts index 5aeaf639..8f6066a2 100644 --- a/src/core.ts +++ b/src/core.ts @@ -9,6 +9,7 @@ import { DataStoreAlgorithm } from "src/data-store-algorithm/data-store-algorith import { Deck, DeckTreeFilter } from "src/deck"; import { DeckTreeStatsCalculator } from "src/deck-tree-stats-calculator"; import { CardDueDateHistogram, NoteDueDateHistogram } from "src/due-date-histogram"; +import { ISRFile, SrTFile } from "src/file"; import { FlashcardReviewMode } from "src/flashcard-review-sequencer"; import { Note } from "src/note"; import { NoteEaseList } from "src/note-ease-list"; @@ -16,7 +17,6 @@ import { NoteFileLoader } from "src/note-file-loader"; import { NoteReviewQueue } from "src/note-review-queue"; import { QuestionPostponementList } from "src/question-postponement-list"; import { SettingsUtil, SRSettings } from "src/settings"; -import { ISRFile, SrTFile } from "src/sr-file"; import { Stats } from "src/stats"; import { TopicPath } from "src/topic-path"; import { globalDateProvider } from "src/utils/dates"; diff --git a/src/data-store-algorithm/data-store-in-note-algorithm-osr.ts b/src/data-store-algorithm/data-store-in-note-algorithm-osr.ts index 55a505cb..6fe4b67b 100644 --- a/src/data-store-algorithm/data-store-in-note-algorithm-osr.ts +++ b/src/data-store-algorithm/data-store-in-note-algorithm-osr.ts @@ -2,7 +2,7 @@ import { Moment } from "moment"; import moment from "moment"; import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { Card } from "src/card"; import { ALLOWED_DATE_FORMATS, @@ -12,18 +12,16 @@ import { YAML_FRONT_MATTER_REGEX, } from "src/constants"; import { IDataStoreAlgorithm } from "src/data-store-algorithm/idata-store-algorithm"; +import { ISRFile } from "src/file"; import { Question } from "src/question"; import { SRSettings } from "src/settings"; -import { ISRFile } from "src/sr-file"; -import { formatDate_YYYY_MM_DD } from "src/utils/dates"; +import { formatDateYYYYMMDD } from "src/utils/dates"; -// // Algorithm: The original OSR algorithm // (RZ: Perhaps not the original algorithm, but the only one available in 2023/early 2024) // // Data Store: With data stored in the note's markdown file -// -export class DataStoreInNote_AlgorithmOsr implements IDataStoreAlgorithm { +export class DataStoreInNoteAlgorithmOsr implements IDataStoreAlgorithm { private settings: SRSettings; constructor(settings: SRSettings) { @@ -43,7 +41,7 @@ export class DataStoreInNote_AlgorithmOsr implements IDataStoreAlgorithm { const dueDate: Moment = moment(frontmatter.get("sr-due"), ALLOWED_DATE_FORMATS); const interval: number = parseFloat(frontmatter.get("sr-interval")); const ease: number = parseFloat(frontmatter.get("sr-ease")); - result = new RepItemScheduleInfo_Osr(dueDate, interval, ease); + result = new RepItemScheduleInfoOsr(dueDate, interval, ease); } return result; } @@ -51,8 +49,8 @@ export class DataStoreInNote_AlgorithmOsr implements IDataStoreAlgorithm { async noteSetSchedule(note: ISRFile, repItemScheduleInfo: RepItemScheduleInfo): Promise { let fileText: string = await note.read(); - const schedInfo: RepItemScheduleInfo_Osr = repItemScheduleInfo as RepItemScheduleInfo_Osr; - const dueString: string = formatDate_YYYY_MM_DD(schedInfo.dueDate); + const schedInfo: RepItemScheduleInfoOsr = repItemScheduleInfo as RepItemScheduleInfoOsr; + const dueString: string = formatDateYYYYMMDD(schedInfo.dueDate); const interval: number = schedInfo.interval; const ease: number = schedInfo.latestEase; @@ -96,13 +94,13 @@ export class DataStoreInNote_AlgorithmOsr implements IDataStoreAlgorithm { formatCardSchedule(card: Card) { let result: string; if (card.hasSchedule) { - const schedule = card.scheduleInfo as RepItemScheduleInfo_Osr; + const schedule = card.scheduleInfo as RepItemScheduleInfoOsr; const dateStr = schedule.dueDate - ? formatDate_YYYY_MM_DD(schedule.dueDate) - : RepItemScheduleInfo_Osr.dummyDueDateForNewCard; + ? formatDateYYYYMMDD(schedule.dueDate) + : RepItemScheduleInfoOsr.dummyDueDateForNewCard; result = `!${dateStr},${schedule.interval},${schedule.latestEase}`; } else { - result = `!${RepItemScheduleInfo_Osr.dummyDueDateForNewCard},${RepItemScheduleInfo_Osr.initialInterval},${this.settings.baseEase}`; + result = `!${RepItemScheduleInfoOsr.dummyDueDateForNewCard},${RepItemScheduleInfoOsr.initialInterval},${this.settings.baseEase}`; } return result; } diff --git a/src/data-store-algorithm/idata-store-algorithm.ts b/src/data-store-algorithm/idata-store-algorithm.ts index 9fe6c1b6..44d4d5e1 100644 --- a/src/data-store-algorithm/idata-store-algorithm.ts +++ b/src/data-store-algorithm/idata-store-algorithm.ts @@ -1,6 +1,6 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; +import { ISRFile } from "src/file"; import { Question } from "src/question"; -import { ISRFile } from "src/sr-file"; export interface IDataStoreAlgorithm { noteGetSchedule(note: ISRFile): Promise; diff --git a/src/data-stores/notes/notes.ts b/src/data-stores/notes/notes.ts index ecf58271..4429bbfe 100644 --- a/src/data-stores/notes/notes.ts +++ b/src/data-stores/notes/notes.ts @@ -2,14 +2,14 @@ import { Moment } from "moment"; import { App } from "obsidian"; import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { LEGACY_SCHEDULING_EXTRACTOR, MULTI_SCHEDULING_EXTRACTOR } from "src/constants"; import { IDataStore } from "src/data-stores/base/data-store"; import { RepItemStorageInfo } from "src/data-stores/base/rep-item-storage-info"; import { NoteEaseList } from "src/note-ease-list"; import { Question } from "src/question"; import { SRSettings } from "src/settings"; -import { DateUtil, formatDate_YYYY_MM_DD, globalDateProvider } from "src/utils/dates"; +import { DateUtil, formatDateYYYYMMDD, globalDateProvider } from "src/utils/dates"; export class StoreInNotes implements IDataStore { private settings: SRSettings; @@ -40,14 +40,14 @@ export class StoreInNotes implements IDataStore { let info: RepItemScheduleInfo; if ( dueDate == null || - formatDate_YYYY_MM_DD(dueDate) == RepItemScheduleInfo_Osr.dummyDueDateForNewCard + formatDateYYYYMMDD(dueDate) == RepItemScheduleInfoOsr.dummyDueDateForNewCard ) { info = null; } else { const delayBeforeReviewTicks: number = dueDate.valueOf() - globalDateProvider.today.valueOf(); - info = new RepItemScheduleInfo_Osr(dueDate, interval, ease, delayBeforeReviewTicks); + info = new RepItemScheduleInfoOsr(dueDate, interval, ease, delayBeforeReviewTicks); } result.push(info); } diff --git a/src/deck-tree-iterator.ts b/src/deck-tree-iterator.ts index b4c08225..8df8bfad 100644 --- a/src/deck-tree-iterator.ts +++ b/src/deck-tree-iterator.ts @@ -185,7 +185,6 @@ class SingleDeckIterator { } } -// // Note that this iterator is destructive over the deck tree supplied to setBaseDeck() // The caller is required to first make a clone if this behavior is unwanted. // @@ -198,7 +197,6 @@ class SingleDeckIterator { // // 1. Whilst iterating, any multi-deck card is only returned once. // 2. All copies are removed from the deck tree supplied to setBaseDeck() -// export class DeckTreeIterator implements IDeckTreeIterator { private iteratorOrder: IIteratorOrder; @@ -280,7 +278,7 @@ export class DeckTreeIterator implements IDeckTreeIterator { } if (this.iteratorOrder.cardOrder == CardOrder.EveryCardRandomDeckAndCard) { - result = this.nextCard_EveryCardRandomDeck(); + result = this.nextCardEveryCardRandomDeck(); } else { // If we are just starting, then depending on settings we want to either start from the first deck, // or a random deck @@ -325,12 +323,13 @@ export class DeckTreeIterator implements IDeckTreeIterator { break; } } + if (this.deckIdx < this.deckArray.length) { this.singleDeckIterator.setDeck(this.deckArray[this.deckIdx]); } } - private nextCard_EveryCardRandomDeck(): boolean { + private nextCardEveryCardRandomDeck(): boolean { // Make the chance of picking a specific deck proportional to the number of cards within const weights: Record = {}; for (let i = 0; i < this.deckArray.length; i++) { diff --git a/src/deck.ts b/src/deck.ts index 389526ef..edcc3f8d 100644 --- a/src/deck.ts +++ b/src/deck.ts @@ -174,16 +174,16 @@ export class Deck { // We explicitly are adding the same card object to each of the specified decks // This is required by getDistinctCardCount() for (const topicPath of topicPathList.list) { - this.appendCard_SingleTopic(topicPath, cardObj); + this.appendCardSingleTopic(topicPath, cardObj); } } } appendCardToRootDeck(cardObj: Card): void { - this.appendCard_SingleTopic(TopicPath.emptyPath, cardObj); + this.appendCardSingleTopic(TopicPath.emptyPath, cardObj); } - appendCard_SingleTopic(topicPath: TopicPath, cardObj: Card): void { + appendCardSingleTopic(topicPath: TopicPath, cardObj: Card): void { const deck: Deck = this.getOrCreateDeck(topicPath); const cardList: Card[] = deck.getCardListForCardType(cardObj.cardListType); diff --git a/src/sr-file.ts b/src/file.ts similarity index 100% rename from src/sr-file.ts rename to src/file.ts diff --git a/src/flashcard-review-sequencer.ts b/src/flashcard-review-sequencer.ts index 3162c9ea..fb7ff813 100644 --- a/src/flashcard-review-sequencer.ts +++ b/src/flashcard-review-sequencer.ts @@ -135,16 +135,16 @@ export class FlashcardReviewSequencer implements IFlashcardReviewSequencer { async processReview(response: ReviewResponse): Promise { switch (this.reviewMode) { case FlashcardReviewMode.Review: - await this.processReview_ReviewMode(response); + await this.processReviewReviewMode(response); break; case FlashcardReviewMode.Cram: - await this.processReview_CramMode(response); + await this.processReviewCramMode(response); break; } } - async processReview_ReviewMode(response: ReviewResponse): Promise { + async processReviewReviewMode(response: ReviewResponse): Promise { if (response != ReviewResponse.Reset || this.currentCard.hasSchedule) { // We need to update the schedule if: // (1) the user reviewed with easy/good/hard (either a new or due card), @@ -181,7 +181,7 @@ export class FlashcardReviewSequencer implements IFlashcardReviewSequencer { } } - async processReview_CramMode(response: ReviewResponse): Promise { + async processReviewCramMode(response: ReviewResponse): Promise { if (response == ReviewResponse.Easy) this.deleteCurrentCard(); else { this.cardSequencer.moveCurrentCardToEndOfList(); diff --git a/src/gui/settings.tsx b/src/gui/settings.tsx index 4ba435ad..f78d1f03 100644 --- a/src/gui/settings.tsx +++ b/src/gui/settings.tsx @@ -16,7 +16,7 @@ function applySettingsUpdate(callback: () => void): void { export class SRSettingTab extends PluginSettingTab { private plugin: SRPlugin; - private tab_structure: TabStructure; + private tabStructure: TabStructure; private statistics: StatisticsView; constructor(app: App, plugin: SRPlugin) { @@ -34,37 +34,41 @@ export class SRSettingTab extends PluginSettingTab { }); header.addClass("sr-centered"); - this.tab_structure = createTabs( + this.tabStructure = createTabs( containerEl, { "main-flashcards": { title: t("FLASHCARDS"), icon: "SpacedRepIcon", - content_generator: (containerElement: HTMLElement) => + contentGenerator: (containerElement: HTMLElement) => this.tabFlashcards(containerElement), }, "main-notes": { title: t("NOTES"), icon: "book-text", - content_generator: (containerElement: HTMLElement) => + contentGenerator: (containerElement: HTMLElement) => this.tabNotes(containerElement), }, "main-algorithm": { title: t("SCHEDULING"), icon: "calendar", - content_generator: (containerElement: HTMLElement) => + contentGenerator: (containerElement: HTMLElement) => this.tabScheduling(containerElement), }, "main-ui-preferences": { title: t("UI"), icon: "presentation", - content_generator: (containerElement: HTMLElement) => + contentGenerator: (containerElement: HTMLElement) => this.tabUiPreferences(containerElement), }, "main-statistics": { title: t("STATS_TITLE"), icon: "bar-chart-3", - content_generator: async (containerElement: HTMLElement): Promise => { + contentGenerator: async (containerElement: HTMLElement): Promise => { + if (this.plugin.osrAppCore.cardStats == null) { + await this.plugin.sync(); + } + this.statistics = new StatisticsView( containerElement, this.plugin.osrAppCore, @@ -75,17 +79,17 @@ export class SRSettingTab extends PluginSettingTab { "main-help": { title: t("HELP"), icon: "badge-help", - content_generator: (containerElement: HTMLElement) => + contentGenerator: (containerElement: HTMLElement) => this.tabHelp(containerElement), }, }, - this.last_position.tab_name, + this.lastPosition.tabName, ); // KEEP THIS AFTER CREATING ALL ELEMENTS: // Scroll to the position when the settings modal was last open, // but do it after content generating has finished. - this.tab_structure.contentGeneratorPromises[this.tab_structure.active_tab_id].then(() => { + this.tabStructure.contentGeneratorPromises[this.tabStructure.activeTabId].then(() => { this.rememberLastPosition(containerEl); }); } @@ -123,7 +127,7 @@ export class SRSettingTab extends PluginSettingTab { }), ); - this.createSetting_FoldersToIgnore(containerEl); + this.createSettingFoldersToIgnore(containerEl); containerEl.createEl("h3", { text: t("GROUP_FLASHCARD_REVIEW") }); new Setting(containerEl) @@ -166,9 +170,11 @@ export class SRSettingTab extends PluginSettingTab { .addOptions( deckOrderEnabled ? { + // eslint-disable-next-line camelcase PrevDeckComplete_Sequential: t( "REVIEW_DECK_ORDER_PREV_DECK_COMPLETE_SEQUENTIAL", ), + // eslint-disable-next-line camelcase PrevDeckComplete_Random: t( "REVIEW_DECK_ORDER_PREV_DECK_COMPLETE_RANDOM", ), @@ -376,7 +382,7 @@ export class SRSettingTab extends PluginSettingTab { }), ); - this.createSetting_FoldersToIgnore(containerEl); + this.createSettingFoldersToIgnore(containerEl); containerEl.createEl("h3", { text: t("NOTES_REVIEW_QUEUE") }); new Setting(containerEl).setName(t("AUTO_NEXT_NOTE")).addToggle((toggle) => @@ -445,7 +451,7 @@ export class SRSettingTab extends PluginSettingTab { }); } - private async createSetting_FoldersToIgnore(containerEl: HTMLElement): Promise { + private async createSettingFoldersToIgnore(containerEl: HTMLElement): Promise { new Setting(containerEl) .setName(t("FOLDERS_TO_IGNORE")) .setDesc(t("FOLDERS_TO_IGNORE_DESC")) @@ -681,7 +687,7 @@ export class SRSettingTab extends PluginSettingTab { algoSettingEl.descEl.insertAdjacentHTML( "beforeend", t("CHECK_ALGORITHM_WIKI", { - algo_url: "https://www.stephenmwangi.com/obsidian-spaced-repetition/algorithms/", + algoUrl: "https://www.stephenmwangi.com/obsidian-spaced-repetition/algorithms/", }), ); algoSettingEl.addDropdown((dropdown) => @@ -887,14 +893,14 @@ export class SRSettingTab extends PluginSettingTab { containerEl.createEl("p").insertAdjacentHTML( "beforeend", t("CHECK_WIKI", { - wiki_url: "https://www.stephenmwangi.com/obsidian-spaced-repetition/", + wikiUrl: "https://www.stephenmwangi.com/obsidian-spaced-repetition/", }), ); containerEl.createEl("p").insertAdjacentHTML( "beforeend", t("GITHUB_DISCUSSIONS", { - discussions_url: + discussionsUrl: "https://github.com/st3v3nmw/obsidian-spaced-repetition/discussions/", }), ); @@ -902,7 +908,7 @@ export class SRSettingTab extends PluginSettingTab { containerEl.createEl("p").insertAdjacentHTML( "beforeend", t("GITHUB_ISSUES", { - issues_url: "https://github.com/st3v3nmw/obsidian-spaced-repetition/issues/", + issuesUrl: "https://github.com/st3v3nmw/obsidian-spaced-repetition/issues/", }), ); @@ -930,14 +936,14 @@ export class SRSettingTab extends PluginSettingTab { containerEl.createEl("p").insertAdjacentHTML( "beforeend", t("GITHUB_SOURCE_CODE", { - github_project_url: "https://github.com/st3v3nmw/obsidian-spaced-repetition", + githubProjectUrl: "https://github.com/st3v3nmw/obsidian-spaced-repetition", }), ); containerEl.createEl("p").insertAdjacentHTML( "beforeend", t("CODE_CONTRIBUTION_INFO", { - code_contribution_url: + codeContributionUrl: "https://www.stephenmwangi.com/obsidian-spaced-repetition/contributing/#code", }), ); @@ -945,39 +951,39 @@ export class SRSettingTab extends PluginSettingTab { containerEl.createEl("p").insertAdjacentHTML( "beforeend", t("TRANSLATION_CONTRIBUTION_INFO", { - translation_contribution_url: + translationContributionUrl: "https://www.stephenmwangi.com/obsidian-spaced-repetition/contributing/#translating", }), ); } - private last_position: { - scroll_position: number; - tab_name: string; + private lastPosition: { + scrollPosition: number; + tabName: string; } = { - scroll_position: 0, - tab_name: "main-flashcards", + scrollPosition: 0, + tabName: "main-flashcards", }; private rememberLastPosition(containerElement: HTMLElement) { - const last_position = this.last_position; + const lastPosition = this.lastPosition; // Go to last position now - this.tab_structure.buttons[last_position.tab_name].click(); + this.tabStructure.buttons[lastPosition.tabName].click(); // Need to delay the scrolling a bit. // Without this, something else would override scrolling and scroll back to 0. containerElement.scrollTo({ - top: this.last_position.scroll_position, + top: this.lastPosition.scrollPosition, behavior: "auto", }); // Listen to changes containerElement.addEventListener("scroll", (_) => { - this.last_position.scroll_position = containerElement.scrollTop; + this.lastPosition.scrollPosition = containerElement.scrollTop; }); - for (const tab_name in this.tab_structure.buttons) { - const button = this.tab_structure.buttons[tab_name]; + for (const tabName in this.tabStructure.buttons) { + const button = this.tabStructure.buttons[tabName]; button.onClickEvent((_: MouseEvent) => { - last_position.tab_name = tab_name; + lastPosition.tabName = tabName; }); } } diff --git a/src/gui/statistics.tsx b/src/gui/statistics.tsx index b96f72b4..327263dc 100644 --- a/src/gui/statistics.tsx +++ b/src/gui/statistics.tsx @@ -121,13 +121,13 @@ export class StatisticsView { } // Add intervals - const average_interval: string = textInterval( + const averageInterval: string = textInterval( Math.round( (cardStats.intervals.getTotalOfValueMultiplyCount() / scheduledCount) * 10, ) / 10 || 0, false, ), - longest_interval: string = textInterval(cardStats.intervals.getMaxValue(), false); + longestInterval: string = textInterval(cardStats.intervals.getMaxValue(), false); this.intervalsChart = createStatsChart( "bar", @@ -137,8 +137,8 @@ export class StatisticsView { Object.keys(cardStats.intervals.dict), Object.values(cardStats.intervals.dict), t("INTERVALS_SUMMARY", { - avg: average_interval, - longest: longest_interval, + avg: averageInterval, + longest: longestInterval, }), t("COUNT"), t("DAYS"), @@ -150,7 +150,7 @@ export class StatisticsView { for (let ease = Math.min(...eases); ease <= Math.max(...eases); ease++) { cardStats.eases.clearCountIfMissing(ease); } - const average_ease: number = + const averageEase: number = Math.round(cardStats.eases.getTotalOfValueMultiplyCount() / scheduledCount) || 0; this.easesChart = createStatsChart( @@ -160,7 +160,7 @@ export class StatisticsView { "", Object.keys(cardStats.eases.dict), Object.values(cardStats.eases.dict), - t("EASES_SUMMARY", { avgEase: average_ease }), + t("EASES_SUMMARY", { avgEase: averageEase }), t("COUNT"), t("EASES"), t("NUMBER_OF_CARDS"), diff --git a/src/gui/tabs.tsx b/src/gui/tabs.tsx index ecab8fe4..1f303163 100644 --- a/src/gui/tabs.tsx +++ b/src/gui/tabs.tsx @@ -23,12 +23,12 @@ import h from "vhtml"; export interface Tab { title: string; icon: string; - content_generator: (containerElement: HTMLElement) => Promise; + contentGenerator: (containerElement: HTMLElement) => Promise; } export interface TabStructure { header: HTMLElement; - active_tab_id: string; + activeTabId: string; buttons: { [key: string]: HTMLElement; }; @@ -57,44 +57,44 @@ export function createTabs( tabs: Tabs, activateTabId: string, ): TabStructure { - const tab_header = containerElement.createEl("div", { + const tabHeader = containerElement.createEl("div", { attr: { class: "sr-tab-header" }, }); - const tab_content_containers: TabContentContainers = {}; - const tab_buttons: TabButtons = {}; - const tab_structure: TabStructure = { - header: tab_header, + const tabContentContainers: TabContentContainers = {}; + const tabButtons: TabButtons = {}; + const tabStructure: TabStructure = { + header: tabHeader, // Indicate that the first tab is active. // This does not affect what tab is active in practice, it just reports the active tab. - active_tab_id: Object.keys(tabs)[0] as string, - buttons: tab_buttons, - contentContainers: tab_content_containers, + activeTabId: Object.keys(tabs)[0] as string, + buttons: tabButtons, + contentContainers: tabContentContainers, contentGeneratorPromises: {}, }; - let first_button: HTMLElement | undefined; - for (const tab_id in tabs) { - const tab = tabs[tab_id]; + let firstButton: HTMLElement | undefined; + for (const tabId in tabs) { + const tab = tabs[tabId]; // Create button - const button = tab_header.createEl("button", { + const button = tabHeader.createEl("button", { attr: { class: "sr-tab-header-button", - activateTab: "sr-tab-" + tab_id, + activateTab: "sr-tab-" + tabId, }, }); button.onclick = function (event: MouseEvent) { // Use 'this' instead of event.target because this way we'll always get a button element, // not an element inside the button (i.e. an icon). - const tab_button = this as HTMLElement; + const tabButton = this as HTMLElement; // Hide all tab contents and get the max dimensions - let max_width = 0; - let max_height = 0; - const tab_header = tab_button.parentElement; - if (null === tab_header) { + let maxWidth = 0; + let maxHeight = 0; + const tabHeader = tabButton.parentElement; + if (null === tabHeader) { throw new Error("Tab header is missing. Did not get a parent from tab button."); } - const containerElement = tab_header.parentElement; + const containerElement = tabHeader.parentElement; if (null === containerElement) { throw new Error( "Container element is missing. Did not get a parent from tab header.", @@ -103,68 +103,66 @@ export function createTabs( // Do not get all tab contents that exist, // because there might be multiple tab systems open at the same time. - const tab_contents = containerElement.findAll("div.sr-tab-content"); - const is_main_settings_modal = containerElement.hasClass("vertical-tab-content"); - for (const index in tab_contents) { - const tab_content = tab_contents[index]; + const tabContents = containerElement.findAll("div.sr-tab-content"); + const isMainSettingsModal = containerElement.hasClass("vertical-tab-content"); + for (const index in tabContents) { + const tabContent = tabContents[index]; // Get the maximum tab dimensions so that all tabs can have the same dimensions. // But don't do it if this is the main settings modal - if (!is_main_settings_modal) { + if (!isMainSettingsModal) { // Need to make the tab visible temporarily in order to get the dimensions. - tab_content.addClass("sr-tab-active"); - if (tab_content.offsetHeight > max_height) { - max_height = tab_content.offsetHeight; + tabContent.addClass("sr-tab-active"); + if (tabContent.offsetHeight > maxHeight) { + maxHeight = tabContent.offsetHeight; } - if (tab_content.offsetWidth > max_width) { - max_width = tab_content.offsetWidth; + if (tabContent.offsetWidth > maxWidth) { + maxWidth = tabContent.offsetWidth; } } // Finally hide the tab - tab_content.removeClass("sr-tab-active"); + tabContent.removeClass("sr-tab-active"); } // Remove active status from all buttons // Do not get all tab buttons that exist, // because there might be multiple tab systems open at the same time. - const adjacent_tab_buttons = tab_header.findAll(".sr-tab-header-button"); - for (const index in adjacent_tab_buttons) { - const tab_button = adjacent_tab_buttons[index]; - tab_button.removeClass("sr-tab-active"); + const adjacentTabButtons = tabHeader.findAll(".sr-tab-header-button"); + for (const index in adjacentTabButtons) { + const tabButton = adjacentTabButtons[index]; + tabButton.removeClass("sr-tab-active"); } // Activate the clicked tab - tab_button.addClass("sr-tab-active"); + tabButton.addClass("sr-tab-active"); const activateTabAttribute: Attr | null = - tab_button.attributes.getNamedItem("activateTab"); + tabButton.attributes.getNamedItem("activateTab"); if (null === activateTabAttribute) { throw new Error("Tab button has no 'activateTab' HTML attribute! Murr!"); } - const activate_tab_id = activateTabAttribute.value; - const tab_content: HTMLElement | null = document.getElementById(activate_tab_id); - if (null === tab_content) { + const activateTabId = activateTabAttribute.value; + const tabContent: HTMLElement | null = document.getElementById(activateTabId); + if (null === tabContent) { throw new Error( - "No tab content was found with activate_tab_id '" + - activate_tab_id + - "'! Hmph!", + "No tab content was found with activate_tab_id '" + activateTabId + "'! Hmph!", ); } - tab_content.addClass("sr-tab-active"); + tabContent.addClass("sr-tab-active"); // Mark the clicked tab as active in TabStructure (just to report which tab is currently active) // Remove "sr-tab" prefix. - tab_structure.active_tab_id = activate_tab_id.replace(/^sr-tab-/, ""); + tabStructure.activeTabId = activateTabId.replace(/^sr-tab-/, ""); // Focus an element (if a focusable element is present) // ? = If not found, do nothing. - tab_content.find(".sr-focus-element-on-tab-opening")?.focus(); + tabContent.find(".sr-focus-element-on-tab-opening")?.focus(); // Apply the max dimensions to this tab // But don't do it if this is the main settings modal - if (!is_main_settings_modal) { - tab_content.style.width = max_width + "px"; - tab_content.style.height = max_height + "px"; + if (!isMainSettingsModal) { + tabContent.style.width = maxWidth + "px"; + tabContent.style.height = maxHeight + "px"; } // Do nothing else (I don't know if this is needed or not) @@ -173,27 +171,27 @@ export function createTabs( if (tab.icon) setIcon(button, tab.icon); button.insertAdjacentHTML("beforeend", {tab.title}); - tab_buttons[tab_id] = button; + tabButtons[tabId] = button; // Create content container - tab_content_containers[tab_id] = containerElement.createEl("div", { - attr: { class: "sr-tab-content", id: "sr-tab-" + tab_id }, + tabContentContainers[tabId] = containerElement.createEl("div", { + attr: { class: "sr-tab-content", id: "sr-tab-" + tabId }, }); // Generate content - tab_structure.contentGeneratorPromises[tab_id] = tab.content_generator( - tab_content_containers[tab_id], + tabStructure.contentGeneratorPromises[tabId] = tab.contentGenerator( + tabContentContainers[tabId], ); // Memorize the first tab's button - if (undefined === first_button) { - first_button = button; + if (undefined === firstButton) { + firstButton = button; } } // Open a tab. - tab_buttons[activateTabId].click(); + tabButtons[activateTabId].click(); // Return the TabStructure - return tab_structure; + return tabStructure; } diff --git a/src/lang/locale/ar.ts b/src/lang/locale/ar.ts index 50ccbfb4..47e88f74 100644 --- a/src/lang/locale/ar.ts +++ b/src/lang/locale/ar.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: '.wiki لمزيد من المعلومات ، تحقق من', + CHECK_WIKI: '.wiki لمزيد من المعلومات ، تحقق من', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "مجلدات لتجاهلها", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -149,7 +147,7 @@ export default { INITIALLY_EXPAND_SUBDECKS_IN_TREE_DESC: " عطل هذا الخيار لطي الرُزم المتداخلة في نفس البطاقة , مفيد إذا كان لديك بطاقات تنتمي إلى العديد من الرُزم في نفس الملف", ALGORITHM: "خوارزمية", - CHECK_ALGORITHM_WIKI: 'algorithm details :لمزيد من المعلومات تحقق من', + CHECK_ALGORITHM_WIKI: 'algorithm details :لمزيد من المعلومات تحقق من', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "سهولة القاعدة", BASE_EASE_DESC: "الحد الأدنى = 130 ، ويفضل حوالي 250.", diff --git a/src/lang/locale/cz.ts b/src/lang/locale/cz.ts index 8c2c4e23..41be4a66 100644 --- a/src/lang/locale/cz.ts +++ b/src/lang/locale/cz.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Pro více informací jděte na wiki.', + CHECK_WIKI: 'Pro více informací jděte na wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Ignorované složky", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -153,7 +151,7 @@ export default { INITIALLY_EXPAND_SUBDECKS_IN_TREE_DESC: "Vypněte toto, chcete-li sbalit vnořené balíčky na stejné kartě. To je užitečné, pokud máte kartičky, které patří k mnoha balíčkům ve stejném souboru.", ALGORITHM: "Algoritmus", - CHECK_ALGORITHM_WIKI: 'Pro více informací jděte na popis algoritmu.', + CHECK_ALGORITHM_WIKI: 'Pro více informací jděte na popis algoritmu.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Základní složitost", BASE_EASE_DESC: "minimum = 130, nejlépe přibližně 250.", diff --git a/src/lang/locale/de.ts b/src/lang/locale/de.ts index 2b3b130e..45882f93 100644 --- a/src/lang/locale/de.ts +++ b/src/lang/locale/de.ts @@ -64,19 +64,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Weitere Informationen gibt es im Wiki (english).', + CHECK_WIKI: 'Weitere Informationen gibt es im Wiki (english).', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Ausgeschlossene Ordner", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -170,7 +168,7 @@ export default { "Deaktivieren Sie dies, um verschachtelte Stapel in derselben Karte zu reduzieren. Nützlich, wenn Sie Karten haben, die zu vielen Stapeln in derselben Datei gehören.", ALGORITHM: "Algorithmus", CHECK_ALGORITHM_WIKI: - 'Weiterführende Informationen: Implementierung des Algorithmus (english).', + 'Weiterführende Informationen: Implementierung des Algorithmus (english).', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Basis der Schwierigkeit", BASE_EASE_DESC: "Minimum ist 130. Empfohlen wird ca. 250.", diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 524246a5..7083d81d 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'For more information, check the wiki.', + CHECK_WIKI: 'For more information, check the wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Folders to ignore", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -152,7 +150,7 @@ export default { "Turn this off to collapse nested decks in the same card. Useful if you have cards which belong to many decks in the same file.", ALGORITHM: "Algorithm", CHECK_ALGORITHM_WIKI: - 'For more information, check the algorithm details.', + 'For more information, check the algorithm details.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Base ease", BASE_EASE_DESC: "minimum = 130, preferrably approximately 250.", diff --git a/src/lang/locale/es.ts b/src/lang/locale/es.ts index 24025ddf..849ac63c 100644 --- a/src/lang/locale/es.ts +++ b/src/lang/locale/es.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Para más información revisa la wiki.', + CHECK_WIKI: 'Para más información revisa la wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Directorios a ignorar", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -157,7 +155,7 @@ export default { "Desactiva esto para contraer mazos anidados en la misma tarjeta. Útil si tienes tarjetas que pertenecen a muchos mazos en el mismo archivo.", ALGORITHM: "Algoritmo", CHECK_ALGORITHM_WIKI: - 'Para más información, revisa la implementación del algoritmo.', + 'Para más información, revisa la implementación del algoritmo.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Base ease", BASE_EASE_DESC: "El mínimo es 130, es preferible que esté aproximado a 250.", diff --git a/src/lang/locale/fr.ts b/src/lang/locale/fr.ts index 48979ddd..3619bc2d 100644 --- a/src/lang/locale/fr.ts +++ b/src/lang/locale/fr.ts @@ -59,19 +59,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contribuer", - CHECK_WIKI: 'Pour plus d\'informations, visitez le wiki.', + CHECK_WIKI: 'Pour plus d\'informations, visitez le wiki.', GITHUB_DISCUSSIONS: - 'Visitez les discussions pour des questions-réponses, des retours ou une discussion généraliste.', + 'Visitez les discussions pour des questions-réponses, des retours ou une discussion généraliste.', GITHUB_ISSUES: - 'Créez un ticket sur GitHub si vous trouvez un bug ou voulez demander une fonctionnalité.', + 'Créez un ticket sur GitHub si vous trouvez un bug ou voulez demander une fonctionnalité.', GITHUB_SOURCE_CODE: - 'Code source du projet disponible sur GitHub', + 'Code source du projet disponible sur GitHub', CODE_CONTRIBUTION_INFO: - 'Information sur les contributions au code', + 'Information sur les contributions au code', TRANSLATION_CONTRIBUTION_INFO: - 'Informations sur la traduction du plugin dans votre langue', - PROJECT_CONTRIBUTIONS: - 'Créez un ticket sur GitHub si vous trouvez un bug ou voulez demander une fonctionnalité', + 'Informations sur la traduction du plugin dans votre langue', FOLDERS_TO_IGNORE: "Dossiers à ignorer", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -157,7 +155,7 @@ export default { "Désactivez pour réduire les paquets dans la même carte. Ce réglage est utile si vous avez des cartes qui appartiennent à beaucoup de paquets à la fois.", ALGORITHM: "Algorithme", CHECK_ALGORITHM_WIKI: - "Pour en savoir plus, lisez l'implémentation de l'algorithme.", + "Pour en savoir plus, lisez l'implémentation de l'algorithme.", SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Facilité de base", BASE_EASE_DESC: "minimum = 130, recommandé = vers 250.", diff --git a/src/lang/locale/it.ts b/src/lang/locale/it.ts index 1153166e..05cb68ff 100644 --- a/src/lang/locale/it.ts +++ b/src/lang/locale/it.ts @@ -59,19 +59,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Per maggiori informazioni, rivolgersi alla wiki.', + CHECK_WIKI: 'Per maggiori informazioni, rivolgersi alla wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Cartelle da ignorare", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -161,7 +159,7 @@ export default { "Disabilitami per collassare mazzi annidati nella stessa scheda. Utile se hai schede che appartengono a più mazzi nello stesso file.", ALGORITHM: "Algoritmo", CHECK_ALGORITHM_WIKI: - "Per maggiori informazioni, visita l'implementazione dell'algoritmo.", + "Per maggiori informazioni, visita l'implementazione dell'algoritmo.", SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Difficoltà base", BASE_EASE_DESC: "mino = 130, preferibilmente circa 250.", diff --git a/src/lang/locale/ja.ts b/src/lang/locale/ja.ts index 85329234..ffe479f7 100644 --- a/src/lang/locale/ja.ts +++ b/src/lang/locale/ja.ts @@ -59,19 +59,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: '詳細についてはwikiを確認してください。', + CHECK_WIKI: '詳細についてはwikiを確認してください。', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "無視するフォルダ", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -157,7 +155,7 @@ export default { "これをオフにすると、同じカード内のネストされたデッキが折りたたまれます。同じファイルに多くのデッキに属するカードがある場合に便利です。", ALGORITHM: "アルゴリズム", CHECK_ALGORITHM_WIKI: - '詳細についてはアルゴリズムの実装を確認してください。', + '詳細についてはアルゴリズムの実装を確認してください。', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "ベースの易しさ", BASE_EASE_DESC: "最小値は130ですが、 適正値はおおよそ250です。", diff --git a/src/lang/locale/ko.ts b/src/lang/locale/ko.ts index e42f0277..79242d47 100644 --- a/src/lang/locale/ko.ts +++ b/src/lang/locale/ko.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: '더 많은 정보를 원하시면, wiki를 확인해주세요.', + CHECK_WIKI: '더 많은 정보를 원하시면, wiki를 확인해주세요.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "무시할 폴더들", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -154,7 +152,7 @@ export default { "같은 카드에 중첩된 덱을 접으려면 이 옵션을 끄십시오. 같은 파일에 여러 덱에 속한 카드가 있는 경우 유용합니다.", ALGORITHM: "알고리즘", CHECK_ALGORITHM_WIKI: - '더 많은 정보를 원하시면, algorithm details을 확인해주세요.', + '더 많은 정보를 원하시면, algorithm details을 확인해주세요.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "기본 ease", BASE_EASE_DESC: "최솟값 = 130, 적정치는 대략 250입니다.", diff --git a/src/lang/locale/pl.ts b/src/lang/locale/pl.ts index f712d7da..0d2f6b70 100644 --- a/src/lang/locale/pl.ts +++ b/src/lang/locale/pl.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Aby uzyskać więcej informacji, sprawdź wiki.', + CHECK_WIKI: 'Aby uzyskać więcej informacji, sprawdź wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Foldery do zignorowania", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -158,7 +156,7 @@ export default { "Wyłącz to, aby zwinąć zagnieżdżone talie w tej samej karcie. Przydatne, jeśli karty należą do wielu talii w tym samym pliku.", ALGORITHM: "Algorytm", CHECK_ALGORITHM_WIKI: - 'Aby uzyskać więcej informacji, sprawdź implementację algorytmu.', + 'Aby uzyskać więcej informacji, sprawdź implementację algorytmu.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Podstawowa łatwość", BASE_EASE_DESC: "minimum = 130, preferowana wartość to około 250.", diff --git a/src/lang/locale/pt-br.ts b/src/lang/locale/pt-br.ts index 25682817..4155bd96 100644 --- a/src/lang/locale/pt-br.ts +++ b/src/lang/locale/pt-br.ts @@ -60,19 +60,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Para mais informações, cheque a wiki.', + CHECK_WIKI: 'Para mais informações, cheque a wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Pastas para ignorar", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -158,7 +156,7 @@ export default { "Desabilite isso para colapsar baralhos que estão um dentro do outro na mesma carta. Útil se você tem cartas que pertencem a muitos baralhos em um mesmo arquivo.", ALGORITHM: "Algorítmo", CHECK_ALGORITHM_WIKI: - 'Para mais informações, cheque a implementação do algorítmo.', + 'Para mais informações, cheque a implementação do algorítmo.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Facilidade base", BASE_EASE_DESC: "mínimo = 130, preferivelmente por volta de 250.", diff --git a/src/lang/locale/ru.ts b/src/lang/locale/ru.ts index 133fcb95..e87e8943 100644 --- a/src/lang/locale/ru.ts +++ b/src/lang/locale/ru.ts @@ -67,19 +67,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: 'Для дополнительной информации посетите: wiki.', + CHECK_WIKI: 'Для дополнительной информации посетите: wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "Игнорируемые папки", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -165,7 +163,7 @@ export default { "Отключите этот параметр, чтобы свернуть вложенные колоды на одной карточке. Полезно, если у вас есть карты, которые принадлежат многим колодам в одном файле.", ALGORITHM: "Алгоритм", CHECK_ALGORITHM_WIKI: - 'За дополнительной информацией обращайтесь к реализация алгоритма.', + 'За дополнительной информацией обращайтесь к реализация алгоритма.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Базовая Лёгкость", BASE_EASE_DESC: "минимум = 130, предпочтительно около 250.", diff --git a/src/lang/locale/tr.ts b/src/lang/locale/tr.ts index 664584a7..f3bd4387 100644 --- a/src/lang/locale/tr.ts +++ b/src/lang/locale/tr.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flash Kartlar ve Notlar", GROUP_CONTRIBUTING: "Katkıda Bulunma", - CHECK_WIKI: 'Daha fazla bilgi için wiki sayfasına göz atın.', + CHECK_WIKI: 'Daha fazla bilgi için wiki sayfasına göz atın.', GITHUB_DISCUSSIONS: - 'Soru-cevap, geri bildirim ve genel tartışmalar için tartışmalar bölümüne göz atın.', + 'Soru-cevap, geri bildirim ve genel tartışmalar için tartışmalar bölümüne göz atın.', GITHUB_ISSUES: - 'Bir özellik isteğiniz ya da hata bildiriminiz varsa buradan bildirin.', + 'Bir özellik isteğiniz ya da hata bildiriminiz varsa buradan bildirin.', GITHUB_SOURCE_CODE: - 'Proje kaynak koduna GitHub üzerinden ulaşabilirsiniz.', + 'Proje kaynak koduna GitHub üzerinden ulaşabilirsiniz.', CODE_CONTRIBUTION_INFO: - 'Kod katkıları hakkında bilgi alın.', + 'Kod katkıları hakkında bilgi alın.', TRANSLATION_CONTRIBUTION_INFO: - 'Eklentiyi kendi dilinize çevirmek hakkında bilgi için çeviri katkıları sayfasını ziyaret edin.', - PROJECT_CONTRIBUTIONS: - 'Bir özellik isteğiniz ya da hata bildiriminiz varsa buradan bildirin.', + 'Eklentiyi kendi dilinize çevirmek hakkında bilgi için çeviri katkıları sayfasını ziyaret edin.', FOLDERS_TO_IGNORE: "Yoksayılan Klasörler", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -155,7 +153,7 @@ export default { "Bunu kapatın, aynı dosyada birçok desteye ait kartlarınız varsa iç içe desteleri daraltmak için kullanışlıdır.", ALGORITHM: "Algoritma", CHECK_ALGORITHM_WIKI: - 'Daha fazla bilgi için algoritma uygulamasına göz atın.', + 'Daha fazla bilgi için algoritma uygulamasına göz atın.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "Temel kolaylık", BASE_EASE_DESC: "minimum = 130, tercihen yaklaşık 250.", diff --git a/src/lang/locale/zh-cn.ts b/src/lang/locale/zh-cn.ts index ff872f4d..bd7f696a 100644 --- a/src/lang/locale/zh-cn.ts +++ b/src/lang/locale/zh-cn.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: '了解更多, 请点击wiki.', + CHECK_WIKI: '了解更多, 请点击wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "忽略此文件夹", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -142,7 +140,7 @@ export default { INITIALLY_EXPAND_SUBDECKS_IN_TREE_DESC: "关闭此选项可折叠同一张卡片中的嵌套牌组。如果您的卡片属于同一文件中的许多套牌,则很有用。", ALGORITHM: "算法", - CHECK_ALGORITHM_WIKI: '了解更多, 请点击算法实现.', + CHECK_ALGORITHM_WIKI: '了解更多, 请点击算法实现.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "基础掌握程度", BASE_EASE_DESC: "最小值130,推荐值约250.", diff --git a/src/lang/locale/zh-tw.ts b/src/lang/locale/zh-tw.ts index fa6629ec..e7335965 100644 --- a/src/lang/locale/zh-tw.ts +++ b/src/lang/locale/zh-tw.ts @@ -58,19 +58,17 @@ export default { GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data", GROUP_FLASHCARDS_NOTES: "Flashcards & Notes", GROUP_CONTRIBUTING: "Contributing", - CHECK_WIKI: '瞭解更多, 請點選wiki.', + CHECK_WIKI: '瞭解更多, 請點選wiki.', GITHUB_DISCUSSIONS: - 'Visit the discussions section for Q&A help, feedback, and general discussion.', + 'Visit the discussions section for Q&A help, feedback, and general discussion.', GITHUB_ISSUES: - 'Raise an issue here if you have a feature request or a bug report.', + 'Raise an issue here if you have a feature request or a bug report.', GITHUB_SOURCE_CODE: - 'The project\'s source code is available on GitHub.', + 'The project\'s source code is available on GitHub.', CODE_CONTRIBUTION_INFO: - 'Here\'s how to contribute code to the plugin.', + 'Here\'s how to contribute code to the plugin.', TRANSLATION_CONTRIBUTION_INFO: - 'Here\'s how to translate the plugin to another language.', - PROJECT_CONTRIBUTIONS: - 'Raise an issue here if you have a feature request or a bug report', + 'Here\'s how to translate the plugin to another language.', FOLDERS_TO_IGNORE: "忽略此資料夾", FOLDERS_TO_IGNORE_DESC: "Enter folder paths or glob patterns on separate lines e.g. Templates/Scripts or **/*.excalidraw.md. This setting is common to both flashcards and notes.", @@ -142,7 +140,7 @@ export default { INITIALLY_EXPAND_SUBDECKS_IN_TREE_DESC: "關閉此選項可摺疊同一張卡片中的巢狀牌組。如果您的卡片屬於同一檔案中的許多套牌,則很有用。", ALGORITHM: "演算法", - CHECK_ALGORITHM_WIKI: '瞭解更多, 請點選算法實現.', + CHECK_ALGORITHM_WIKI: '瞭解更多, 請點選算法實現.', SM2_OSR_VARIANT: "OSR's variant of SM-2", BASE_EASE: "基礎掌握程度", BASE_EASE_DESC: "最小值130,推薦值約250.", diff --git a/src/main.ts b/src/main.ts index aa0a34be..bbb758f4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,10 +3,10 @@ import { Menu, Notice, Plugin, TAbstractFile, TFile, WorkspaceLeaf } from "obsid import { ReviewResponse } from "src/algorithms/base/repetition-item"; import { SrsAlgorithm } from "src/algorithms/base/srs-algorithm"; import { ObsidianVaultNoteLinkInfoFinder } from "src/algorithms/osr/obsidian-vault-notelink-info-finder"; -import { SrsAlgorithm_Osr } from "src/algorithms/osr/srs-algorithm-osr"; +import { SrsAlgorithmOsr } from "src/algorithms/osr/srs-algorithm-osr"; import { OsrAppCore } from "src/core"; import { DataStoreAlgorithm } from "src/data-store-algorithm/data-store-algorithm"; -import { DataStoreInNote_AlgorithmOsr } from "src/data-store-algorithm/data-store-in-note-algorithm-osr"; +import { DataStoreInNoteAlgorithmOsr } from "src/data-store-algorithm/data-store-in-note-algorithm-osr"; import { DataStore } from "src/data-stores/base/data-store"; import { StoreInNotes } from "src/data-stores/notes/notes"; import { CardListType, Deck, DeckTreeFilter } from "src/deck"; @@ -17,6 +17,7 @@ import { IDeckTreeIterator, IIteratorOrder, } from "src/deck-tree-iterator"; +import { ISRFile, SrTFile } from "src/file"; import { FlashcardReviewMode, FlashcardReviewSequencer, @@ -35,7 +36,6 @@ import { generateParser, setDebugParser } from "src/parser"; import { DEFAULT_DATA, PluginData } from "src/plugin-data"; import { QuestionPostponementList } from "src/question-postponement-list"; import { DEFAULT_SETTINGS, SettingsUtil, SRSettings, upgradeSettings } from "src/settings"; -import { ISRFile, SrTFile as SrTFile } from "src/sr-file"; import { TopicPath } from "src/topic-path"; import { convertToStringOrEmpty, TextDirection } from "src/utils/strings"; @@ -427,15 +427,15 @@ export default class SRPlugin extends Plugin { setupDataStoreAndAlgorithmInstances(settings: SRSettings) { // For now we can hardcode as we only support the one data store and one algorithm DataStore.instance = new StoreInNotes(settings); - SrsAlgorithm.instance = new SrsAlgorithm_Osr(settings); - DataStoreAlgorithm.instance = new DataStoreInNote_AlgorithmOsr(settings); + SrsAlgorithm.instance = new SrsAlgorithmOsr(settings); + DataStoreAlgorithm.instance = new DataStoreInNoteAlgorithmOsr(settings); } async savePluginData(): Promise { await this.saveData(this.data); } - async debouncedGenerateParser(timeout_ms = 250) { + async debouncedGenerateParser(timeoutMs = 250) { if (this.debouncedGenerateParserTimeout) { clearTimeout(this.debouncedGenerateParserTimeout); } @@ -453,7 +453,7 @@ export default class SRPlugin extends Plugin { }; generateParser(parserOptions); this.debouncedGenerateParserTimeout = null; - }, timeout_ms); + }, timeoutMs); } showRibbonIcon(status: boolean) { diff --git a/src/note-file-loader.ts b/src/note-file-loader.ts index e6df2344..39dc836d 100644 --- a/src/note-file-loader.ts +++ b/src/note-file-loader.ts @@ -1,8 +1,8 @@ +import { ISRFile } from "src/file"; import { Note } from "src/note"; import { NoteQuestionParser } from "src/note-question-parser"; import { Question } from "src/question"; import { SRSettings } from "src/settings"; -import { ISRFile } from "src/sr-file"; import { TopicPath } from "src/topic-path"; import { TextDirection } from "src/utils/strings"; diff --git a/src/note-parser.ts b/src/note-parser.ts index 55181b91..b9df3d35 100644 --- a/src/note-parser.ts +++ b/src/note-parser.ts @@ -1,7 +1,7 @@ +import { ISRFile } from "src/file"; import { Note } from "src/note"; import { NoteQuestionParser } from "src/note-question-parser"; import { SRSettings } from "src/settings"; -import { ISRFile } from "src/sr-file"; import { TopicPath } from "src/topic-path"; import { TextDirection } from "src/utils/strings"; diff --git a/src/note-question-parser.ts b/src/note-question-parser.ts index 342da19b..fc917691 100644 --- a/src/note-question-parser.ts +++ b/src/note-question-parser.ts @@ -3,11 +3,11 @@ import { TagCache } from "obsidian"; import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; import { Card } from "src/card"; import { DataStore } from "src/data-stores/base/data-store"; +import { frontmatterTagPseudoLineNum, ISRFile } from "src/file"; import { ParsedQuestionInfo, parseEx, ParserOptions } from "src/parser"; import { Question, QuestionText } from "src/question"; import { CardFrontBack, CardFrontBackUtil } from "src/question-type"; import { SettingsUtil, SRSettings } from "src/settings"; -import { frontmatterTagPseudoLineNum, ISRFile } from "src/sr-file"; import { TopicPath, TopicPathList } from "src/topic-path"; import { splitNoteIntoFrontmatterAndContent, @@ -321,19 +321,17 @@ export class NoteQuestionParser { return new TopicPathList(list, lineNum); } - private createTopicPathList_FromSingleTag(tagCache: TagCache): TopicPathList { + private createTopicPathListFromSingleTag(tagCache: TagCache): TopicPathList { const list: TopicPath[] = [TopicPath.getTopicPathFromTag(tagCache.tag)]; return new TopicPathList(list, tagCache.position.start.line); } - // // A question can be associated with multiple topics (hence returning TopicPathList and not just TopicPath). // // If the question has an associated question specific TopicPath, then that is returned. // // Else the first TopicPathList prior to the question (in the order present in the file) is returned. // That could be either the tags within the note's frontmatter, or tags on lines within the note's content. - // private determineQuestionTopicPathList(question: Question): TopicPathList { let result: TopicPathList; if (this.settings.convertFoldersToDecks) { @@ -363,7 +361,7 @@ export class NoteQuestionParser { // if nothing matched, then use the first one // This could occur if the only topic tags present are question specific if (!result && this.flashcardTagList.length > 0) { - result = this.createTopicPathList_FromSingleTag(this.flashcardTagList[0]); + result = this.createTopicPathListFromSingleTag(this.flashcardTagList[0]); } } } diff --git a/src/note-review-deck.ts b/src/note-review-deck.ts index c67f0be3..c3cae6d0 100644 --- a/src/note-review-deck.ts +++ b/src/note-review-deck.ts @@ -1,5 +1,5 @@ +import { ISRFile } from "src/file"; import { t } from "src/lang/helpers"; -import { ISRFile } from "src/sr-file"; import { globalDateProvider } from "src/utils/dates"; import { globalRandomNumberProvider } from "src/utils/numbers"; diff --git a/src/note-review-queue.ts b/src/note-review-queue.ts index 2d8b8d86..6c8629cc 100644 --- a/src/note-review-queue.ts +++ b/src/note-review-queue.ts @@ -1,6 +1,6 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; +import { ISRFile } from "src/file"; import { NoteReviewDeck, SchedNote } from "src/note-review-deck"; -import { ISRFile } from "src/sr-file"; export class NoteReviewQueue { private _reviewDecks: Map; diff --git a/src/note.ts b/src/note.ts index 55da8c72..07a583d8 100644 --- a/src/note.ts +++ b/src/note.ts @@ -1,7 +1,7 @@ import { Deck } from "src/deck"; +import { ISRFile } from "src/file"; import { Question } from "src/question"; import { SRSettings } from "src/settings"; -import { ISRFile } from "src/sr-file"; export class Note { file: ISRFile; diff --git a/src/parser.ts b/src/parser.ts index 5423ab0e..fa46e5fd 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -76,34 +76,34 @@ export function generateParser(options: ParserOptions): Parser { function generateGrammar(options: ParserOptions): string { // Contains the grammar for cloze cards - let clozes_grammar = ""; + let clozesGrammar = ""; // An array contianing the types of cards enabled by the user - const card_rules_list: string[] = ["html_comment", "tilde_code", "backprime_code"]; + const cardRulesList: string[] = ["html_comment", "tilde_code", "backprime_code"]; // Include reversed inline flashcards rule only if the user provided a non-empty marker for reversed inline flashcards - if (options.singleLineCardSeparator.trim() !== "") card_rules_list.push("inline_rev_card"); + if (options.singleLineCardSeparator.trim() !== "") cardRulesList.push("inline_rev_card"); // Include inline flashcards rule only if the user provided a non-empty marker for inline flashcards - if (options.singleLineCardSeparator.trim() !== "") card_rules_list.push("inline_card"); + if (options.singleLineCardSeparator.trim() !== "") cardRulesList.push("inline_card"); // Include reversed multiline flashcards rule only if the user provided a non-empty marker for reversed multiline flashcards if (options.multilineReversedCardSeparator.trim() !== "") - card_rules_list.push("multiline_rev_card"); + cardRulesList.push("multiline_rev_card"); // Include multiline flashcards rule only if the user provided a non-empty marker for multiline flashcards - if (options.multilineCardSeparator.trim() !== "") card_rules_list.push("multiline_card"); + if (options.multilineCardSeparator.trim() !== "") cardRulesList.push("multiline_card"); - const cloze_rules_list: string[] = []; - if (options.convertHighlightsToClozes) cloze_rules_list.push("cloze_equal"); - if (options.convertBoldTextToClozes) cloze_rules_list.push("cloze_star"); - if (options.convertCurlyBracketsToClozes) cloze_rules_list.push("cloze_bracket"); + const clozeRulesList: string[] = []; + if (options.convertHighlightsToClozes) clozeRulesList.push("cloze_equal"); + if (options.convertBoldTextToClozes) clozeRulesList.push("cloze_star"); + if (options.convertCurlyBracketsToClozes) clozeRulesList.push("cloze_bracket"); // Include cloze cards only if the user enabled at least one type of cloze cards - if (cloze_rules_list.length > 0) { - card_rules_list.push("cloze_card"); - const cloze_rules = cloze_rules_list.join(" / "); - clozes_grammar = ` + if (clozeRulesList.length > 0) { + cardRulesList.push("cloze_card"); + const clozeRules = clozeRulesList.join(" / "); + clozesGrammar = ` cloze_card = $(multiline_before_cloze? cloze_line (multiline_after_cloze)? (newline annotation)?) { return createParsedQuestionInfo(CardType.Cloze,text().trimEnd(),location().start.line-1,location().end.line-1); @@ -119,7 +119,7 @@ multiline_after_cloze = e:(!(newline separator_line) text_line1)+ cloze_text -= ${cloze_rules} += ${clozeRules} cloze_equal = cloze_mark_equal (!cloze_mark_equal non_newline)+ cloze_mark_equal @@ -147,9 +147,9 @@ cloze_mark_bracket_close // Important: we need to include `loose_line` rule to detect any other loose line. // Otherwise, we get a syntax error because the parser is likely not able to reach the end // of the file, as it may encounter loose lines, which it would not know how to handle. - card_rules_list.push("loose_line"); + cardRulesList.push("loose_line"); - const card_rules = card_rules_list.join(" / "); + const cardRules = cardRulesList.join(" / "); return `{ // The fallback case is important if we want to test the rules with https://peggyjs.org/online.html @@ -180,7 +180,7 @@ main /* The input text to the parser contains arbitrary text, not just card definitions. Hence we fallback to matching on loose_line. The result from loose_line is filtered out by filterBlocks() */ block -= ${card_rules} += ${cardRules} html_comment = $("" (html_comment / .))* "-->" newline?) { @@ -265,7 +265,7 @@ multiline_rev_before multiline_rev_after = $(!separator_line text_line)+ -${clozes_grammar} +${clozesGrammar} inline_mark = "${options.singleLineCardSeparator}" diff --git a/src/question-type.ts b/src/question-type.ts index bfc39ce5..9bb22be1 100644 --- a/src/question-type.ts +++ b/src/question-type.ts @@ -28,7 +28,7 @@ export interface IQuestionTypeHandler { expand(questionText: string, settings: SRSettings): CardFrontBack[]; } -class QuestionType_SingleLineBasic implements IQuestionTypeHandler { +class QuestionTypeSingleLineBasic implements IQuestionTypeHandler { expand(questionText: string, settings: SRSettings): CardFrontBack[] { const idx: number = questionText.indexOf(settings.singleLineCardSeparator); const item: CardFrontBack = new CardFrontBack( @@ -40,7 +40,7 @@ class QuestionType_SingleLineBasic implements IQuestionTypeHandler { } } -class QuestionType_SingleLineReversed implements IQuestionTypeHandler { +class QuestionTypeSingleLineReversed implements IQuestionTypeHandler { expand(questionText: string, settings: SRSettings): CardFrontBack[] { const idx: number = questionText.indexOf(settings.singleLineReversedCardSeparator); const side1: string = questionText.substring(0, idx), @@ -55,7 +55,7 @@ class QuestionType_SingleLineReversed implements IQuestionTypeHandler { } } -class QuestionType_MultiLineBasic implements IQuestionTypeHandler { +class QuestionTypeMultiLineBasic implements IQuestionTypeHandler { expand(questionText: string, settings: SRSettings): CardFrontBack[] { // We don't need to worry about "\r\n", as multi line questions processed by parse() concatenates lines explicitly with "\n" const questionLines = questionText.split("\n"); @@ -71,7 +71,7 @@ class QuestionType_MultiLineBasic implements IQuestionTypeHandler { } } -class QuestionType_MultiLineReversed implements IQuestionTypeHandler { +class QuestionTypeMultiLineReversed implements IQuestionTypeHandler { expand(questionText: string, settings: SRSettings): CardFrontBack[] { // We don't need to worry about "\r\n", as multi line questions processed by parse() concatenates lines explicitly with "\n" const questionLines = questionText.split("\n"); @@ -90,7 +90,7 @@ class QuestionType_MultiLineReversed implements IQuestionTypeHandler { } } -class QuestionType_Cloze implements IQuestionTypeHandler { +class QuestionTypeCloze implements IQuestionTypeHandler { expand(questionText: string, settings: SRSettings): CardFrontBack[] { const siblings: RegExpMatchArray[] = []; if (settings.convertHighlightsToClozes) { @@ -120,16 +120,16 @@ class QuestionType_Cloze implements IQuestionTypeHandler { deletionEnd: number = deletionStart + m[0].length; front = questionText.substring(0, deletionStart) + - QuestionType_ClozeUtil.renderClozeFront() + + QuestionTypeClozeUtil.renderClozeFront() + questionText.substring(deletionEnd); - front = QuestionType_ClozeUtil.removeClozeTokens(front, settings); + front = QuestionTypeClozeUtil.removeClozeTokens(front, settings); back = questionText.substring(0, deletionStart) + - QuestionType_ClozeUtil.renderClozeBack( + QuestionTypeClozeUtil.renderClozeBack( questionText.substring(deletionStart, deletionEnd), ) + questionText.substring(deletionEnd); - back = QuestionType_ClozeUtil.removeClozeTokens(back, settings); + back = QuestionTypeClozeUtil.removeClozeTokens(back, settings); result.push(new CardFrontBack(front, back)); } @@ -137,7 +137,7 @@ class QuestionType_Cloze implements IQuestionTypeHandler { } } -export class QuestionType_ClozeUtil { +export class QuestionTypeClozeUtil { static renderClozeFront(): string { return "[...]"; } @@ -162,19 +162,19 @@ export class QuestionTypeFactory { let handler: IQuestionTypeHandler; switch (questionType) { case CardType.SingleLineBasic: - handler = new QuestionType_SingleLineBasic(); + handler = new QuestionTypeSingleLineBasic(); break; case CardType.SingleLineReversed: - handler = new QuestionType_SingleLineReversed(); + handler = new QuestionTypeSingleLineReversed(); break; case CardType.MultiLineBasic: - handler = new QuestionType_MultiLineBasic(); + handler = new QuestionTypeMultiLineBasic(); break; case CardType.MultiLineReversed: - handler = new QuestionType_MultiLineReversed(); + handler = new QuestionTypeMultiLineReversed(); break; case CardType.Cloze: - handler = new QuestionType_Cloze(); + handler = new QuestionTypeCloze(); break; } return handler; diff --git a/src/topic-path.ts b/src/topic-path.ts index a430ec94..048842f5 100644 --- a/src/topic-path.ts +++ b/src/topic-path.ts @@ -1,6 +1,6 @@ import { OBSIDIAN_TAG_AT_STARTOFLINE_REGEX } from "src/constants"; +import { ISRFile } from "src/file"; import { SRSettings } from "src/settings"; -import { ISRFile } from "src/sr-file"; export class TopicPath { path: string[]; diff --git a/src/utils/dates.ts b/src/utils/dates.ts index 6b12bde6..f6b1006e 100644 --- a/src/utils/dates.ts +++ b/src/utils/dates.ts @@ -10,7 +10,7 @@ import { ALLOWED_DATE_FORMATS, PREFERRED_DATE_FORMAT } from "src/constants"; * @returns * @deprecated use formatDate() instead */ -export function formatDate_YYYY_MM_DD(ticks: Moment): string { +export function formatDateYYYYMMDD(ticks: Moment): string { return ticks.format(PREFERRED_DATE_FORMAT); } @@ -132,11 +132,11 @@ function getOriginDateAsMoment(): Moment { return DateUtil.dateStrToMoment(originDate); } -export function setupStaticDateProvider_OriginDatePlusDays(days: number) { +export function setupStaticDateProviderOriginDatePlusDays(days: number) { const simulatedDate: Moment = getOriginDateAsMoment().add(days, "d"); globalDateProvider = new StaticDateProvider(simulatedDate); } -export function setupStaticDateProvider_20230906() { +export function setupStaticDateProvider20230906() { setupStaticDateProvider(originDate); } diff --git a/tests/unit/algorithms/osr/rep-item-schedule-info-osr.test.ts b/tests/unit/algorithms/osr/rep-item-schedule-info-osr.test.ts index 578566df..fbd0e429 100644 --- a/tests/unit/algorithms/osr/rep-item-schedule-info-osr.test.ts +++ b/tests/unit/algorithms/osr/rep-item-schedule-info-osr.test.ts @@ -1,11 +1,11 @@ import moment from "moment"; -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { DEFAULT_SETTINGS } from "src/settings"; describe("formatCardScheduleForHtmlComment", () => { test("With due date", () => { - const repItem: RepItemScheduleInfo_Osr = RepItemScheduleInfo_Osr.fromDueDateStr( + const repItem: RepItemScheduleInfoOsr = RepItemScheduleInfoOsr.fromDueDateStr( "2023-09-02", 4, 270, @@ -15,14 +15,14 @@ describe("formatCardScheduleForHtmlComment", () => { }); test("Without due date", () => { - const repItem: RepItemScheduleInfo_Osr = new RepItemScheduleInfo_Osr(null, 5, 290, null); + const repItem: RepItemScheduleInfoOsr = new RepItemScheduleInfoOsr(null, 5, 290, null); expect(repItem.formatCardScheduleForHtmlComment()).toEqual("!2000-01-01,5,290"); }); }); test("getDummyScheduleForNewCard", () => { - const repItem: RepItemScheduleInfo_Osr = - RepItemScheduleInfo_Osr.getDummyScheduleForNewCard(DEFAULT_SETTINGS); + const repItem: RepItemScheduleInfoOsr = + RepItemScheduleInfoOsr.getDummyScheduleForNewCard(DEFAULT_SETTINGS); expect(repItem.interval).toEqual(1); expect(repItem.latestEase).toEqual(250); expect(repItem.dueDate.valueOf).toEqual(moment("2000-01-01").valueOf); diff --git a/tests/unit/card.test.ts b/tests/unit/card.test.ts index 54ddcc54..56f92393 100644 --- a/tests/unit/card.test.ts +++ b/tests/unit/card.test.ts @@ -1,4 +1,4 @@ -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { Card } from "src/card"; import { TICKS_PER_DAY } from "src/constants"; @@ -14,7 +14,7 @@ describe("Card", () => { new Card({ front: "What year did Aegon's Conquest start?", back: "2BC #flashcards", - scheduleInfo: RepItemScheduleInfo_Osr.fromDueDateStr( + scheduleInfo: RepItemScheduleInfoOsr.fromDueDateStr( "2023-09-03", 1, 230, diff --git a/tests/unit/core.test.ts b/tests/unit/core.test.ts index 7150753e..0fe4cce4 100644 --- a/tests/unit/core.test.ts +++ b/tests/unit/core.test.ts @@ -3,14 +3,14 @@ import moment from "moment"; import { ReviewResponse } from "src/algorithms/base/repetition-item"; import { CardListType } from "src/deck"; import { NoteDueDateHistogram } from "src/due-date-histogram"; +import { ISRFile } from "src/file"; import { NoteReviewDeck, SchedNote } from "src/note-review-deck"; import { DEFAULT_SETTINGS, SRSettings } from "src/settings"; -import { ISRFile } from "src/sr-file"; -import { formatDate_YYYY_MM_DD, setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { formatDateYYYYMMDD, setupStaticDateProvider20230906 } from "src/utils/dates"; import { UnitTestOsrCore } from "./helpers/unit-test-core"; -import { unitTest_CheckNoteFrontmatter } from "./helpers/unit-test-helper"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestCheckNoteFrontmatter } from "./helpers/unit-test-helper"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; function checkDeckTreeCounts( osrCore: UnitTestOsrCore, @@ -25,7 +25,7 @@ function checkDeckTreeCounts( ); } -function checkNoteReviewDeck_Basic( +function checkNoteReviewDeckBasic( actual: NoteReviewDeck, expected: { deckName: string; @@ -45,12 +45,12 @@ function checkScheduledNote( expected: { filename: string; dueDate: string }, ): void { expect(actual.note.path.endsWith(expected.filename)).toBeTruthy(); - expect(formatDate_YYYY_MM_DD(moment(actual.dueUnix))).toEqual(expected.dueDate); + expect(formatDateYYYYMMDD(moment(actual.dueUnix))).toEqual(expected.dueDate); } beforeAll(() => { - setupStaticDateProvider_20230906(); - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + setupStaticDateProvider20230906(); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); test("No questions in the text; no files tagged as notes", async () => { @@ -73,7 +73,7 @@ describe("Notes", () => { // Single deck "#review", with single new note "Computation Graph.md" const actual: NoteReviewDeck = osrCore.noteReviewQueue.reviewDecks.get("#review"); - checkNoteReviewDeck_Basic(actual, { + checkNoteReviewDeckBasic(actual, { deckName: "#review", dueNotesCount: 0, newNotesLength: 1, @@ -91,7 +91,7 @@ describe("Notes", () => { // Single deck "#review", with single scheduled note "Triboelectric Effect.md", const actual: NoteReviewDeck = osrCore.noteReviewQueue.reviewDecks.get("#review"); - checkNoteReviewDeck_Basic(actual, { + checkNoteReviewDeckBasic(actual, { deckName: "#review", dueNotesCount: 0, newNotesLength: 0, @@ -116,7 +116,7 @@ describe("Notes", () => { // Check note frontmatter - 4 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-10"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); }); // The notes that have links to [[A]] themselves haven't been reviewed, @@ -132,7 +132,7 @@ describe("Notes", () => { // Check note frontmatter - 4 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-10"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); }); test("Review note with a backlink (one source file already reviewed)", async () => { @@ -148,7 +148,7 @@ describe("Notes", () => { // Check note frontmatter - 4 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-10"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 4, 272); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 4, 272); }); }); @@ -174,7 +174,7 @@ describe("Notes", () => { // Check note frontmatter - 11 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-17"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 11, 270); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 11, 270); expect(osrCore.dueDateNoteHistogram.dueNotesCount).toEqual(0); expectedHistogram = new NoteDueDateHistogram({ @@ -197,7 +197,7 @@ describe("Notes", () => { // Check note frontmatter - 2 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-08"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 2, 250); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 2, 250); }); }); @@ -213,7 +213,7 @@ describe("Notes", () => { // Check note frontmatter - 4 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-10"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); }); // The notes that have links to [[A]] themselves haven't been reviewed, @@ -229,7 +229,7 @@ describe("Notes", () => { // Check note frontmatter - 4 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-10"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 4, 270); }); test("Review note with a backlink (one source file already reviewed)", async () => { @@ -245,7 +245,7 @@ describe("Notes", () => { // Check note frontmatter - 4 days after the simulated test date of 2023-09-06 const expectedDueDate: string = "2023-09-10"; - unitTest_CheckNoteFrontmatter(file.content, expectedDueDate, 4, 272); + unitTestCheckNoteFrontmatter(file.content, expectedDueDate, 4, 272); }); }); diff --git a/tests/unit/data-store-algorithm/data-store-in-note-algorithm-osr.test.ts b/tests/unit/data-store-algorithm/data-store-in-note-algorithm-osr.test.ts index 45905947..84c33b0a 100644 --- a/tests/unit/data-store-algorithm/data-store-in-note-algorithm-osr.test.ts +++ b/tests/unit/data-store-algorithm/data-store-in-note-algorithm-osr.test.ts @@ -1,19 +1,19 @@ -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { Card } from "src/card"; -import { DataStoreInNote_AlgorithmOsr } from "src/data-store-algorithm/data-store-in-note-algorithm-osr"; +import { DataStoreInNoteAlgorithmOsr } from "src/data-store-algorithm/data-store-in-note-algorithm-osr"; import { DEFAULT_SETTINGS, SRSettings } from "src/settings"; -import { setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { setupStaticDateProvider20230906 } from "src/utils/dates"; import { UnitTestSRFile } from "../helpers/unit-test-file"; beforeAll(() => { - setupStaticDateProvider_20230906(); + setupStaticDateProvider20230906(); }); describe("noteSetSchedule", () => { test("File originally has frontmatter (but not OSR note scheduling frontmatter)", async () => { const settings: SRSettings = { ...DEFAULT_SETTINGS }; - const instance: DataStoreInNote_AlgorithmOsr = new DataStoreInNote_AlgorithmOsr(settings); + const instance: DataStoreInNoteAlgorithmOsr = new DataStoreInNoteAlgorithmOsr(settings); const noteText: string = `--- created: 2024-01-17 @@ -21,7 +21,7 @@ created: 2024-01-17 A very interesting note `; const file: UnitTestSRFile = new UnitTestSRFile(noteText); - const scheduleInfo: RepItemScheduleInfo_Osr = RepItemScheduleInfo_Osr.fromDueDateStr( + const scheduleInfo: RepItemScheduleInfoOsr = RepItemScheduleInfoOsr.fromDueDateStr( "2023-10-06", 25, 263, @@ -43,9 +43,9 @@ A very interesting note describe("formatCardSchedule", () => { test("Has schedule, with due date", async () => { const settings: SRSettings = { ...DEFAULT_SETTINGS }; - const instance: DataStoreInNote_AlgorithmOsr = new DataStoreInNote_AlgorithmOsr(settings); + const instance: DataStoreInNoteAlgorithmOsr = new DataStoreInNoteAlgorithmOsr(settings); - const scheduleInfo: RepItemScheduleInfo_Osr = RepItemScheduleInfo_Osr.fromDueDateStr( + const scheduleInfo: RepItemScheduleInfoOsr = RepItemScheduleInfoOsr.fromDueDateStr( "2023-10-06", 25, 263, @@ -58,9 +58,9 @@ describe("formatCardSchedule", () => { test("Has schedule, but no due date", async () => { const settings: SRSettings = { ...DEFAULT_SETTINGS }; - const instance: DataStoreInNote_AlgorithmOsr = new DataStoreInNote_AlgorithmOsr(settings); + const instance: DataStoreInNoteAlgorithmOsr = new DataStoreInNoteAlgorithmOsr(settings); - const scheduleInfo: RepItemScheduleInfo_Osr = new RepItemScheduleInfo_Osr( + const scheduleInfo: RepItemScheduleInfoOsr = new RepItemScheduleInfoOsr( null, 25, 303, diff --git a/tests/unit/deck-tree-iterator.test.ts b/tests/unit/deck-tree-iterator.test.ts index 3dcc999d..19b93e50 100644 --- a/tests/unit/deck-tree-iterator.test.ts +++ b/tests/unit/deck-tree-iterator.test.ts @@ -2,16 +2,16 @@ import { CardListType, Deck } from "src/deck"; import { CardOrder, DeckOrder, DeckTreeIterator } from "src/deck-tree-iterator"; import { DEFAULT_SETTINGS } from "src/settings"; import { TopicPath } from "src/topic-path"; -import { setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { setupStaticDateProvider20230906 } from "src/utils/dates"; import { setupNextRandomNumber, setupStaticRandomNumberProvider } from "src/utils/numbers"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; import { SampleItemDecks } from "./sample-items"; beforeAll(() => { - setupStaticDateProvider_20230906(); + setupStaticDateProvider20230906(); setupStaticRandomNumberProvider(); - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("setDeck", () => { diff --git a/tests/unit/deck.test.ts b/tests/unit/deck.test.ts index 0562579b..de1caa6b 100644 --- a/tests/unit/deck.test.ts +++ b/tests/unit/deck.test.ts @@ -3,11 +3,11 @@ import { CardListType, Deck } from "src/deck"; import { DEFAULT_SETTINGS } from "src/settings"; import { TopicPath } from "src/topic-path"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; import { SampleItemDecks } from "./sample-items"; beforeAll(() => { - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("constructor", () => { diff --git a/tests/unit/flashcard-review-sequencer.test.ts b/tests/unit/flashcard-review-sequencer.test.ts index 370694bc..5eb215a5 100644 --- a/tests/unit/flashcard-review-sequencer.test.ts +++ b/tests/unit/flashcard-review-sequencer.test.ts @@ -21,15 +21,15 @@ import { QuestionPostponementList } from "src/question-postponement-list"; import { DEFAULT_SETTINGS, SRSettings } from "src/settings"; import { TopicPath } from "src/topic-path"; import { - setupStaticDateProvider_20230906, - setupStaticDateProvider_OriginDatePlusDays, + setupStaticDateProvider20230906, + setupStaticDateProviderOriginDatePlusDays, } from "src/utils/dates"; import { UnitTestSRFile } from "./helpers/unit-test-file"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; import { SampleItemDecks } from "./sample-items"; -const order_DueFirst_Sequential: IIteratorOrder = { +const orderDueFirstSequential: IIteratorOrder = { cardOrder: CardOrder.DueFirstSequential, deckOrder: DeckOrder.PrevDeckComplete_Sequential, }; @@ -67,7 +67,7 @@ class TestContext { this.questionPostponementList, this.dueDateFlashcardHistogram, ); - setupStaticDateProvider_OriginDatePlusDays(daysAfterOrigin); + setupStaticDateProviderOriginDatePlusDays(daysAfterOrigin); await this.setSequencerDeckTreeFromOriginalText(); } @@ -105,7 +105,7 @@ class TestContext { ): TestContext { const settingsClone: SRSettings = { ...settings }; const cardSequencer: IDeckTreeIterator = new DeckTreeIterator(iteratorOrder, null); - unitTestSetup_StandardDataStoreAlgorithm(settingsClone); + unitTestSetupStandardDataStoreAlgorithm(settingsClone); const cardPostponementList: QuestionPostponementList = new QuestionPostponementList( null, settingsClone, @@ -138,14 +138,14 @@ class TestContext { } interface Info1 { - cardQ2_PreReviewText: string; - cardQ2_PostReviewEase: number; - cardQ2_PostReviewInterval: number; - cardQ2_PostReviewDueDate: string; - cardQ2_PostReviewText: string; + cardQ2PreReviewText: string; + cardQ2PostReviewEase: number; + cardQ2PostReviewInterval: number; + cardQ2PostReviewDueDate: string; + cardQ2PostReviewText: string; } -async function checkReviewResponse_ReviewMode( +async function checkReviewResponseReviewMode( reviewResponse: ReviewResponse, info: Info1, ): Promise { @@ -156,7 +156,7 @@ async function checkReviewResponse_ReviewMode( const fakeFilePath: string = moment().millisecond().toString(); const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, @@ -177,19 +177,19 @@ async function checkReviewResponse_ReviewMode( expect(c.reviewSequencer.currentCard.front).toEqual("Q1"); // Schedule for the reviewed card has been updated - expect(card.scheduleInfo.latestEase).toEqual(info.cardQ2_PostReviewEase); - expect(card.scheduleInfo.interval).toEqual(info.cardQ2_PostReviewInterval); - expect(card.scheduleInfo.dueDate.unix).toEqual(moment(info.cardQ2_PostReviewDueDate).unix); + expect(card.scheduleInfo.latestEase).toEqual(info.cardQ2PostReviewEase); + expect(card.scheduleInfo.interval).toEqual(info.cardQ2PostReviewInterval); + expect(card.scheduleInfo.dueDate.unix).toEqual(moment(info.cardQ2PostReviewDueDate).unix); // Note text has been updated const expectedText: string = c.originalText.replace( - info.cardQ2_PreReviewText, - info.cardQ2_PostReviewText, + info.cardQ2PreReviewText, + info.cardQ2PostReviewText, ); expect(await c.file.read()).toEqual(expectedText); } -async function checkReviewResponse_CramMode(reviewResponse: ReviewResponse): Promise { +async function checkReviewResponseCramMode(reviewResponse: ReviewResponse): Promise { const text: string = ` #flashcards Q1::A1 #flashcards Q2::A2 @@ -198,7 +198,7 @@ async function checkReviewResponse_CramMode(reviewResponse: ReviewResponse): Pro const str: string = moment().millisecond().toString(); const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Cram, DEFAULT_SETTINGS, text, @@ -245,12 +245,7 @@ async function setupSample1( #flashcards/science/physics Q5::A5 #flashcards/math Q6::A6`; - const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, - reviewMode, - settings, - text, - ); + const c: TestContext = TestContext.Create(orderDueFirstSequential, reviewMode, settings, text); await c.setSequencerDeckTreeFromOriginalText(); return c; } @@ -282,13 +277,13 @@ function skipThenCheckCardFront(sequencer: IFlashcardReviewSequencer, expectedFr // Do this before each test, as some tests change the "current" date beforeEach(() => { - setupStaticDateProvider_20230906(); + setupStaticDateProvider20230906(); }); describe("setDeckTree", () => { test("Empty deck", () => { const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, "", @@ -306,7 +301,7 @@ Q1::A1 Q2::A2 Q3::A3`; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, @@ -365,7 +360,7 @@ describe("skipCurrentCard", () => { `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, @@ -421,7 +416,7 @@ describe("processReview", () => { #flashcards Q3::A3 `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, @@ -468,14 +463,14 @@ describe("processReview", () => { describe("ReviewResponse.Easy", () => { test("Card schedule is updated, next card becomes current", async () => { const expected: Info1 = { - cardQ2_PreReviewText: "Q2::A2 ", - cardQ2_PostReviewEase: 290, - cardQ2_PostReviewInterval: 15, - cardQ2_PostReviewDueDate: "2023-09-21", // 15 days after the unit testing fixed date of 2023-09-06 - cardQ2_PostReviewText: `Q2::A2 + cardQ2PreReviewText: "Q2::A2 ", + cardQ2PostReviewEase: 290, + cardQ2PostReviewInterval: 15, + cardQ2PostReviewDueDate: "2023-09-21", // 15 days after the unit testing fixed date of 2023-09-06 + cardQ2PostReviewText: `Q2::A2 `, }; - await checkReviewResponse_ReviewMode(ReviewResponse.Easy, expected); + await checkReviewResponseReviewMode(ReviewResponse.Easy, expected); }); }); @@ -492,7 +487,7 @@ Q1::A1 `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, settings, text, @@ -532,7 +527,7 @@ Q1::A1 `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, settings, text, @@ -566,10 +561,11 @@ Q1::A1 `; // Simulate performing the review on 2023-09-06 - // Check that the reviewed card, scheduled for following day; 2 buried cards have schedule dates with magic number indicating unreviewed card ("2000-01-01") - setupStaticDateProvider_OriginDatePlusDays(0); + // Check that the reviewed card, scheduled for following day; + // 2 buried cards have schedule dates with magic number indicating unreviewed card ("2000-01-01") + setupStaticDateProviderOriginDatePlusDays(0); const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, settings, text, @@ -629,9 +625,9 @@ Q1::A1 const text: string = "#flashcards Q1::A1"; // Create the test context - setupStaticDateProvider_OriginDatePlusDays(0); + setupStaticDateProviderOriginDatePlusDays(0); const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, settings, text, @@ -654,7 +650,7 @@ What is Newton's equation for gravitational force $$\\huge F_g=\\frac {G m_1 m_2}{d^2}$$`; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, fileText, @@ -686,7 +682,7 @@ ${indent}- bar?::baz `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, settings, text, @@ -706,7 +702,7 @@ ${indent}- bar?::baz describe("ReviewResponse.Easy", () => { test("Next card after reviewed card becomes current; reviewed easy card doesn't resurface", async () => { // [Q1, Q2, Q3] review Q1, then current becomes Q2 - const c: TestContext = await checkReviewResponse_CramMode(ReviewResponse.Easy); + const c: TestContext = await checkReviewResponseCramMode(ReviewResponse.Easy); expect(c.reviewSequencer.currentCard.front).toEqual("Q2"); skipThenCheckCardFront(c.reviewSequencer, "Q3"); skipThenCheckCardFront(c.reviewSequencer, "Q4"); @@ -719,7 +715,7 @@ ${indent}- bar?::baz describe("ReviewResponse.Hard", () => { test("Next card after reviewed card becomes current; reviewed hard card seen again", async () => { // [Q1, Q2, Q3] review Q1, then current becomes Q2 - const c: TestContext = await checkReviewResponse_CramMode(ReviewResponse.Hard); + const c: TestContext = await checkReviewResponseCramMode(ReviewResponse.Hard); expect(c.reviewSequencer.currentCard.front).toEqual("Q2"); skipThenCheckCardFront(c.reviewSequencer, "Q3"); skipThenCheckCardFront(c.reviewSequencer, "Q4"); @@ -987,7 +983,7 @@ Q3::A3 Q4::A4 `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, @@ -1004,14 +1000,14 @@ Q3::A3 Q4::A4 `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, ); await c.setSequencerDeckTreeFromOriginalText(); - expect(c.reviewSequencer.currentCard.front).toEqual("Q4"); // This is the first card as we are using order_DueFirst_Sequential + expect(c.reviewSequencer.currentCard.front).toEqual("Q4"); // This is the first card as we are using orderDueFirstSequential expect(c.getDeckStats("#flashcards")).toEqual(new DeckStats(1, 3, 4)); c.reviewSequencer.skipCurrentCard(); // One less due card @@ -1026,7 +1022,7 @@ Q3::A3 Q4::A4 `; const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, DEFAULT_SETTINGS, text, @@ -1034,7 +1030,7 @@ Q4::A4 await c.setSequencerDeckTreeFromOriginalText(); await checkStats(c, "#flashcards", [ - [new DeckStats(1, 3, 4), "Q4", ReviewResponse.Easy], // This is the first card as we are using order_DueFirst_Sequential + [new DeckStats(1, 3, 4), "Q4", ReviewResponse.Easy], // This is the first card as we are using orderDueFirstSequential [new DeckStats(0, 3, 4), "Q1", ReviewResponse.Easy], // Iterated through all the due cards, now the new ones [new DeckStats(0, 2, 4), "Q2", ReviewResponse.Easy], ]); @@ -1108,7 +1104,7 @@ async function checkUpdateCurrentQuestionText( settings: SRSettings, ): Promise { const c: TestContext = TestContext.Create( - order_DueFirst_Sequential, + orderDueFirstSequential, FlashcardReviewMode.Review, settings, noteText, diff --git a/tests/unit/helpers/unit-test-file.ts b/tests/unit/helpers/unit-test-file.ts index 1a192f01..7bdfe052 100644 --- a/tests/unit/helpers/unit-test-file.ts +++ b/tests/unit/helpers/unit-test-file.ts @@ -1,10 +1,10 @@ import * as fs from "fs"; import { TagCache, TFile } from "obsidian"; -import { ISRFile } from "src/sr-file"; +import { ISRFile } from "src/file"; import { TextDirection } from "src/utils/strings"; -import { unitTest_BasicFrontmatterParser, unitTest_GetAllTagsFromTextEx } from "./unit-test-helper"; +import { unitTestBasicFrontmatterParser, unitTestGetAllTagsFromTextEx } from "./unit-test-helper"; export class UnitTestSRFile implements ISRFile { content: string; @@ -28,15 +28,15 @@ export class UnitTestSRFile implements ISRFile { } async getFrontmatter(): Promise> { - return unitTest_BasicFrontmatterParser(await this.read()); + return unitTestBasicFrontmatterParser(await this.read()); } getAllTagsFromCache(): string[] { - return unitTest_GetAllTagsFromTextEx(this.content).map((item) => item.tag); + return unitTestGetAllTagsFromTextEx(this.content).map((item) => item.tag); } getAllTagsFromText(): TagCache[] { - return unitTest_GetAllTagsFromTextEx(this.content); + return unitTestGetAllTagsFromTextEx(this.content); } getQuestionContext(_: number): string[] { diff --git a/tests/unit/helpers/unit-test-helper.test.ts b/tests/unit/helpers/unit-test-helper.test.ts index 08997ed5..69c93201 100644 --- a/tests/unit/helpers/unit-test-helper.test.ts +++ b/tests/unit/helpers/unit-test-helper.test.ts @@ -4,17 +4,17 @@ import { DEFAULT_SETTINGS } from "src/settings"; import { UnitTestOsrCore } from "./unit-test-core"; import { - unitTest_CreateTagCacheObj, - unitTest_GetAllTagsFromTextEx, - unitTest_ParseForOutgoingLinks, + unitTestCreateTagCacheObj, + unitTestGetAllTagsFromTextEx, + unitTestParseForOutgoingLinks, } from "./unit-test-helper"; import { UnitTestLinkInfoFinder } from "./unit-test-link-info-finder"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./unit-test-setup"; let linkInfoFinder: UnitTestLinkInfoFinder; beforeAll(() => { - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("unitTest_GetAllTagsFromTextEx", () => { @@ -42,11 +42,11 @@ This single {{question}} turns into {{3 separate}} {{cards}} #flashcards/science/misc `; - const actual: TagCache[] = unitTest_GetAllTagsFromTextEx(text); + const actual: TagCache[] = unitTestGetAllTagsFromTextEx(text); const expected: TagCache[] = [ - unitTest_CreateTagCacheObj("#review", 2), - unitTest_CreateTagCacheObj("#flashcards/science/chemistry", 5), - unitTest_CreateTagCacheObj("#flashcards/science/misc", 18), + unitTestCreateTagCacheObj("#review", 2), + unitTestCreateTagCacheObj("#flashcards/science/chemistry", 5), + unitTestCreateTagCacheObj("#flashcards/science/misc", 18), ]; expect(actual).toEqual(expected); }); @@ -60,10 +60,10 @@ This single {{question}} turns into {{3 separate}} {{cards}} `; - const actual: TagCache[] = unitTest_GetAllTagsFromTextEx(text); + const actual: TagCache[] = unitTestGetAllTagsFromTextEx(text); const expected: TagCache[] = [ - unitTest_CreateTagCacheObj("#flashcards/science/chemistry", 2), - unitTest_CreateTagCacheObj("#flashcards/science/misc", 2), + unitTestCreateTagCacheObj("#flashcards/science/chemistry", 2), + unitTestCreateTagCacheObj("#flashcards/science/misc", 2), ]; expect(actual).toEqual(expected); }); @@ -81,7 +81,7 @@ It can occur with different materials, such as: (also known as triboelectricity, triboelectric charging, triboelectrification, or tribocharging) `; - const links: string[] = unitTest_ParseForOutgoingLinks(text); + const links: string[] = unitTestParseForOutgoingLinks(text); expect(links.length).toEqual(0); }); @@ -95,7 +95,7 @@ It can occur with different materials, such as: (also known as triboelectricity, triboelectric charging, [[triboelectrification]], or tribocharging) `; - const links: string[] = unitTest_ParseForOutgoingLinks(text); + const links: string[] = unitTestParseForOutgoingLinks(text); const expected: string[] = ["transfer between", "triboelectrification"]; expect(links).toEqual(expected); }); @@ -104,13 +104,13 @@ It can occur with different materials, such as: const text: string = ` The triboelectric effect describes electric charge [[triboelectrification]], or [[tribocharging]]) `; - const links: string[] = unitTest_ParseForOutgoingLinks(text); + const links: string[] = unitTestParseForOutgoingLinks(text); const expected: string[] = ["triboelectrification", "tribocharging"]; expect(links).toEqual(expected); }); }); -function check_getResolvedLinks(linkName: string, expected: Map): void { +function checkGetResolvedLinks(linkName: string, expected: Map): void { const e: Record = {}; expected.forEach((n, linkName) => { const filename: string = linkInfoFinder.getFilenameForLink(linkName); @@ -127,7 +127,7 @@ describe("UnitTestLinkInfoFinder", () => { linkInfoFinder.init(osrCore.getFileMap()); // One link from A to each of B, C, D - check_getResolvedLinks( + checkGetResolvedLinks( "A", new Map([ ["B", 1], @@ -137,12 +137,12 @@ describe("UnitTestLinkInfoFinder", () => { ); // No links from B - check_getResolvedLinks("B", new Map([])); + checkGetResolvedLinks("B", new Map([])); // One link from C to D - check_getResolvedLinks("C", new Map([["D", 1]])); + checkGetResolvedLinks("C", new Map([["D", 1]])); - check_getResolvedLinks( + checkGetResolvedLinks( "D", new Map([ ["A", 1], diff --git a/tests/unit/helpers/unit-test-helper.ts b/tests/unit/helpers/unit-test-helper.ts index de418eb4..97900c71 100644 --- a/tests/unit/helpers/unit-test-helper.ts +++ b/tests/unit/helpers/unit-test-helper.ts @@ -1,9 +1,9 @@ import { TagCache } from "obsidian"; -import { frontmatterTagPseudoLineNum } from "src/sr-file"; +import { frontmatterTagPseudoLineNum } from "src/file"; import { splitNoteIntoFrontmatterAndContent, splitTextIntoLineArray } from "src/utils/strings"; -export function unitTest_CreateTagCacheObj(tag: string, line: number): TagCache { +export function unitTestCreateTagCacheObj(tag: string, line: number): TagCache { return { tag: tag, position: { @@ -13,7 +13,7 @@ export function unitTest_CreateTagCacheObj(tag: string, line: number): TagCache }; } -export function unitTest_GetAllTagsFromTextEx(text: string): TagCache[] { +export function unitTestGetAllTagsFromTextEx(text: string): TagCache[] { const [frontmatter, _] = splitNoteIntoFrontmatterAndContent(text); const result = [] as TagCache[]; let lines: string[]; @@ -28,7 +28,7 @@ export function unitTest_GetAllTagsFromTextEx(text: string): TagCache[] { if (line.startsWith(dataPrefix)) { const tagStr: string = line.substring(dataPrefix.length); result.push( - unitTest_CreateTagCacheObj("#" + tagStr, frontmatterTagPseudoLineNum), + unitTestCreateTagCacheObj("#" + tagStr, frontmatterTagPseudoLineNum), ); } else { break; @@ -61,23 +61,23 @@ export function unitTest_GetAllTagsFromTextEx(text: string): TagCache[] { return result; } -export function unitTest_GetAllTagsFromText(text: string): string[] { +export function unitTestGetAllTagsFromText(text: string): string[] { const tagRegex = /#[^\s#]+/gi; const result: RegExpMatchArray = text.match(tagRegex); if (!result) return []; return result; } -export function unitTest_BasicFrontmatterParser(text: string): Map { +export function unitTestBasicFrontmatterParser(text: string): Map { const result = new Map(); - const map: Map = unitTest_BasicFrontmatterParserEx(text); + const map: Map = unitTestBasicFrontmatterParserEx(text); map.forEach((value, key) => { result.set(key, value.pop()); }); return result; } -export function unitTest_BasicFrontmatterParserEx(text: string): Map { +export function unitTestBasicFrontmatterParserEx(text: string): Map { const [frontmatter, _] = splitNoteIntoFrontmatterAndContent(text); const result = new Map(); @@ -121,7 +121,7 @@ export function unitTest_BasicFrontmatterParserEx(text: string): Map = unitTest_BasicFrontmatterParser(text); + const frontmatter: Map = unitTestBasicFrontmatterParser(text); expect(frontmatter).toBeTruthy(); expect(frontmatter.get("sr-due")).toEqual(expectedDueDate); diff --git a/tests/unit/helpers/unit-test-link-info-finder.ts b/tests/unit/helpers/unit-test-link-info-finder.ts index 6dd3d7d4..b94c85e9 100644 --- a/tests/unit/helpers/unit-test-link-info-finder.ts +++ b/tests/unit/helpers/unit-test-link-info-finder.ts @@ -3,7 +3,7 @@ import path from "path"; import { IOsrVaultNoteLinkInfoFinder } from "src/algorithms/osr/obsidian-vault-notelink-info-finder"; import { UnitTestSRFile } from "./unit-test-file"; -import { unitTest_ParseForOutgoingLinks } from "./unit-test-helper"; +import { unitTestParseForOutgoingLinks } from "./unit-test-helper"; export class UnitTestLinkInfoFinder implements IOsrVaultNoteLinkInfoFinder { private linkPathMap: Map; @@ -24,7 +24,7 @@ export class UnitTestLinkInfoFinder implements IOsrVaultNoteLinkInfoFinder { this.outgoingLinks = new Map>(); fileMap.forEach((file, sourceFilename) => { // Find all the (outgoing) links present in the file - const outgoingLinks2: string[] = unitTest_ParseForOutgoingLinks(file.content); + const outgoingLinks2: string[] = unitTestParseForOutgoingLinks(file.content); for (const targetLink of outgoingLinks2) { const targetFilename: string = this.linkPathMap.get(targetLink); diff --git a/tests/unit/helpers/unit-test-setup.ts b/tests/unit/helpers/unit-test-setup.ts index fc34a497..45e46867 100644 --- a/tests/unit/helpers/unit-test-setup.ts +++ b/tests/unit/helpers/unit-test-setup.ts @@ -1,13 +1,13 @@ import { SrsAlgorithm } from "src/algorithms/base/srs-algorithm"; -import { SrsAlgorithm_Osr } from "src/algorithms/osr/srs-algorithm-osr"; +import { SrsAlgorithmOsr } from "src/algorithms/osr/srs-algorithm-osr"; import { DataStoreAlgorithm } from "src/data-store-algorithm/data-store-algorithm"; -import { DataStoreInNote_AlgorithmOsr } from "src/data-store-algorithm/data-store-in-note-algorithm-osr"; +import { DataStoreInNoteAlgorithmOsr } from "src/data-store-algorithm/data-store-in-note-algorithm-osr"; import { DataStore } from "src/data-stores/base/data-store"; import { StoreInNotes } from "src/data-stores/notes/notes"; import { SRSettings } from "src/settings"; -export function unitTestSetup_StandardDataStoreAlgorithm(settings: SRSettings) { +export function unitTestSetupStandardDataStoreAlgorithm(settings: SRSettings) { DataStore.instance = new StoreInNotes(settings); - SrsAlgorithm.instance = new SrsAlgorithm_Osr(settings); - DataStoreAlgorithm.instance = new DataStoreInNote_AlgorithmOsr(settings); + SrsAlgorithm.instance = new SrsAlgorithmOsr(settings); + DataStoreAlgorithm.instance = new DataStoreInNoteAlgorithmOsr(settings); } diff --git a/tests/unit/lang/helpers.test.ts b/tests/unit/lang/helpers.test.ts index e4d17357..f5a6bb78 100644 --- a/tests/unit/lang/helpers.test.ts +++ b/tests/unit/lang/helpers.test.ts @@ -1,20 +1,20 @@ test("Check that localization entries are consistent across all files", () => { jest.isolateModules(() => { const { localeMap } = require("src/lang/helpers"); - const expected_keys: string[] = Object.keys(localeMap["en"]); - for (const [language_code, locale] of Object.entries(localeMap) as [string, string[]][]) { - const locale_keys = Object.keys(locale); - if (locale_keys.length == 0 || language_code == "en") continue; + const expectedKeys: string[] = Object.keys(localeMap["en"]); + for (const [languageCode, locale] of Object.entries(localeMap) as [string, string[]][]) { + const localeKeys = Object.keys(locale); + if (localeKeys.length == 0 || languageCode == "en") continue; - const unmapped_keys = expected_keys.filter((x) => !locale_keys.includes(x)); + const unmappedKeys = expectedKeys.filter((x) => !localeKeys.includes(x)); expect( - unmapped_keys.length, - `The ${language_code} locale does not include translations for: ${unmapped_keys}.`, + unmappedKeys.length, + `The ${languageCode} locale does not include translations for: ${unmappedKeys}.`, ).toBe(0); - const extra_keys = locale_keys.filter((x) => !expected_keys.includes(x)); + const extraKeys = localeKeys.filter((x) => !expectedKeys.includes(x)); expect( - extra_keys.length, - `The ${language_code} locale includes the following translations that are no longer in use: ${extra_keys}.`, + extraKeys.length, + `The ${languageCode} locale includes the following translations that are no longer in use: ${extraKeys}.`, ).toBe(0); } }); diff --git a/tests/unit/note-card-schedule-parser.test.ts b/tests/unit/note-card-schedule-parser.test.ts index 90e1cbe1..62318850 100644 --- a/tests/unit/note-card-schedule-parser.test.ts +++ b/tests/unit/note-card-schedule-parser.test.ts @@ -1,15 +1,15 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { TICKS_PER_DAY } from "src/constants"; import { DataStore } from "src/data-stores/base/data-store"; import { DEFAULT_SETTINGS } from "src/settings"; -import { setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { setupStaticDateProvider20230906 } from "src/utils/dates"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; beforeAll(() => { - setupStaticDateProvider_20230906(); - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + setupStaticDateProvider20230906(); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); test("No schedule info for question", () => { @@ -24,7 +24,7 @@ test("Single schedule info for question (on separate line)", () => { ); expect(actual).toEqual([ - RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-02", 4, 270, -4 * TICKS_PER_DAY), + RepItemScheduleInfoOsr.fromDueDateStr("2023-09-02", 4, 270, -4 * TICKS_PER_DAY), ]); }); @@ -35,7 +35,7 @@ test("Single schedule info for question (on same line)", () => { ); expect(actual).toEqual([ - RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-02", 4, 270, -4 * TICKS_PER_DAY), + RepItemScheduleInfoOsr.fromDueDateStr("2023-09-02", 4, 270, -4 * TICKS_PER_DAY), ]); }); @@ -47,8 +47,8 @@ test("Multiple schedule info for question (on separate line)", () => { ); expect(actual).toEqual([ - RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-03", 1, 230, -3 * TICKS_PER_DAY), - RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-05", 3, 250, -1 * TICKS_PER_DAY), - RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-06", 4, 270, 0), + RepItemScheduleInfoOsr.fromDueDateStr("2023-09-03", 1, 230, -3 * TICKS_PER_DAY), + RepItemScheduleInfoOsr.fromDueDateStr("2023-09-05", 3, 250, -1 * TICKS_PER_DAY), + RepItemScheduleInfoOsr.fromDueDateStr("2023-09-06", 4, 270, 0), ]); }); diff --git a/tests/unit/note-file-loader.test.ts b/tests/unit/note-file-loader.test.ts index c757dc01..a07022a3 100644 --- a/tests/unit/note-file-loader.test.ts +++ b/tests/unit/note-file-loader.test.ts @@ -5,12 +5,12 @@ import { TopicPath } from "src/topic-path"; import { TextDirection } from "src/utils/strings"; import { UnitTestSRFile } from "./helpers/unit-test-file"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; const noteFileLoader: NoteFileLoader = new NoteFileLoader(DEFAULT_SETTINGS); beforeAll(() => { - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("load", () => { diff --git a/tests/unit/note-parser.test.ts b/tests/unit/note-parser.test.ts index cb072ca1..222c5c31 100644 --- a/tests/unit/note-parser.test.ts +++ b/tests/unit/note-parser.test.ts @@ -2,17 +2,17 @@ import { Note } from "src/note"; import { NoteParser } from "src/note-parser"; import { DEFAULT_SETTINGS } from "src/settings"; import { TopicPath } from "src/topic-path"; -import { setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { setupStaticDateProvider20230906 } from "src/utils/dates"; import { TextDirection } from "src/utils/strings"; import { UnitTestSRFile } from "./helpers/unit-test-file"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; const parser: NoteParser = new NoteParser(DEFAULT_SETTINGS); beforeAll(() => { - setupStaticDateProvider_20230906(); - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + setupStaticDateProvider20230906(); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("Multiple questions in the text", () => { diff --git a/tests/unit/note-question-parser.test.ts b/tests/unit/note-question-parser.test.ts index ed6115d0..5d9f6737 100644 --- a/tests/unit/note-question-parser.test.ts +++ b/tests/unit/note-question-parser.test.ts @@ -1,30 +1,30 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"; -import { RepItemScheduleInfo_Osr } from "src/algorithms/osr/rep-item-schedule-info-osr"; +import { RepItemScheduleInfoOsr } from "src/algorithms/osr/rep-item-schedule-info-osr"; import { Card } from "src/card"; import { TICKS_PER_DAY } from "src/constants"; +import { frontmatterTagPseudoLineNum, ISRFile } from "src/file"; import { NoteQuestionParser } from "src/note-question-parser"; import { CardType, Question } from "src/question"; import { DEFAULT_SETTINGS, SRSettings } from "src/settings"; -import { frontmatterTagPseudoLineNum, ISRFile } from "src/sr-file"; import { TopicPath, TopicPathList } from "src/topic-path"; -import { setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { setupStaticDateProvider20230906 } from "src/utils/dates"; import { TextDirection } from "src/utils/strings"; import { UnitTestSRFile } from "./helpers/unit-test-file"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; -import { createTest_NoteQuestionParser } from "./sample-items"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { createTestNoteQuestionParser } from "./sample-items"; const parserWithDefaultSettings: NoteQuestionParser = - createTest_NoteQuestionParser(DEFAULT_SETTINGS); -const settings_ConvertFoldersToDecks: SRSettings = { ...DEFAULT_SETTINGS }; -settings_ConvertFoldersToDecks.convertFoldersToDecks = true; -const parser_ConvertFoldersToDecks: NoteQuestionParser = createTest_NoteQuestionParser( - settings_ConvertFoldersToDecks, + createTestNoteQuestionParser(DEFAULT_SETTINGS); +const settingsConvertFoldersToDecks: SRSettings = { ...DEFAULT_SETTINGS }; +settingsConvertFoldersToDecks.convertFoldersToDecks = true; +const parserConvertFoldersToDecks: NoteQuestionParser = createTestNoteQuestionParser( + settingsConvertFoldersToDecks, ); beforeAll(() => { - setupStaticDateProvider_20230906(); - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + setupStaticDateProvider20230906(); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("No flashcard questions", () => { @@ -104,7 +104,7 @@ A::B const folderTopicPath: TopicPath = TopicPath.emptyPath; const delayDays = 3 - 6; - const scheduleInfo = RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-03", 1, 230); + const scheduleInfo = RepItemScheduleInfoOsr.fromDueDateStr("2023-09-03", 1, 230); scheduleInfo.delayedBeforeReviewTicks = delayDays * TICKS_PER_DAY; const card1 = { cardIdx: 0, @@ -208,7 +208,7 @@ A::B ^d7cee0 const folderTopicPath: TopicPath = TopicPath.emptyPath; const card1 = { cardIdx: 0, - scheduleInfo: null as RepItemScheduleInfo_Osr, + scheduleInfo: null as RepItemScheduleInfoOsr, }; const expected = [ { @@ -250,7 +250,7 @@ A::B ^d7cee0 const folderTopicPath: TopicPath = TopicPath.emptyPath; const delayDays = 3 - 6; - const scheduleInfo = RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-03", 1, 230); + const scheduleInfo = RepItemScheduleInfoOsr.fromDueDateStr("2023-09-03", 1, 230); scheduleInfo.delayedBeforeReviewTicks = delayDays * TICKS_PER_DAY; const card1 = { @@ -297,7 +297,7 @@ A::B ^d7cee0 const folderTopicPath: TopicPath = TopicPath.emptyPath; const delayDays = 3 - 6; - const scheduleInfo = RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-03", 1, 230); + const scheduleInfo = RepItemScheduleInfoOsr.fromDueDateStr("2023-09-03", 1, 230); scheduleInfo.delayedBeforeReviewTicks = delayDays * TICKS_PER_DAY; const card1 = { cardIdx: 0, @@ -342,7 +342,7 @@ A::B ^d7cee0 const folderTopicPath: TopicPath = TopicPath.emptyPath; const delayDays = 3 - 6; - const scheduleInfo = RepItemScheduleInfo_Osr.fromDueDateStr("2023-09-03", 1, 230); + const scheduleInfo = RepItemScheduleInfoOsr.fromDueDateStr("2023-09-03", 1, 230); scheduleInfo.delayedBeforeReviewTicks = delayDays * TICKS_PER_DAY; const card1 = { cardIdx: 0, @@ -387,7 +387,7 @@ Q2::A2 `; const noteFile: ISRFile = new UnitTestSRFile(noteText); const folderTopicPath: TopicPath = TopicPath.emptyPath; - const questionList: Question[] = await parser_ConvertFoldersToDecks.createQuestionList( + const questionList: Question[] = await parserConvertFoldersToDecks.createQuestionList( noteFile, TextDirection.Ltr, folderTopicPath, @@ -405,7 +405,7 @@ Q3::A3 const noteFile: ISRFile = new UnitTestSRFile(noteText); const folderTopicPath: TopicPath = new TopicPath(["flashcards", "science"]); - const questionList: Question[] = await parser_ConvertFoldersToDecks.createQuestionList( + const questionList: Question[] = await parserConvertFoldersToDecks.createQuestionList( noteFile, TextDirection.Ltr, folderTopicPath, @@ -497,7 +497,7 @@ describe("Handling tags within note", () => { describe("Settings mode: Convert folder path to tag", () => { const settings: SRSettings = { ...DEFAULT_SETTINGS }; settings.convertFoldersToDecks = true; - const parser2: NoteQuestionParser = createTest_NoteQuestionParser(settings); + const parser2: NoteQuestionParser = createTestNoteQuestionParser(settings); test("Folder path applies to all questions within note", async () => { const noteText: string = ` diff --git a/tests/unit/note-review-queue.test.ts b/tests/unit/note-review-queue.test.ts index c6345dfb..09b06e00 100644 --- a/tests/unit/note-review-queue.test.ts +++ b/tests/unit/note-review-queue.test.ts @@ -1,13 +1,13 @@ import { DueDateHistogram } from "src/due-date-histogram"; import { DEFAULT_SETTINGS } from "src/settings"; -import { setupStaticDateProvider, setupStaticDateProvider_20230906 } from "src/utils/dates"; +import { setupStaticDateProvider, setupStaticDateProvider20230906 } from "src/utils/dates"; import { UnitTestOsrCore } from "./helpers/unit-test-core"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; beforeAll(() => { - setupStaticDateProvider_20230906(); - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + setupStaticDateProvider20230906(); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); function checkHistogramValue(histogram: DueDateHistogram, nDays: number, expectedValue: number) { diff --git a/tests/unit/note.test.ts b/tests/unit/note.test.ts index ccb4d927..f2cb24c9 100644 --- a/tests/unit/note.test.ts +++ b/tests/unit/note.test.ts @@ -7,13 +7,13 @@ import { TopicPath } from "src/topic-path"; import { TextDirection } from "src/utils/strings"; import { UnitTestSRFile } from "./helpers/unit-test-file"; -import { unitTestSetup_StandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; +import { unitTestSetupStandardDataStoreAlgorithm } from "./helpers/unit-test-setup"; const parser: NoteParser = new NoteParser(DEFAULT_SETTINGS); const noteFileLoader: NoteFileLoader = new NoteFileLoader(DEFAULT_SETTINGS); beforeAll(() => { - unitTestSetup_StandardDataStoreAlgorithm(DEFAULT_SETTINGS); + unitTestSetupStandardDataStoreAlgorithm(DEFAULT_SETTINGS); }); describe("appendCardsToDeck", () => { diff --git a/tests/unit/question-type.test.ts b/tests/unit/question-type.test.ts index bcbcd765..3f5e88ed 100644 --- a/tests/unit/question-type.test.ts +++ b/tests/unit/question-type.test.ts @@ -1,5 +1,5 @@ import { CardType } from "src/question"; -import { CardFrontBack, CardFrontBackUtil, QuestionType_ClozeUtil } from "src/question-type"; +import { CardFrontBack, CardFrontBackUtil, QuestionTypeClozeUtil } from "src/question-type"; import { DEFAULT_SETTINGS, SRSettings } from "src/settings"; test("CardType.SingleLineBasic", () => { @@ -37,7 +37,7 @@ test("CardType.MultiLineReversed", () => { }); test("CardType.Cloze", () => { - const frontHtml = QuestionType_ClozeUtil.renderClozeFront(); + const frontHtml = QuestionTypeClozeUtil.renderClozeFront(); expect( CardFrontBackUtil.expand( @@ -48,7 +48,7 @@ test("CardType.Cloze", () => { ).toEqual([ new CardFrontBack( "This is a very " + frontHtml + " test", - "This is a very " + QuestionType_ClozeUtil.renderClozeBack("interesting") + " test", + "This is a very " + QuestionTypeClozeUtil.renderClozeBack("interesting") + " test", ), ]); @@ -62,7 +62,7 @@ test("CardType.Cloze", () => { ).toEqual([ new CardFrontBack( "This is a very " + frontHtml + " test", - "This is a very " + QuestionType_ClozeUtil.renderClozeBack("interesting") + " test", + "This is a very " + QuestionTypeClozeUtil.renderClozeBack("interesting") + " test", ), ]); @@ -71,7 +71,7 @@ test("CardType.Cloze", () => { ).toEqual([ new CardFrontBack( "This is a very " + frontHtml + " test", - "This is a very " + QuestionType_ClozeUtil.renderClozeBack("interesting") + " test", + "This is a very " + QuestionTypeClozeUtil.renderClozeBack("interesting") + " test", ), ]); diff --git a/tests/unit/question.test.ts b/tests/unit/question.test.ts index 0412cbe1..e77e9b2d 100644 --- a/tests/unit/question.test.ts +++ b/tests/unit/question.test.ts @@ -2,8 +2,8 @@ import { Question, QuestionText } from "src/question"; import { DEFAULT_SETTINGS, SRSettings } from "src/settings"; import { TextDirection } from "src/utils/strings"; -const settings_cardCommentOnSameLine: SRSettings = { ...DEFAULT_SETTINGS }; -settings_cardCommentOnSameLine.cardCommentOnSameLine = true; +const settingsCardCommentOnSameLine: SRSettings = { ...DEFAULT_SETTINGS }; +settingsCardCommentOnSameLine.cardCommentOnSameLine = true; describe("Question", () => { describe("getHtmlCommentSeparator", () => { @@ -17,7 +17,7 @@ describe("Question", () => { }); expect(question.getHtmlCommentSeparator(DEFAULT_SETTINGS)).toEqual("\n"); - expect(question.getHtmlCommentSeparator(settings_cardCommentOnSameLine)).toEqual("\n"); + expect(question.getHtmlCommentSeparator(settingsCardCommentOnSameLine)).toEqual("\n"); }); test("Doesn't end with a code block", async () => { @@ -28,7 +28,7 @@ describe("Question", () => { }); expect(question.getHtmlCommentSeparator(DEFAULT_SETTINGS)).toEqual("\n"); - expect(question.getHtmlCommentSeparator(settings_cardCommentOnSameLine)).toEqual(" "); + expect(question.getHtmlCommentSeparator(settingsCardCommentOnSameLine)).toEqual(" "); }); }); }); diff --git a/tests/unit/sample-items.ts b/tests/unit/sample-items.ts index eace206d..e633c8b5 100644 --- a/tests/unit/sample-items.ts +++ b/tests/unit/sample-items.ts @@ -9,18 +9,18 @@ import { TextDirection } from "src/utils/strings"; import { UnitTestSRFile } from "./helpers/unit-test-file"; -export function createTest_NoteQuestionParser(settings: SRSettings): NoteQuestionParser { +export function createTestNoteQuestionParser(settings: SRSettings): NoteQuestionParser { const questionParser: NoteQuestionParser = new NoteQuestionParser(settings); return questionParser; } -export function createTest_NoteParser(): NoteParser { +export function createTestNoteParser(): NoteParser { const result = new NoteParser(DEFAULT_SETTINGS); return result; } -export const test_RefDate_20230906: Date = new Date(2023, 8, 6); +export const testRefDate20230906: Date = new Date(2023, 8, 6); export class SampleItemDecks { - static async createSingleLevelTree_NewCards(): Promise { + static async createSingleLevelTreeNewCards(): Promise { const text: string = ` Q1::A1 Q2::A2 @@ -68,7 +68,7 @@ Q3::A3`; folderTopicPath: TopicPath = TopicPath.emptyPath, ): Promise { const deck: Deck = new Deck("Root", null); - const noteParser: NoteParser = createTest_NoteParser(); + const noteParser: NoteParser = createTestNoteParser(); const note: Note = await noteParser.parse(file, TextDirection.Ltr, folderTopicPath); note.appendCardsToDeck(deck); return deck; diff --git a/tests/unit/utils/numbers.test.ts b/tests/unit/utils/numbers.test.ts index 386243ad..72161e79 100644 --- a/tests/unit/utils/numbers.test.ts +++ b/tests/unit/utils/numbers.test.ts @@ -58,7 +58,7 @@ describe("WeightedRandomNumber", () => { const weights: Record = { 10: 1, }; - check_getRandomValues(weights, { lower: 0, upper: 0, next: 0 }, 10, 0); + checkGetRandomValues(weights, { lower: 0, upper: 0, next: 0 }, 10, 0); }); test("Two weights", () => { @@ -67,10 +67,10 @@ describe("WeightedRandomNumber", () => { 10: 1, 20: 99, }; - check_getRandomValues(weights, { lower: 0, upper: 99, next: 0 }, 10, 0); + checkGetRandomValues(weights, { lower: 0, upper: 99, next: 0 }, 10, 0); - check_getRandomValues(weights, { lower: 0, upper: 99, next: 1 }, 20, 0); - check_getRandomValues(weights, { lower: 0, upper: 99, next: 99 }, 20, 98); + checkGetRandomValues(weights, { lower: 0, upper: 99, next: 1 }, 20, 0); + checkGetRandomValues(weights, { lower: 0, upper: 99, next: 99 }, 20, 98); }); test("4 weights", () => { @@ -80,13 +80,13 @@ describe("WeightedRandomNumber", () => { 30: 1, 40: 11, }; - check_getRandomValues(weights, { lower: 0, upper: 49, next: 0 }, 10, 0); - check_getRandomValues(weights, { lower: 0, upper: 49, next: 4 }, 10, 4); - check_getRandomValues(weights, { lower: 0, upper: 49, next: 5 }, 20, 0); - check_getRandomValues(weights, { lower: 0, upper: 49, next: 37 }, 20, 32); - check_getRandomValues(weights, { lower: 0, upper: 49, next: 38 }, 30, 0); - check_getRandomValues(weights, { lower: 0, upper: 49, next: 39 }, 40, 0); - check_getRandomValues(weights, { lower: 0, upper: 49, next: 49 }, 40, 10); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 0 }, 10, 0); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 4 }, 10, 4); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 5 }, 20, 0); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 37 }, 20, 32); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 38 }, 30, 0); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 39 }, 40, 0); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 49 }, 40, 10); }); test("Invalid weights parameter", () => { @@ -97,13 +97,13 @@ describe("WeightedRandomNumber", () => { 40: 11, }; const t = () => { - check_getRandomValues(weights, { lower: 0, upper: 49, next: 0 }, 10, 10); + checkGetRandomValues(weights, { lower: 0, upper: 49, next: 0 }, 10, 10); }; expect(t).toThrow(); }); }); -function check_getRandomValues( +function checkGetRandomValues( weights: Record, info: IStaticRandom, expectedValue: number,