Cannabis Freedom Index

Changelog 6e6a451tree

Include language atlas explanations in glossary API

2 files of code, design or docs +2 −1 lines

Code, design and documents 2 files

scripts/answers.test.mjs +1 −0
@@ -141,4 +141,5 @@ test("glossary API exports sourced multilingual cannabis vocabulary and inflecti
   const data = glossaryAPI(path.resolve(root, ".."));
   assert.equal(data.version, 1);
+  assert.ok(data.entries.find(entry => entry.kind === "language" && entry.id === "bhang")?.text.length > 20);
   assert.ok(data.entries.some(e => e.kind === "glossary" && e.id === "THC"));
   assert.ok(data.entries.some(e => e.kind === "country-word" && e.word === "konopa" && e.sources.length));

src/lib/glossary-api.js +1 −1
@@ -25,5 +25,5 @@ export function glossaryAPI(root = process.cwd()) {
   for (const file of fs.readdirSync(dir).filter(f => f.endsWith(".md")).sort()) {
     const item = frontmatter(path.join(dir, file));
-    entries.push({ kind: "language", id: file.slice(0, -3), title: item.title, also: item.also ?? [], spelling: item.spelling ?? [], sources: item.sources ?? [], url: `/culture/language/${file.slice(0, -3)}/` });
+    entries.push({ kind: "language", id: file.slice(0, -3), title: item.title, text: item.summary, also: item.also ?? [], spelling: item.spelling ?? [], sources: item.sources ?? [], url: `/culture/language/${file.slice(0, -3)}/` });
     add([item.title, ...(item.also ?? []), ...(item.spelling ?? []).flatMap(s => [s.text, ...(!/^[\[/]/.test(s.say ?? "") ? [s.say] : [])])]);
   }

    ↑↓ to move, ↵ to open.