mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-21 01:34:51 +00:00
Refactored linkMassager mechanism
Now the link massager can control the HTML attributes of the link, and suppress it entirely if necessary. Using this new facility to generate a cleaner readme file for github
This commit is contained in:
@@ -117,6 +117,22 @@ var commandLineSwitches = {
|
||||
});
|
||||
}
|
||||
},
|
||||
links: {
|
||||
args: {min: 1, max: 1},
|
||||
handler: function(args,callback) {
|
||||
var type = args[0];
|
||||
app.store.linkMassager = function(linkInfo) {
|
||||
switch(type) {
|
||||
case "none":
|
||||
if(!linkInfo.isExternal) {
|
||||
linkInfo.suppressLink = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
process.nextTick(function() {callback(null);});
|
||||
}
|
||||
},
|
||||
savewiki: {
|
||||
args: {min: 1, max: 1},
|
||||
handler: function(args,callback) {
|
||||
@@ -284,6 +300,9 @@ var processNextSwitch = function() {
|
||||
if(currSwitch < switches.length) {
|
||||
var s = switches[currSwitch++],
|
||||
csw = commandLineSwitches[s.switchName];
|
||||
if(!csw) {
|
||||
throw "Unknown command line switch --" + s.switchName;
|
||||
}
|
||||
if(s.args.length < csw.args.min) {
|
||||
throw "Command line switch --" + s.switchName + " should have a minimum of " + csw.args.min + " arguments";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user