Skip to content

Commit 753b756

Browse files
committed
Update + clean up files
1 parent e8e616a commit 753b756

File tree

6 files changed

+13
-16
lines changed

6 files changed

+13
-16
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "wiki-2-note",
33
"name": "Wiki 2 Note",
4-
"version": "1.0.6",
4+
"version": "1.0.7",
55
"minAppVersion": "0.15.0",
66
"description": "Generate a Note from a Wikipedia article.",
77
"author": "Johannes Hans",

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
"@typescript-eslint/eslint-plugin": "5.29.0",
1919
"@typescript-eslint/parser": "5.29.0",
2020
"builtin-modules": "3.3.0",
21-
"esbuild": "0.17.3",
21+
"esbuild": "0.25.0",
2222
"obsidian": "latest",
2323
"tslib": "2.4.0",
2424
"typescript": "4.7.4"
2525
},
2626
"dependencies": {
27-
"axios": "^1.8.4",
2827
"cheerio": "^1.0.0",
29-
"turndown": "^7.2.0"
28+
"turndown": "7.2.2"
3029
},
3130
"type": "module"
3231
}

src/Modal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class WikiModal extends Modal {
1212

1313
private input: HTMLInputElement;
1414

15-
async onOpen() {
15+
onOpen() {
1616
const {contentEl} = this;
1717
contentEl.classList.add("wiki-modal");
1818

19-
const label = contentEl.createEl('label', { text: 'Name of the Wikipedia Entry:' });
19+
const label = contentEl.createEl('label', { text: 'Name of the wikipedia entry:' });
2020
label.setAttr('for', 'text-input');
2121
this.input = contentEl.createEl("input", {type: "text"});
2222
this.input.id = 'text-input';

src/ModalMultiple.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ class WikiMultiModal extends Modal {
2121

2222
if(this.input.length >= 2) this.input[this.input.length-2].focus();
2323

24-
this.input[this.input.length - 1].onclick = async () => {
24+
this.input[this.input.length - 1].onclick = () => {
2525
this.createInput(contentEl,submitButton)
2626
};
2727
this.input[this.input.length - 2].onclick = null;
2828
}
2929

30-
async onOpen() {
30+
onOpen() {
3131
const {contentEl} = this;
3232
contentEl.classList.add("wiki-modal");
3333

34-
contentEl.createEl('label', { text: 'Name of the Wikipedia entries:' });
34+
contentEl.createEl('label', { text: 'Name of the wikipedia entries:' });
3535
contentEl.createEl('label', {text: 'Click text field to add more...'});
3636
this.input = [];
3737
const firstInput = contentEl.createEl("input", {type: "text"});
@@ -43,7 +43,7 @@ class WikiMultiModal extends Modal {
4343
this.close();
4444
};
4545

46-
this.input[this.input.length - 1].onclick = async () => {
46+
this.input[this.input.length - 1].onclick = () => {
4747
this.createInput(contentEl,submitButton);
4848
};
4949
}

src/Plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class WikiPlugin extends Plugin {
1919
init() {
2020
this.addCommand({
2121
id: 'open-import-modal',
22-
name: 'Import Wikipedia article',
22+
name: 'Import wikipedia article',
2323
callback: () => {
2424
new WikiModal(this.app, this.settings).open();
2525
}

src/WikipediaNote.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {WikiPluginSettings} from "./PluginSettings";
2-
import axios from "axios";
32
import * as cheerio from "cheerio";
43
import TurndownService from "turndown";
54
import {Notice, requestUrl} from "obsidian";
@@ -44,7 +43,7 @@ async function cleanWikiHtml(title: string, countryPrefix: string) {
4443
$e.removeAttr("about");
4544
return $;
4645
} catch (error) {
47-
new Notice("Unable to fetch data from Wikipedia.");
46+
new Notice("Unable to fetch data from wikipedia.");
4847
console.error(error);
4948
return null;
5049
}
@@ -76,7 +75,7 @@ async function fetchWikipediaMarkdown(title: string, settings: WikiPluginSetting
7675

7776
const html = `
7877
<span class="figure" style="display: inline-block; float: right; max-width: 200px; border: 2px solid ${settings.tableBorder}; background-color: ${settings.tableBackground}; padding: 5px; margin: 10px; clear: both">
79-
<img class="figureimg" src="${imgLink}">
78+
<img alt="image" class="figureimg" src="${imgLink}">
8079
<p>${caption}</p>
8180
</span>
8281
`
@@ -138,10 +137,9 @@ async function fetchWikipediaMarkdown(title: string, settings: WikiPluginSetting
138137
filter: "span",
139138
replacement: (content, node) => {
140139
if (node) {
141-
if ((node as HTMLElement)?.classList.contains("figure")) {
140+
if ("classList" in node && node?.classList.contains("figure")) {
142141
const serializer = new XMLSerializer();
143142
return serializer.serializeToString(node);
144-
} else {
145143
}
146144
}
147145
return "";

0 commit comments

Comments
 (0)