generated from ztimson/template
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc27fa632 | ||
|
|
943280f326 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ztimson/zim-utils",
|
||||
"version": "0.4.4",
|
||||
"version": "0.4.6",
|
||||
"description": "Native, dependency-light ZIM archive reader/searcher and Kiwix catalog downloader for Node.js",
|
||||
"author": "Zak Timson",
|
||||
"license": "MIT",
|
||||
|
||||
+8
-2
@@ -32,6 +32,12 @@ function tokenize(terms) {
|
||||
return String(terms).split(/[,\s]+/).map(t => t.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
function normalizeSummary(summary) {
|
||||
if(typeof summary === 'string') return summary;
|
||||
if(summary && typeof summary === 'object') return summary._text || '';
|
||||
return '';
|
||||
}
|
||||
|
||||
export class KiwixServer {
|
||||
static #empty = '<?xml version="1.0" encoding="UTF-8" ?>\n<library version="20110515"></library>\n';
|
||||
|
||||
@@ -218,7 +224,7 @@ export class KiwixServer {
|
||||
id: e.id,
|
||||
title: e.title,
|
||||
updated: new Date(e.date),
|
||||
summary: e.description,
|
||||
summary: normalizeSummary(e.description),
|
||||
language: e.language,
|
||||
name: e.name,
|
||||
category: tags.find(t => t.startsWith('_category'))?.slice(10) || '',
|
||||
@@ -292,7 +298,7 @@ export class KiwixServer {
|
||||
href: `${resultBook.href}/${page}`,
|
||||
icon: resultBook.icon,
|
||||
viewer: this.baseUrl + hit.link,
|
||||
summary: hit.description,
|
||||
summary: normalizeSummary(hit.description),
|
||||
xapianScore: +hit.score || 0,
|
||||
};
|
||||
}).filter(Boolean);
|
||||
|
||||
Reference in New Issue
Block a user