fixup! diigo-cache: RSS in diigo's export shape, from cached items

A diigo note item's body (note_content) renders first, as a Highlight:
line, as the export does: the 6 "export has notes, cache none" items
from the comparison were notes whose bodies the cache had all along.

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 08:31:07 -05:00
1 parent 81f91a6747
commit cbde0dfbd3
2 files changed
+10 -2

No files matched your search

+4 -2
View File
@@ -24,14 +24,16 @@ const list = (v: unknown): Record<string, unknown>[] => (Array.isArray(v) ? (v a
* `Tags:a,b;Description:…;Annotations and Sticky notes:…` — tags * `Tags:a,b;Description:…;Annotations and Sticky notes:…` — tags
* comma-separated (`no_tag` when none), then each highlight as * comma-separated (`no_tag` when none), then each highlight as
* `Highlight:<text>\n` followed by its sticky notes, one * `Highlight:<text>\n` followed by its sticky notes, one
* `Sticky notes:<text>\n` each (notes may span lines) * `Sticky notes:<text>\n` each (notes may span lines). A diigo *note*
* item's body (`note_content`) comes first, as a `Highlight:` line.
*/ */
export function itemDescription(item: Item): string { export function itemDescription(item: Item): string {
const tags = str(item.tags) || "no_tag"; const tags = str(item.tags) || "no_tag";
const body = str(item.note_content) ? `Highlight:${str(item.note_content)}\n` : "";
const notes = list(item.annotations) const notes = list(item.annotations)
.map((a) => `Highlight:${str(a.content)}\n${list(a.stickyNotes).map((n) => `Sticky notes:${str(n.content)}\n`).join("")}`) .map((a) => `Highlight:${str(a.content)}\n${list(a.stickyNotes).map((n) => `Sticky notes:${str(n.content)}\n`).join("")}`)
.join(""); .join("");
return `Tags:${tags};Description:${str(item.description)};Annotations and Sticky notes:${notes}`; return `Tags:${tags};Description:${str(item.description)};Annotations and Sticky notes:${body}${notes}`;
} }
/** one `<item>`: title, link, packed description. The title is whole /** one `<item>`: title, link, packed description. The title is whole
+6
View File
@@ -21,6 +21,12 @@ describe("itemDescription", () => {
); );
}); });
it("renders a note item's body as a Highlight line, as diigo's export does", () => {
expect(itemDescription({ type_name: "note", tags: "", description: "", note_content: "the note", annotations: [] })).toBe(
"Tags:no_tag;Description:;Annotations and Sticky notes:Highlight:the note\n",
);
});
it("says no_tag when there are no tags, and leaves empty parts empty", () => { it("says no_tag when there are no tags, and leaves empty parts empty", () => {
expect(itemDescription({ tags: "", description: "", annotations: [] })).toBe( expect(itemDescription({ tags: "", description: "", annotations: [] })).toBe(
"Tags:no_tag;Description:;Annotations and Sticky notes:", "Tags:no_tag;Description:;Annotations and Sticky notes:",