mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-26 20:27:00 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 799815d85a | |||
| 2946246834 | |||
| 6d276d1e79 | |||
| 6a3a369b3e | |||
| 5d8afa2135 | |||
| ab3e6aa8ce | |||
| 822092736e | |||
| 7497acd2e3 | |||
| ae137885b8 | |||
| b964cc7009 | |||
| c2ea126c5f | |||
| b668dba479 | |||
| 2cae5a0310 | |||
| b6a0f3ff67 | |||
| fa00b52fb5 | |||
| 2999d90907 | |||
| b6696bcad2 | |||
| 728c87c525 | |||
| ace394ee2d | |||
| 076ee98f64 | |||
| 2e472654ca | |||
| d46bd14678 | |||
| b3e5b3d106 | |||
| b830ef5dca | |||
| 45326c4ad2 | |||
| 603b61e8c8 | |||
| efb066c8e3 | |||
| c30db427b1 | |||
| 23056fc85d | |||
| 5f1bfc0280 | |||
| b715901f92 | |||
| 38fea06cf9 |
@@ -30,14 +30,55 @@ $ gitbook build ./repository --output=./outputFolder
|
||||
Options for commands `build` and `serve` are:
|
||||
|
||||
```
|
||||
-t, --title <name> Name of the book to generate, defaults to repo name
|
||||
-i, --intro <intro> Description of the book to generate
|
||||
-g, --github <repo_path> ID of github repo like : username/repo
|
||||
-o, --output <directory> Path to output directory, defaults to ./_book
|
||||
-f, --format <name> Change generation format, defaults to site, availables are: site, page, pdf, json
|
||||
--githubHost <url> The url of the github host (defaults to https://github.com/)
|
||||
--plugins <plugins> List of plugins to use separated by ","
|
||||
--pluginsConfig <json file> JSON File containing plugins configuration
|
||||
--config <config file> Configuration file to use, defaults to book.json
|
||||
```
|
||||
|
||||
GitBook load the default configuration from a `book.json` file in the repository if it exists.
|
||||
|
||||
Here are the options that can be stored in this file:
|
||||
|
||||
```
|
||||
{
|
||||
// Folders to use for output (caution: it override the value from the command line)
|
||||
"output": null,
|
||||
|
||||
// Generator to use for building (caution: it override the value from the command line)
|
||||
"generator": "site",
|
||||
|
||||
// Book title and description (defaults are extracted from the README)
|
||||
"title": null,
|
||||
"description": null,
|
||||
|
||||
// GitHub informations (defaults are extracted using git)
|
||||
"github": null,
|
||||
"githubHost": "https://github.com/",
|
||||
|
||||
// Plugins list, can contain "-name" for removing default plugins
|
||||
"plugins": [],
|
||||
|
||||
// Global configuration for plugins
|
||||
"pluginsConfig": {},
|
||||
|
||||
// Links in template (null: default, false: remove, string: new value)
|
||||
"links": {
|
||||
// Link to home in the top-left corner
|
||||
"home": null,
|
||||
|
||||
// Links in top of sidebar
|
||||
"about": null,
|
||||
"issues": null,
|
||||
"edit": null,
|
||||
|
||||
// Sharing links
|
||||
"sharing": {
|
||||
"google": null,
|
||||
"facebook": null,
|
||||
"twitter": null
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can publish your books to our index by visiting [GitBook.io](http://www.gitbook.io)
|
||||
@@ -137,7 +178,7 @@ GitBook will read the `.gitignore`, `.bookignore` and `.ignore` files to get a l
|
||||
|
||||
#### Plugins
|
||||
|
||||
Plugins can used to extend your book functionnalities. Read [GitbookIO/plugin](https://github.com/GitbookIO/plugin) for more informations 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.
|
||||
|
||||
##### Default plugins:
|
||||
|
||||
@@ -148,5 +189,8 @@ Plugins can used to extend your book functionnalities. Read [GitbookIO/plugin](h
|
||||
|
||||
* [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
|
||||
* [Transform comments to notes](https://github.com/erixtekila/gitbook-plugin-comments): Allow markdown comments to be inserted in HTML output
|
||||
* [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
|
||||
* [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
|
||||
* [Bootstrap JavaScript plugins](https://github.com/mrpotes/gitbook-plugin-bootstrapjs): Use the [Bootstrap JavaScript plugins](http://getbootstrap.com/javascript) in your online GitBook
|
||||
|
||||
+9
-36
@@ -12,12 +12,7 @@ var buildCommand = function(command) {
|
||||
return command
|
||||
.option('-o, --output <directory>', 'Path to output directory, defaults to ./_book')
|
||||
.option('-f, --format <name>', 'Change generation format, defaults to site, availables are: '+_.keys(generators).join(", "))
|
||||
.option('-t, --title <name>', 'Name of the book to generate, default is extracted from readme')
|
||||
.option('-i, --intro <intro>', 'Description of the book to generate, default is extracted from readme')
|
||||
.option('--plugins <plugins>', 'List of plugins to use separated by ","')
|
||||
.option('--pluginsConfig <json file>', 'JSON File containing plugins configuration')
|
||||
.option('-g, --github <repo_path>', 'ID of github repo like : username/repo')
|
||||
.option('--githubHost <url>', 'The url of the github host (defaults to https://github.com/');
|
||||
.option('--config <config file>', 'Configuration file to use, defualt to book.json')
|
||||
};
|
||||
|
||||
|
||||
@@ -26,37 +21,15 @@ var makeBuildFunc = function(converter) {
|
||||
dir = dir || process.cwd();
|
||||
outputDir = options.output;
|
||||
|
||||
// Read plugins config
|
||||
var pluginsConfig = {};
|
||||
if (options.pluginsConfig) {
|
||||
pluginsConfig = JSON.parse(fs.readFileSync(options.pluginsConfig))
|
||||
}
|
||||
|
||||
|
||||
console.log('Starting build ...');
|
||||
// Get repo's URL
|
||||
return utils.gitURL(dir)
|
||||
.then(function(url) {
|
||||
// Get ID of repo
|
||||
return utils.githubID(url);
|
||||
}, function(err) {
|
||||
return null;
|
||||
})
|
||||
.then(function(repoID) {
|
||||
return converter(
|
||||
_.extend({}, options || {}, {
|
||||
input: dir,
|
||||
output: outputDir,
|
||||
title: options.title,
|
||||
description: options.intro,
|
||||
github: options.github || repoID,
|
||||
githubHost: options.githubHost,
|
||||
generator: options.format,
|
||||
plugins: options.plugins,
|
||||
pluginsConfig: pluginsConfig
|
||||
})
|
||||
);
|
||||
})
|
||||
return converter(
|
||||
_.extend({}, options || {}, {
|
||||
input: dir,
|
||||
output: outputDir,
|
||||
generator: options.format,
|
||||
configFile: options.config
|
||||
})
|
||||
)
|
||||
.then(function(output) {
|
||||
console.log("Successfuly built !");
|
||||
return output;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ build.command(prog.command('serve [source_dir]'))
|
||||
if (!options.watch) return;
|
||||
return utils.watch(_options.input)
|
||||
.then(function(filepath) {
|
||||
console.log("Restart after change in "+path.relative(dir, filepath));
|
||||
console.log("Restart after change in files");
|
||||
console.log('');
|
||||
return generate();
|
||||
})
|
||||
|
||||
@@ -4,60 +4,9 @@ var _ = require('lodash');
|
||||
var http = require('http');
|
||||
var send = require('send');
|
||||
|
||||
var cp = require('child_process');
|
||||
var path = require('path');
|
||||
var url = require('url');
|
||||
|
||||
var Gaze = require('gaze').Gaze;
|
||||
|
||||
|
||||
// Get the remote of a given repo
|
||||
function gitURL(path) {
|
||||
var d = Q.defer();
|
||||
|
||||
cp.exec("git config --get remote.origin.url", {
|
||||
cwd: path,
|
||||
env: process.env,
|
||||
}, function(err, stdout, stderr) {
|
||||
if(err) {
|
||||
return d.reject(err);
|
||||
}
|
||||
|
||||
return d.resolve(stdout);
|
||||
});
|
||||
|
||||
return d.promise
|
||||
.then(function(output) {
|
||||
return output.replace(/(\r\n|\n|\r)/gm, "");
|
||||
});
|
||||
}
|
||||
|
||||
// Poorman's parsing
|
||||
// Parse a git URL to a github ID : username/reponame
|
||||
function githubID(_url) {
|
||||
// Remove .git if it's in _url
|
||||
var sliceEnd = _url.slice(-4) === '.git' ? -4 : _url.length;
|
||||
|
||||
// Detect HTTPS repos
|
||||
var parsed = url.parse(_url);
|
||||
if(parsed.protocol === 'https:' && parsed.host === 'github.com') {
|
||||
return parsed.path.slice(1, sliceEnd);
|
||||
}
|
||||
|
||||
// Detect SSH repos
|
||||
if(_url.indexOf('git@') === 0) {
|
||||
return _url.split(':', 2)[1].slice(0, sliceEnd);
|
||||
}
|
||||
|
||||
// None found
|
||||
return null;
|
||||
}
|
||||
|
||||
function titleCase(str)
|
||||
{
|
||||
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
|
||||
}
|
||||
|
||||
function watch(dir) {
|
||||
var d = Q.defer();
|
||||
dir = path.resolve(dir);
|
||||
@@ -88,9 +37,6 @@ function logError(err) {
|
||||
|
||||
// Exports
|
||||
module.exports = {
|
||||
gitURL: gitURL,
|
||||
githubID: githubID,
|
||||
titleCase: titleCase,
|
||||
watch: watch,
|
||||
logError: logError
|
||||
};
|
||||
|
||||
@@ -12,8 +12,8 @@ var BaseGenerator = function(options) {
|
||||
this.plugins = [];
|
||||
};
|
||||
|
||||
BaseGenerator.prototype.callHook = function(name) {
|
||||
return this.plugins.hook(name, this);
|
||||
BaseGenerator.prototype.callHook = function(name, data) {
|
||||
return this.plugins.hook(name, this, data);
|
||||
};
|
||||
|
||||
BaseGenerator.prototype.loadPlugins = function() {
|
||||
|
||||
+47
-10
@@ -28,26 +28,34 @@ var generate = function(options) {
|
||||
|
||||
options = _.defaults(options || {}, {
|
||||
// Folders to use
|
||||
input: null,
|
||||
output: null,
|
||||
"input": null,
|
||||
"output": null,
|
||||
|
||||
// Config file (relative to input)
|
||||
"configFile": "book.json",
|
||||
|
||||
// Output generator
|
||||
generator: "site",
|
||||
"generator": "site",
|
||||
|
||||
// Book title, keyword, description
|
||||
title: null,
|
||||
description: null,
|
||||
"title": null,
|
||||
"description": null,
|
||||
|
||||
// Origin github repository id
|
||||
github: null,
|
||||
githubHost: 'https://github.com/',
|
||||
"github": null,
|
||||
"githubHost": 'https://github.com/',
|
||||
|
||||
// Theming
|
||||
theme: path.resolve(__dirname, '../../theme'),
|
||||
"theme": path.resolve(__dirname, '../../theme'),
|
||||
|
||||
// Plugins
|
||||
plugins: [],
|
||||
pluginsConfig: {}
|
||||
"plugins": [],
|
||||
"pluginsConfig": {},
|
||||
|
||||
// Links
|
||||
"links": {
|
||||
"about": null
|
||||
}
|
||||
});
|
||||
|
||||
if (!options.input) {
|
||||
@@ -63,6 +71,35 @@ var generate = function(options) {
|
||||
// Clean output folder
|
||||
return fs.remove(options.output)
|
||||
|
||||
// Read config file
|
||||
.then(function() {
|
||||
return fs.readFile(path.resolve(options.input, options.configFile))
|
||||
.then(function(_config) {
|
||||
// Extend current config
|
||||
_config = JSON.parse(_config);
|
||||
_config = _.omit(_config, 'input', 'configFile');
|
||||
|
||||
_.extend(options, _config);
|
||||
}, function() {
|
||||
// No config file: not a big deal
|
||||
return Q();
|
||||
})
|
||||
})
|
||||
|
||||
// Get repo's URL
|
||||
.then(function() {
|
||||
return parse.git.url(options.input)
|
||||
.then(function(_url) {
|
||||
// Get ID of repo
|
||||
return parse.git.githubID(_url);
|
||||
}, function(err) {
|
||||
return null;
|
||||
})
|
||||
.then(function(repoId) {
|
||||
options.github = options.github || repoId;
|
||||
});
|
||||
})
|
||||
|
||||
.then(function() {
|
||||
return fs.mkdirp(options.output);
|
||||
})
|
||||
|
||||
+14
-9
@@ -74,21 +74,26 @@ Plugin.prototype.resolveFile = function(filename) {
|
||||
};
|
||||
|
||||
// Resolve file path
|
||||
Plugin.prototype.callHook = function(name, args) {
|
||||
Plugin.prototype.callHook = function(name, context, data) {
|
||||
var hookFunc = this.infos.hooks? this.infos.hooks[name] : null;
|
||||
args = _.isArray(args) ? args : [args];
|
||||
data = data || {};
|
||||
|
||||
if (!hookFunc) return Q();
|
||||
if (!hookFunc) return Q(data);
|
||||
|
||||
return Q()
|
||||
.then(function() {
|
||||
return hookFunc.apply(null, args);
|
||||
return hookFunc.apply(context, [data]);
|
||||
});
|
||||
};
|
||||
|
||||
// Has assets
|
||||
Plugin.prototype.hasAssets = function(out) {
|
||||
return (this.infos.book && this.infos.book.assets);
|
||||
};
|
||||
|
||||
// Copy plugin assets fodler
|
||||
Plugin.prototype.copyAssets = function(out) {
|
||||
if (!this.infos.book || !this.infos.book.assets) return Q();
|
||||
if (!this.hasAssets()) return Q();
|
||||
return fs.copy(
|
||||
this.resolveFile(this.infos.book.assets),
|
||||
out
|
||||
@@ -159,12 +164,12 @@ Plugin.fromList = function(names, root) {
|
||||
return Q({
|
||||
'list': plugins,
|
||||
'resources': resources,
|
||||
'hook': function(name, args) {
|
||||
'hook': function(name, context, data) {
|
||||
return _.reduce(plugins, function(prev, plugin) {
|
||||
return prev.then(function() {
|
||||
return plugin.callHook(name, args);
|
||||
return prev.then(function(ret) {
|
||||
return plugin.callHook(name, context, ret);
|
||||
})
|
||||
}, Q());
|
||||
}, Q(data));
|
||||
},
|
||||
'template': function(name) {
|
||||
var withTpl = _.find(plugins, function(plugin) {
|
||||
|
||||
@@ -59,8 +59,11 @@ Generator.prototype.loadPlugins = function() {
|
||||
};
|
||||
|
||||
// Generate a template
|
||||
Generator.prototype._writeTemplate = function(tpl, options, output) {
|
||||
Generator.prototype._writeTemplate = function(tpl, options, output, interpolate) {
|
||||
var that = this;
|
||||
|
||||
interpolate = interpolate || _.identity;
|
||||
|
||||
return Q()
|
||||
.then(function(sections) {
|
||||
return tpl(_.extend({
|
||||
@@ -77,9 +80,12 @@ Generator.prototype._writeTemplate = function(tpl, options, output) {
|
||||
allNavigation: that.options.navigation,
|
||||
|
||||
plugins: that.plugins,
|
||||
pluginsConfig: JSON.stringify(that.options.pluginsConfig)
|
||||
pluginsConfig: JSON.stringify(that.options.pluginsConfig),
|
||||
|
||||
options: that.options
|
||||
}, options));
|
||||
})
|
||||
.then(interpolate)
|
||||
.then(function(html) {
|
||||
return fs.writeFile(
|
||||
output,
|
||||
@@ -96,7 +102,6 @@ Generator.prototype.indexPage = function(lexed, pagePath) {
|
||||
// Convert a markdown file to html
|
||||
Generator.prototype.convertFile = function(content, _input) {
|
||||
var that = this;
|
||||
var progress = parse.progress(this.options.navigation, _input);
|
||||
|
||||
_output = _input.replace(".md", ".html");
|
||||
if (_output == "README.html") _output = "index.html";
|
||||
@@ -105,10 +110,28 @@ Generator.prototype.convertFile = function(content, _input) {
|
||||
var output = path.join(this.options.output, _output);
|
||||
var basePath = path.relative(path.dirname(output), this.options.output) || ".";
|
||||
|
||||
var page = {
|
||||
path: _input,
|
||||
content: content,
|
||||
progress: parse.progress(this.options.navigation, _input)
|
||||
};
|
||||
|
||||
var _callHook = function(name) {
|
||||
return that.callHook(name, page)
|
||||
.then(function(_page) {
|
||||
page = _page;
|
||||
return page;
|
||||
});
|
||||
};
|
||||
|
||||
return Q()
|
||||
.then(function() {
|
||||
// Send content to plugins
|
||||
return _callHook("page:before");
|
||||
})
|
||||
.then(function() {
|
||||
// Lex page
|
||||
return parse.lex(content);
|
||||
return parse.lex(page.content);
|
||||
})
|
||||
.then(function(lexed) {
|
||||
// Index page in search
|
||||
@@ -124,17 +147,27 @@ Generator.prototype.convertFile = function(content, _input) {
|
||||
});
|
||||
})
|
||||
.then(function(sections) {
|
||||
page.sections = sections;
|
||||
|
||||
// Use plugin hook
|
||||
return _callHook("page");
|
||||
})
|
||||
.then(function() {
|
||||
that.manifest.add("CACHE", _output);
|
||||
|
||||
return that._writeTemplate(that.template, {
|
||||
progress: progress,
|
||||
progress: page.progress,
|
||||
|
||||
_input: _input,
|
||||
content: sections,
|
||||
content: page.sections,
|
||||
|
||||
basePath: basePath,
|
||||
staticBase: path.join(basePath, "gitbook"),
|
||||
}, output);
|
||||
}, output, function(html) {
|
||||
page.content = html;
|
||||
|
||||
return _callHook("page:after").get("content")
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -174,8 +207,9 @@ Generator.prototype.copyAssets = function() {
|
||||
.then(function() {
|
||||
return Q.all(
|
||||
_.map(that.plugins.list, function(plugin) {
|
||||
var pluginAssets = path.join(that.options.output, "gitbook/plugins/", plugin.name);
|
||||
if (!plugin.hasAssets()) return Q();
|
||||
|
||||
var pluginAssets = path.join(that.options.output, "gitbook/plugins/", plugin.name);
|
||||
return plugin.copyAssets(pluginAssets)
|
||||
.then(function() {
|
||||
return that.manifest.addFolder(pluginAssets, "gitbook/plugins/"+plugin.name);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
var Q = require('q');
|
||||
var _ = require('lodash');
|
||||
var cp = require('child_process');
|
||||
var url = require('url');
|
||||
|
||||
// Get the remote of a given repo
|
||||
function gitURL(path) {
|
||||
var d = Q.defer();
|
||||
|
||||
cp.exec("git config --get remote.origin.url", {
|
||||
cwd: path,
|
||||
env: process.env,
|
||||
}, function(err, stdout, stderr) {
|
||||
if(err) {
|
||||
return d.reject(err);
|
||||
}
|
||||
|
||||
return d.resolve(stdout);
|
||||
});
|
||||
|
||||
return d.promise
|
||||
.then(function(output) {
|
||||
return output.replace(/(\r\n|\n|\r)/gm, "");
|
||||
});
|
||||
}
|
||||
|
||||
// Poorman's parsing
|
||||
// Parse a git URL to a github ID : username/reponame
|
||||
function githubID(_url) {
|
||||
// Remove .git if it's in _url
|
||||
var sliceEnd = _url.slice(-4) === '.git' ? -4 : _url.length;
|
||||
|
||||
// Detect HTTPS repos
|
||||
var parsed = url.parse(_url);
|
||||
if(parsed.protocol === 'https:' && parsed.host === 'github.com') {
|
||||
return parsed.path.slice(1, sliceEnd);
|
||||
}
|
||||
|
||||
// Detect SSH repos
|
||||
if(_url.indexOf('git@') === 0) {
|
||||
return _url.split(':', 2)[1].slice(0, sliceEnd);
|
||||
}
|
||||
|
||||
// None found
|
||||
return null;
|
||||
}
|
||||
|
||||
function titleCase(str) {
|
||||
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
url: gitURL,
|
||||
githubID: githubID,
|
||||
titleCase: titleCase
|
||||
};
|
||||
+2
-1
@@ -5,5 +5,6 @@ module.exports = {
|
||||
lex: require('./lex'),
|
||||
progress: require('./progress'),
|
||||
navigation: require('./navigation'),
|
||||
readme: require('./readme')
|
||||
readme: require('./readme'),
|
||||
git: require('./git')
|
||||
};
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitbook",
|
||||
"version": "0.3.2",
|
||||
"version": "0.4.2",
|
||||
"homepage": "http://www.gitbook.io/",
|
||||
"description": "Library and cmd utility to generate GitBooks",
|
||||
"main": "lib/index.js",
|
||||
@@ -18,7 +18,7 @@
|
||||
"highlight.js": "8.0.0",
|
||||
"tmp": "0.0.23",
|
||||
"semver": "2.2.1",
|
||||
"gaze": "0.6.4",
|
||||
"gaze": "~0.5.1",
|
||||
"resolve": "0.6.3",
|
||||
|
||||
"gitbook-plugin": "0.0.2",
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -28,7 +28,7 @@ define([
|
||||
.done(function (html) {
|
||||
// Push url to history
|
||||
if (push) history.pushState({ path: url }, null, url);
|
||||
|
||||
|
||||
// Replace html content
|
||||
html = html.replace( /<(\/?)(html|head|body)([^>]*)>/ig, function(a,b,c,d){
|
||||
return '<' + b + 'div' + ( b ? '' : ' data-element="' + c + '"' ) + d + '>';
|
||||
@@ -36,6 +36,7 @@ define([
|
||||
|
||||
var $page = $(html);
|
||||
var $pageHead = $page.find("[data-element=head]");
|
||||
var $pageBody = $page.find('.book');
|
||||
|
||||
// Merge heads
|
||||
var headContent = $pageHead.html()
|
||||
@@ -45,13 +46,11 @@ define([
|
||||
});
|
||||
$("head").html(headContent);
|
||||
|
||||
// Update header, body
|
||||
$('.book-header').html($page.find('.book-header').html());
|
||||
$('.book-body').html($page.find('.book-body').html());
|
||||
|
||||
// Update summary
|
||||
// Merge body
|
||||
var scrollPosition = $('.book-summary .summary').scrollTop();
|
||||
$('.book-summary').html($page.find('.book-summary').html());
|
||||
$pageBody.toggleClass("with-summary", $(".book").hasClass("with-summary"))
|
||||
|
||||
$(".book").replaceWith($pageBody);
|
||||
$('.book-summary .summary').scrollTop(scrollPosition);
|
||||
|
||||
// Update state
|
||||
@@ -134,7 +133,7 @@ define([
|
||||
if (url) handleNavigation(url, true);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var init = function() {
|
||||
// Prevent cache so that using the back button works
|
||||
@@ -157,7 +156,7 @@ define([
|
||||
$(document).on('click', ".navigation-prev", handlePagination);
|
||||
$(document).on('click', ".navigation-next", handlePagination);
|
||||
$(document).on('click', ".summary [data-path] a", handlePagination);
|
||||
|
||||
|
||||
$(window).resize(updateNavigationPosition);
|
||||
|
||||
// Prepare current page
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
.book {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.book-body {
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
top: @header-height;
|
||||
right: 0px;
|
||||
left: 0px;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.book-header {
|
||||
font-family: @font-family-sans;
|
||||
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
}
|
||||
.book .book-body .page-wrapper .page-inner section.normal {
|
||||
padding: 25px 0px;
|
||||
padding-bottom: 25px;
|
||||
padding-top: 15px;
|
||||
color:@page-color;
|
||||
|
||||
@@ -72,25 +72,25 @@
|
||||
font-size: inherit; }
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
font-size: 2.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
font-size: 2em;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px; }
|
||||
font-size: 1.5em; }
|
||||
|
||||
h4 {
|
||||
font-size: 16px; }
|
||||
font-size: 1.2em; }
|
||||
|
||||
h5 {
|
||||
font-size: 14px; }
|
||||
font-size: 1em; }
|
||||
|
||||
h6 {
|
||||
font-size: 14px; }
|
||||
font-size: 1em; }
|
||||
|
||||
p, blockquote, ul, ol, dl, table, pre {
|
||||
margin: 15px 0; }
|
||||
|
||||
@@ -40,6 +40,11 @@
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
|
||||
&.navigation-unique {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.bar {
|
||||
height: @bar-height;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.book-summary {
|
||||
font-family: @font-family-sans;
|
||||
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
top: @header-height;
|
||||
left: -@sidebar-width;
|
||||
bottom: 0px;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
{% if githubId %}
|
||||
<a href="{{ githubHost }}{{ githubId }}" target="_blank" class="btn pull-left"><i class="fa fa-github-alt"></i></a>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
<a href="#" class="btn pull-left 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>
|
||||
@@ -12,13 +12,19 @@
|
||||
</span>
|
||||
|
||||
<!-- Actions Right -->
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% if options.links.sharing.facebook !== false %}
|
||||
<a href="#" target="_blank" class="btn pull-right" data-sharing="facebook"><i class="fa fa-facebook"></i></a>
|
||||
{% endif %}
|
||||
{% if options.links.sharing.twitter !== false %}
|
||||
<a href="#" target="_blank" class="btn pull-right" data-sharing="twitter"><i class="fa fa-twitter"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if githubId %}
|
||||
<a href="{{ githubHost }}{{ githubId }}/stargazers" target="_blank" class="btn pull-right count-star"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="{{ githubHost }}{{ githubId }}/watchers" target="_blank" class="btn pull-right count-watch"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
<a href="{{ githubHost }}{{ githubId }}/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="{{ githubHost }}{{ githubId }}/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Title -->
|
||||
|
||||
@@ -3,18 +3,28 @@
|
||||
<input type="text" placeholder="Search" class="form-control" />
|
||||
</div>
|
||||
<ul class="summary">
|
||||
{% if githubId %}
|
||||
{% if options.links.about !== false && (options.links.about != null || githubId) %}
|
||||
<li>
|
||||
<a href="{{ githubHost }}{{ githubAuthor }}" target="blank">About the author</a>
|
||||
<a href="{{ options.links.about|default(githubHost+githubAuthor) }}" target="blank">About the author</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if options.links.issues !== false && (options.links.issues != null || githubId) %}
|
||||
<li>
|
||||
<a href="{{ githubHost }}{{ githubId }}/issues" target="blank">Questions and Issues</a>
|
||||
<a href="{{ options.links.issues|default(githubHost+githubId+"/issues") }}" target="blank">Questions and Issues</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if options.links.contribute !== false && (options.links.contribute != null || githubId) %}
|
||||
<li>
|
||||
<a href="{{ githubHost }}{{ githubId }}/edit/master/{{ _input }}" target="blank">Edit and Contribute</a>
|
||||
<a href="{{ options.links.contribute|default(githubHost+githubId+"/edit/master/"+_input) }}" target="blank">Edit and Contribute</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if options.links.contribute || options.links.issues || options.links.about || githubId %}
|
||||
<li class="divider"></li>
|
||||
{% endif %}
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="{{ basePath }}/"><i class="fa fa-check"></i> Introduction</a>
|
||||
</li>
|
||||
@@ -44,5 +54,12 @@
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if options.links.gitbook !== false %}
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href="http://www.gitbook.io/" target="blank">Generated using GitBook</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
</div>
|
||||
|
||||
{% if progress.current.prev and progress.current.prev.path %}
|
||||
<a href="{{ basePath }}/{{ progress.current.prev.path|mdLink }}" class="navigation navigation-prev"><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 %}"><i class="fa fa-angle-left"></i></a>
|
||||
{% endif %}
|
||||
{% if progress.current.next and progress.current.next.path %}
|
||||
<a href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" class="navigation navigation-next"><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 %}"><i class="fa fa-angle-right"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user