mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
Add resources.substitute back, fix toc promise
This commit is contained in:
parent
8edc82244c
commit
662a3e1079
7 changed files with 43 additions and 8 deletions
|
@ -224,4 +224,22 @@ Resources.prototype.get = function(path) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Substitute urls in content, with replacements,
|
||||
* relative to a url if provided
|
||||
* @param {string} content
|
||||
* @param {[string]} url url to resolve to
|
||||
* @return {string} content with urls substituted
|
||||
*/
|
||||
Resources.prototype.substitute = function(content, url) {
|
||||
var relUrls;
|
||||
if (url) {
|
||||
relUrls = this.relativeTo(url);
|
||||
} else {
|
||||
relUrls = this.urls;
|
||||
}
|
||||
return replace.substitute(content, relUrls, this.replacementUrls);
|
||||
};
|
||||
|
||||
|
||||
module.exports = Resources;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue