Skip to content

Commit

Permalink
Comment Prepend Divider
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanopagliari committed Jan 24, 2022
1 parent c1daa32 commit 0ba5ad8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
Binary file added .github/workflows/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const DEFAULT_SETTINGS: MyPluginSettings = {
keyMergeAbove: "+",
keyCommentPrepend: "%",
commentPrependDefault: false,
commentPrependDivider: ": ",
keyH1: "#",
keyH2: "##",
keyH3: "###",
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,8 @@ export default class MyPlugin extends Plugin {
const zoteroStorageMac = new RegExp(
/.+?(?=Zotero\/storage)Zotero\/storage\//gm
);
console.log(selectedEntry.attachments[0].path)
console.log(zoteroStorageMac.test(selectedEntry.attachments[0].path))
if (zoteroStorageMac.test(selectedEntry.attachments[0].path)) {
pathZoteroStorage = String(
selectedEntry.attachments[0].path.match(zoteroStorageMac)
Expand All @@ -1492,8 +1494,9 @@ export default class MyPlugin extends Plugin {
}

const zoteroStorageWindows = new RegExp(
/.+?(?=Zotero\\storage\\)Zotero\\storage\\/gm
/.+?(?=Zotero\\storage\\)Zotero\\storage\\/gm
);
console.log(zoteroStorageWindows.test(selectedEntry.attachments[0].path))
if (zoteroStorageWindows.test(selectedEntry.attachments[0].path)) {
pathZoteroStorage = String(selectedEntry.attachments[0].path.match(zoteroStorageWindows)
);
Expand Down Expand Up @@ -2066,7 +2069,6 @@ export default class MyPlugin extends Plugin {
this.settings.exportTitle,
this.settings.exportPath
);

//Extract the annotation and the keyword from the text
const resultAnnotations = this.extractAnnotation(
selectedEntry,
Expand Down
13 changes: 12 additions & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,17 @@ export class SettingTab extends PluginSettingTab {
}
})
);


new Setting(settingsAdvanced)
.setDesc("Text placed between the comment and the related highlight")
.addText((text) =>
text
.setValue(settings.commentPrependDivider)
.onChange(async (value) => {
settings.commentPrependDivider = value;
await plugin.saveSettings();
})
);
new Setting(settingsAdvanced)
.setDesc("Always place the comment made to an highlight before the text of the highlight")
.addToggle((text) =>
Expand All @@ -759,6 +769,7 @@ export class SettingTab extends PluginSettingTab {
})
);

//commentPrependDivider
new Setting(settingsAdvanced)
.setName("Transform the highlight/comment into a task")
.addText((text) =>
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export interface MyPluginSettings {
keyMergeAbove: string;
keyCommentPrepend: string;
commentPrependDefault: boolean;
commentPrependDivider: string;
keyH1: string;
keyH2: string;
keyH3: string;
Expand Down

0 comments on commit 0ba5ad8

Please sign in to comment.