Skip to content

Commit

Permalink
fix: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
srg-kostyrko committed Dec 17, 2023
1 parent 5b4f333 commit c94bec9
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ There variables can be used in note name template, note storage path, content of
- `{{start_date}}` - first day of week, month, quarter, year or interval depending on note type, formatted using date format from settings, format can be overridden using following syntax `{{start_date:format}}` where format is string using Moment.js format rules (like `{{start_date:YYYY-MM-DD}}`)
- `{{end_date}}` - last day of week, month, quarter, year or interval depending on note type, formatting rules are the same as in `{{start_date}}`
- `{{date}}` - alias to `{{start_date}}`
- `{{index}}` - avaliable for interval based journals indicating index of interval (like financial quarter or spring number)
- `{{index}}` - available for interval based journals indicating index of interval (like financial quarter or spring number)

## Supported code blocks

Expand Down Expand Up @@ -68,7 +68,7 @@ Example look for interval note (configured as 1 week sprints):
```
````

Timeline code blocks helps navigating daily notes in bigger periods (like week, month, quarter or year). By defauls daily and weekly notes show `week` timeline, monthly note - `month` timeline, quarter note - `quarter` timeline and yearly note - `calendar` timeline. This can be changed using `mode` param.
Timeline code blocks helps navigating daily notes in bigger periods (like week, month, quarter or year). By default daily and weekly notes show `week` timeline, monthly note - `month` timeline, quarter note - `quarter` timeline and yearly note - `calendar` timeline. This can be changed using `mode` param.

````markdown
```calendar-timeline
Expand Down
26 changes: 13 additions & 13 deletions src/interval-journal/interval-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,42 +102,42 @@ export class IntervalManager {
}

