mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-30 22:18:46 +00:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 443def6cfd | |||
| 75464574d7 | |||
| 86f05c68c5 | |||
| 8dd407eaa8 | |||
| ea7ad10e8a | |||
| 62ec695dc8 | |||
| ca37ac73a9 | |||
| 96edd50c8f | |||
| 3993c1e35a | |||
| 5298558925 | |||
| c6ba147917 | |||
| 7efecea3d6 | |||
| a73fed3ebd | |||
| 50ef7bcd23 | |||
| 82e422cb89 | |||
| dab46c779d | |||
| 58a5245d21 | |||
| 612f9a6dc7 | |||
| 90d4dff263 | |||
| 0f38385c7d | |||
| 2b50616251 | |||
| 5b7f37f0d4 | |||
| 6ca8e26741 | |||
| a3ada05598 | |||
| 42eb11aaff | |||
| b581859afd | |||
| 2e22fae52a | |||
| 603ac8b91d | |||
| 5faa4841ca | |||
| 7416b826e0 | |||
| 82afc34755 | |||
| da39631a5a | |||
| fc8685a7c1 | |||
| 5e0204a980 | |||
| 6bb0f33f39 | |||
| ed4fd565b2 | |||
| 79cff28abd | |||
| 27329239f7 | |||
| 9de86fc0e4 | |||
| 7fa7826372 | |||
| 96ecfd098b | |||
| f7fe976c7e | |||
| 756629b91d | |||
| e640d124d4 | |||
| 7f41466297 | |||
| 57dfc062d2 |
@@ -23,3 +23,5 @@ build/Release
|
|||||||
# Deployed apps should consider commenting this line out:
|
# Deployed apps should consider commenting this line out:
|
||||||
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
|
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
theme/javascript/vendors
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Release notes
|
||||||
|
|
||||||
+17
-5
@@ -4,10 +4,18 @@ module.exports = function (grunt) {
|
|||||||
// Load NPM tasks
|
// Load NPM tasks
|
||||||
grunt.loadNpmTasks('grunt-contrib-less');
|
grunt.loadNpmTasks('grunt-contrib-less');
|
||||||
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
||||||
|
grunt.loadNpmTasks("grunt-bower-install-simple");
|
||||||
|
|
||||||
// Init GRUNT configuraton
|
// Init GRUNT configuraton
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
'bower-install-simple': {
|
||||||
|
options: {
|
||||||
|
color: true,
|
||||||
|
production: false,
|
||||||
|
directory: "theme/javascript/vendors"
|
||||||
|
}
|
||||||
|
},
|
||||||
less: {
|
less: {
|
||||||
development: {
|
development: {
|
||||||
options: {
|
options: {
|
||||||
@@ -31,11 +39,12 @@ module.exports = function (grunt) {
|
|||||||
optimize: "uglify", //"uglify",
|
optimize: "uglify", //"uglify",
|
||||||
include: ["requireLib"],
|
include: ["requireLib"],
|
||||||
paths: {
|
paths: {
|
||||||
"jQuery": 'vendors/jquery',
|
"jQuery": 'vendors/jquery/dist/jquery',
|
||||||
"lodash": 'vendors/lodash',
|
"lodash": 'vendors/lodash/dist/lodash',
|
||||||
"requireLib": 'vendors/require',
|
"requireLib": 'vendors/requirejs/require',
|
||||||
"Mousetrap": 'vendors/mousetrap',
|
"Mousetrap": 'vendors/mousetrap/mousetrap',
|
||||||
"lunr": path.join(__dirname, "node_modules/lunr/lunr")
|
"lunr": 'vendors/lunr.js/lunr',
|
||||||
|
"URI": 'vendors/URIjs/src/URI'
|
||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
'jQuery': {
|
'jQuery': {
|
||||||
@@ -56,8 +65,11 @@ module.exports = function (grunt) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
grunt.registerTask("bower-install", [ "bower-install-simple" ]);
|
||||||
|
|
||||||
// Build
|
// Build
|
||||||
grunt.registerTask('build', [
|
grunt.registerTask('build', [
|
||||||
|
'bower-install',
|
||||||
'less',
|
'less',
|
||||||
'requirejs'
|
'requirejs'
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ GitBook
|
|||||||
|
|
||||||
[](https://travis-ci.org/GitbookIO/gitbook)
|
[](https://travis-ci.org/GitbookIO/gitbook)
|
||||||
|
|
||||||
GitBook is a command line tool (and Node.js library) for building beautiful programming books and exercises using GitHub/Git and Markdown. You can see an example: [Learn Javascript](http://gitbookio.github.io/javascript/). An [editor](https://github.com/GitbookIO/editor) is available for Windows, Mac and Linux. You can follow [@GitBookIO](https://twitter.com/GitBookIO) on Twitter.
|
GitBook is a command line tool (and Node.js library) for building beautiful books and exercises using GitHub/Git and Markdown. You can see an example: [Learn Javascript](https://www.gitbook.io/book/GitBookIO/javascript). An [editor](https://github.com/GitbookIO/editor) is available for Windows, Mac and Linux. You can follow [@GitBookIO](https://twitter.com/GitBookIO) on Twitter.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -59,7 +59,18 @@ Here are the options that can be stored in this file:
|
|||||||
"plugins": [],
|
"plugins": [],
|
||||||
|
|
||||||
// Global configuration for plugins
|
// Global configuration for plugins
|
||||||
"pluginsConfig": {},
|
"pluginsConfig": {
|
||||||
|
"fontSettings": {
|
||||||
|
"theme": "sepia", "night" or "white",
|
||||||
|
"family": "serif" or "sans",
|
||||||
|
"size": 1 to 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// set another theme with your own layout
|
||||||
|
// it's recommended to use plugins or add more options for default theme, though
|
||||||
|
// see https://github.com/GitbookIO/gitbook/issues/209
|
||||||
|
"theme": "./localtheme",
|
||||||
|
|
||||||
// Links in template (null: default, false: remove, string: new value)
|
// Links in template (null: default, false: remove, string: new value)
|
||||||
"links": {
|
"links": {
|
||||||
@@ -69,7 +80,7 @@ Here are the options that can be stored in this file:
|
|||||||
// Links in top of sidebar
|
// Links in top of sidebar
|
||||||
"about": null,
|
"about": null,
|
||||||
"issues": null,
|
"issues": null,
|
||||||
"edit": null,
|
"contribute": null,
|
||||||
|
|
||||||
// Sharing links
|
// Sharing links
|
||||||
"sharing": {
|
"sharing": {
|
||||||
@@ -95,7 +106,7 @@ GitBook can generate your book in the following formats:
|
|||||||
|
|
||||||
## Book Format
|
## Book Format
|
||||||
|
|
||||||
A book is a GitHub repository containing at least 2 files: `README.md` and `SUMMARY.md`.
|
A book is a Git repository containing at least 2 files: `README.md` and `SUMMARY.md`.
|
||||||
|
|
||||||
#### README.md
|
#### README.md
|
||||||
|
|
||||||
@@ -176,6 +187,17 @@ You can see a complete example with the [Learn Git](https://github.com/GitbookIO
|
|||||||
|
|
||||||
GitBook will read the `.gitignore`, `.bookignore` and `.ignore` files to get a list of files and folders to skip. (The format inside those files, follows the same convention as `.gitignore`)
|
GitBook will read the `.gitignore`, `.bookignore` and `.ignore` files to get a list of files and folders to skip. (The format inside those files, follows the same convention as `.gitignore`)
|
||||||
|
|
||||||
|
#### Cover
|
||||||
|
|
||||||
|
A cover image can be set by creating a file: **/cover.jpg**.
|
||||||
|
The best resolution is **1800x2360**. The generation of the cover can be done automatically using the plugin [autocover](https://github.com/GitbookIO/plugin-autocover).
|
||||||
|
|
||||||
|
A small version of the cover can also be set by creating a file: **/cover_small.jpg**.
|
||||||
|
|
||||||
|
#### Publish your book
|
||||||
|
|
||||||
|
The platform [GitBook.io](https://www.gitbook.io/) is like an "Heroku for books", you can create a book on it (public, paid, or private) and update it using **git push**.
|
||||||
|
|
||||||
#### Plugins
|
#### Plugins
|
||||||
|
|
||||||
Plugins can used to extend your book's functionality. Read [GitbookIO/plugin](https://github.com/GitbookIO/plugin) for more information about how to build a plugin for gitbook.
|
Plugins can used to extend your book's functionality. Read [GitbookIO/plugin](https://github.com/GitbookIO/plugin) for more information about how to build a plugin for gitbook.
|
||||||
@@ -189,8 +211,9 @@ Plugins can used to extend your book's functionality. Read [GitbookIO/plugin](ht
|
|||||||
|
|
||||||
* [Google Analytics](https://github.com/GitbookIO/plugin-ga): Google Analytics tracking for your book
|
* [Google Analytics](https://github.com/GitbookIO/plugin-ga): Google Analytics tracking for your book
|
||||||
* [Disqus](https://github.com/GitbookIO/plugin-disqus): Disqus comments integration in your book
|
* [Disqus](https://github.com/GitbookIO/plugin-disqus): Disqus comments integration in your book
|
||||||
|
* [Autocover](https://github.com/GitbookIO/plugin-autocover): Generate a cover for your book
|
||||||
* [Transform annoted quotes to notes](https://github.com/erixtekila/gitbook-plugin-richquotes): Allow extra markdown markup to render blockquotes as nice notes
|
* [Transform annoted quotes to notes](https://github.com/erixtekila/gitbook-plugin-richquotes): Allow extra markdown markup to render blockquotes as nice notes
|
||||||
* [Send code to console](https://github.com/erixtekila/gitbook-plugin-toconsole): Evaluate javascript blockin the browser inspector's console
|
* [Send code to console](https://github.com/erixtekila/gitbook-plugin-toconsole): Evaluate javascript block in the browser inspector's console
|
||||||
* [Revealable sections](https://github.com/mrpotes/gitbook-plugin-reveal): Reveal sections of the page using buttons made from the first title in each section
|
* [Revealable sections](https://github.com/mrpotes/gitbook-plugin-reveal): Reveal sections of the page using buttons made from the first title in each section
|
||||||
* [Markdown within HTML](https://github.com/mrpotes/gitbook-plugin-nestedmd): Process markdown within HTML blocks - allows custom layout options for individual pages
|
* [Markdown within HTML](https://github.com/mrpotes/gitbook-plugin-nestedmd): Process markdown within HTML blocks - allows custom layout options for individual pages
|
||||||
* [Bootstrap JavaScript plugins](https://github.com/mrpotes/gitbook-plugin-bootstrapjs): Use the [Bootstrap JavaScript plugins](http://getbootstrap.com/javascript) in your online GitBook
|
* [Bootstrap JavaScript plugins](https://github.com/mrpotes/gitbook-plugin-bootstrapjs): Use the [Bootstrap JavaScript plugins](http://getbootstrap.com/javascript) in your online GitBook
|
||||||
|
|||||||
+5
-2
@@ -33,8 +33,11 @@ var makeBuildFunc = function(converter) {
|
|||||||
.then(function(output) {
|
.then(function(output) {
|
||||||
console.log("Successfuly built !");
|
console.log("Successfuly built !");
|
||||||
return output;
|
return output;
|
||||||
}, utils.logError);
|
}, utils.logError)
|
||||||
};
|
.fail(function() {
|
||||||
|
process.exit(-1);
|
||||||
|
});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
+3
-1
@@ -30,7 +30,9 @@ function watch(dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logError(err) {
|
function logError(err) {
|
||||||
console.log(err.stack || err.message || err);
|
var message = err.message || err;
|
||||||
|
if (process.env.DEBUG != null) message = err.stack || message;
|
||||||
|
console.log(message);
|
||||||
return Q.reject(err);
|
return Q.reject(err);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "GitBook",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"jquery": "2.1.1",
|
||||||
|
"lodash": "2.4.1",
|
||||||
|
"requirejs": "2.1.11",
|
||||||
|
"URIjs": "1.13.1",
|
||||||
|
"mousetrap": "1.4.6",
|
||||||
|
"lunr.js": "0.5.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
+183
-102
@@ -18,14 +18,27 @@ var generators = {
|
|||||||
|
|
||||||
var defaultDescription = "Book generated using GitBook";
|
var defaultDescription = "Book generated using GitBook";
|
||||||
|
|
||||||
/*
|
|
||||||
* Use a specific generator to convert a gitbook to a site/pdf/ebook/
|
|
||||||
* output is always a folder
|
|
||||||
*/
|
|
||||||
var generate = function(options) {
|
|
||||||
var generator = null;
|
|
||||||
var files;
|
|
||||||
|
|
||||||
|
var containsFiles = function(dir, files) {
|
||||||
|
return Q.all(_.map(files, function(file) {
|
||||||
|
return fs.exists(path.join(dir, file));
|
||||||
|
}))
|
||||||
|
.then(_.all);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Create the generator and load plugins
|
||||||
|
var loadGenerator = function(options) {
|
||||||
|
var generator = new generators[options.generator](options);
|
||||||
|
|
||||||
|
return generator.loadPlugins()
|
||||||
|
.then(_.constant(generator));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var generate = function(options) {
|
||||||
|
// Set defaults to options
|
||||||
options = _.defaults(options || {}, {
|
options = _.defaults(options || {}, {
|
||||||
// Folders to use
|
// Folders to use
|
||||||
"input": null,
|
"input": null,
|
||||||
@@ -54,22 +67,115 @@ var generate = function(options) {
|
|||||||
|
|
||||||
// Links
|
// Links
|
||||||
"links": {
|
"links": {
|
||||||
"about": null
|
"about": null,
|
||||||
|
"issues": null,
|
||||||
|
"contribue": null,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Validate options
|
||||||
if (!options.input) {
|
if (!options.input) {
|
||||||
return Q.reject(new Error("Need option input (book input directory)"));
|
return Q.reject(new Error("Need option input (book input directory)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure generator exists
|
||||||
if (!generators[options.generator]) {
|
if (!generators[options.generator]) {
|
||||||
return Q.reject(new Error("Invalid generator (availables are: "+_.keys(generators).join(", ")));
|
return Q.reject(new Error("Invalid generator (availables are: "+_.keys(generators).join(", ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check files to get folder type (book, multilanguage book or neither)
|
||||||
|
return Q()
|
||||||
|
|
||||||
|
// Read readme
|
||||||
|
.then(function() {
|
||||||
|
return fs.readFile(path.join(options.input, "README.md"), "utf-8")
|
||||||
|
.then(function(_readme) {
|
||||||
|
_readme = parse.readme(_readme);
|
||||||
|
|
||||||
|
options.title = options.title || _readme.title;
|
||||||
|
options.description = options.description || _readme.description || defaultDescription;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
// Detect multi-languages book
|
||||||
|
.then(function() {
|
||||||
|
return containsFiles(options.input, ['LANGS.md'])
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function(isMultiLang) {
|
||||||
|
// Multi language book
|
||||||
|
if(isMultiLang) {
|
||||||
|
return generateMultiLang(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Book
|
||||||
|
return generateBook(options);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var generateMultiLang = function(options) {
|
||||||
|
var langsSummary;
|
||||||
options.output = options.output || path.join(options.input, "_book");
|
options.output = options.output || path.join(options.input, "_book");
|
||||||
|
|
||||||
|
// Multi-languages book
|
||||||
|
return fs.readFile(path.join(options.input, "LANGS.md"), "utf-8")
|
||||||
|
|
||||||
// Clean output folder
|
// Clean output folder
|
||||||
return fs.remove(options.output)
|
.then(function(_langsSummary) {
|
||||||
|
langsSummary = _langsSummary;
|
||||||
|
return fs.remove(options.output);
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
return fs.mkdirp(options.output);
|
||||||
|
})
|
||||||
|
|
||||||
|
// Generate sub-books
|
||||||
|
.then(function() {
|
||||||
|
options.langsSummary = parse.langs(langsSummary);
|
||||||
|
|
||||||
|
// Generated a book for each valid entry
|
||||||
|
return _.reduce(options.langsSummary.list, function(prev, entry) {
|
||||||
|
return prev.then(function() {
|
||||||
|
return generate(_.extend({}, options, {
|
||||||
|
input: path.join(options.input, entry.path),
|
||||||
|
output: path.join(options.output, entry.path)
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
}, Q());
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(function() {
|
||||||
|
return loadGenerator(options);
|
||||||
|
})
|
||||||
|
|
||||||
|
// Generate languages index
|
||||||
|
.then(function(generator) {
|
||||||
|
return generator.langsIndex(options.langsSummary);
|
||||||
|
})
|
||||||
|
|
||||||
|
// Return options to caller
|
||||||
|
.then(_.constant(options));
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use a specific generator to convert a gitbook to a site/pdf/ebook/
|
||||||
|
* output is always a folder
|
||||||
|
*/
|
||||||
|
var generateBook = function(options) {
|
||||||
|
var files;
|
||||||
|
|
||||||
|
options.output = options.output || path.join(options.input, "_book");
|
||||||
|
|
||||||
|
// Check if it's a book
|
||||||
|
return containsFiles(options.input, ['SUMMARY.md', 'README.md'])
|
||||||
|
|
||||||
|
// Fail if not a book
|
||||||
|
.then(function(isBook) {
|
||||||
|
if(!isBook) {
|
||||||
|
return Q.reject(new Error("Invalid gitbook repository, need SUMMARY.md and README.md"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Read config file
|
// Read config file
|
||||||
.then(function() {
|
.then(function() {
|
||||||
@@ -83,11 +189,26 @@ var generate = function(options) {
|
|||||||
}, function() {
|
}, function() {
|
||||||
// No config file: not a big deal
|
// No config file: not a big deal
|
||||||
return Q();
|
return Q();
|
||||||
})
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
// Clean output folder
|
||||||
|
.then(function() {
|
||||||
|
return fs.remove(options.output);
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get repo's URL
|
// Get repo's URL
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
// Git deactivated
|
||||||
|
if(options.github === false) {
|
||||||
|
options.github = null;
|
||||||
|
return null;
|
||||||
|
} else if(options.github) {
|
||||||
|
// Git already specified in options
|
||||||
|
return options.github;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try auto detecting
|
||||||
return parse.git.url(options.input)
|
return parse.git.url(options.input)
|
||||||
.then(function(_url) {
|
.then(function(_url) {
|
||||||
// Get ID of repo
|
// Get ID of repo
|
||||||
@@ -96,7 +217,7 @@ var generate = function(options) {
|
|||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.then(function(repoId) {
|
.then(function(repoId) {
|
||||||
options.github = options.github || repoId;
|
options.github = repoId;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -109,108 +230,67 @@ var generate = function(options) {
|
|||||||
return fs.list(options.input)
|
return fs.list(options.input)
|
||||||
.then(function(_files) {
|
.then(function(_files) {
|
||||||
files = _files;
|
files = _files;
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create the generator and load plugins
|
|
||||||
.then(function() {
|
.then(function() {
|
||||||
generator = new generators[options.generator](options);
|
return loadGenerator(options);
|
||||||
return generator.loadPlugins();
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Detect multi-languages book
|
// Detect multi-languages book
|
||||||
.then(function() {
|
.then(function(generator) {
|
||||||
if (_.contains(files, "LANGS.md")) {
|
// Generate the book
|
||||||
// Multi-languages book
|
return Q()
|
||||||
return fs.readFile(path.join(options.input, "LANGS.md"), "utf-8")
|
|
||||||
|
|
||||||
// Generate sub-books
|
// Get summary
|
||||||
.then(function(_langsSummary) {
|
.then(function() {
|
||||||
options.langsSummary = parse.langs(_langsSummary);
|
return fs.readFile(path.join(options.input, "SUMMARY.md"), "utf-8")
|
||||||
|
.then(function(_summary) {
|
||||||
|
options.summary = parse.summary(_summary);
|
||||||
|
|
||||||
// Generated a book for each valid entry
|
// Parse navigation
|
||||||
return Q.all(
|
options.navigation = parse.navigation(options.summary);
|
||||||
_.map(options.langsSummary.list, function(entry) {
|
|
||||||
return generate(_.extend({}, options, {
|
|
||||||
input: path.join(options.input, entry.path),
|
|
||||||
output: path.join(options.output, entry.path)
|
|
||||||
}));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
})
|
|
||||||
|
|
||||||
// Generate languages index
|
|
||||||
.then(function() {
|
|
||||||
return generator.langsIndex(options.langsSummary);
|
|
||||||
});
|
});
|
||||||
} else if (!_.contains(files, "SUMMARY.md") || !_.contains(files, "README.md")) {
|
})
|
||||||
// Invalid book
|
|
||||||
return Q.reject(new Error("Invalid gitbook repository, need SUMMARY.md and README.md"));
|
|
||||||
} else {
|
|
||||||
// Generate the book
|
|
||||||
return Q()
|
|
||||||
|
|
||||||
// Read readme
|
// Skip processing some files
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return fs.readFile(path.join(options.input, "README.md"), "utf-8")
|
files = _.filter(files, function (file) {
|
||||||
.then(function(_readme) {
|
return !(
|
||||||
_readme = parse.readme(_readme);
|
file === 'SUMMARY.md'
|
||||||
|
|
||||||
options.title = options.title || _readme.title;
|
|
||||||
options.description = options.description || _readme.description || defaultDescription;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
// Get summary
|
|
||||||
.then(function() {
|
|
||||||
return fs.readFile(path.join(options.input, "SUMMARY.md"), "utf-8")
|
|
||||||
.then(function(_summary) {
|
|
||||||
options.summary = parse.summary(_summary);
|
|
||||||
|
|
||||||
// Parse navigation
|
|
||||||
options.navigation = parse.navigation(options.summary);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
// Skip processing some files
|
|
||||||
.then(function() {
|
|
||||||
files = _.filter(files, function (file) {
|
|
||||||
return !(
|
|
||||||
file === 'SUMMARY.md'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
// Copy file and replace markdown file
|
|
||||||
.then(function() {
|
|
||||||
return Q.all(
|
|
||||||
_.chain(files)
|
|
||||||
.map(function(file) {
|
|
||||||
if (!file) return;
|
|
||||||
|
|
||||||
if (file[file.length -1] == "/") {
|
|
||||||
return Q(generator.transferFolder(file));
|
|
||||||
} else if (path.extname(file) == ".md" && options.navigation[file] != null) {
|
|
||||||
return fs.readFile(path.join(options.input, file), "utf-8")
|
|
||||||
.then(function(content) {
|
|
||||||
return Q(generator.convertFile(content, file));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return Q(generator.transferFile(file));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.value()
|
|
||||||
);
|
);
|
||||||
})
|
|
||||||
|
|
||||||
// Finish generation
|
|
||||||
.then(function() {
|
|
||||||
return generator.finish();
|
|
||||||
})
|
|
||||||
.then(function() {
|
|
||||||
return generator.callHook("finish");
|
|
||||||
});
|
});
|
||||||
}
|
})
|
||||||
|
|
||||||
|
// Copy file and replace markdown file
|
||||||
|
.then(function() {
|
||||||
|
return Q.all(
|
||||||
|
_.chain(files)
|
||||||
|
.map(function(file) {
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
if (file[file.length -1] == "/") {
|
||||||
|
return Q(generator.transferFolder(file));
|
||||||
|
} else if (path.extname(file) == ".md" && options.navigation[file] != null) {
|
||||||
|
return fs.readFile(path.join(options.input, file), "utf-8")
|
||||||
|
.then(function(content) {
|
||||||
|
return Q(generator.convertFile(content, file));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return Q(generator.transferFile(file));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.value()
|
||||||
|
);
|
||||||
|
})
|
||||||
|
|
||||||
|
// Finish generation
|
||||||
|
.then(function() {
|
||||||
|
return generator.finish();
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
return generator.callHook("finish");
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// Return all options
|
// Return all options
|
||||||
@@ -281,5 +361,6 @@ module.exports = {
|
|||||||
generators: generators,
|
generators: generators,
|
||||||
folder: generate,
|
folder: generate,
|
||||||
file: generateFile,
|
file: generateFile,
|
||||||
Plugin: Plugin
|
book: generateBook,
|
||||||
|
Plugin: Plugin,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,6 +40,23 @@ Generator.prototype.convertFile = function(content, input) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Generate languages index
|
||||||
|
Generator.prototype.langsIndex = function(langs) {
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
var json = {
|
||||||
|
langs: langs.list
|
||||||
|
};
|
||||||
|
|
||||||
|
return Q()
|
||||||
|
.then(function() {
|
||||||
|
return fs.writeFile(
|
||||||
|
path.join(that.options.output, "langs.json"),
|
||||||
|
JSON.stringify(json, null, 4)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Generator.prototype.finish = function() {
|
Generator.prototype.finish = function() {
|
||||||
// ignore
|
// ignore
|
||||||
};
|
};
|
||||||
|
|||||||
+14
-3
@@ -1,5 +1,6 @@
|
|||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var marked = require('marked');
|
var marked = require('marked');
|
||||||
|
var textRenderer = require('marked-text-renderer');
|
||||||
|
|
||||||
function extractFirstNode(nodes, nType) {
|
function extractFirstNode(nodes, nType) {
|
||||||
return _.chain(nodes)
|
return _.chain(nodes)
|
||||||
@@ -14,16 +15,26 @@ function extractFirstNode(nodes, nType) {
|
|||||||
|
|
||||||
function parseReadme(src) {
|
function parseReadme(src) {
|
||||||
var nodes, title, description;
|
var nodes, title, description;
|
||||||
|
var renderer = textRenderer();
|
||||||
|
|
||||||
// Parse content
|
// Parse content
|
||||||
nodes = marked.lexer(src);
|
nodes = marked.lexer(src);
|
||||||
|
|
||||||
var title = extractFirstNode(nodes, "heading");
|
var title = extractFirstNode(nodes, "heading");
|
||||||
var description = extractFirstNode(nodes, "paragraph");
|
var description = extractFirstNode(nodes, "paragraph");
|
||||||
|
|
||||||
|
var convert = _.compose(
|
||||||
|
function(text) {
|
||||||
|
return _.unescape(text.replace(/(\r\n|\n|\r)/gm, ""));
|
||||||
|
},
|
||||||
|
_.partialRight(marked, _.extend({}, marked.defaults, {
|
||||||
|
renderer: renderer
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: title,
|
title: convert(title),
|
||||||
description: description
|
description: convert(description)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function parseTitle(src, nums) {
|
|||||||
level: level,
|
level: level,
|
||||||
|
|
||||||
// Replace .md references with .html
|
// Replace .md references with .html
|
||||||
path: matches[2],
|
path: matches[2].replace(/\\/g, '/'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "0.4.2",
|
"version": "0.4.4",
|
||||||
"homepage": "http://www.gitbook.io/",
|
"homepage": "http://www.gitbook.io/",
|
||||||
"description": "Library and cmd utility to generate GitBooks",
|
"description": "Library and cmd utility to generate GitBooks",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@@ -30,7 +30,8 @@
|
|||||||
"grunt": "~0.4.2",
|
"grunt": "~0.4.2",
|
||||||
"grunt-cli": "0.1.11",
|
"grunt-cli": "0.1.11",
|
||||||
"grunt-contrib-less": "~0.5.0",
|
"grunt-contrib-less": "~0.5.0",
|
||||||
"grunt-contrib-requirejs": "0.4.1"
|
"grunt-contrib-requirejs": "0.4.1",
|
||||||
|
"grunt-bower-install-simple": "0.9.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "export TESTING=true; mocha --reporter list"
|
"test": "export TESTING=true; mocha --reporter list"
|
||||||
|
|||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
# This is a test
|
||||||
|
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
* [test](test.md)
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
# Test
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
# This should fail
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
var _ = require('lodash');
|
||||||
|
var Q = require('q');
|
||||||
|
var path = require('path');
|
||||||
|
var tmp = require('tmp');
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var generate = require("../lib/generate");
|
||||||
|
|
||||||
|
var generateTmpBook = function(path) {
|
||||||
|
return ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var BOOKS = {
|
||||||
|
"book1": true,
|
||||||
|
"book2": false
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('Site Generation', function () {
|
||||||
|
var ret = {};
|
||||||
|
|
||||||
|
beforeEach(function(done){
|
||||||
|
Q.all(_.map(BOOKS, function(state, bookName) {
|
||||||
|
return Q.nfcall(tmp.dir)
|
||||||
|
.then(function(_dir) {
|
||||||
|
return generate.folder({
|
||||||
|
input: path.join(__dirname, "fixtures", bookName),
|
||||||
|
output: _dir
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(function(_book) {
|
||||||
|
ret[bookName] = _book;
|
||||||
|
}, function(err) {
|
||||||
|
// ignore errors here
|
||||||
|
});
|
||||||
|
}))
|
||||||
|
.fin(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should generate the valid sites', function() {
|
||||||
|
_.each(BOOKS, function(state, bookName) {
|
||||||
|
assert((ret[bookName] != null) == state);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,6 +4,17 @@ define([
|
|||||||
], function($, storage) {
|
], function($, storage) {
|
||||||
var fontState;
|
var fontState;
|
||||||
|
|
||||||
|
var THEMES = {
|
||||||
|
"white": 0,
|
||||||
|
"sepia": 1,
|
||||||
|
"night": 2
|
||||||
|
};
|
||||||
|
|
||||||
|
var FAMILY = {
|
||||||
|
"serif": 0,
|
||||||
|
"sans": 1
|
||||||
|
};
|
||||||
|
|
||||||
var togglePopover = function(e) {
|
var togglePopover = function(e) {
|
||||||
var $dropdown = $("#font-settings-wrapper .dropdown-menu");
|
var $dropdown = $("#font-settings-wrapper .dropdown-menu");
|
||||||
|
|
||||||
@@ -11,7 +22,7 @@ define([
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
var closePopover = function(e) {
|
var closePopover = function(e) {
|
||||||
var $dropdown = $("#font-settings-wrapper .dropdown-menu");
|
var $dropdown = $("#font-settings-wrapper .dropdown-menu");
|
||||||
|
|
||||||
@@ -29,7 +40,7 @@ define([
|
|||||||
fontState.save();
|
fontState.save();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var reduceFontSize = function(e){
|
var reduceFontSize = function(e){
|
||||||
var $bookBody = $(".book-body");
|
var $bookBody = $(".book-body");
|
||||||
|
|
||||||
@@ -70,7 +81,7 @@ define([
|
|||||||
fontState.save();
|
fontState.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
var init = function() {
|
var init = function(config) {
|
||||||
var $toggle, $bookBody, $dropdown, $book;
|
var $toggle, $bookBody, $dropdown, $book;
|
||||||
|
|
||||||
//Find DOM elements.
|
//Find DOM elements.
|
||||||
@@ -79,11 +90,11 @@ define([
|
|||||||
$dropdown = $("#font-settings-wrapper .dropdown-menu");
|
$dropdown = $("#font-settings-wrapper .dropdown-menu");
|
||||||
$bookBody = $(".book-body");
|
$bookBody = $(".book-body");
|
||||||
|
|
||||||
//Instantiate font state object
|
// Instantiate font state object
|
||||||
fontState = storage.get("fontState", {
|
fontState = storage.get("fontState", {
|
||||||
size:1,
|
size: config.size || 1,
|
||||||
family:0,
|
family: FAMILY[config.family || "serif"],
|
||||||
theme:0
|
theme: THEMES[config.theme || "white"]
|
||||||
});
|
});
|
||||||
fontState.save = function(){
|
fontState.save = function(){
|
||||||
storage.set("fontState",fontState);
|
storage.set("fontState",fontState);
|
||||||
@@ -100,15 +111,15 @@ define([
|
|||||||
//Add event listeners
|
//Add event listeners
|
||||||
$(document).on('click', "#enlarge-font-size", enlargeFontSize);
|
$(document).on('click', "#enlarge-font-size", enlargeFontSize);
|
||||||
$(document).on('click', "#reduce-font-size", reduceFontSize);
|
$(document).on('click', "#reduce-font-size", reduceFontSize);
|
||||||
|
|
||||||
$(document).on('click', "#font-settings-wrapper .font-family-list li", changeFontFamily);
|
$(document).on('click', "#font-settings-wrapper .font-family-list li", changeFontFamily);
|
||||||
$(document).on('click', "#font-settings-wrapper .color-theme-list button", changeColorTheme);
|
$(document).on('click', "#font-settings-wrapper .color-theme-list button", changeColorTheme);
|
||||||
|
|
||||||
$(document).on('click', ".book-header .toggle-font-settings", togglePopover);
|
$(document).on('click', ".book-header .toggle-font-settings", togglePopover);
|
||||||
$(document).on('click', "#font-settings-wrapper .dropdown-menu", function(e){ e.stopPropagation(); });
|
$(document).on('click', "#font-settings-wrapper .dropdown-menu", function(e){ e.stopPropagation(); });
|
||||||
$(document).on("click", closePopover);
|
$(document).on("click", closePopover);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init
|
init: init
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
define([
|
define([
|
||||||
"jQuery",
|
"jQuery",
|
||||||
"utils/path",
|
"utils/url",
|
||||||
"core/events",
|
"core/events",
|
||||||
"core/state",
|
"core/state",
|
||||||
"core/search",
|
"core/search",
|
||||||
@@ -8,15 +8,15 @@ define([
|
|||||||
"core/exercise",
|
"core/exercise",
|
||||||
"core/quiz",
|
"core/quiz",
|
||||||
"core/loading"
|
"core/loading"
|
||||||
], function($, path, events, state, search, progress, exercises, quiz, loading) {
|
], function($, URL, events, state, search, progress, exercises, quiz, loading) {
|
||||||
var prev, next;
|
var prev, next;
|
||||||
var githubCountStars, githubCountWatch;
|
var githubCountStars, githubCountWatch;
|
||||||
|
|
||||||
var usePushState = (typeof history.pushState !== "undefined");
|
var usePushState = (typeof history.pushState !== "undefined");
|
||||||
|
|
||||||
var handleNavigation = function(relativeUrl, push) {
|
var handleNavigation = function(relativeUrl, push) {
|
||||||
var url = path.isAbsolute(relativeUrl) ? relativeUrl : path.join(path.dirname(window.location.pathname), relativeUrl);
|
var url = URL.join(window.location.pathname, relativeUrl);
|
||||||
console.log("navigate to ", url, "baseurl="+relativeUrl);
|
console.log("navigate to ", url, "baseurl="+relativeUrl, "current="+window.location.pathname);
|
||||||
|
|
||||||
if (!usePushState) {
|
if (!usePushState) {
|
||||||
// Refresh the page to the new URL if pushState not supported
|
// Refresh the page to the new URL if pushState not supported
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ define([
|
|||||||
|
|
||||||
// Bind sharing button
|
// Bind sharing button
|
||||||
sharing.init();
|
sharing.init();
|
||||||
|
|
||||||
// Init navigation
|
// Init navigation
|
||||||
navigation.init();
|
navigation.init();
|
||||||
|
|
||||||
//Init font settings
|
//Init font settings
|
||||||
fontSettings.init();
|
fontSettings.init(config.fontSettings || {});
|
||||||
|
|
||||||
events.trigger("start", config);
|
events.trigger("start", config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
define([], function() {
|
|
||||||
// Joins path segments. Preserves initial "/" and resolves ".." and "."
|
|
||||||
// Does not support using ".." to go above/outside the root.
|
|
||||||
// This means that join("foo", "../../bar") will not resolve to "../bar"
|
|
||||||
function join(/* path segments */) {
|
|
||||||
// Split the inputs into a list of path commands.
|
|
||||||
var parts = [];
|
|
||||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
||||||
parts = parts.concat(arguments[i].split("/"));
|
|
||||||
}
|
|
||||||
// Interpret the path commands to get the new resolved path.
|
|
||||||
var newParts = [];
|
|
||||||
for (i = 0, l = parts.length; i < l; i++) {
|
|
||||||
var part = parts[i];
|
|
||||||
// Remove leading and trailing slashes
|
|
||||||
// Also remove "." segments
|
|
||||||
if (!part || part === ".") continue;
|
|
||||||
// Interpret ".." to pop the last segment
|
|
||||||
if (part === "..") newParts.pop();
|
|
||||||
// Push new path segments.
|
|
||||||
else newParts.push(part);
|
|
||||||
}
|
|
||||||
// Preserve the initial slash if there was one.
|
|
||||||
if (parts[0] === "") newParts.unshift("");
|
|
||||||
// Turn back into a single string path.
|
|
||||||
return newParts.join("/") || (newParts.length ? "/" : ".");
|
|
||||||
}
|
|
||||||
|
|
||||||
// A simple function to get the dirname of a path
|
|
||||||
// Trailing slashes are ignored. Leading slash is preserved.
|
|
||||||
function dirname(path) {
|
|
||||||
return join(path, "..");
|
|
||||||
}
|
|
||||||
|
|
||||||
// test if a path or url is absolute
|
|
||||||
function isAbsolute(path) {
|
|
||||||
if (!path) return false;
|
|
||||||
|
|
||||||
return (path[0] == "/" || path.indexOf("http://") == 0 || path.indexOf("https://") == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
dirname: dirname,
|
|
||||||
join: join,
|
|
||||||
isAbsolute: isAbsolute
|
|
||||||
};
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
define([
|
||||||
|
"vendors/URIjs/src/URI"
|
||||||
|
], function(URI) {
|
||||||
|
// Joins path segments. Preserves initial "/" and resolves ".." and "."
|
||||||
|
// Does not support using ".." to go above/outside the root.
|
||||||
|
// This means that join("foo", "../../bar") will not resolve to "../bar"
|
||||||
|
function join(baseUrl, url) {
|
||||||
|
var theUrl = new URI(url);
|
||||||
|
if (theUrl.is("relative")) {
|
||||||
|
theUrl = theUrl.absoluteTo(baseUrl);
|
||||||
|
}
|
||||||
|
return theUrl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// A simple function to get the dirname of a path
|
||||||
|
// Trailing slashes are ignored. Leading slash is preserved.
|
||||||
|
function dirname(path) {
|
||||||
|
return join(path, "..");
|
||||||
|
}
|
||||||
|
|
||||||
|
// test if a path or url is absolute
|
||||||
|
function isAbsolute(path) {
|
||||||
|
if (!path) return false;
|
||||||
|
|
||||||
|
return (path[0] == "/" || path.indexOf("http://") == 0 || path.indexOf("https://") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
dirname: dirname,
|
||||||
|
join: join,
|
||||||
|
isAbsolute: isAbsolute
|
||||||
|
};
|
||||||
|
})
|
||||||
Vendored
-9111
File diff suppressed because it is too large
Load Diff
Vendored
-6785
File diff suppressed because it is too large
Load Diff
-953
@@ -1,953 +0,0 @@
|
|||||||
/*global define:false */
|
|
||||||
/**
|
|
||||||
* Copyright 2013 Craig Campbell
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
* Mousetrap is a simple keyboard shortcut library for Javascript with
|
|
||||||
* no external dependencies
|
|
||||||
*
|
|
||||||
* @version 1.4.6
|
|
||||||
* @url craig.is/killing/mice
|
|
||||||
*/
|
|
||||||
(function(window, document, undefined) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mapping of special keycodes to their corresponding keys
|
|
||||||
*
|
|
||||||
* everything in this dictionary cannot use keypress events
|
|
||||||
* so it has to be here to map to the correct keycodes for
|
|
||||||
* keyup/keydown events
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
var _MAP = {
|
|
||||||
8: 'backspace',
|
|
||||||
9: 'tab',
|
|
||||||
13: 'enter',
|
|
||||||
16: 'shift',
|
|
||||||
17: 'ctrl',
|
|
||||||
18: 'alt',
|
|
||||||
20: 'capslock',
|
|
||||||
27: 'esc',
|
|
||||||
32: 'space',
|
|
||||||
33: 'pageup',
|
|
||||||
34: 'pagedown',
|
|
||||||
35: 'end',
|
|
||||||
36: 'home',
|
|
||||||
37: 'left',
|
|
||||||
38: 'up',
|
|
||||||
39: 'right',
|
|
||||||
40: 'down',
|
|
||||||
45: 'ins',
|
|
||||||
46: 'del',
|
|
||||||
91: 'meta',
|
|
||||||
93: 'meta',
|
|
||||||
224: 'meta'
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mapping for special characters so they can support
|
|
||||||
*
|
|
||||||
* this dictionary is only used incase you want to bind a
|
|
||||||
* keyup or keydown event to one of these keys
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
_KEYCODE_MAP = {
|
|
||||||
106: '*',
|
|
||||||
107: '+',
|
|
||||||
109: '-',
|
|
||||||
110: '.',
|
|
||||||
111 : '/',
|
|
||||||
186: ';',
|
|
||||||
187: '=',
|
|
||||||
188: ',',
|
|
||||||
189: '-',
|
|
||||||
190: '.',
|
|
||||||
191: '/',
|
|
||||||
192: '`',
|
|
||||||
219: '[',
|
|
||||||
220: '\\',
|
|
||||||
221: ']',
|
|
||||||
222: '\''
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this is a mapping of keys that require shift on a US keypad
|
|
||||||
* back to the non shift equivelents
|
|
||||||
*
|
|
||||||
* this is so you can use keyup events with these keys
|
|
||||||
*
|
|
||||||
* note that this will only work reliably on US keyboards
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
_SHIFT_MAP = {
|
|
||||||
'~': '`',
|
|
||||||
'!': '1',
|
|
||||||
'@': '2',
|
|
||||||
'#': '3',
|
|
||||||
'$': '4',
|
|
||||||
'%': '5',
|
|
||||||
'^': '6',
|
|
||||||
'&': '7',
|
|
||||||
'*': '8',
|
|
||||||
'(': '9',
|
|
||||||
')': '0',
|
|
||||||
'_': '-',
|
|
||||||
'+': '=',
|
|
||||||
':': ';',
|
|
||||||
'\"': '\'',
|
|
||||||
'<': ',',
|
|
||||||
'>': '.',
|
|
||||||
'?': '/',
|
|
||||||
'|': '\\'
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this is a list of special strings you can use to map
|
|
||||||
* to modifier keys when you specify your keyboard shortcuts
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
_SPECIAL_ALIASES = {
|
|
||||||
'option': 'alt',
|
|
||||||
'command': 'meta',
|
|
||||||
'return': 'enter',
|
|
||||||
'escape': 'esc',
|
|
||||||
'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* variable to store the flipped version of _MAP from above
|
|
||||||
* needed to check if we should use keypress or not when no action
|
|
||||||
* is specified
|
|
||||||
*
|
|
||||||
* @type {Object|undefined}
|
|
||||||
*/
|
|
||||||
_REVERSE_MAP,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a list of all the callbacks setup via Mousetrap.bind()
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
_callbacks = {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* direct map of string combinations to callbacks used for trigger()
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
_directMap = {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* keeps track of what level each sequence is at since multiple
|
|
||||||
* sequences can start out with the same sequence
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
_sequenceLevels = {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* variable to store the setTimeout call
|
|
||||||
*
|
|
||||||
* @type {null|number}
|
|
||||||
*/
|
|
||||||
_resetTimer,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* temporary state where we will ignore the next keyup
|
|
||||||
*
|
|
||||||
* @type {boolean|string}
|
|
||||||
*/
|
|
||||||
_ignoreNextKeyup = false,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* temporary state where we will ignore the next keypress
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
_ignoreNextKeypress = false,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* are we currently inside of a sequence?
|
|
||||||
* type of action ("keyup" or "keydown" or "keypress") or false
|
|
||||||
*
|
|
||||||
* @type {boolean|string}
|
|
||||||
*/
|
|
||||||
_nextExpectedAction = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* loop through the f keys, f1 to f19 and add them to the map
|
|
||||||
* programatically
|
|
||||||
*/
|
|
||||||
for (var i = 1; i < 20; ++i) {
|
|
||||||
_MAP[111 + i] = 'f' + i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* loop through to map numbers on the numeric keypad
|
|
||||||
*/
|
|
||||||
for (i = 0; i <= 9; ++i) {
|
|
||||||
_MAP[i + 96] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cross browser add event method
|
|
||||||
*
|
|
||||||
* @param {Element|HTMLDocument} object
|
|
||||||
* @param {string} type
|
|
||||||
* @param {Function} callback
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _addEvent(object, type, callback) {
|
|
||||||
if (object.addEventListener) {
|
|
||||||
object.addEventListener(type, callback, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
object.attachEvent('on' + type, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* takes the event and returns the key character
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
function _characterFromEvent(e) {
|
|
||||||
|
|
||||||
// for keypress events we should return the character as is
|
|
||||||
if (e.type == 'keypress') {
|
|
||||||
var character = String.fromCharCode(e.which);
|
|
||||||
|
|
||||||
// if the shift key is not pressed then it is safe to assume
|
|
||||||
// that we want the character to be lowercase. this means if
|
|
||||||
// you accidentally have caps lock on then your key bindings
|
|
||||||
// will continue to work
|
|
||||||
//
|
|
||||||
// the only side effect that might not be desired is if you
|
|
||||||
// bind something like 'A' cause you want to trigger an
|
|
||||||
// event when capital A is pressed caps lock will no longer
|
|
||||||
// trigger the event. shift+a will though.
|
|
||||||
if (!e.shiftKey) {
|
|
||||||
character = character.toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for non keypress events the special maps are needed
|
|
||||||
if (_MAP[e.which]) {
|
|
||||||
return _MAP[e.which];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_KEYCODE_MAP[e.which]) {
|
|
||||||
return _KEYCODE_MAP[e.which];
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it is not in the special map
|
|
||||||
|
|
||||||
// with keydown and keyup events the character seems to always
|
|
||||||
// come in as an uppercase character whether you are pressing shift
|
|
||||||
// or not. we should make sure it is always lowercase for comparisons
|
|
||||||
return String.fromCharCode(e.which).toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* checks if two arrays are equal
|
|
||||||
*
|
|
||||||
* @param {Array} modifiers1
|
|
||||||
* @param {Array} modifiers2
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function _modifiersMatch(modifiers1, modifiers2) {
|
|
||||||
return modifiers1.sort().join(',') === modifiers2.sort().join(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* resets all sequence counters except for the ones passed in
|
|
||||||
*
|
|
||||||
* @param {Object} doNotReset
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _resetSequences(doNotReset) {
|
|
||||||
doNotReset = doNotReset || {};
|
|
||||||
|
|
||||||
var activeSequences = false,
|
|
||||||
key;
|
|
||||||
|
|
||||||
for (key in _sequenceLevels) {
|
|
||||||
if (doNotReset[key]) {
|
|
||||||
activeSequences = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_sequenceLevels[key] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!activeSequences) {
|
|
||||||
_nextExpectedAction = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* finds all callbacks that match based on the keycode, modifiers,
|
|
||||||
* and action
|
|
||||||
*
|
|
||||||
* @param {string} character
|
|
||||||
* @param {Array} modifiers
|
|
||||||
* @param {Event|Object} e
|
|
||||||
* @param {string=} sequenceName - name of the sequence we are looking for
|
|
||||||
* @param {string=} combination
|
|
||||||
* @param {number=} level
|
|
||||||
* @returns {Array}
|
|
||||||
*/
|
|
||||||
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
|
|
||||||
var i,
|
|
||||||
callback,
|
|
||||||
matches = [],
|
|
||||||
action = e.type;
|
|
||||||
|
|
||||||
// if there are no events related to this keycode
|
|
||||||
if (!_callbacks[character]) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// if a modifier key is coming up on its own we should allow it
|
|
||||||
if (action == 'keyup' && _isModifier(character)) {
|
|
||||||
modifiers = [character];
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through all callbacks for the key that was pressed
|
|
||||||
// and see if any of them match
|
|
||||||
for (i = 0; i < _callbacks[character].length; ++i) {
|
|
||||||
callback = _callbacks[character][i];
|
|
||||||
|
|
||||||
// if a sequence name is not specified, but this is a sequence at
|
|
||||||
// the wrong level then move onto the next match
|
|
||||||
if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the action we are looking for doesn't match the action we got
|
|
||||||
// then we should keep going
|
|
||||||
if (action != callback.action) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this is a keypress event and the meta key and control key
|
|
||||||
// are not pressed that means that we need to only look at the
|
|
||||||
// character, otherwise check the modifiers as well
|
|
||||||
//
|
|
||||||
// chrome will not fire a keypress if meta or control is down
|
|
||||||
// safari will fire a keypress if meta or meta+shift is down
|
|
||||||
// firefox will fire a keypress if meta or control is down
|
|
||||||
if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
|
|
||||||
|
|
||||||
// when you bind a combination or sequence a second time it
|
|
||||||
// should overwrite the first one. if a sequenceName or
|
|
||||||
// combination is specified in this call it does just that
|
|
||||||
//
|
|
||||||
// @todo make deleting its own method?
|
|
||||||
var deleteCombo = !sequenceName && callback.combo == combination;
|
|
||||||
var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
|
|
||||||
if (deleteCombo || deleteSequence) {
|
|
||||||
_callbacks[character].splice(i, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
matches.push(callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* takes a key event and figures out what the modifiers are
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns {Array}
|
|
||||||
*/
|
|
||||||
function _eventModifiers(e) {
|
|
||||||
var modifiers = [];
|
|
||||||
|
|
||||||
if (e.shiftKey) {
|
|
||||||
modifiers.push('shift');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.altKey) {
|
|
||||||
modifiers.push('alt');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.ctrlKey) {
|
|
||||||
modifiers.push('ctrl');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.metaKey) {
|
|
||||||
modifiers.push('meta');
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* prevents default for this event
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _preventDefault(e) {
|
|
||||||
if (e.preventDefault) {
|
|
||||||
e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* stops propogation for this event
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _stopPropagation(e) {
|
|
||||||
if (e.stopPropagation) {
|
|
||||||
e.stopPropagation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.cancelBubble = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* actually calls the callback function
|
|
||||||
*
|
|
||||||
* if your callback function returns false this will use the jquery
|
|
||||||
* convention - prevent default and stop propogation on the event
|
|
||||||
*
|
|
||||||
* @param {Function} callback
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _fireCallback(callback, e, combo, sequence) {
|
|
||||||
|
|
||||||
// if this event should not happen stop here
|
|
||||||
if (Mousetrap.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callback(e, combo) === false) {
|
|
||||||
_preventDefault(e);
|
|
||||||
_stopPropagation(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* handles a character key event
|
|
||||||
*
|
|
||||||
* @param {string} character
|
|
||||||
* @param {Array} modifiers
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _handleKey(character, modifiers, e) {
|
|
||||||
var callbacks = _getMatches(character, modifiers, e),
|
|
||||||
i,
|
|
||||||
doNotReset = {},
|
|
||||||
maxLevel = 0,
|
|
||||||
processedSequenceCallback = false;
|
|
||||||
|
|
||||||
// Calculate the maxLevel for sequences so we can only execute the longest callback sequence
|
|
||||||
for (i = 0; i < callbacks.length; ++i) {
|
|
||||||
if (callbacks[i].seq) {
|
|
||||||
maxLevel = Math.max(maxLevel, callbacks[i].level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through matching callbacks for this key event
|
|
||||||
for (i = 0; i < callbacks.length; ++i) {
|
|
||||||
|
|
||||||
// fire for all sequence callbacks
|
|
||||||
// this is because if for example you have multiple sequences
|
|
||||||
// bound such as "g i" and "g t" they both need to fire the
|
|
||||||
// callback for matching g cause otherwise you can only ever
|
|
||||||
// match the first one
|
|
||||||
if (callbacks[i].seq) {
|
|
||||||
|
|
||||||
// only fire callbacks for the maxLevel to prevent
|
|
||||||
// subsequences from also firing
|
|
||||||
//
|
|
||||||
// for example 'a option b' should not cause 'option b' to fire
|
|
||||||
// even though 'option b' is part of the other sequence
|
|
||||||
//
|
|
||||||
// any sequences that do not match here will be discarded
|
|
||||||
// below by the _resetSequences call
|
|
||||||
if (callbacks[i].level != maxLevel) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
processedSequenceCallback = true;
|
|
||||||
|
|
||||||
// keep a list of which sequences were matches for later
|
|
||||||
doNotReset[callbacks[i].seq] = 1;
|
|
||||||
_fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if there were no sequence matches but we are still here
|
|
||||||
// that means this is a regular match so we should fire that
|
|
||||||
if (!processedSequenceCallback) {
|
|
||||||
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the key you pressed matches the type of sequence without
|
|
||||||
// being a modifier (ie "keyup" or "keypress") then we should
|
|
||||||
// reset all sequences that were not matched by this event
|
|
||||||
//
|
|
||||||
// this is so, for example, if you have the sequence "h a t" and you
|
|
||||||
// type "h e a r t" it does not match. in this case the "e" will
|
|
||||||
// cause the sequence to reset
|
|
||||||
//
|
|
||||||
// modifier keys are ignored because you can have a sequence
|
|
||||||
// that contains modifiers such as "enter ctrl+space" and in most
|
|
||||||
// cases the modifier key will be pressed before the next key
|
|
||||||
//
|
|
||||||
// also if you have a sequence such as "ctrl+b a" then pressing the
|
|
||||||
// "b" key will trigger a "keypress" and a "keydown"
|
|
||||||
//
|
|
||||||
// the "keydown" is expected when there is a modifier, but the
|
|
||||||
// "keypress" ends up matching the _nextExpectedAction since it occurs
|
|
||||||
// after and that causes the sequence to reset
|
|
||||||
//
|
|
||||||
// we ignore keypresses in a sequence that directly follow a keydown
|
|
||||||
// for the same character
|
|
||||||
var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
|
|
||||||
if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
|
|
||||||
_resetSequences(doNotReset);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* handles a keydown event
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _handleKeyEvent(e) {
|
|
||||||
|
|
||||||
// normalize e.which for key events
|
|
||||||
// @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
|
|
||||||
if (typeof e.which !== 'number') {
|
|
||||||
e.which = e.keyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
var character = _characterFromEvent(e);
|
|
||||||
|
|
||||||
// no character found then stop
|
|
||||||
if (!character) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to use === for the character check because the character can be 0
|
|
||||||
if (e.type == 'keyup' && _ignoreNextKeyup === character) {
|
|
||||||
_ignoreNextKeyup = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mousetrap.handleKey(character, _eventModifiers(e), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* determines if the keycode specified is a modifier key or not
|
|
||||||
*
|
|
||||||
* @param {string} key
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function _isModifier(key) {
|
|
||||||
return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* called to set a 1 second timeout on the specified sequence
|
|
||||||
*
|
|
||||||
* this is so after each key press in the sequence you have 1 second
|
|
||||||
* to press the next key before you have to start over
|
|
||||||
*
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _resetSequenceTimer() {
|
|
||||||
clearTimeout(_resetTimer);
|
|
||||||
_resetTimer = setTimeout(_resetSequences, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reverses the map lookup so that we can look for specific keys
|
|
||||||
* to see what can and can't use keypress
|
|
||||||
*
|
|
||||||
* @return {Object}
|
|
||||||
*/
|
|
||||||
function _getReverseMap() {
|
|
||||||
if (!_REVERSE_MAP) {
|
|
||||||
_REVERSE_MAP = {};
|
|
||||||
for (var key in _MAP) {
|
|
||||||
|
|
||||||
// pull out the numeric keypad from here cause keypress should
|
|
||||||
// be able to detect the keys from the character
|
|
||||||
if (key > 95 && key < 112) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_MAP.hasOwnProperty(key)) {
|
|
||||||
_REVERSE_MAP[_MAP[key]] = key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _REVERSE_MAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* picks the best action based on the key combination
|
|
||||||
*
|
|
||||||
* @param {string} key - character for key
|
|
||||||
* @param {Array} modifiers
|
|
||||||
* @param {string=} action passed in
|
|
||||||
*/
|
|
||||||
function _pickBestAction(key, modifiers, action) {
|
|
||||||
|
|
||||||
// if no action was picked in we should try to pick the one
|
|
||||||
// that we think would work best for this key
|
|
||||||
if (!action) {
|
|
||||||
action = _getReverseMap()[key] ? 'keydown' : 'keypress';
|
|
||||||
}
|
|
||||||
|
|
||||||
// modifier keys don't work as expected with keypress,
|
|
||||||
// switch to keydown
|
|
||||||
if (action == 'keypress' && modifiers.length) {
|
|
||||||
action = 'keydown';
|
|
||||||
}
|
|
||||||
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* binds a key sequence to an event
|
|
||||||
*
|
|
||||||
* @param {string} combo - combo specified in bind call
|
|
||||||
* @param {Array} keys
|
|
||||||
* @param {Function} callback
|
|
||||||
* @param {string=} action
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _bindSequence(combo, keys, callback, action) {
|
|
||||||
|
|
||||||
// start off by adding a sequence level record for this combination
|
|
||||||
// and setting the level to 0
|
|
||||||
_sequenceLevels[combo] = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* callback to increase the sequence level for this sequence and reset
|
|
||||||
* all other sequences that were active
|
|
||||||
*
|
|
||||||
* @param {string} nextAction
|
|
||||||
* @returns {Function}
|
|
||||||
*/
|
|
||||||
function _increaseSequence(nextAction) {
|
|
||||||
return function() {
|
|
||||||
_nextExpectedAction = nextAction;
|
|
||||||
++_sequenceLevels[combo];
|
|
||||||
_resetSequenceTimer();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* wraps the specified callback inside of another function in order
|
|
||||||
* to reset all sequence counters as soon as this sequence is done
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _callbackAndReset(e) {
|
|
||||||
_fireCallback(callback, e, combo);
|
|
||||||
|
|
||||||
// we should ignore the next key up if the action is key down
|
|
||||||
// or keypress. this is so if you finish a sequence and
|
|
||||||
// release the key the final key will not trigger a keyup
|
|
||||||
if (action !== 'keyup') {
|
|
||||||
_ignoreNextKeyup = _characterFromEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// weird race condition if a sequence ends with the key
|
|
||||||
// another sequence begins with
|
|
||||||
setTimeout(_resetSequences, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through keys one at a time and bind the appropriate callback
|
|
||||||
// function. for any key leading up to the final one it should
|
|
||||||
// increase the sequence. after the final, it should reset all sequences
|
|
||||||
//
|
|
||||||
// if an action is specified in the original bind call then that will
|
|
||||||
// be used throughout. otherwise we will pass the action that the
|
|
||||||
// next key in the sequence should match. this allows a sequence
|
|
||||||
// to mix and match keypress and keydown events depending on which
|
|
||||||
// ones are better suited to the key provided
|
|
||||||
for (var i = 0; i < keys.length; ++i) {
|
|
||||||
var isFinal = i + 1 === keys.length;
|
|
||||||
var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
|
|
||||||
_bindSingle(keys[i], wrappedCallback, action, combo, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts from a string key combination to an array
|
|
||||||
*
|
|
||||||
* @param {string} combination like "command+shift+l"
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function _keysFromString(combination) {
|
|
||||||
if (combination === '+') {
|
|
||||||
return ['+'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return combination.split('+');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets info for a specific key combination
|
|
||||||
*
|
|
||||||
* @param {string} combination key combination ("command+s" or "a" or "*")
|
|
||||||
* @param {string=} action
|
|
||||||
* @returns {Object}
|
|
||||||
*/
|
|
||||||
function _getKeyInfo(combination, action) {
|
|
||||||
var keys,
|
|
||||||
key,
|
|
||||||
i,
|
|
||||||
modifiers = [];
|
|
||||||
|
|
||||||
// take the keys from this pattern and figure out what the actual
|
|
||||||
// pattern is all about
|
|
||||||
keys = _keysFromString(combination);
|
|
||||||
|
|
||||||
for (i = 0; i < keys.length; ++i) {
|
|
||||||
key = keys[i];
|
|
||||||
|
|
||||||
// normalize key names
|
|
||||||
if (_SPECIAL_ALIASES[key]) {
|
|
||||||
key = _SPECIAL_ALIASES[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this is not a keypress event then we should
|
|
||||||
// be smart about using shift keys
|
|
||||||
// this will only work for US keyboards however
|
|
||||||
if (action && action != 'keypress' && _SHIFT_MAP[key]) {
|
|
||||||
key = _SHIFT_MAP[key];
|
|
||||||
modifiers.push('shift');
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this key is a modifier then add it to the list of modifiers
|
|
||||||
if (_isModifier(key)) {
|
|
||||||
modifiers.push(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// depending on what the key combination is
|
|
||||||
// we will try to pick the best event for it
|
|
||||||
action = _pickBestAction(key, modifiers, action);
|
|
||||||
|
|
||||||
return {
|
|
||||||
key: key,
|
|
||||||
modifiers: modifiers,
|
|
||||||
action: action
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* binds a single keyboard combination
|
|
||||||
*
|
|
||||||
* @param {string} combination
|
|
||||||
* @param {Function} callback
|
|
||||||
* @param {string=} action
|
|
||||||
* @param {string=} sequenceName - name of sequence if part of sequence
|
|
||||||
* @param {number=} level - what part of the sequence the command is
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _bindSingle(combination, callback, action, sequenceName, level) {
|
|
||||||
|
|
||||||
// store a direct mapped reference for use with Mousetrap.trigger
|
|
||||||
_directMap[combination + ':' + action] = callback;
|
|
||||||
|
|
||||||
// make sure multiple spaces in a row become a single space
|
|
||||||
combination = combination.replace(/\s+/g, ' ');
|
|
||||||
|
|
||||||
var sequence = combination.split(' '),
|
|
||||||
info;
|
|
||||||
|
|
||||||
// if this pattern is a sequence of keys then run through this method
|
|
||||||
// to reprocess each pattern one key at a time
|
|
||||||
if (sequence.length > 1) {
|
|
||||||
_bindSequence(combination, sequence, callback, action);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
info = _getKeyInfo(combination, action);
|
|
||||||
|
|
||||||
// make sure to initialize array if this is the first time
|
|
||||||
// a callback is added for this key
|
|
||||||
_callbacks[info.key] = _callbacks[info.key] || [];
|
|
||||||
|
|
||||||
// remove an existing match if there is one
|
|
||||||
_getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
|
|
||||||
|
|
||||||
// add this call back to the array
|
|
||||||
// if it is a sequence put it at the beginning
|
|
||||||
// if not put it at the end
|
|
||||||
//
|
|
||||||
// this is important because the way these are processed expects
|
|
||||||
// the sequence ones to come first
|
|
||||||
_callbacks[info.key][sequenceName ? 'unshift' : 'push']({
|
|
||||||
callback: callback,
|
|
||||||
modifiers: info.modifiers,
|
|
||||||
action: info.action,
|
|
||||||
seq: sequenceName,
|
|
||||||
level: level,
|
|
||||||
combo: combination
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* binds multiple combinations to the same callback
|
|
||||||
*
|
|
||||||
* @param {Array} combinations
|
|
||||||
* @param {Function} callback
|
|
||||||
* @param {string|undefined} action
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function _bindMultiple(combinations, callback, action) {
|
|
||||||
for (var i = 0; i < combinations.length; ++i) {
|
|
||||||
_bindSingle(combinations[i], callback, action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// start!
|
|
||||||
_addEvent(document, 'keypress', _handleKeyEvent);
|
|
||||||
_addEvent(document, 'keydown', _handleKeyEvent);
|
|
||||||
_addEvent(document, 'keyup', _handleKeyEvent);
|
|
||||||
|
|
||||||
var Mousetrap = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* binds an event to mousetrap
|
|
||||||
*
|
|
||||||
* can be a single key, a combination of keys separated with +,
|
|
||||||
* an array of keys, or a sequence of keys separated by spaces
|
|
||||||
*
|
|
||||||
* be sure to list the modifier keys first to make sure that the
|
|
||||||
* correct key ends up getting bound (the last key in the pattern)
|
|
||||||
*
|
|
||||||
* @param {string|Array} keys
|
|
||||||
* @param {Function} callback
|
|
||||||
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
bind: function(keys, callback, action) {
|
|
||||||
keys = keys instanceof Array ? keys : [keys];
|
|
||||||
_bindMultiple(keys, callback, action);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* unbinds an event to mousetrap
|
|
||||||
*
|
|
||||||
* the unbinding sets the callback function of the specified key combo
|
|
||||||
* to an empty function and deletes the corresponding key in the
|
|
||||||
* _directMap dict.
|
|
||||||
*
|
|
||||||
* TODO: actually remove this from the _callbacks dictionary instead
|
|
||||||
* of binding an empty function
|
|
||||||
*
|
|
||||||
* the keycombo+action has to be exactly the same as
|
|
||||||
* it was defined in the bind method
|
|
||||||
*
|
|
||||||
* @param {string|Array} keys
|
|
||||||
* @param {string} action
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
unbind: function(keys, action) {
|
|
||||||
return Mousetrap.bind(keys, function() {}, action);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* triggers an event that has already been bound
|
|
||||||
*
|
|
||||||
* @param {string} keys
|
|
||||||
* @param {string=} action
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
trigger: function(keys, action) {
|
|
||||||
if (_directMap[keys + ':' + action]) {
|
|
||||||
_directMap[keys + ':' + action]({}, keys);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* resets the library back to its initial state. this is useful
|
|
||||||
* if you want to clear out the current keyboard shortcuts and bind
|
|
||||||
* new ones - for example if you switch to another page
|
|
||||||
*
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
reset: function() {
|
|
||||||
_callbacks = {};
|
|
||||||
_directMap = {};
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* should we stop this event before firing off callbacks
|
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
* @param {Element} element
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
stopCallback: function(e, element) {
|
|
||||||
|
|
||||||
// if the element has the class "mousetrap" then no need to stop
|
|
||||||
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop for input, select, and textarea
|
|
||||||
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* exposes _handleKey publicly so it can be overwritten by extensions
|
|
||||||
*/
|
|
||||||
handleKey: _handleKey
|
|
||||||
};
|
|
||||||
|
|
||||||
// expose mousetrap to the global object
|
|
||||||
window.Mousetrap = Mousetrap;
|
|
||||||
|
|
||||||
// expose mousetrap as an AMD module
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define(Mousetrap);
|
|
||||||
}
|
|
||||||
}) (window, document);
|
|
||||||
Vendored
-2068
File diff suppressed because it is too large
Load Diff
@@ -84,7 +84,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.with-summary {
|
&.with-summary {
|
||||||
@media (min-width: 800px) {
|
@media (min-width: @sidebar-breakpoint) {
|
||||||
.book-body {
|
.book-body {
|
||||||
left: 250px;
|
left: 250px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: @sidebar-breakpoint) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
left: -100%;
|
left: -100%;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
// Sidebar
|
// Sidebar
|
||||||
@sidebar-width: 250px;
|
@sidebar-width: 250px;
|
||||||
|
@sidebar-breakpoint: 600px;
|
||||||
@sidebar-color: hsl(207, 15%, 80%);
|
@sidebar-color: hsl(207, 15%, 80%);
|
||||||
@sidebar-background: hsl(207, 15%, 95%);
|
@sidebar-background: hsl(207, 15%, 95%);
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
<div class="dropdown-menu font-settings">
|
<div class="dropdown-menu font-settings">
|
||||||
<div class="dropdown-caret">
|
<div class="dropdown-caret">
|
||||||
<span class="caret-outer"></span>
|
<span class="caret-outer"></span>
|
||||||
<span class="caret-inner"></span>
|
<span class="caret-inner"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group btn-block">
|
<div class="btn-group btn-block">
|
||||||
<button id="reduce-font-size" class="btn btn-default">A</button>
|
<button id="reduce-font-size" class="btn btn-default">A</button>
|
||||||
<button id="enlarge-font-size" class="btn btn-default">A</button>
|
<button id="enlarge-font-size" class="btn btn-default">A</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="list-group font-family-list">
|
<ul class="list-group font-family-list">
|
||||||
<li class="list-group-item" data-font="0">Serif</li>
|
<li class="list-group-item" data-font="0">Serif</li>
|
||||||
<li class="list-group-item" data-font="1">Sans</li>
|
<li class="list-group-item" data-font="1">Sans</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="btn-group btn-group-xs btn-block color-theme-list">
|
<div class="btn-group btn-group-xs btn-block color-theme-list">
|
||||||
<button type="button" class="btn btn-default" id="color-theme-preview-0" data-theme="0">White</button>
|
<button type="button" class="btn btn-default" id="color-theme-preview-0" data-theme="0">White</button>
|
||||||
<button type="button" class="btn btn-default" id="color-theme-preview-1" data-theme="1">Sepia</button>
|
<button type="button" class="btn btn-default" id="color-theme-preview-1" data-theme="1">Sepia</button>
|
||||||
<button type="button" class="btn btn-default" id="color-theme-preview-2" data-theme="2">Night</button>
|
<button type="button" class="btn btn-default" id="color-theme-preview-2" data-theme="2">Night</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
{% if options.links.home !== false and (options.links.home != null or githubId) %}
|
{% if options.links.home !== false and (options.links.home != null or githubId) %}
|
||||||
<a href="{{ options.links.home|default(githubHost+githubId) }}" target="_blank" class="btn pull-left"><i class="fa fa-bookmark-o"></i></a>
|
<a href="{{ options.links.home|default(githubHost+githubId) }}" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="#" class="btn pull-left toggle-summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
<a href="#" class="btn pull-left toggle-search"><i class="fa fa-search"></i></a>
|
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||||
<span id="font-settings-wrapper">
|
<span id="font-settings-wrapper">
|
||||||
<a href="#" class="btn pull-left toggle-font-settings"><i class="fa fa-font"></i>
|
<a href="#" class="btn pull-left toggle-font-settings" aria-label="Toggle font settings"><i class="fa fa-font"></i>
|
||||||
</a>
|
</a>
|
||||||
{% include "./font-settings.html" %}
|
{% include "./font-settings.html" %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- Actions Right -->
|
<!-- Actions Right -->
|
||||||
{% if options.links.sharing.google !== false %}
|
{% if options.links.sharing.google !== false %}
|
||||||
<a href="#" target="_blank" class="btn pull-right" data-sharing="google-plus"><i class="fa fa-google-plus"></i></a>
|
<a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Share on Google Plus"><i class="fa fa-google-plus"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if options.links.sharing.facebook !== false %}
|
{% if options.links.sharing.facebook !== false %}
|
||||||
<a href="#" target="_blank" class="btn pull-right" data-sharing="facebook"><i class="fa fa-facebook"></i></a>
|
<a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Share on Facebook"><i class="fa fa-facebook"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if options.links.sharing.twitter !== false %}
|
{% if options.links.sharing.twitter !== false %}
|
||||||
<a href="#" target="_blank" class="btn pull-right" data-sharing="twitter"><i class="fa fa-twitter"></i></a>
|
<a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Share on Twitter"><i class="fa fa-twitter"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if githubId %}
|
{% if githubId %}
|
||||||
|
|||||||
@@ -3,25 +3,25 @@
|
|||||||
<input type="text" placeholder="Search" class="form-control" />
|
<input type="text" placeholder="Search" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
<ul class="summary">
|
<ul class="summary">
|
||||||
{% if options.links.about !== false && (options.links.about != null || githubId) %}
|
{% if options.links.about !== false && (options.links.about || githubId) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ options.links.about|default(githubHost+githubAuthor) }}" target="blank">About the author</a>
|
<a href="{{ options.links.about|default(githubHost+githubAuthor) }}" target="blank" class="author-link">About the author</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if options.links.issues !== false && (options.links.issues != null || githubId) %}
|
{% if options.links.issues !== false && (options.links.issues || githubId) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ options.links.issues|default(githubHost+githubId+"/issues") }}" target="blank">Questions and Issues</a>
|
<a href="{{ options.links.issues|default(githubHost+githubId+"/issues") }}" target="blank"class="issues-link">Questions and Issues</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if options.links.contribute !== false && (options.links.contribute != null || githubId) %}
|
{% if options.links.contribute !== false && (options.links.contribute || githubId) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ options.links.contribute|default(githubHost+githubId+"/edit/master/"+_input) }}" target="blank">Edit and Contribute</a>
|
<a href="{{ options.links.contribute|default(githubHost+githubId+"/edit/master/"+_input) }}" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if options.links.contribute || options.links.issues || options.links.about || githubId %}
|
{% if options.links.contribute || options.links.issues || options.links.about %}
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<a href="{{ basePath }}/"><i class="fa fa-check"></i> Introduction</a>
|
<a href="{{ basePath }}/"><i class="fa fa-check"></i> Introduction</a>
|
||||||
</li>
|
</li>
|
||||||
{% for item in summary.chapters %}
|
{% for item in summary.chapters %}
|
||||||
<li {% if item._path == _input %}class="active"{% endif %} data-level="{{ item.level }}" {% if item.path %}data-path="{{ item.path|mdLink }}"{% endif %}>
|
<li class="chapter {% if item._path == _input %}active{% endif %}" data-level="{{ item.level }}" {% if item.path %}data-path="{{ item.path|mdLink }}"{% endif %}>
|
||||||
{% if item.path %}
|
{% if item.path %}
|
||||||
<a href="{{ basePath }}/{{ item.path|mdLink }}">
|
<a href="{{ basePath }}/{{ item.path|mdLink }}">
|
||||||
<i class="fa fa-check"></i> <b>{{ item.level }}.</b> {{ item.title }}
|
<i class="fa fa-check"></i> <b>{{ item.level }}.</b> {{ item.title }}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
{% if options.links.gitbook !== false %}
|
{% if options.links.gitbook !== false %}
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://www.gitbook.io/" target="blank">Generated using GitBook</a>
|
<a href="http://www.gitbook.io/" target="blank" class="gitbook-link">Generated using GitBook</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -28,10 +28,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if progress.current.prev and progress.current.prev.path %}
|
{% if progress.current.prev and progress.current.prev.path %}
|
||||||
<a href="{{ basePath }}/{{ progress.current.prev.path|mdLink }}" class="navigation navigation-prev {% if !progress.current.next or !progress.current.next.path %}navigation-unique{% endif %}"><i class="fa fa-angle-left"></i></a>
|
<a href="{{ basePath }}/{{ progress.current.prev.path|mdLink }}" class="navigation navigation-prev {% if !progress.current.next or !progress.current.next.path %}navigation-unique{% endif %}" aria-label="Previous page: {{ progress.current.prev.title }}"><i class="fa fa-angle-left"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if progress.current.next and progress.current.next.path %}
|
{% if progress.current.next and progress.current.next.path %}
|
||||||
<a href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" class="navigation navigation-next {% if !progress.current.prev or !progress.current.prev.path %}navigation-unique{% endif %}"><i class="fa fa-angle-right"></i></a>
|
<a href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" class="navigation navigation-next {% if !progress.current.prev or !progress.current.prev.path %}navigation-unique{% endif %}" aria-label="Next page: {{ progress.current.next.title }}"><i class="fa fa-angle-right"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user