print-window-tiddler
Jeremy Ruston 2012-12-13 21:31:57 +00:00
rodzic ce273a22f1
commit 916ca8eecf
1 zmienionych plików z 40 dodań i 0 usunięć

Wyświetl plik

@ -69,6 +69,19 @@ exports.removeArrayEntries = function(array,value) {
}
};
/*
Check whether any members of a hashmap are present in another hashmap
*/
exports.checkDependencies = function(dependencies,changes) {
var hit = false;
$tw.utils.each(changes,function(change,title) {
if($tw.utils.hop(dependencies,title)) {
hit = true;
}
});
return hit;
};
exports.deepCopy = function(object) {
var result,t;
if($tw.utils.isArray(object)) {
@ -302,6 +315,33 @@ exports.hyphenateCss = function(propName) {
});
};
/*
Parse a text reference in the format "title!!field" into its constituent parts
*/
exports.parseTextReference = function(textRef) {
// Look for a metadata field separator
var pos = textRef.indexOf("!!");
if(pos !== -1) {
if(pos === 0) {
// Just a field
return {
field: textRef.substring(2)
};
} else {
// Field and title
return {
title: textRef.substring(0,pos),
field: textRef.substring(pos + 2)
};
}
} else {
// Otherwise, we've just got a title
return {
title: textRef
};
}
};
/*
Extract the version number from the meta tag or from the boot file
*/