Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #251

Merged
merged 2 commits into from
Aug 15, 2021
Merged

Fixes #251

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "jest"
},
"keywords": [],
"author": "",
"author": "Stephen Mwangi",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/flashcard-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ export class FlashcardModal extends Modal {
let replacementRegex = new RegExp(escapeRegexString(this.currentCard.cardText), "gm");

let sep: string = this.plugin.data.settings.cardCommentOnSameLine ? " " : "\n";
// Override separator if last block is a codeblock
if (this.currentCard.cardText.endsWith("```") && sep !== "\n") sep = "\n";

// check if we're adding scheduling information to the flashcard
// for the first time
Expand Down
42 changes: 18 additions & 24 deletions src/lang/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,21 @@ export default {
// settings.ts
Notes: "Notes",
Flashcards: "Flashcards",
"Spaced Repetition Plugin - Settings":
"Spaced Repetition Plugin - Settings",
"Spaced Repetition Plugin - Settings": "Spaced Repetition Plugin - Settings",
"For more information, check the": "For more information, check the",
wiki: "wiki",
"algorithm implementation": "algorithm implementation",
"Flashcard tags": "Flashcard tags",
"Enter tags separated by spaces or newlines i.e. #flashcards #deck2 #deck3.":
"Enter tags separated by spaces or newlines i.e. #flashcards #deck2 #deck3.",
"Convert folders to decks and subdecks?":
"Convert folders to decks and subdecks?",
"Convert folders to decks and subdecks?": "Convert folders to decks and subdecks?",
"This is an alternative to the Flashcard tags option above.":
"This is an alternative to the Flashcard tags option above.",
"Save scheduling comment on the same line as the flashcard's last line?":
"Save scheduling comment on the same line as the flashcard's last line?",
"Turning this on will make the HTML comments not break list formatting.":
"Turning this on will make the HTML comments not break list formatting.",
"Bury sibling cards until the next day?":
"Bury sibling cards until the next day?",
"Bury sibling cards until the next day?": "Bury sibling cards until the next day?",
"Siblings are cards generated from the same card text i.e. cloze deletions":
"Siblings are cards generated from the same card text i.e. cloze deletions",
"Show context in cards?": "Show context in cards?",
Expand All @@ -74,8 +71,7 @@ export default {
"Flashcard Width Percentage": "Flashcard Width Percentage",
"Show file name instead of 'Open file' in flashcard review?":
"Show file name instead of 'Open file' in flashcard review?",
"Randomize card order during review?":
"Randomize card order during review?",
"Randomize card order during review?": "Randomize card order during review?",
"Disable cloze cards?": "Disable cloze cards?",
"If you're not currently using 'em & would like the plugin to run a tad faster.":
"If you're not currently using 'em & would like the plugin to run a tad faster.",
Expand All @@ -85,46 +81,45 @@ export default {
"Note that after changing this you have to manually edit any flashcards you already have.":
"Note that after changing this you have to manually edit any flashcards you already have.",
"Separator for multiline flashcards": "Separator for multiline flashcards",
"Clear cache?": "Clear cache?",
"Clear cache": "Clear cache",
"Cache cleared": "Cache cleared",
"If you're having issues seeing some cards, try this.":
"If you're having issues seeing some cards, try this.",
"Tags to review": "Tags to review",
"Enter tags separated by spaces or newlines i.e. #review #tag2 #tag3.":
"Enter tags separated by spaces or newlines i.e. #review #tag2 #tag3.",
"Open a random note for review": "Open a random note for review",
"When you turn this off, notes are ordered by importance (PageRank).":
"When you turn this off, notes are ordered by importance (PageRank).",
"Open next note automatically after a review":
"Open next note automatically after a review",
"Open next note automatically after a review": "Open next note automatically after a review",
"For faster reviews.": "For faster reviews.",
"Disable review options in the file menu i.e. Review: Easy Good Hard":
"Disable review options in the file menu i.e. Review: Easy Good Hard",
"After disabling, you can review using the command hotkeys. Reload Obsidian after changing this.":
"After disabling, you can review using the command hotkeys. Reload Obsidian after changing this.",
"Maximum number of days to display on right panel":
"Maximum number of days to display on right panel",
"Reduce this for a cleaner interface.":
"Reduce this for a cleaner interface.",
"The number of days must be at least 1.":
"The number of days must be at least 1.",
"Reduce this for a cleaner interface.": "Reduce this for a cleaner interface.",
"The number of days must be at least 1.": "The number of days must be at least 1.",
"Please provide a valid number.": "Please provide a valid number.",
Algorithm: "Algorithm",
"Base ease": "Base ease",
"minimum = 130, preferrably approximately 250.":
"minimum = 130, preferrably approximately 250.",
"The base ease must be at least 130.":
"The base ease must be at least 130.",
"The base ease must be at least 130.": "The base ease must be at least 130.",
"Interval change when you review a flashcard/note as hard":
"Interval change when you review a flashcard/note as hard",
"newInterval = oldInterval * intervalChange / 100.":
"newInterval = oldInterval * intervalChange / 100.",
"Easy bonus": "Easy bonus",
"The easy bonus allows you to set the difference in intervals between answering Good and Easy on a flashcard/note (minimum = 100%).":
"The easy bonus allows you to set the difference in intervals between answering Good and Easy on a flashcard/note (minimum = 100%).",
"The easy bonus must be at least 100.":
"The easy bonus must be at least 100.",
"The easy bonus must be at least 100.": "The easy bonus must be at least 100.",
"Maximum Interval": "Maximum Interval",
"Allows you to place an upper limit on the interval (default = 100 years).":
"Allows you to place an upper limit on the interval (default = 100 years).",
"The maximum interval must be at least 1 day.":
"The maximum interval must be at least 1 day.",
"The maximum interval must be at least 1 day.": "The maximum interval must be at least 1 day.",
"Maximum link contribution": "Maximum link contribution",
"Maximum contribution of the weighted ease of linked notes to the initial ease.":
"Maximum contribution of the weighted ease of linked notes to the initial ease.",
Expand All @@ -142,16 +137,15 @@ export default {
"Note that this requires the Obsidian Charts plugin to work":
"Note that this requires the Obsidian Charts plugin to work",
Forecast: "Forecast",
"The number of cards due in the future":
"The number of cards due in the future",
"The number of cards due in the future": "The number of cards due in the future",
"Number of cards": "Number of cards",
Scheduled: "Scheduled",
Review: "Review",
due: "due",
Days: "Days",
"Folders to ignore": "Folders to ignore",
"Enter folder paths separated by newlines i.e. Templates Meta/Scripts":
"Enter folder paths separated by newlines i.e. Templates Meta/Scripts":
"Enter folder paths separated by newlines i.e. Templates Meta/Scripts",
"Note is saved under ignored folder (check settings).":
"Note is saved under ignored folder (check settings).":
"Note is saved under ignored folder (check settings).",
};
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ export default class SRPlugin extends Plugin {

for (let tag of tags) {
if (
this.data.settings.tagsToReview.some(
this.data.settings.flashcardTags.some(
(tagToReview) =>
tag === tagToReview || tag.startsWith(tagToReview + "/")
)
Expand Down
49 changes: 30 additions & 19 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const DEFAULT_SETTINGS: SRSettings = {
cardCommentOnSameLine: false,
burySiblingCards: false,
showContextInCards: true,
flashcardHeightPercentage: Platform.isDesktop ? 80 : 100,
flashcardWidthPercentage: Platform.isDesktop ? 40 : 100,
flashcardHeightPercentage: Platform.isMobile ? 100 : 80,
flashcardWidthPercentage: Platform.isMobile ? 100 : 40,
showFileNameInFileLink: false,
randomizeCardOrder: true,
disableClozeCards: false,
Expand Down Expand Up @@ -99,6 +99,23 @@ export class SRSettingTab extends PluginSettingTab {
t("wiki") +
"</a>.";

new Setting(containerEl)
.setName(t("Folders to ignore"))
.setDesc(t("Enter folder paths separated by newlines i.e. Templates Meta/Scripts"))
.addTextArea((text) =>
text
.setValue(this.plugin.data.settings.noteFoldersToIgnore.join("\n"))
.onChange((value) => {
applySettingsUpdate(async () => {
this.plugin.data.settings.noteFoldersToIgnore = value
.split(/\n+/)
.map((v) => v.trim())
.filter((v) => v);
await this.plugin.savePluginData();
});
})
);

containerEl.createDiv().innerHTML = "<h3>" + t("Flashcards") + "</h3>";

new Setting(containerEl)
Expand Down Expand Up @@ -367,6 +384,17 @@ export class SRSettingTab extends PluginSettingTab {
});
});

new Setting(containerEl)
.setName(t("Clear cache?"))
.setDesc(t("If you're having issues seeing some cards, try this."))
.addButton((button) => {
button.setButtonText(t("Clear cache")).onClick(async () => {
this.plugin.data.cache = {};
await this.plugin.savePluginData();
new Notice(t("Cache cleared"));
});
});

containerEl.createDiv().innerHTML = "<h3>" + t("Notes") + "</h3>";

new Setting(containerEl)
Expand All @@ -383,23 +411,6 @@ export class SRSettingTab extends PluginSettingTab {
})
);

new Setting(containerEl)
.setName(t("Folders to ignore"))
.setDesc(t("Enter folder paths separated by newlines i.e. Templates Meta/Scripts"))
.addTextArea((text) =>
text
.setValue(this.plugin.data.settings.noteFoldersToIgnore.join("\n"))
.onChange((value) => {
applySettingsUpdate(async () => {
this.plugin.data.settings.noteFoldersToIgnore = value
.split(/\n+/)
.map((v) => v.trim())
.filter((v) => v);
await this.plugin.savePluginData();
});
})
);

new Setting(containerEl)
.setName(t("Open a random note for review"))
.setDesc(t("When you turn this off, notes are ordered by importance (PageRank)."))
Expand Down