From 80e2f23714489b7e2cc15e4372aa2dc1d681be9e Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Sun, 17 Aug 2014 21:13:39 -0700 Subject: [PATCH] Add "id" attribute to parsed glossary entries --- lib/parse/glossary.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/parse/glossary.js b/lib/parse/glossary.js index 6286783bd..1b6279b36 100644 --- a/lib/parse/glossary.js +++ b/lib/parse/glossary.js @@ -33,9 +33,15 @@ function parseGlossary(src) { // Simplify each group to a simple object with name/description return { name: pair[0].text, + id: entryId(pair[0].text), description: pair[1].text, }; }); } +// Normalizes a glossary entry's name to create an ID +function entryId(name) { + return name.toLowercase(); +} + module.exports = parseGlossary;