mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-29 13:39:11 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bf592f870 | |||
| 241e205717 | |||
| fb2720ea8d | |||
| 14853befda | |||
| e7f2803d11 | |||
| 320015dd8f | |||
| 471c124a98 | |||
| aa44a109c6 | |||
| 41e5ca8422 |
@@ -2,6 +2,13 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## 2.3.3
|
||||||
|
- Fix bug in SUMMARY parsing preventing multiple entries without filenames
|
||||||
|
|
||||||
|
## 2.3.2
|
||||||
|
- Fix blocks (like maths) in Asciidoc
|
||||||
|
- Fix error when checking gitbook version
|
||||||
|
|
||||||
## 2.3.1
|
## 2.3.1
|
||||||
- Fix black font color for ebooks (mobi, pdf and epub)
|
- Fix black font color for ebooks (mobi, pdf and epub)
|
||||||
- Fix ISO code for korean language
|
- Fix ISO code for korean language
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ Configuration.prototype.load = function() {
|
|||||||
if (!semver.satisfies(pkg.version, that.options.gitbook)) {
|
if (!semver.satisfies(pkg.version, that.options.gitbook)) {
|
||||||
throw "GitBook version doesn't satisfy version required by the book: "+that.options.gitbook;
|
throw "GitBook version doesn't satisfy version required by the book: "+that.options.gitbook;
|
||||||
}
|
}
|
||||||
if (that.options.gitbook != '*' && !semver.satisfies(that.options.gitbook, semver.inc(pkg.version, 'patch'))) {
|
if (that.options.gitbook != '*' && !semver.satisfies(semver.inc(pkg.version, 'patch'), that.options.gitbook)) {
|
||||||
that.book.log.warn.ln("gitbook version specified in your book.json might be too strict for future patches, \""+(_.first(pkg.version.split("."))+".x.x")+"\" is more adequate");
|
that.book.log.warn.ln("gitbook version specified in your book.json might be too strict for future patches, \""+(_.first(pkg.version.split("."))+".x.x")+"\" is more adequate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -103,16 +103,16 @@ TemplateEngine.prototype.processBlock = function(blk) {
|
|||||||
return blk.body;
|
return blk.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return it as a macro
|
// Return it as a position marker
|
||||||
return "%+%"+blk.id+"%+%";
|
return "@%@"+blk.id+"@%@";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Replace blocks by body after processing
|
// Replace position markers of blocks by body after processing
|
||||||
// This is done to avoid that markdown processer parse the block content
|
// This is done to avoid that markdown/asciidoc processer parse the block content
|
||||||
TemplateEngine.prototype.replaceBlocks = function(content) {
|
TemplateEngine.prototype.replaceBlocks = function(content) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
return content.replace(/\%\+\%([\s\S]+?)\%\+\%/g, function(match, key) {
|
return content.replace(/\@\%\@([\s\S]+?)\@\%\@/g, function(match, key) {
|
||||||
var blk = that.blocks[key];
|
var blk = that.blocks[key];
|
||||||
if (!blk) return match;
|
if (!blk) return match;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "2.3.1",
|
"version": "2.3.3",
|
||||||
"homepage": "https://www.gitbook.com",
|
"homepage": "https://www.gitbook.com",
|
||||||
"description": "Library and cmd utility to generate GitBooks",
|
"description": "Library and cmd utility to generate GitBooks",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"resolve": "0.6.3",
|
"resolve": "0.6.3",
|
||||||
"fs-extra": "0.16.5",
|
"fs-extra": "0.16.5",
|
||||||
"fstream-ignore": "1.0.2",
|
"fstream-ignore": "1.0.2",
|
||||||
"gitbook-parsers": "0.8.1",
|
"gitbook-parsers": "0.8.2",
|
||||||
"nunjucks": "mozilla/nunjucks#b4351ec0752b102ebd02c5e2cbc2898a6e0e4839",
|
"nunjucks": "mozilla/nunjucks#b4351ec0752b102ebd02c5e2cbc2898a6e0e4839",
|
||||||
"nunjucks-autoescape": "1.0.0",
|
"nunjucks-autoescape": "1.0.0",
|
||||||
"nunjucks-filter": "1.0.0",
|
"nunjucks-filter": "1.0.0",
|
||||||
|
|||||||
@@ -4,3 +4,6 @@
|
|||||||
* [Hello 2](hello2.md)
|
* [Hello 2](hello2.md)
|
||||||
* Hello 3
|
* Hello 3
|
||||||
* [Hello 4](hello3/hello4.md)
|
* [Hello 4](hello3/hello4.md)
|
||||||
|
* Hello 5
|
||||||
|
* [Hello 6](hello3/hello5/hello6.md)
|
||||||
|
|
||||||
|
|||||||
@@ -19,5 +19,6 @@ describe('Init Books', function () {
|
|||||||
should(fs.existsSync(path.resolve(initRoot, "hello.md"))).be.ok;
|
should(fs.existsSync(path.resolve(initRoot, "hello.md"))).be.ok;
|
||||||
should(fs.existsSync(path.resolve(initRoot, "hello2.md"))).be.ok;
|
should(fs.existsSync(path.resolve(initRoot, "hello2.md"))).be.ok;
|
||||||
should(fs.existsSync(path.resolve(initRoot, "hello3/hello4.md"))).be.ok;
|
should(fs.existsSync(path.resolve(initRoot, "hello3/hello4.md"))).be.ok;
|
||||||
|
should(fs.existsSync(path.resolve(initRoot, "hello3/hello5/hello6.md"))).be.ok;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ var should = require('should');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var Plugin = require('../lib/plugin');
|
var Plugin = require('../lib/plugin');
|
||||||
|
var parsers = require("gitbook-parsers");
|
||||||
var PLUGINS_ROOT = path.resolve(__dirname, 'plugins');
|
var PLUGINS_ROOT = path.resolve(__dirname, 'plugins');
|
||||||
|
|
||||||
describe('Plugins', function () {
|
describe('Plugins', function () {
|
||||||
@@ -200,5 +201,38 @@ describe('Plugins', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Blocks without parsing', function() {
|
||||||
|
var plugin;
|
||||||
|
|
||||||
|
before(function() {
|
||||||
|
plugin = new Plugin(book, "blocks");
|
||||||
|
plugin.load("./blocks", PLUGINS_ROOT);
|
||||||
|
|
||||||
|
return book.plugins.load(plugin);
|
||||||
|
});
|
||||||
|
|
||||||
|
var testTpl = function(markup, str, args, options) {
|
||||||
|
var filetype = parsers.get(markup);
|
||||||
|
|
||||||
|
return book.template.renderString(str, args, options)
|
||||||
|
.then(filetype.page).get('sections').get(0).get('content')
|
||||||
|
.then(book.template.postProcess)
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should correctly process unparsable for markdown', function() {
|
||||||
|
return testTpl('.md', '{% test %}**hello**{% endtest %}')
|
||||||
|
.then(function(content) {
|
||||||
|
content.should.equal("<p>test**hello**test</p>\n");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly process unparsable for asciidoc', function() {
|
||||||
|
return testTpl('.adoc', '{% test %}**hello**{% endtest %}')
|
||||||
|
.then(function(content) {
|
||||||
|
content.should.equal('<div class="paragraph">\n<p>test**hello**test</p>\n</div>');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user