summaryrefslogtreecommitdiffstats
path: root/lib/parse/glossary.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-08-15 12:09:36 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-08-15 12:09:36 -0700
commitcbe4e9edec3a1751030ad40a28e25df20fde2b08 (patch)
tree7e4346898ba1d71e8ffef80e252e4935a8f33fa6 /lib/parse/glossary.js
parente0aed828e0e2be6df601c41649195f6fc71553c9 (diff)
downloadgitbook-cbe4e9edec3a1751030ad40a28e25df20fde2b08.zip
gitbook-cbe4e9edec3a1751030ad40a28e25df20fde2b08.tar.gz
gitbook-cbe4e9edec3a1751030ad40a28e25df20fde2b08.tar.bz2
Simplify output of glossary parsing to more simple objects
Diffstat (limited to 'lib/parse/glossary.js')
-rw-r--r--lib/parse/glossary.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/parse/glossary.js b/lib/parse/glossary.js
index 65473cf..6286783 100644
--- a/lib/parse/glossary.js
+++ b/lib/parse/glossary.js
@@ -28,9 +28,14 @@ function groups(nodes) {
function parseGlossary(src) {
var nodes = kramed.lexer(src);
- var entries = groups(nodes);
-
- return entries;
+ return groups(nodes)
+ .map(function(pair) {
+ // Simplify each group to a simple object with name/description
+ return {
+ name: pair[0].text,
+ description: pair[1].text,
+ };
+ });
}
module.exports = parseGlossary;