private calculateIntervalAfterKnown(date: MomentDate, interval: Interval): Interval {
let curent = interval.endDate.clone().add(1, "day");
let current = interval.endDate.clone().add(1, "day");
let index = interval.index + 1;
if (this.shouldResetYearly && !curent.isSame(interval.startDate, "year")) {
if (this.shouldResetYearly && !current.isSame(interval.startDate, "year")) {
index = 1;
}
while (curent.isBefore(date, "day")) {
const next = curent.clone().add(this.config.duration, this.config.granularity);
while (current.isBefore(date, "day")) {
const next = current.clone().add(this.config.duration, this.config.granularity);
if (next.isAfter(date, "day")) {
break;
}
index++;
if (this.shouldResetYearly && !next.isSame(curent, "year")) {
if (this.shouldResetYearly && !next.isSame(current, "year")) {
index = 1;
}
curent = next;
current = next;
}
return {
startDate: curent,
endDate: this.createEndDate(curent),
startDate: current,
endDate: this.createEndDate(current),
index,
};
}

private calculateIntervalBeforeKnown(date: MomentDate, interval: Interval): Interval {
const curent = interval.startDate.clone();
const current = interval.startDate.clone();
let index = interval.index;
while (curent.isAfter(date, "day")) {
curent.subtract(this.config.duration, this.config.granularity);
while (current.isAfter(date, "day")) {
current.subtract(this.config.duration, this.config.granularity);
index--;
if (this.shouldResetYearly && index === 0) {
index = this.maximumYearIndex;
}
}
return {
startDate: curent,
endDate: this.createEndDate(curent),
startDate: current,
endDate: this.createEndDate(current),
index,
};
}
Expand Down
16 changes: 8 additions & 8 deletions src/settings/settings-calendar-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,29 @@ export class SettingsCalendarPage extends SettingsWidget {
});
if (this.config.openOnStartup) {
startUp.addDropdown((dropdown) => {
const avaliable: CalendarGranularity[] = [];
const available: CalendarGranularity[] = [];
if (this.config.day.enabled) {
dropdown.addOption("day", "Daily note");
avaliable.push("day");
available.push("day");
}
if (this.config.week.enabled) {
dropdown.addOption("week", "Weekly note");
avaliable.push("week");
available.push("week");
}
if (this.config.month.enabled) {
dropdown.addOption("month", "Monthly note");
avaliable.push("month");
available.push("month");
}
if (this.config.quarter.enabled) {
dropdown.addOption("quarter", "Quarterly note");
avaliable.push("quarter");
available.push("quarter");
}
if (this.config.year.enabled) {
dropdown.addOption("year", "Yearly note");
avaliable.push("year");
available.push("year");
}
if (!avaliable.contains(this.config.startupSection)) {
this.config.startupSection = avaliable[0];
if (!available.contains(this.config.startupSection)) {
this.config.startupSection = available[0];
this.save();
}
dropdown.setValue(this.config.startupSection).onChange((value) => {
Expand Down
14 changes: 7 additions & 7 deletions src/settings/settings-calendar-section-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class SettingsCalendarSectionPage extends SettingsWidget {
text: "Template used to generate new note name.",
});
nameTemplate.descEl.createEl("br");
this.createVaribleReferenceHint(nameTemplate.descEl);
this.createVariableReferenceHint(nameTemplate.descEl);

const dateFormat = new Setting(containerEl).setName("Default date format").addMomentFormat((format) => {
format
Expand Down Expand Up @@ -130,7 +130,7 @@ export class SettingsCalendarSectionPage extends SettingsWidget {
text: "New notes will be created in this folder.",
});
folder.descEl.createEl("br");
this.createVaribleReferenceHint(folder.descEl);
this.createVariableReferenceHint(folder.descEl);

const template = new Setting(containerEl).setName("Template").addText((text) => {
new TemplateSuggestion(this.app, text.inputEl);
Expand All @@ -143,7 +143,7 @@ export class SettingsCalendarSectionPage extends SettingsWidget {
text: "Path to note that will be used as template when creating new notes. ",
});
template.descEl.createEl("br");
this.createVaribleReferenceHint(template.descEl);
this.createVariableReferenceHint(template.descEl);
template.descEl.createEl("br");
this.createCodeBlockReferenceHint(template.descEl);

Expand All @@ -158,19 +158,19 @@ export class SettingsCalendarSectionPage extends SettingsWidget {
});

if (this.config.ribbon.show) {
let iconPreivewButton: ButtonComponent | null = null;
let iconPreviewButton: ButtonComponent | null = null;
new Setting(containerEl)
.setName("Ribbon icon")
.setDesc("Select icon to be show in ribbon.")
.addButton((button) => {
iconPreivewButton = button;
iconPreviewButton = button;
button.setIcon(this.ribbonIcon).setDisabled(true);
})
.addText((text) => {
new IconSuggestion(this.app, text.inputEl);
text.setValue(this.config.ribbon.icon).onChange((value) => {
this.config.ribbon.icon = value;
iconPreivewButton?.setIcon(value);
iconPreviewButton?.setIcon(value);
this.save();
});
});
Expand Down Expand Up @@ -205,7 +205,7 @@ export class SettingsCalendarSectionPage extends SettingsWidget {
}
}

createVaribleReferenceHint(el: HTMLElement): void {
createVariableReferenceHint(el: HTMLElement): void {
const link = el.createEl("span", {
cls: "var-ref journal-link",
text: "Supported variables.",
Expand Down
14 changes: 7 additions & 7 deletions src/settings/settings-interval-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class SettingsIntervalPage extends SettingsWidget {
text: "Template used to generate new note name.",
});
nameTemplate.descEl.createEl("br");
this.createVaribleReferenceHint(nameTemplate.descEl);
this.createVariableReferenceHint(nameTemplate.descEl);

const dateFormat = new Setting(containerEl).setName("Default date format").addMomentFormat((format) => {
format
Expand Down Expand Up @@ -148,7 +148,7 @@ export class SettingsIntervalPage extends SettingsWidget {
text: "New notes will be created in this folder.",
});
folder.descEl.createEl("br");
this.createVaribleReferenceHint(folder.descEl);
this.createVariableReferenceHint(folder.descEl);

const template = new Setting(containerEl).setName("Template").addText((text) => {
new TemplateSuggestion(this.app, text.inputEl);
Expand All @@ -161,7 +161,7 @@ export class SettingsIntervalPage extends SettingsWidget {
text: "Path to note that will be used as template when creating new notes. ",
});
template.descEl.createEl("br");
this.createVaribleReferenceHint(template.descEl);
this.createVariableReferenceHint(template.descEl);
template.descEl.createEl("br");
this.createCodeBlockReferenceHint(template.descEl);

Expand All @@ -176,19 +176,19 @@ export class SettingsIntervalPage extends SettingsWidget {
});

if (this.config.ribbon.show) {
let iconPreivewButton: ButtonComponent | null = null;
let iconPreviewButton: ButtonComponent | null = null;
new Setting(containerEl)
.setName("Ribbon icon")
.setDesc("Select icon to be show in ribbon.")
.addButton((button) => {
iconPreivewButton = button;
iconPreviewButton = button;
button.setIcon(this.ribbonIcon).setDisabled(true);
})
.addText((text) => {
new IconSuggestion(this.app, text.inputEl);
text.setValue(this.config.ribbon.icon).onChange((value) => {
this.config.ribbon.icon = value;
iconPreivewButton?.setIcon(this.ribbonIcon);
iconPreviewButton?.setIcon(this.ribbonIcon);
this.save();
});
});
Expand All @@ -214,7 +214,7 @@ export class SettingsIntervalPage extends SettingsWidget {
});
}

createVaribleReferenceHint(el: HTMLElement): void {
createVariableReferenceHint(el: HTMLElement): void {
const link = el.createEl("span", {
cls: "var-ref journal-link",
text: "Supported variables.",
Expand Down
10 changes: 5 additions & 5 deletions src/settings/ui/calendar-code-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ export class CalendarCodeBlocksModal extends Modal {
text: "Click on a code block to copy it to your clipboard.",
});

const navBlokContainer = contentEl.createDiv({
const navBlockContainer = contentEl.createDiv({
cls: "journal-code-block",
});
navBlokContainer.createSpan({
navBlockContainer.createSpan({
text: "```calendar-nav",
});
navBlokContainer.createEl("br");
navBlokContainer.createSpan({
navBlockContainer.createEl("br");
navBlockContainer.createSpan({
text: "```",
});

Expand Down Expand Up @@ -75,7 +75,7 @@ export class CalendarCodeBlocksModal extends Modal {

if (this.granularity === "day") {
contentEl.createEl("p", {
text: "For daily notes timeline blocks helps navigating withing corresponding week.",
text: "For daily notes timeline blocks helps navigating within corresponding week.",
});
} else {
contentEl.createEl("p", {
Expand Down
8 changes: 4 additions & 4 deletions src/settings/ui/interval-code-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export class IntervalCodeBlocksModal extends Modal {
text: "Click on a code block to copy it to your clipboard.",
});

const navBlokContainer = contentEl.createDiv({
const navBlockContainer = contentEl.createDiv({
cls: "journal-code-block",
});
navBlokContainer.createSpan({
navBlockContainer.createSpan({
text: "```interval-nav",
});
navBlokContainer.createEl("br");
navBlokContainer.createSpan({
navBlockContainer.createEl("br");
navBlockContainer.createSpan({
text: "```",
});
contentEl.createEl("p", {
Expand Down

0 comments on commit c94bec9

Please sign in to comment.