Add more deprecated api

This commit is contained in:
Samy Pessé
2016-03-07 11:00:01 +01:00
parent b4bdf97cfe
commit b61254dda6
3 changed files with 16 additions and 3 deletions
+13
View File
@@ -100,6 +100,12 @@ function Book(opts) {
var cfg = this.config.dump();
error.deprecateField(cfg, 'book', (this.output? this.output.name : null), '"options.generator" property is deprecated, use "output.name" instead');
// options.generator
cfg.generator = this.output? this.output.name : null;
// options.output
cfg.output = this.output? this.output.root() : null;
return cfg;
}
});
@@ -353,6 +359,13 @@ Book.prototype.isInLanguageBook = function(filename) {
});
};
// ----- DEPRECATED METHODS
Book.prototype.contentLink = error.deprecateMethod(function(s) {
return this.output.toURL(s);
}, '.contentLink() is deprecated, use ".output.toURL()" instead');
// Initialize a book
Book.init = function(fs, root, opts) {
var book = new Book(_.extend(opts || {}, {
+2 -2
View File
@@ -185,7 +185,7 @@ Output.prototype.onRelativeLink = function(currentPage, href) {
href = currentPage.relative(href);
// Replace .md by .html
href = this.outputUrl(href);
href = this.toURL(href);
}
return href;
@@ -263,7 +263,7 @@ Output.prototype.outputPath = function(filename, ext) {
// Filename for output
// /test/index.html -> /test/
Output.prototype.outputUrl = function(filename, ext) {
Output.prototype.toURL = function(filename, ext) {
var href = this.outputPath(filename, ext);
if (path.basename(href) == 'index.html' && this.opts.directoryIndex) {
+1 -1
View File
@@ -117,7 +117,7 @@ WebsiteOutput.prototype.prepare = function() {
// Transform a '.md' into a '.html' (README -> index)
that.env.addFilter('contentURL', function(s) {
return location.normalize(that.outputUrl(s));
return that.toURL(s);
});
// Relase path to an asset