fix
This commit is contained in:
25
book/node_modules/honkit/lib/output/helper/resolveFileToURL.js
generated
vendored
Normal file
25
book/node_modules/honkit/lib/output/helper/resolveFileToURL.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const location_1 = __importDefault(require("../../utils/location"));
|
||||
const fileToURL_1 = __importDefault(require("./fileToURL"));
|
||||
/**
|
||||
* Resolve an absolute path (extracted from a link)
|
||||
*
|
||||
* @param {Output} output
|
||||
* @param {string} filePath
|
||||
* @return {string}
|
||||
*/
|
||||
function resolveFileToURL(output, filePath) {
|
||||
// Convert /test.png -> test.png
|
||||
filePath = location_1.default.toAbsolute(filePath, "", "");
|
||||
const page = output.getPage(filePath);
|
||||
// if file is a page, return correct .html url
|
||||
if (page) {
|
||||
filePath = (0, fileToURL_1.default)(output, filePath);
|
||||
}
|
||||
return location_1.default.normalize(filePath);
|
||||
}
|
||||
exports.default = resolveFileToURL;
|
Reference in New Issue
Block a user