in packages/docpack-page-generator/lib/plugin.js [162:186]
PageGeneratorPlugin.prototype.generateURL = function(target, compilationContext) {
var config = this.config;
var url;
var typeofURL = typeof config.url;
if ('attrs' in target && CONST.URL_ATTR_NAME in target.attrs) {
url = target.attrs[CONST.URL_ATTR_NAME];
}
else if (typeofURL == 'string') {
url = config.url;
} else if (typeofURL == 'function') {
url = config.url(target);
if (typeof url != 'string') {
throw new Error('`url` function should return a string');
}
} else {
throw new Error('`url` option can be string or function');
}
return tools.interpolateName(url, {
path: target.absolutePath,
context: compilationContext,
content: target.content
});
};