summaryrefslogtreecommitdiffstats
path: root/lib/backbone
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backbone')
-rw-r--r--lib/backbone/glossary.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/backbone/glossary.js b/lib/backbone/glossary.js
index 9aed1ac..45848e0 100644
--- a/lib/backbone/glossary.js
+++ b/lib/backbone/glossary.js
@@ -44,6 +44,15 @@ util.inherits(Glossary, BackboneFile);
Glossary.prototype.type = 'glossary';
+// Get templating context
+Glossary.prototype.getContext = function() {
+ return {
+ glossary: {
+ path: this.path
+ }
+ };
+};
+
// Parse the readme content
Glossary.prototype.parse = function(content) {
var that = this;
@@ -73,4 +82,16 @@ Glossary.prototype.isEmpty = function(id) {
return _.size(this.entries) === 0;
};
+// Convert the glossary to a list of annotations
+Glossary.prototype.annotations = function() {
+ return _.map(this.entries, function(entry) {
+ return {
+ id: entry.id,
+ name: entry.name,
+ description: entry.description,
+ href: '/' + this.path + '#' + entry.id
+ };
+ }, this);
+};
+
module.exports = Glossary;