Compare commits

...

9 Commits

Author SHA1 Message Date
Samy Pessé 07d5245a5f Bump version to 3.0.0-pre.7 2016-04-11 09:59:58 +02:00
Samy Pessé 6b844213ec Update theme-default@1.0.0-pre.6 2016-04-11 09:59:18 +02:00
Samy Pessé dabdeb8a80 Fix #1195: fix external images and fix test for it 2016-04-11 09:56:13 +02:00
Samy Pessé ecd56315e6 Merge pull request #1220 from seanlane/patch-1
Fix minor spelling error.
2016-04-11 09:34:15 +02:00
Sean Lane 15b9e839e9 Fix minor spelling error. 2016-04-10 14:31:49 -06:00
Samy Pesse d7f7dcd47b Switch to ignore@3.1.1 2016-04-10 22:28:29 +02:00
Samy Pessé b1981e09b8 Fix generator deprecation warning being shown for each call 2016-04-10 18:20:51 +02:00
Samy Pessé c9edd0a795 Load plugins from book parent in multilingual book 2016-04-09 12:16:17 +02:00
Samy Pesse d83e0716bb Add test for main language in json output 2016-04-08 23:58:42 +02:00
7 changed files with 30 additions and 18 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ Each chapter has a dedicated page (`part#/README.md`) and is split into subchapt
##### Anchors
Chaptersi n the Table of Contents can be pointing to specific part of a file using anchor.
Chapters in the Table of Contents can be pointing to specific part of a file using anchor.
```markdown
# Summary
+6 -4
View File
@@ -38,10 +38,8 @@ function Output(book, opts, parent) {
// Files to ignore in output
this.ignore = Ignore();
// Hack to inherits from rules of the book:
// Waiting for https://github.com/kaelzhang/node-ignore/pull/19 to be merged
this.ignore._rules = this.ignore._rules.concat(this.book.ignore._rules);
this.ignore._cache = {};
// Hack to inherits from rules of the book
this.ignore.add(this.book.ignore);
}
// Default name for generator
@@ -209,6 +207,10 @@ Output.prototype.onOutputSVG = function(page, svg) {
// Output an image as a file
// Normalize the relative link
Output.prototype.onOutputImage = function(page, imgFile) {
if (location.isExternal(imgFile)) {
return imgFile;
}
imgFile = page.resolveLocal(imgFile);
return page.relative(imgFile);
};
+7 -2
View File
@@ -144,10 +144,15 @@ function listInstalled(folder) {
function listPlugins(book) {
return Promise.all([
listInstalled(path.resolve(__dirname, '../..')),
listInstalled(book.root)
listInstalled(book.root),
book.isLanguageBook()? listInstalled(book.parent.root) : Promise([])
])
.spread(function(defaultPlugins, plugins) {
var results = plugins.concat(defaultPlugins);
var args = _.toArray(arguments);
var results = _.reduce(args, function(out, a) {
return out.concat(a);
}, []);
return _.uniq(results, 'name');
});
}
+10 -6
View File
@@ -63,6 +63,13 @@ function TemplateEngine(output) {
// Add default blocks and filters
this.addBlocks(defaultBlocks);
this.addFilters(defaultFilters);
// Build context for this book with depreacted fields
this.ctx = {
book: this.book,
output: this.output
};
error.deprecateField(this.ctx, 'generator', this.output.name, '"generator" property is deprecated, use "output.generator" instead');
}
// Bind a function to a context
@@ -71,12 +78,9 @@ TemplateEngine.prototype.bindContext = function(func) {
var that = this;
return function() {
var ctx = {
ctx: this.ctx,
book: that.book,
output: that.output
};
error.deprecateField(ctx, 'generator', that.output.name, '"generator" property is deprecated, use "output.generator" instead');
var ctx = _.extend({
ctx: this.ctx
}, that.ctx);
return func.apply(ctx, arguments);
};
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "3.0.0-pre.6",
"version": "3.0.0-pre.7",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
@@ -26,11 +26,11 @@
"gitbook-plugin-livereload": "0.0.1",
"gitbook-plugin-search": "1.2.0",
"gitbook-plugin-sharing": "1.0.1",
"gitbook-plugin-theme-default": "1.0.0-pre.5",
"gitbook-plugin-theme-default": "1.0.0-pre.6",
"github-slugid": "1.0.1",
"graceful-fs": "4.1.3",
"i18n-t": "1.0.0",
"ignore": "3.0.14",
"ignore": "3.1.1",
"json-schema-defaults": "0.1.1",
"jsonschema": "1.1.0",
"juice": "1.10.0",
+2 -1
View File
@@ -53,9 +53,10 @@ describe('JSON Output', function() {
it('should correctly generate a README.json for the whole book', function() {
output.should.have.file('README.json');
var json = require(output.resolve('README.json'));
json.book.language.should.equal('en');
json.should.have.property('languages')
.with.property('list').with.lengthOf(2);
});
+1 -1
View File
@@ -289,7 +289,7 @@ describe('Page', function() {
it('should keep external images path', function() {
page.content.should.be.html({
'img[src="https:/upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"]': {
'img[src="https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"]': {
count: 1
}
});