Compare commits

...

21 Commits

Author SHA1 Message Date
Aaron O'Mullan 799815d85a Bump version to 0.4.2 2014-05-01 16:17:05 -07:00
Samy Pessé 2946246834 Fix #191: remove log for changes in files 2014-05-01 18:55:45 +02:00
Samy Pessé 6d276d1e79 Add option to remove home link 2014-05-01 18:53:49 +02:00
Samy Pessé 6a3a369b3e Add options to remove sharing links 2014-05-01 18:37:30 +02:00
Samy Pessé 5d8afa2135 Merge pull request #196 from mrpotes/new-plugins
New plugins
2014-05-01 18:33:30 +02:00
Samy Pessé ab3e6aa8ce Fix font-size for titles in markdown content 2014-05-01 18:29:42 +02:00
James Phillpotts 822092736e New plugins 2014-05-01 17:00:38 +01:00
Samy Pessé 7497acd2e3 Center navigation button on mobile on start page 2014-05-01 17:37:38 +02:00
Samy Pessé ae137885b8 Fix book content padding on mobile 2014-05-01 17:27:03 +02:00
Samy Pessé b964cc7009 Fix #162: hide watch/star buttons on mobile 2014-05-01 17:16:09 +02:00
Samy Pessé c2ea126c5f Fix #182: Replace all book body when page changes 2014-05-01 14:05:14 +02:00
Samy Pessé b668dba479 Update gaze version to 0.5.1 2014-05-01 13:26:50 +02:00
Samy Pessé 2cae5a0310 Secure .book position 2014-05-01 13:26:19 +02:00
Samy Pessé b6a0f3ff67 Fix #164: use position absolute instead of fixed 2014-04-30 17:01:25 +02:00
Samy Pessé fa00b52fb5 Fix #127: add configuration for changing links in sidebar 2014-04-30 16:46:24 +02:00
Samy Pessé 2999d90907 Merge pull request #188 from snipe/feature/json-doc
Added quotes for JSON example, per #127
2014-04-30 12:48:28 +02:00
snipe b6696bcad2 Added quotes for JSON example, per #127 2014-04-30 06:46:28 -04:00
Samy Pessé 728c87c525 Merge pull request #187 from snipe/feature/typo-fixes
Fixed typos
2014-04-30 12:05:12 +02:00
snipe ace394ee2d Fixed typos 2014-04-30 05:28:18 -04:00
Samy Pessé 076ee98f64 Fix #186: Plugins that don't have assets should be skipped 2014-04-30 11:15:01 +02:00
Samy Pessé 2e472654ca Fix error when calling hooks in site generation 2014-04-30 10:54:45 +02:00
18 changed files with 125 additions and 60 deletions
+31 -10
View File
@@ -32,7 +32,7 @@ Options for commands `build` and `serve` are:
```
-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
--config <config file> Configuration file to use, defualt to book.json
--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.
@@ -42,24 +42,42 @@ 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,
"output": null,
// Generator to use for building (caution: it override the value from the command line)
generator: "site",
"generator": "site",
// Book title and description (defaults are extracted from the README)
title: null,
description: null,
"title": null,
"description": null,
// GitHub informations (defaults are extracted using git)
github: null,
githubHost: 'https://github.com/',
"github": null,
"githubHost": "https://github.com/",
// Plugins list, can contain "-name" for removing default plugins
plugins: [],
"plugins": [],
// Global configuration for plugins
pluginsConfig: {}
"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
}
}
}
```
@@ -160,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:
@@ -173,3 +191,6 @@ Plugins can used to extend your book functionnalities. Read [GitbookIO/plugin](h
* [Disqus](https://github.com/GitbookIO/plugin-disqus): Disqus comments integration in your book
* [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
+1 -1
View File
@@ -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();
})
+16 -11
View File
@@ -28,29 +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",
"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) {
+6 -1
View File
@@ -86,9 +86,14 @@ Plugin.prototype.callHook = function(name, 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
+6 -3
View File
@@ -80,7 +80,9 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
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)
@@ -115,7 +117,7 @@ Generator.prototype.convertFile = function(content, _input) {
};
var _callHook = function(name) {
return that.callHook("page:before", page)
return that.callHook(name, page)
.then(function(_page) {
page = _page;
return page;
@@ -205,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);
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "0.4.1",
"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
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8 -9
View File
@@ -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
+5 -1
View File
@@ -1,6 +1,10 @@
.book {
position: relative;
width: 100%;
height: 100%;
.book-body {
position: fixed;
position: absolute;
top: @header-height;
right: 0px;
left: 0px;
+1 -1
View File
@@ -2,7 +2,7 @@
.book-header {
font-family: @font-family-sans;
position: fixed;
position: absolute;
overflow: visible;
top: 0px;
right: 0px;
+7 -7
View File
@@ -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; }
+5
View File
@@ -40,6 +40,11 @@
width: 50%;
display: inline-block;
float: left;
&.navigation-unique {
max-width: 100%;
width: 100%;
}
}
}
}
+1 -1
View File
@@ -16,7 +16,7 @@
width: 100%;
position: relative;
background: #fff;
margin-bottom: 20px;
margin-bottom: 10px;
.bar {
height: @bar-height;
+1 -1
View File
@@ -2,7 +2,7 @@
.book-summary {
font-family: @font-family-sans;
position: fixed;
position: absolute;
top: @header-height;
left: -@sidebar-width;
bottom: 0px;
+10 -4
View File
@@ -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 -->
+21 -4
View File
@@ -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>
+2 -2
View File
@@ -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>