mirror of
https://gitlab.com/octtspacc/OcttKB
synced 2025-06-06 00:29:12 +02:00
OcttKB Cross-Repo Sync (HTML to Raw)
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
/*\
|
||||
module-type: library
|
||||
|
||||
This handles all logging and alerts Relink emits.
|
||||
|
||||
\*/
|
||||
|
||||
exports.getString = function(outputType, title, options) {
|
||||
title = "$:/plugins/flibbles/relink/language/" + title;
|
||||
return options.wiki.renderTiddler(outputType, title, options);
|
||||
};
|
||||
|
||||
var logger;
|
||||
|
||||
exports.warn = function(string, options) {
|
||||
if (!logger) {
|
||||
logger = new $tw.utils.Logger("Relinker");
|
||||
}
|
||||
logger.alert(string);
|
||||
};
|
||||
|
||||
exports.reportFailures = function(failureList, options) {
|
||||
var alertString = this.getString("text/html", "Error/ReportFailedRelinks", options)
|
||||
var alreadyReported = Object.create(null);
|
||||
var reportList = [];
|
||||
$tw.utils.each(failureList, function(f) {
|
||||
if (!alreadyReported[f]) {
|
||||
if ($tw.browser) {
|
||||
// This might not make the link if the title is complicated.
|
||||
// Whatever.
|
||||
reportList.push("\n* [[" + f + "]]");
|
||||
} else {
|
||||
reportList.push("\n* " + f);
|
||||
}
|
||||
alreadyReported[f] = true;
|
||||
}
|
||||
});
|
||||
this.warn(alertString + "\n" + reportList.join(""));
|
||||
};
|
Reference in New Issue
Block a user