1
0
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:
Jeremy Ruston
2012-04-07 12:10:46 +01:00
parent 5d10e7b750
commit af7b69e778
6 changed files with 71 additions and 27 deletions

View File

@@ -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";
}