Kanzi 0.6.18: fix double bracket comment + missing text/DOI

- plugin/bootstrap.js: mergeComments now strips leading [code] before dedup, so [r] red note + red note collapse to single red note (was double [r] + stripped)
- plugin/manager.html: 0.6.17 text: a.annotation?.text now sent, vis shows text snippet and DOI/ISBN (simondon was isbn, not DOI, correctly)
- Bump to 0.6.18
This commit is contained in:
Utku Bilen Demir 2026-09-24 00:00:52 +02:00
parent c96a4f393b
commit 5a11d31c48
4 changed files with 34 additions and 4 deletions

View file

@ -13,7 +13,7 @@ Import Kindle `My Clippings.txt` highlights into Zotero as native annotations, d
# Install # Install
1. Download `kindle-zotero-importer.xpi` from [Releases](../../releases) (latest `0.6.17`, or `0.6.16-beta` for preview). 1. Download `kindle-zotero-importer.xpi` from [Releases](../../releases) (latest `0.6.18`, or `0.6.17-beta` for preview).
2. In Zotero: `Tools` → `Plugins` → `gear` → `Install Plugin From File…` → pick the `.xpi` → restart Zotero. 2. In Zotero: `Tools` → `Plugins` → `gear` → `Install Plugin From File…` → pick the `.xpi` → restart Zotero.
3. `Tools` → `Kanzi…` to open the manager. 3. `Tools` → `Kanzi…` to open the manager.

23
plugin/bootstrap.js vendored
View file

@ -548,18 +548,39 @@ var KindleZoteroImporter = {
}, },
mergeComments(existingComment, newComment) { mergeComments(existingComment, newComment) {
const stripBracket = (s) => String(s || "").replace(/^\s*\[[^\]]+\]\s*/, "").trim();
const seen = new Set(); const seen = new Set();
const merged = []; const merged = [];
for (const comment of [existingComment, newComment]) { for (const comment of [existingComment, newComment]) {
for (const part of String(comment || "").split(/\n\s*\n/)) { for (const part of String(comment || "").split(/\n\s*\n/)) {
const cleaned = part.trim(); const cleaned = part.trim();
if (!cleaned || seen.has(cleaned)) { if (!cleaned) continue;
// dedup on stripped version too, so "[r] note" and "note" are same
const key = stripBracket(cleaned).toLowerCase() || cleaned.toLowerCase();
if (seen.has(cleaned) || seen.has(key)) {
// if we have stripped version already, prefer stripped
if (seen.has(key) && cleaned !== stripBracket(cleaned)) {
// replace existing bracket version with stripped if we now have stripped
const idx = merged.findIndex(p => stripBracket(p).toLowerCase() === key);
if (idx >= 0) merged[idx] = stripBracket(cleaned);
seen.add(cleaned);
seen.add(key);
continue;
}
continue; continue;
} }
seen.add(cleaned); seen.add(cleaned);
seen.add(key);
// store stripped version if it had bracket
const stripped = stripBracket(cleaned);
if (stripped !== cleaned) {
merged.push(stripped);
seen.add(stripped);
} else {
merged.push(cleaned); merged.push(cleaned);
} }
} }
}
return merged.join("\n\n"); return merged.join("\n\n");
}, },

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Kanzi", "name": "Kanzi",
"version": "0.6.17", "version": "0.6.18",
"description": "Kindle annotations to Zotero — My Clippings.txt → native annotations.", "description": "Kindle annotations to Zotero — My Clippings.txt → native annotations.",
"homepage_url": "https://github.com/UtkuBilenDemir/kindle-zotero_importer", "homepage_url": "https://github.com/UtkuBilenDemir/kindle-zotero_importer",
"author": "Utku Bilen Demir", "author": "Utku Bilen Demir",

View file

@ -2,6 +2,15 @@
"addons": { "addons": {
"kindlezoteroimporter@utkubilen.de": { "kindlezoteroimporter@utkubilen.de": {
"updates": [ "updates": [
{
"version": "0.6.18",
"update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.18/kindle-zotero-importer.xpi",
"applications": {
"zotero": {
"strict_min_version": "6.999"
}
}
},
{ {
"version": "0.6.17", "version": "0.6.17",
"update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.17/kindle-zotero-importer.xpi", "update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.17/kindle-zotero-importer.xpi",