mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-02 04:46:57 +00:00
Revised test data
Testing against the output of cook.rb isn't satisfactory because of the bugs in it; instead we're now going to test against the tiddlywiki.com build products
This commit is contained in:
44
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Crypto.js
Executable file
44
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Crypto.js
Executable file
@@ -0,0 +1,44 @@
|
||||
//--
|
||||
//-- Deprecated Crypto functions and associated conversion routines.
|
||||
//-- Use the jQuery.encoding functions directly instead.
|
||||
//--
|
||||
|
||||
// Crypto 'namespace'
|
||||
function Crypto() {}
|
||||
|
||||
// Convert a string to an array of big-endian 32-bit words
|
||||
Crypto.strToBe32s = function(str)
|
||||
{
|
||||
return jQuery.encoding.strToBe32s(str);
|
||||
};
|
||||
|
||||
// Convert an array of big-endian 32-bit words to a string
|
||||
Crypto.be32sToStr = function(be)
|
||||
{
|
||||
return jQuery.encoding.be32sToStr(be);
|
||||
};
|
||||
|
||||
// Convert an array of big-endian 32-bit words to a hex string
|
||||
Crypto.be32sToHex = function(be)
|
||||
{
|
||||
return jQuery.encoding.be32sToHex(be);
|
||||
};
|
||||
|
||||
// Return, in hex, the SHA-1 hash of a string
|
||||
Crypto.hexSha1Str = function(str)
|
||||
{
|
||||
return jQuery.encoding.digests.hexSha1Str(str);
|
||||
};
|
||||
|
||||
// Return the SHA-1 hash of a string
|
||||
Crypto.sha1Str = function(str)
|
||||
{
|
||||
return jQuery.encoding.digests.sha1Str(str);
|
||||
};
|
||||
|
||||
// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
|
||||
Crypto.sha1 = function(x,blen)
|
||||
{
|
||||
return jQuery.encoding.digests.sha1(x,blen);
|
||||
};
|
||||
|
||||
90
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Deprecated.js
Executable file
90
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Deprecated.js
Executable file
@@ -0,0 +1,90 @@
|
||||
//--
|
||||
//-- Deprecated code
|
||||
//--
|
||||
|
||||
// @Deprecated: Use createElementAndWikify and this.termRegExp instead
|
||||
config.formatterHelpers.charFormatHelper = function(w)
|
||||
{
|
||||
w.subWikify(createTiddlyElement(w.output,this.element),this.terminator);
|
||||
};
|
||||
|
||||
// @Deprecated: Use enclosedTextHelper and this.lookaheadRegExp instead
|
||||
config.formatterHelpers.monospacedByLineHelper = function(w)
|
||||
{
|
||||
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
|
||||
lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
var text = lookaheadMatch[1];
|
||||
if(config.browser.isIE)
|
||||
text = text.replace(/\n/g,"\r");
|
||||
createTiddlyElement(w.output,"pre",null,null,text);
|
||||
w.nextMatch = lookaheadRegExp.lastIndex;
|
||||
}
|
||||
};
|
||||
|
||||
// @Deprecated: Use <br> or <br /> instead of <<br>>
|
||||
config.macros.br = {};
|
||||
config.macros.br.handler = function(place)
|
||||
{
|
||||
createTiddlyElement(place,"br");
|
||||
};
|
||||
|
||||
// Find an entry in an array. Returns the array index or null
|
||||
// @Deprecated: Use indexOf instead
|
||||
Array.prototype.find = function(item)
|
||||
{
|
||||
var i = this.indexOf(item);
|
||||
return i == -1 ? null : i;
|
||||
};
|
||||
|
||||
// Load a tiddler from an HTML DIV. The caller should make sure to later call Tiddler.changed()
|
||||
// @Deprecated: Use store.getLoader().internalizeTiddler instead
|
||||
Tiddler.prototype.loadFromDiv = function(divRef,title)
|
||||
{
|
||||
return store.getLoader().internalizeTiddler(store,this,title,divRef);
|
||||
};
|
||||
|
||||
// Format the text for storage in an HTML DIV
|
||||
// @Deprecated Use store.getSaver().externalizeTiddler instead.
|
||||
Tiddler.prototype.saveToDiv = function()
|
||||
{
|
||||
return store.getSaver().externalizeTiddler(store,this);
|
||||
};
|
||||
|
||||
// @Deprecated: Use store.allTiddlersAsHtml() instead
|
||||
function allTiddlersAsHtml()
|
||||
{
|
||||
return store.allTiddlersAsHtml();
|
||||
}
|
||||
|
||||
// @Deprecated: Use refreshPageTemplate instead
|
||||
function applyPageTemplate(title)
|
||||
{
|
||||
refreshPageTemplate(title);
|
||||
}
|
||||
|
||||
// @Deprecated: Use story.displayTiddlers instead
|
||||
function displayTiddlers(srcElement,titles,template,unused1,unused2,animate,unused3)
|
||||
{
|
||||
story.displayTiddlers(srcElement,titles,template,animate);
|
||||
}
|
||||
|
||||
// @Deprecated: Use story.displayTiddler instead
|
||||
function displayTiddler(srcElement,title,template,unused1,unused2,animate,unused3)
|
||||
{
|
||||
story.displayTiddler(srcElement,title,template,animate);
|
||||
}
|
||||
|
||||
// @Deprecated: Use functions on right hand side directly instead
|
||||
var createTiddlerPopup = Popup.create;
|
||||
var scrollToTiddlerPopup = Popup.show;
|
||||
var hideTiddlerPopup = Popup.remove;
|
||||
|
||||
// @Deprecated: Use right hand side directly instead
|
||||
var regexpBackSlashEn = new RegExp("\\\\n","mg");
|
||||
var regexpBackSlash = new RegExp("\\\\","mg");
|
||||
var regexpBackSlashEss = new RegExp("\\\\s","mg");
|
||||
var regexpNewLine = new RegExp("\n","mg");
|
||||
var regexpCarriageReturn = new RegExp("\r","mg");
|
||||
|
||||
20
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/FileAdaptor.js
Executable file
20
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/FileAdaptor.js
Executable file
@@ -0,0 +1,20 @@
|
||||
//--
|
||||
//-- Deprecated FileAdaptor functions
|
||||
//--
|
||||
|
||||
FileAdaptor.loadTiddlyWikiCallback = function(status,context,responseText,url,xhr)
|
||||
{
|
||||
context.status = status;
|
||||
if(!status) {
|
||||
context.statusText = "Error reading file";
|
||||
} else {
|
||||
//# Load the content into a TiddlyWiki() object
|
||||
context.adaptor.store = new TiddlyWiki();
|
||||
if(!context.adaptor.store.importTiddlyWiki(responseText)) {
|
||||
context.statusText = config.messages.invalidFileError.format([url]);
|
||||
context.status = false;
|
||||
}
|
||||
}
|
||||
context.complete(context,context.userParams);
|
||||
};
|
||||
|
||||
26
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Http.js
Executable file
26
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Http.js
Executable file
@@ -0,0 +1,26 @@
|
||||
//--
|
||||
//-- Deprecated HTTP request code
|
||||
//-- Use the jQuery ajax functions directly instead
|
||||
//--
|
||||
|
||||
//# Load a file over http
|
||||
//# url - the source url
|
||||
//# callback - function to call when there is a response
|
||||
//# params - parameter object that gets passed to the callback for storing it's state
|
||||
//# Return value is the underlying XMLHttpRequest object, or a string if there was an error
|
||||
//# Callback function is called like this:
|
||||
//# callback(status,params,responseText,xhr)
|
||||
//# status - true if OK, false if error
|
||||
//# params - the parameter object provided to loadRemoteFile()
|
||||
//# responseText - the text of the file
|
||||
//# xhr - the underlying XMLHttpRequest object
|
||||
function loadRemoteFile(url,callback,params)
|
||||
{
|
||||
return httpReq("GET",url,callback,params);
|
||||
}
|
||||
|
||||
function doHttp(type,url,data,contentType,username,password,callback,params,headers,allowCache)
|
||||
{
|
||||
return httpReq(type,url,callback,params,headers,data,contentType,username,password,allowCache);
|
||||
}
|
||||
|
||||
16
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Numbers.js
Executable file
16
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Numbers.js
Executable file
@@ -0,0 +1,16 @@
|
||||
//--
|
||||
//-- Deprecated Number functions
|
||||
//--
|
||||
|
||||
// @Deprecated: no direct replacement, since not used in core code
|
||||
// Clamp a number to a range
|
||||
Number.prototype.clamp = function(min,max)
|
||||
{
|
||||
var c = this;
|
||||
if(c < min)
|
||||
c = min;
|
||||
if(c > max)
|
||||
c = max;
|
||||
return Number(c);
|
||||
};
|
||||
|
||||
29
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Strings.js
Executable file
29
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Strings.js
Executable file
@@ -0,0 +1,29 @@
|
||||
//--
|
||||
//-- Deprecated String functions
|
||||
//--
|
||||
|
||||
// @Deprecated: no direct replacement, since not used in core code
|
||||
String.prototype.toJSONString = function()
|
||||
{
|
||||
// Convert a string to it's JSON representation by encoding control characters, double quotes and backslash. See json.org
|
||||
var m = {
|
||||
'\b': '\\b',
|
||||
'\f': '\\f',
|
||||
'\n': '\\n',
|
||||
'\r': '\\r',
|
||||
'\t': '\\t',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
var replaceFn = function(a,b) {
|
||||
var c = m[b];
|
||||
if(c)
|
||||
return c;
|
||||
c = b.charCodeAt();
|
||||
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
|
||||
};
|
||||
if(/["\\\x00-\x1f]/.test(this))
|
||||
return '"' + this.replace(/([\x00-\x1f\\"])/g,replaceFn) + '"';
|
||||
return '"' + this + '"';
|
||||
};
|
||||
|
||||
22
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Tiddler.js
Executable file
22
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Tiddler.js
Executable file
@@ -0,0 +1,22 @@
|
||||
//--
|
||||
//-- Deprecated Tiddler code
|
||||
//--
|
||||
|
||||
// @Deprecated: Use tiddlerToRssItem(tiddler,uri) instead
|
||||
Tiddler.prototype.toRssItem = function(uri)
|
||||
{
|
||||
return tiddlerToRssItem(this,uri);
|
||||
};
|
||||
|
||||
// @Deprecated: Use "<item>\n" + tiddlerToRssItem(tiddler,uri) + "\n</item>" instead
|
||||
Tiddler.prototype.saveToRss = function(uri)
|
||||
{
|
||||
return "<item>\n" + tiddlerToRssItem(this,uri) + "\n</item>";
|
||||
};
|
||||
|
||||
// @Deprecated: Use jQuery.encoding.digests.hexSha1Str instead
|
||||
Tiddler.prototype.generateFingerprint = function()
|
||||
{
|
||||
return "0x" + Crypto.hexSha1Str(this.text);
|
||||
};
|
||||
|
||||
38
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Utilities.js
Executable file
38
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Utilities.js
Executable file
@@ -0,0 +1,38 @@
|
||||
//--
|
||||
//-- Deprecated utility functions
|
||||
//-- Use the jQuery functions directly instead
|
||||
//--
|
||||
|
||||
// Remove all children of a node
|
||||
function removeChildren(e)
|
||||
{
|
||||
jQuery(e).empty();
|
||||
}
|
||||
|
||||
// Remove a node and all it's children
|
||||
function removeNode(e)
|
||||
{
|
||||
jQuery(e).remove();
|
||||
}
|
||||
|
||||
// Return the content of an element as plain text with no formatting
|
||||
function getPlainText(e)
|
||||
{
|
||||
return jQuery(e).text();
|
||||
}
|
||||
|
||||
function addClass(e,className)
|
||||
{
|
||||
jQuery(e).addClass(className);
|
||||
}
|
||||
|
||||
function removeClass(e,className)
|
||||
{
|
||||
jQuery(e).removeClass(className);
|
||||
}
|
||||
|
||||
function hasClass(e,className)
|
||||
{
|
||||
return jQuery(e).hasClass(className);
|
||||
}
|
||||
|
||||
16
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Wikifier.js
Executable file
16
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Wikifier.js
Executable file
@@ -0,0 +1,16 @@
|
||||
//--
|
||||
//-- Deprecated Wikifier code
|
||||
//--
|
||||
|
||||
//# Wikify a named tiddler to plain text
|
||||
function wikifyPlain(title,theStore,limit)
|
||||
{
|
||||
if(!theStore)
|
||||
theStore = store;
|
||||
if(theStore.tiddlerExists(title) || theStore.isShadowTiddler(title)) {
|
||||
return wikifyPlainText(theStore.getTiddlerText(title),limit,tiddler);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
10
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/split.recipe
Executable file
10
test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/split.recipe
Executable file
@@ -0,0 +1,10 @@
|
||||
jsdeprecated: Crypto.js
|
||||
jsdeprecated: Deprecated.js
|
||||
jsdeprecated: FileAdaptor.js
|
||||
jsdeprecated: Http.js
|
||||
jsdeprecated: Strings.js
|
||||
jsdeprecated: Tiddler.js
|
||||
jsdeprecated: Numbers.js
|
||||
jsdeprecated: Utilities.js
|
||||
jsdeprecated: Wikifier.js
|
||||
|
||||
Reference in New Issue
Block a user