Phase 6 add CrossWire SWORD imports
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { fetchSwordConfCatalog } from './sword-lib.js'
|
||||
|
||||
const catalog = await fetchSwordConfCatalog()
|
||||
const modules = [...catalog.modules.values()]
|
||||
.map((entry) => ({
|
||||
id: entry.module_id,
|
||||
description: scalar(entry.conf.Description),
|
||||
mod_drv: scalar(entry.conf.ModDrv),
|
||||
source_type: scalar(entry.conf.SourceType),
|
||||
license: scalar(entry.conf.DistributionLicense),
|
||||
lang: scalar(entry.conf.Lang),
|
||||
}))
|
||||
.sort((a, b) => a.id.localeCompare(b.id))
|
||||
|
||||
for (const module of modules) {
|
||||
console.log([
|
||||
module.id.padEnd(24),
|
||||
module.mod_drv.padEnd(8),
|
||||
module.source_type.padEnd(8),
|
||||
module.lang.padEnd(6),
|
||||
module.license.padEnd(24),
|
||||
module.description,
|
||||
].join(' ').trimEnd())
|
||||
}
|
||||
|
||||
console.log(`\n${modules.length} SWORD module(s) listed from ${catalog.source_url}`)
|
||||
|
||||
function scalar(value) {
|
||||
if (Array.isArray(value)) return value.join(', ')
|
||||
return value ?? ''
|
||||
}
|
||||
Reference in New Issue
Block a user