summaryrefslogtreecommitdiffstats
path: root/lib/page/index.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-17 21:03:00 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-17 21:03:00 +0100
commite75002a96d00f608f75236344ceb4434c487d863 (patch)
tree41d1458b19be25197c7b8c698b82dce8d1fe3b80 /lib/page/index.js
parenta68364d4d7593d43a83a1d16d71db32bde0a6465 (diff)
downloadgitbook-e75002a96d00f608f75236344ceb4434c487d863.zip
gitbook-e75002a96d00f608f75236344ceb4434c487d863.tar.gz
gitbook-e75002a96d00f608f75236344ceb4434c487d863.tar.bz2
Improve annotation with glossary terms
Diffstat (limited to 'lib/page/index.js')
-rw-r--r--lib/page/index.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/page/index.js b/lib/page/index.js
index c9cd066..629bcee 100644
--- a/lib/page/index.js
+++ b/lib/page/index.js
@@ -147,7 +147,11 @@ Page.prototype.toHTML = function(output) {
// Normalize HTML output
.then(function() {
var pipelineOpts = {
- onRelativeLink: _.partial(output.onRelativeLink, that),
+ onRelativeLink: function (href) {
+ href = that.relative(href);
+ return output.onRelativeLink(that, href);
+ },
+ //_.partial(output.onRelativeLink, that),
onImage: _.partial(output.onOutputImage, that),
onOutputSVG: _.partial(output.onOutputSVG, that),
@@ -159,7 +163,17 @@ Page.prototype.toHTML = function(output) {
language: lang
}
});
- }
+ },
+
+ // Convert glossary entries to annotations
+ annotations: _.map(that.book.glossary.entries, function(entry) {
+ return {
+ id: entry.id,
+ name: entry.name,
+ description: entry.description,
+ href: '/GLOSSARY.html'
+ };
+ })
};
var pipeline = new HTMLPipeline(that.content, pipelineOpts);