diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-22 21:52:13 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-22 21:52:13 +0100 |
commit | 0c8513801c131ec6e2c7b348403a4c66a9bf2a11 (patch) | |
tree | 0d30ae9e895d930ad2d7a9bed0c6fbee3d8e59b3 /lib/utils | |
parent | 90789aa5b92a17825c6d98beced5abc3794f4d84 (diff) | |
download | gitbook-0c8513801c131ec6e2c7b348403a4c66a9bf2a11.zip gitbook-0c8513801c131ec6e2c7b348403a4c66a9bf2a11.tar.gz gitbook-0c8513801c131ec6e2c7b348403a4c66a9bf2a11.tar.bz2 |
Write glossary for website
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/page.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils/page.js b/lib/utils/page.js index 9a468d6..0168831 100644 --- a/lib/utils/page.js +++ b/lib/utils/page.js @@ -95,9 +95,15 @@ function normalizeHtml(src, options) { // Replace glossayr terms _.each(options.glossary, function(term) { var r = new RegExp( "\\b(" + pregQuote(term.name.toLowerCase()) + ")\\b" , 'gi' ); + var includedInFiles = false; $("*").each(function() { replaceText($, this, r, function(match) { + if (!includedInFiles) { + includedInFiles = true; + term.files = term.files || []; + term.files.push(options.navigation[options.input]); + } return "<a href='"+links.toAbsolute("GLOSSARY.html", options.base, options.output)+"#"+term.id+"' class='glossary-term' title='"+term.description+"'>"+match+"</span>"; }); }); @@ -110,6 +116,9 @@ function normalizeHtml(src, options) { // Adapt page content to be relative to a base folder function normalizePage(sections, options) { options = _.defaults(options || {}, { + // Current file path + input: ".", + // Navigation to use to transform path navigation: {}, |