mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-22 19:04:38 +00:00
Compare commits
216 Commits
v5.0.4-bet
...
v5.0.7-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f6ee1d2a8 | ||
|
|
183e9544b4 | ||
|
|
dfc57ffa49 | ||
|
|
3f9561dd95 | ||
|
|
37ca86ff3d | ||
|
|
cf26986061 | ||
|
|
54822e25d4 | ||
|
|
4a9108154d | ||
|
|
8a88253b4e | ||
|
|
7891824883 | ||
|
|
fca5681a1a | ||
|
|
5c9a5f5cba | ||
|
|
69d342d46a | ||
|
|
66254b436c | ||
|
|
d42981f201 | ||
|
|
04dbf99e54 | ||
|
|
762940adbc | ||
|
|
f58d4fb531 | ||
|
|
45c45e098f | ||
|
|
b5629ccc82 | ||
|
|
bd067c6b1e | ||
|
|
1d10ccb368 | ||
|
|
9297b27b89 | ||
|
|
0b3efe179e | ||
|
|
e6843aabff | ||
|
|
02d3861d7d | ||
|
|
592ef257a2 | ||
|
|
6ba9bf9a95 | ||
|
|
18fe0c0f75 | ||
|
|
c49681ecf3 | ||
|
|
6255b97b14 | ||
|
|
6cb44ac0cc | ||
|
|
b1b9c7d6cd | ||
|
|
951147d502 | ||
|
|
9539664e46 | ||
|
|
f9b5d75446 | ||
|
|
70a7321edd | ||
|
|
9522050aa7 | ||
|
|
8d37219545 | ||
|
|
a76da88380 | ||
|
|
42262a637c | ||
|
|
e6a7a0db1e | ||
|
|
edc71cb920 | ||
|
|
bd48ecfcb1 | ||
|
|
f4b27b33de | ||
|
|
644d88a6c5 | ||
|
|
43eb81173d | ||
|
|
a8eff78b62 | ||
|
|
f90db97625 | ||
|
|
e339b6dffe | ||
|
|
64304f9b7f | ||
|
|
867dfabff8 | ||
|
|
b627bba277 | ||
|
|
b9b1b001da | ||
|
|
e9ae8d2015 | ||
|
|
2fc6451bf7 | ||
|
|
f31369035b | ||
|
|
1e54b1bcc9 | ||
|
|
d3c421985c | ||
|
|
1c283c5586 | ||
|
|
4f5a923ca0 | ||
|
|
95cb99adb9 | ||
|
|
d5df78d979 | ||
|
|
ed5cf8b044 | ||
|
|
98edbec46d | ||
|
|
299e9d15fb | ||
|
|
2f4932fefc | ||
|
|
5f1d49f2e0 | ||
|
|
6ea9dc997f | ||
|
|
c9d06ad18a | ||
|
|
3414f1ca8e | ||
|
|
60926198b1 | ||
|
|
2c790d982f | ||
|
|
839361d54f | ||
|
|
14ca91a949 | ||
|
|
81de74342d | ||
|
|
0338c36610 | ||
|
|
c7fb0bd349 | ||
|
|
d7d5165847 | ||
|
|
aefc7b7ce2 | ||
|
|
1657111cb7 | ||
|
|
08a8689117 | ||
|
|
b1b38dc143 | ||
|
|
22f48198bd | ||
|
|
4072c4461d | ||
|
|
43fb16f232 | ||
|
|
809c441ab3 | ||
|
|
9985efa406 | ||
|
|
84e149e36c | ||
|
|
25423d2d07 | ||
|
|
12770ca3e6 | ||
|
|
a5d75db8d2 | ||
|
|
9444ef095f | ||
|
|
b04141fefd | ||
|
|
c74bf6a655 | ||
|
|
19080f9958 | ||
|
|
b5d2b79a37 | ||
|
|
17b542980f | ||
|
|
8f4e1587a2 | ||
|
|
4b000fac72 | ||
|
|
426f2978cf | ||
|
|
bad2e36e45 | ||
|
|
a4f895dc4d | ||
|
|
e254529763 | ||
|
|
5dff212e5a | ||
|
|
b7a1db1e9f | ||
|
|
6964120fce | ||
|
|
a704498155 | ||
|
|
83811bc2a9 | ||
|
|
bd40977c85 | ||
|
|
e87097c22e | ||
|
|
e74cb05540 | ||
|
|
b326315b0e | ||
|
|
a3384d101e | ||
|
|
8ef520ef37 | ||
|
|
b64b7982af | ||
|
|
c5035fc0b0 | ||
|
|
2740f8c1f0 | ||
|
|
209bc78268 | ||
|
|
ffcc215e8f | ||
|
|
0fb13e649b | ||
|
|
b42eefe1e8 | ||
|
|
82a48cf85c | ||
|
|
9fee9b1043 | ||
|
|
d57010d2fb | ||
|
|
f2409d4245 | ||
|
|
4181de5b74 | ||
|
|
954901d788 | ||
|
|
4688190c96 | ||
|
|
a1d2e70307 | ||
|
|
e0f428b9b2 | ||
|
|
504f353844 | ||
|
|
7857464ab5 | ||
|
|
103f4f6637 | ||
|
|
b06e09a4d3 | ||
|
|
9d72570092 | ||
|
|
1638824adc | ||
|
|
79bed656bb | ||
|
|
6fcfa2738a | ||
|
|
47ebed87f9 | ||
|
|
3c35c9ecf8 | ||
|
|
027421f5e6 | ||
|
|
1a74e2538c | ||
|
|
8fc5c1d4a0 | ||
|
|
1374bd9d78 | ||
|
|
307b5c7d6b | ||
|
|
5dea8ca758 | ||
|
|
3677fdd3b0 | ||
|
|
5758fcb69b | ||
|
|
385099c4f7 | ||
|
|
2343bb3e5b | ||
|
|
b132e1023d | ||
|
|
2d99f4dc15 | ||
|
|
c9b319c41c | ||
|
|
b652238650 | ||
|
|
d0cd72ed85 | ||
|
|
4289367b7f | ||
|
|
b76ca5dc3b | ||
|
|
71b5c561f2 | ||
|
|
6a02535d08 | ||
|
|
87fbd988f1 | ||
|
|
3d79eb87d1 | ||
|
|
089a838611 | ||
|
|
e48e7e9443 | ||
|
|
917865c393 | ||
|
|
ec14a0a16d | ||
|
|
b9e80a270b | ||
|
|
44568dc6ef | ||
|
|
d043bdd289 | ||
|
|
ce8cc7607f | ||
|
|
6d6e8afb9c | ||
|
|
bb0be9e02f | ||
|
|
5dd33904e7 | ||
|
|
2ee5093944 | ||
|
|
87a553d75d | ||
|
|
ec7dff291d | ||
|
|
de2e5adf15 | ||
|
|
b3ad61ce20 | ||
|
|
5eb57365b6 | ||
|
|
c49bc2b0a6 | ||
|
|
3494dd019d | ||
|
|
784e6d17f0 | ||
|
|
9efd45dda9 | ||
|
|
eb7b82696b | ||
|
|
3b114371d0 | ||
|
|
14868d8228 | ||
|
|
3cc8138133 | ||
|
|
b6f2f1e1aa | ||
|
|
424147234e | ||
|
|
8e080eac0a | ||
|
|
38142d2b19 | ||
|
|
bd7db62da0 | ||
|
|
4cdfbd6b36 | ||
|
|
ef59a3743f | ||
|
|
cee1bc0863 | ||
|
|
ce8c79ecfa | ||
|
|
ac81d9d43f | ||
|
|
d69614259f | ||
|
|
0e88417e62 | ||
|
|
46892371cb | ||
|
|
f9de55ad5f | ||
|
|
81106e500d | ||
|
|
cfad04a5d0 | ||
|
|
1aa5dedfaf | ||
|
|
98fdd3e184 | ||
|
|
73c5ecdaa7 | ||
|
|
eef32e70e3 | ||
|
|
ad6bf4f9c5 | ||
|
|
7db31dc138 | ||
|
|
7b7e799a70 | ||
|
|
3aab737bea | ||
|
|
12b4cc5d3e | ||
|
|
10c25c1692 | ||
|
|
c35742f916 | ||
|
|
15a41d7e57 | ||
|
|
4e37fa7e47 |
11
bld.cmd
11
bld.cmd
@@ -38,9 +38,12 @@ node .\tiddlywiki.js ^
|
||||
--savetiddler $:/favicon.ico %TW5_BUILD_OUTPUT%\favicon.ico ^
|
||||
--rendertiddler ReadMe .\readme.md text/html ^
|
||||
--rendertiddler ContributingTemplate .\contributing.md text/html ^
|
||||
--rendertiddler $:/core/copyright.txt .\licenses\copyright.md text/plain ^
|
||||
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.html text/plain ^
|
||||
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.hta text/plain ^
|
||||
--savetiddler $:/green_favicon.ico %TW5_BUILD_OUTPUT%/static/favicon.ico ^
|
||||
--rendertiddler $:/core/templates/static.template.html %TW5_BUILD_OUTPUT%\static.html text/plain ^
|
||||
--rendertiddler $:/core/templates/alltiddlers.template.html %TW5_BUILD_OUTPUT%\alltiddlers.html text/plain ^
|
||||
--rendertiddler $:/core/templates/static.template.css %TW5_BUILD_OUTPUT%\static\static.css text/plain ^
|
||||
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html %TW5_BUILD_OUTPUT%\static text/plain ^
|
||||
|| exit 1
|
||||
@@ -87,6 +90,14 @@ node .\tiddlywiki.js ^
|
||||
|| exit 1
|
||||
|
||||
|
||||
rem highlightdemo.html: wiki to demo highlight plugin
|
||||
|
||||
node .\tiddlywiki.js ^
|
||||
.\editions\highlightdemo ^
|
||||
--verbose ^
|
||||
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\highlightdemo.html text/plain ^
|
||||
|| exit 1
|
||||
|
||||
rem Make the CNAME file that GitHub Pages requires
|
||||
|
||||
echo tiddlywiki.com > %TW5_BUILD_OUTPUT%\CNAME
|
||||
|
||||
11
bld.sh
11
bld.sh
@@ -39,9 +39,12 @@ node ./tiddlywiki.js \
|
||||
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
|
||||
--rendertiddler ReadMe ./readme.md text/html \
|
||||
--rendertiddler ContributingTemplate ./contributing.md text/html \
|
||||
--rendertiddler $:/core/copyright.txt ./licenses/copyright.md text/plain \
|
||||
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.html text/plain \
|
||||
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.hta text/plain \
|
||||
--savetiddler $:/green_favicon.ico $TW5_BUILD_OUTPUT/static/favicon.ico \
|
||||
--rendertiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \
|
||||
--rendertiddler $:/core/templates/alltiddlers.template.html $TW5_BUILD_OUTPUT/alltiddlers.html text/plain \
|
||||
--rendertiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \
|
||||
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
|
||||
|| exit 1
|
||||
@@ -87,6 +90,14 @@ node ./tiddlywiki.js \
|
||||
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# highlightdemo.html: wiki to demo highlight plugin
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
./editions/highlightdemo \
|
||||
--verbose \
|
||||
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/highlightdemo.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# Run the test edition to run the Node.js tests and to generate test.html for tests in the browser
|
||||
|
||||
./test.sh
|
||||
|
||||
@@ -14,10 +14,10 @@ Error message and password prompt
|
||||
z-index: 20000;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
width: 480px;
|
||||
width: 200px;
|
||||
top: 4em;
|
||||
left: 50%;
|
||||
margin-left: -264px; /* - width/2 - paddingHorz/2 - border */
|
||||
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
|
||||
padding: 16px 16px 16px 16px;
|
||||
-webkit-border-radius: 8px;
|
||||
-moz-border-radius: 8px;
|
||||
@@ -29,6 +29,8 @@ Error message and password prompt
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
|
||||
background-color: rgb(255, 75, 75);
|
||||
border: 8px solid rgb(255, 0, 0);
|
||||
width: 480px;
|
||||
margin-left: -244px; /* - width/2 - paddingHorz/2 - border */
|
||||
}
|
||||
|
||||
.tw-error-form div {
|
||||
@@ -54,4 +56,9 @@ Error message and password prompt
|
||||
.tw-password-wrapper h1 {
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.tw-password-wrapper input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
134
boot/boot.js
134
boot/boot.js
@@ -38,7 +38,7 @@ $tw.boot = $tw.boot || {};
|
||||
/////////////////////////// Standard node.js libraries
|
||||
|
||||
var fs, path, vm;
|
||||
if(!$tw.browser) {
|
||||
if($tw.node) {
|
||||
fs = require("fs");
|
||||
path = require("path");
|
||||
vm = require("vm");
|
||||
@@ -46,15 +46,6 @@ if(!$tw.browser) {
|
||||
|
||||
/////////////////////////// Utility functions
|
||||
|
||||
/*
|
||||
Log a message
|
||||
*/
|
||||
$tw.utils.log = function(/* args */) {
|
||||
if(console !== undefined && console.log !== undefined) {
|
||||
return Function.apply.call(console.log, console, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Check if an object has a property
|
||||
*/
|
||||
@@ -207,10 +198,10 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
||||
};
|
||||
|
||||
/*
|
||||
Convert "&" to &, "<" to <, ">" to > and """ to "
|
||||
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to "
|
||||
*/
|
||||
$tw.utils.htmlDecode = function(s) {
|
||||
return s.toString().replace(/</mg,"<").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&");
|
||||
return s.toString().replace(/</mg,"<").replace(/ /mg,"\x40").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&");
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -246,7 +237,7 @@ $tw.utils.parseDate = function(value) {
|
||||
parseInt(value.substr(10,2)||"00",10),
|
||||
parseInt(value.substr(12,2)||"00",10),
|
||||
parseInt(value.substr(14,3)||"000",10)));
|
||||
} else if ($tw.utils.isDate(value)) {
|
||||
} else if($tw.utils.isDate(value)) {
|
||||
return value;
|
||||
} else {
|
||||
return null;
|
||||
@@ -282,7 +273,7 @@ $tw.utils.parseStringArray = function(value) {
|
||||
}
|
||||
} while(match);
|
||||
return results;
|
||||
} else if ($tw.utils.isArray(value)) {
|
||||
} else if($tw.utils.isArray(value)) {
|
||||
return value;
|
||||
} else {
|
||||
return null;
|
||||
@@ -448,11 +439,13 @@ Adds a new password prompt. Options are:
|
||||
submitText: text to use for submit button (defaults to "Login")
|
||||
serviceName: text of the human readable service name
|
||||
noUserName: set true to disable username prompt
|
||||
canCancel: set true to enable a cancel button (callback called with null)
|
||||
callback: function to be called on submission with parameter of object {username:,password:}. Callback must return `true` to remove the password prompt
|
||||
*/
|
||||
$tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
|
||||
// Create and add the prompt to the DOM
|
||||
var submitText = options.submitText || "Login",
|
||||
var self = this,
|
||||
submitText = options.submitText || "Login",
|
||||
dm = $tw.utils.domMaker,
|
||||
children = [dm("h1",{text: options.serviceName})];
|
||||
if(!options.noUserName) {
|
||||
@@ -465,6 +458,19 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
|
||||
attributes: {type: "password", name: "password", placeholder: "Password"},
|
||||
"class": "input-small"
|
||||
}));
|
||||
if(options.canCancel) {
|
||||
children.push(dm("button",{
|
||||
text: "Cancel",
|
||||
"class": "btn",
|
||||
eventListeners: [{
|
||||
name: "click",
|
||||
handlerFunction: function(event) {
|
||||
self.removePrompt(promptInfo);
|
||||
options.callback(null);
|
||||
}
|
||||
}]
|
||||
}));
|
||||
}
|
||||
children.push(dm("button",{
|
||||
attributes: {type: "submit"},
|
||||
text: submitText,
|
||||
@@ -492,12 +498,7 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
|
||||
// Call the callback
|
||||
if(options.callback(data)) {
|
||||
// Remove the prompt if the callback returned true
|
||||
var i = self.passwordPrompts.indexOf(promptInfo);
|
||||
if(i !== -1) {
|
||||
self.passwordPrompts.splice(i,1);
|
||||
promptInfo.form.parentNode.removeChild(promptInfo.form);
|
||||
self.setWrapperDisplay();
|
||||
}
|
||||
self.removePrompt(promptInfo);
|
||||
} else {
|
||||
// Clear the password if the callback returned false
|
||||
$tw.utils.each(form.elements,function(element) {
|
||||
@@ -520,17 +521,29 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
|
||||
this.setWrapperDisplay();
|
||||
};
|
||||
|
||||
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
|
||||
var i = this.passwordPrompts.indexOf(promptInfo);
|
||||
if(i !== -1) {
|
||||
this.passwordPrompts.splice(i,1);
|
||||
promptInfo.form.parentNode.removeChild(promptInfo.form);
|
||||
this.setWrapperDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Crypto helper object for encrypted content. It maintains the password text in a closure, and provides methods to change
|
||||
the password, and to encrypt/decrypt a block of text
|
||||
*/
|
||||
$tw.utils.Crypto = function() {
|
||||
var sjcl = $tw.browser ? window.sjcl : require("./sjcl.js"),
|
||||
password = null,
|
||||
callSjcl = function(method,inputText) {
|
||||
currentPassword = null,
|
||||
callSjcl = function(method,inputText,password) {
|
||||
password = password || currentPassword;
|
||||
var outputText;
|
||||
try {
|
||||
outputText = sjcl[method](password,inputText);
|
||||
if(password) {
|
||||
outputText = sjcl[method](password,inputText);
|
||||
}
|
||||
} catch(ex) {
|
||||
console.log("Crypto error:" + ex);
|
||||
outputText = null;
|
||||
@@ -538,22 +551,22 @@ $tw.utils.Crypto = function() {
|
||||
return outputText;
|
||||
};
|
||||
this.setPassword = function(newPassword) {
|
||||
password = newPassword;
|
||||
currentPassword = newPassword;
|
||||
this.updateCryptoStateTiddler();
|
||||
};
|
||||
this.updateCryptoStateTiddler = function() {
|
||||
if($tw.wiki && $tw.wiki.addTiddler) {
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: password ? "yes" : "no"}));
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: currentPassword ? "yes" : "no"}));
|
||||
}
|
||||
};
|
||||
this.hasPassword = function() {
|
||||
return !!password;
|
||||
return !!currentPassword;
|
||||
}
|
||||
this.encrypt = function(text) {
|
||||
return callSjcl("encrypt",text);
|
||||
this.encrypt = function(text,password) {
|
||||
return callSjcl("encrypt",text,password);
|
||||
};
|
||||
this.decrypt = function(text) {
|
||||
return callSjcl("decrypt",text);
|
||||
this.decrypt = function(text,password) {
|
||||
return callSjcl("decrypt",text,password);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -779,7 +792,9 @@ $tw.Wiki.prototype.addTiddler = function(tiddler) {
|
||||
if(!(tiddler instanceof $tw.Tiddler)) {
|
||||
tiddler = new $tw.Tiddler(tiddler);
|
||||
}
|
||||
this.tiddlers[tiddler.fields.title] = tiddler;
|
||||
if(tiddler.fields.title) {
|
||||
this.tiddlers[tiddler.fields.title] = tiddler;
|
||||
}
|
||||
};
|
||||
|
||||
$tw.Wiki.prototype.addTiddlers = function(tiddlers) {
|
||||
@@ -859,10 +874,12 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
|
||||
// Extract the constituent tiddlers
|
||||
$tw.utils.each(pluginInfo.tiddlers,function(constituentTiddler,constituentTitle) {
|
||||
// Save the tiddler object
|
||||
self.shadowTiddlers[constituentTitle] = {
|
||||
source: tiddler.fields.title,
|
||||
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
|
||||
};
|
||||
if(constituentTitle) {
|
||||
self.shadowTiddlers[constituentTitle] = {
|
||||
source: tiddler.fields.title,
|
||||
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -911,7 +928,7 @@ $tw.Wiki.prototype.getTiddler = function(title) {
|
||||
var t = this.tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
return t;
|
||||
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
|
||||
} else if(title !== undefined && $tw.utils.hop(this.shadowTiddlers,title)) {
|
||||
return this.shadowTiddlers[title].tiddler;
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -1096,7 +1113,7 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
||||
}
|
||||
});
|
||||
|
||||
$tw.loadTiddlers = function() {
|
||||
$tw.loadTiddlersBrowser = function() {
|
||||
// In the browser, we load tiddlers from certain elements
|
||||
var containerIds = [
|
||||
"libraryModules",
|
||||
@@ -1131,6 +1148,12 @@ $tw.boot.decryptEncryptedTiddlers = function(callback) {
|
||||
callback();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////// Node definitions
|
||||
|
||||
if($tw.node) {
|
||||
|
||||
/*
|
||||
Load the tiddlers contained in a particular file (and optionally extract fields from the accompanying .meta file) returned as {filepath:,type:,tiddlers:[],hasMetaFile:}
|
||||
*/
|
||||
@@ -1226,7 +1249,9 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
||||
// Save the plugin tiddlers into the plugin info
|
||||
pluginInfo.tiddlers = pluginInfo.tiddlers || {};
|
||||
for(t=0; t<pluginTiddlers.length; t++) {
|
||||
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
|
||||
if(pluginTiddlers[t].title) {
|
||||
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1357,7 +1382,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||
return wikiInfo;
|
||||
};
|
||||
|
||||
$tw.loadTiddlers = function() {
|
||||
$tw.loadTiddlersNode = function() {
|
||||
// Load the boot tiddlers
|
||||
$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) {
|
||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||
@@ -1370,12 +1395,17 @@ $tw.loadTiddlers = function() {
|
||||
}
|
||||
};
|
||||
|
||||
// End of if(!$tw.browser)
|
||||
// End of if($tw.node)
|
||||
}
|
||||
|
||||
/////////////////////////// Main startup function called once tiddlers have been decrypted
|
||||
|
||||
$tw.boot.startup = function() {
|
||||
/*
|
||||
Startup TiddlyWiki. Options are:
|
||||
readBrowserTiddlers: whether to read tiddlers from the HTML file we're executing within; if not, tiddlers are read from the file system with Node.js APIs
|
||||
*/
|
||||
$tw.boot.startup = function(options) {
|
||||
options = options || {};
|
||||
// Initialise some more $tw properties
|
||||
$tw.utils.deepDefaults($tw,{
|
||||
modules: { // Information about each module
|
||||
@@ -1394,7 +1424,7 @@ $tw.boot.startup = function() {
|
||||
contentTypeInfo: {} // Map type to {encoding:,extension:}
|
||||
}
|
||||
});
|
||||
if(!$tw.browser) {
|
||||
if(!options.readBrowserTiddlers) {
|
||||
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
|
||||
$tw.boot.files = {};
|
||||
// System paths and filenames
|
||||
@@ -1413,7 +1443,7 @@ $tw.boot.startup = function() {
|
||||
$tw.boot.wikiPath = process.cwd();
|
||||
}
|
||||
// Read package info
|
||||
$tw.packageInfo = require("../package");
|
||||
$tw.packageInfo = require("../package.json");
|
||||
// Check node version number
|
||||
if($tw.utils.checkVersions($tw.packageInfo.engines.node.substr(2),process.version.substr(1))) {
|
||||
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engines.node);
|
||||
@@ -1444,7 +1474,11 @@ $tw.boot.startup = function() {
|
||||
$tw.Wiki.tiddlerDeserializerModules = {};
|
||||
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
|
||||
// Load tiddlers
|
||||
$tw.loadTiddlers();
|
||||
if(options.readBrowserTiddlers) {
|
||||
$tw.loadTiddlersBrowser();
|
||||
} else {
|
||||
$tw.loadTiddlersNode();
|
||||
}
|
||||
// Unpack plugin tiddlers
|
||||
$tw.wiki.registerPluginTiddlers("plugin");
|
||||
$tw.wiki.unpackPluginTiddlers();
|
||||
@@ -1453,7 +1487,9 @@ $tw.boot.startup = function() {
|
||||
// And any modules within plugins
|
||||
$tw.wiki.defineShadowModules();
|
||||
// Make sure the crypto state tiddler is up to date
|
||||
$tw.crypto.updateCryptoStateTiddler();
|
||||
if($tw.crypto) {
|
||||
$tw.crypto.updateCryptoStateTiddler();
|
||||
}
|
||||
// Run any startup modules
|
||||
$tw.modules.forEachModuleOfType("startup",function(title,module) {
|
||||
if(module.startup) {
|
||||
@@ -1474,13 +1510,15 @@ $tw.boot.boot = function() {
|
||||
// Preload any encrypted tiddlers
|
||||
$tw.boot.decryptEncryptedTiddlers(function() {
|
||||
// Startup
|
||||
$tw.boot.startup();
|
||||
$tw.boot.startup({
|
||||
readBrowserTiddlers: !!$tw.browser
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/////////////////////////// Autoboot in the browser
|
||||
|
||||
if($tw.browser) {
|
||||
if($tw.browser && !$tw.boot.suppressBoot) {
|
||||
$tw.boot.boot();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,12 @@ var _bootprefix = (function($tw) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$tw = $tw || {browser: typeof(window) !== "undefined" ? {} : null};
|
||||
$tw = $tw || {};
|
||||
|
||||
// Detect platforms
|
||||
$tw.browser = typeof(window) !== "undefined" ? {} : null;
|
||||
$tw.node = typeof(process) === "object" ? {} : null;
|
||||
$tw.nodeWebKit = $tw.node && global.window && global.window.nwDispatcher ? {} : null;
|
||||
|
||||
/*
|
||||
Information about each module is kept in an object with these members:
|
||||
@@ -92,6 +97,3 @@ if(typeof(exports) === "undefined") {
|
||||
// Export functionality as a module
|
||||
exports.bootprefix = _bootprefix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
3
core/config/editor-type-mappings/image-gif.tid
Normal file
3
core/config/editor-type-mappings/image-gif.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/gif
|
||||
|
||||
bitmap
|
||||
3
core/config/editor-type-mappings/image-jpeg.tid
Normal file
3
core/config/editor-type-mappings/image-jpeg.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/jpeg
|
||||
|
||||
bitmap
|
||||
3
core/config/editor-type-mappings/image-jpg.tid
Normal file
3
core/config/editor-type-mappings/image-jpg.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/jpg
|
||||
|
||||
bitmap
|
||||
3
core/config/editor-type-mappings/image-png.tid
Normal file
3
core/config/editor-type-mappings/image-png.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/png
|
||||
|
||||
bitmap
|
||||
3
core/config/editor-type-mappings/image-x-icon.tid
Normal file
3
core/config/editor-type-mappings/image-x-icon.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/x-icon
|
||||
|
||||
bitmap
|
||||
3
core/config/editor-type-mappings/text-vnd-tiddlywiki.tid
Normal file
3
core/config/editor-type-mappings/text-vnd-tiddlywiki.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/text/vnd.tiddlywiki
|
||||
|
||||
text
|
||||
@@ -4,7 +4,7 @@ type: text/plain
|
||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||
|
||||
Copyright © Jeremy Ruston 2004-2007
|
||||
Copyright © UnaMesa Association 2007-2013
|
||||
Copyright © UnaMesa Association 2007-2014
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
3
core/docs/types/image_x-icon.tid
Normal file
3
core/docs/types/image_x-icon.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/docs/types/image/x-icon
|
||||
description: ICO format icon file
|
||||
name: image/x-icon
|
||||
@@ -1,3 +1,3 @@
|
||||
title: $:/docs/types/text/vnd.tiddlywiki
|
||||
description: TW5 wikitext
|
||||
description: TiddlyWiki version 5 wikitext
|
||||
name: text/vnd.tiddlywiki
|
||||
|
||||
3
core/docs/types/text_x-tiddlywiki.tid
Normal file
3
core/docs/types/text_x-tiddlywiki.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/docs/types/text/x-tiddlywiki
|
||||
description: TiddlyWiki Classic wikitext
|
||||
name: text/x-tiddlywiki
|
||||
@@ -42,7 +42,7 @@ Command.prototype.execute = function() {
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var parser = wiki.parseTiddler(template),
|
||||
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
|
||||
var container = $tw.document.createElement("div");
|
||||
var container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
||||
fs.writeFileSync(path.resolve(pathname,encodeURIComponent(title) + extension),text,"utf8");
|
||||
|
||||
@@ -79,7 +79,7 @@ SimpleServer.prototype.checkCredentials = function(request,incomingUsername,inco
|
||||
}
|
||||
}
|
||||
|
||||
SimpleServer.prototype.listen = function(port) {
|
||||
SimpleServer.prototype.listen = function(port,host) {
|
||||
var self = this;
|
||||
http.createServer(function(request,response) {
|
||||
// Compose the state object
|
||||
@@ -125,7 +125,7 @@ SimpleServer.prototype.listen = function(port) {
|
||||
});
|
||||
break;
|
||||
}
|
||||
}).listen(port);
|
||||
}).listen(port,host);
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
@@ -264,7 +264,8 @@ Command.prototype.execute = function() {
|
||||
renderType = this.params[2] || "text/plain",
|
||||
serveType = this.params[3] || "text/html",
|
||||
username = this.params[4],
|
||||
password = this.params[5];
|
||||
password = this.params[5],
|
||||
host = this.params[6] || "127.0.0.1";
|
||||
this.server.set({
|
||||
rootTiddler: rootTiddler,
|
||||
renderType: renderType,
|
||||
@@ -272,8 +273,8 @@ Command.prototype.execute = function() {
|
||||
username: username,
|
||||
password: password
|
||||
});
|
||||
this.server.listen(port);
|
||||
console.log("Serving on port " + port);
|
||||
this.server.listen(port,host);
|
||||
console.log("Serving on " + host + ":" + port);
|
||||
console.log("(press ctrl-C to exit)");
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -36,30 +36,35 @@ var parseTiddlerDiv = function(text /* [,fields] */) {
|
||||
}
|
||||
}
|
||||
// Parse the DIV body
|
||||
var divRegExp = /^\s*<div\s+([^>]*)>([(?:\s|\S)]*)<\/div>\s*$/gi,
|
||||
subDivRegExp = /^\s*<pre>([(?:\s|\S)]*)<\/pre>\s*$/gi,
|
||||
attrRegExp = /\s*([^=\s]+)\s*=\s*"([^"]*)"/gi,
|
||||
match = divRegExp.exec(text);
|
||||
var startRegExp = /^\s*<div\s+([^>]*)>(\s*<pre>)?/gi,
|
||||
endRegExp,
|
||||
match = startRegExp.exec(text);
|
||||
if(match) {
|
||||
var subMatch = subDivRegExp.exec(match[2]); // Body of the <DIV> tag
|
||||
if(subMatch) {
|
||||
result.text = subMatch[1];
|
||||
// Old-style DIVs don't have the <pre> tag
|
||||
if(match[2]) {
|
||||
endRegExp = /<\/pre>\s*<\/div>\s*$/gi;
|
||||
} else {
|
||||
result.text = match[2];
|
||||
endRegExp = /<\/div>\s*$/gi;
|
||||
}
|
||||
var endMatch = endRegExp.exec(text);
|
||||
if(endMatch) {
|
||||
// Extract the text
|
||||
result.text = text.substring(match.index + match[0].length,endMatch.index);
|
||||
// Process the attributes
|
||||
var attrRegExp = /\s*([^=\s]+)\s*=\s*"([^"]*)"/gi,
|
||||
attrMatch;
|
||||
do {
|
||||
attrMatch = attrRegExp.exec(match[1]);
|
||||
if(attrMatch) {
|
||||
var name = attrMatch[1];
|
||||
var value = attrMatch[2];
|
||||
result[name] = value;
|
||||
}
|
||||
} while(attrMatch);
|
||||
return result;
|
||||
}
|
||||
var attrMatch;
|
||||
do {
|
||||
attrMatch = attrRegExp.exec(match[1]);
|
||||
if(attrMatch) {
|
||||
var name = attrMatch[1];
|
||||
var value = attrMatch[2];
|
||||
result[name] = value;
|
||||
}
|
||||
} while(attrMatch);
|
||||
return result;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
exports["application/x-tiddler-html-div"] = function(text,fields) {
|
||||
@@ -95,7 +100,7 @@ exports["text/html"] = function(text,fields) {
|
||||
var storeAreaMarkerRegExp = /<div id=["']?storeArea['"]?( style=["']?display:none;["']?)?>/gi,
|
||||
match = storeAreaMarkerRegExp.exec(text);
|
||||
if(match) {
|
||||
// If so, it's either a classic TiddlyWiki file or a TW5 file
|
||||
// If so, it's either a classic TiddlyWiki file or an unencrypted TW5 file
|
||||
// First read the normal tiddlers
|
||||
var results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);
|
||||
// Then any system tiddlers
|
||||
@@ -106,8 +111,15 @@ exports["text/html"] = function(text,fields) {
|
||||
}
|
||||
return results
|
||||
} else {
|
||||
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
|
||||
return deserializeHtmlFile(text,fields);
|
||||
// Check whether we've got an encrypted file
|
||||
var encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);
|
||||
if(encryptedStoreArea) {
|
||||
// If so, attempt to decrypt it using the current password
|
||||
return $tw.utils.decryptStoreArea(encryptedStoreArea);
|
||||
} else {
|
||||
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
|
||||
return deserializeHtmlFile(text,fields);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,31 +33,55 @@ function parseFilterOperation(operators,filterString,p) {
|
||||
operator.prefix = filterString.charAt(p++);
|
||||
}
|
||||
// Get the operator name
|
||||
bracketPos = filterString.indexOf("[",p);
|
||||
curlyBracketPos = filterString.indexOf("{",p);
|
||||
if((bracketPos === -1) && (curlyBracketPos === -1)) {
|
||||
var nextBracketPos = filterString.substring(p).search(/[\[\{\/]/);
|
||||
if(nextBracketPos === -1) {
|
||||
throw "Missing [ in filter expression";
|
||||
}
|
||||
if(bracketPos === -1 || (curlyBracketPos !== -1 && curlyBracketPos < bracketPos)) {
|
||||
// Curly brackets
|
||||
operator.indirect = true;
|
||||
operator.operator = filterString.substring(p,curlyBracketPos);
|
||||
p = curlyBracketPos + 1;
|
||||
} else {
|
||||
// Square brackets
|
||||
operator.operator = filterString.substring(p,bracketPos);
|
||||
p = bracketPos + 1;
|
||||
nextBracketPos += p;
|
||||
var bracket = filterString.charAt(nextBracketPos);
|
||||
operator.operator = filterString.substring(p,nextBracketPos);
|
||||
|
||||
// Any suffix?
|
||||
var colon = operator.operator.indexOf(':');
|
||||
if(colon > -1) {
|
||||
operator.suffix = operator.operator.substring(colon + 1);
|
||||
operator.operator = operator.operator.substring(0,colon) || "field";
|
||||
}
|
||||
if(operator.operator === "") {
|
||||
// Empty operator means: title
|
||||
else if(operator.operator === "") {
|
||||
operator.operator = "title";
|
||||
}
|
||||
// Get the operand
|
||||
bracketPos = filterString.indexOf(operator.indirect ? "}" : "]",p);
|
||||
if(bracketPos === -1) {
|
||||
|
||||
p = nextBracketPos + 1;
|
||||
switch (bracket) {
|
||||
case '{': // Curly brackets
|
||||
operator.indirect = true;
|
||||
nextBracketPos = filterString.indexOf('}',p);
|
||||
break;
|
||||
case '[': // Square brackets
|
||||
nextBracketPos = filterString.indexOf(']',p);
|
||||
break;
|
||||
case '/': // regexp brackets
|
||||
var rex = /^((?:[^\\\/]*|\\.))*\/(?:\(([mygi]+)\))?/g,
|
||||
rexMatch = rex.exec(filterString.substring(p));
|
||||
if(rexMatch) {
|
||||
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
|
||||
nextBracketPos = p + rex.lastIndex - 1;
|
||||
}
|
||||
else {
|
||||
throw "Unterminated regular expression in filter expression";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(nextBracketPos === -1) {
|
||||
throw "Missing closing bracket in filter expression";
|
||||
}
|
||||
operator.operand = filterString.substring(p,bracketPos);
|
||||
p = bracketPos + 1;
|
||||
if(!operator.regexp) {
|
||||
operator.operand = filterString.substring(p,nextBracketPos);
|
||||
}
|
||||
p = nextBracketPos + 1;
|
||||
|
||||
// Push this operator
|
||||
operators.push(operator);
|
||||
} while(filterString.charAt(p) !== "]");
|
||||
@@ -161,7 +185,9 @@ exports.compileFilter = function(filterString) {
|
||||
results = operatorFunction(accumulator,{
|
||||
operator: operator.operator,
|
||||
operand: operand,
|
||||
prefix: operator.prefix
|
||||
prefix: operator.prefix,
|
||||
suffix: operator.suffix,
|
||||
regexp: operator.regexp
|
||||
},{
|
||||
wiki: self,
|
||||
currTiddlerTitle: currTiddlerTitle
|
||||
|
||||
@@ -16,12 +16,19 @@ Filter operator for comparing fields for equality
|
||||
Export our filter function
|
||||
*/
|
||||
exports.field = function(source,operator,options) {
|
||||
var results = [];
|
||||
var results = [],
|
||||
fieldname = (operator.suffix || operator.operator).toLowerCase();
|
||||
// Function to check an individual title
|
||||
function checkTiddler(title) {
|
||||
var tiddler = options.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var match = tiddler.getFieldString(operator.operator) === operator.operand;
|
||||
var match,
|
||||
text = tiddler.getFieldString(fieldname);
|
||||
if(operator.regexp) {
|
||||
match = !!operator.regexp.exec(text);
|
||||
} else {
|
||||
match = text === operator.operand;
|
||||
}
|
||||
if(operator.prefix === "!") {
|
||||
match = !match;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ exports.has = function(source,operator,options) {
|
||||
function checkTiddler(title) {
|
||||
var tiddler = options.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var match = $tw.utils.hop(tiddler.fields,operator.operand);
|
||||
var match = $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] !== "";
|
||||
if(operator.prefix === "!") {
|
||||
match = !match;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ Export our filter function
|
||||
*/
|
||||
exports.list = function(source,operator,options) {
|
||||
var results = [],
|
||||
list = options.wiki.getTiddlerList(operator.operand);
|
||||
tr = $tw.utils.parseTextReference(operator.operand),
|
||||
list = options.wiki.getTiddlerList(tr.title,tr.field,tr.index);
|
||||
function checkTiddler(title) {
|
||||
var match = list.indexOf(title) !== -1;
|
||||
if(operator.prefix === "!") {
|
||||
|
||||
87
core/modules/filters/listops.js
Normal file
87
core/modules/filters/listops.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/listops.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operators for manipulating the current selection list
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Reverse list
|
||||
*/
|
||||
exports.reverse = function(source,operator,options) {
|
||||
var results = [];
|
||||
if(!$tw.utils.isArray(source)) {
|
||||
source = Object.keys(source).sort();
|
||||
}
|
||||
$tw.utils.each(source,function(title) {
|
||||
results.unshift(title);
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
/*
|
||||
First entry/entries in list
|
||||
*/
|
||||
exports.first = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1;
|
||||
if(!$tw.utils.isArray(source)) {
|
||||
source = Object.keys(source).sort();
|
||||
}
|
||||
return source.slice(0,Math.min(count,source.length));
|
||||
};
|
||||
|
||||
/*
|
||||
Last entry/entries in list
|
||||
*/
|
||||
exports.last = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1;
|
||||
if(!$tw.utils.isArray(source)) {
|
||||
source = Object.keys(source).sort();
|
||||
}
|
||||
return source.slice(-count);
|
||||
};
|
||||
|
||||
/*
|
||||
All but the first entry/entries of the list
|
||||
*/
|
||||
exports.rest = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1;
|
||||
if(!$tw.utils.isArray(source)) {
|
||||
source = Object.keys(source).sort();
|
||||
}
|
||||
return source.slice(count);
|
||||
};
|
||||
exports.butfirst = exports.rest;
|
||||
exports.bf = exports.rest;
|
||||
|
||||
/*
|
||||
All but the last entry/entries of the list
|
||||
*/
|
||||
exports.butlast = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1;
|
||||
if(!$tw.utils.isArray(source)) {
|
||||
source = Object.keys(source).sort();
|
||||
}
|
||||
return source.slice(0,-count);
|
||||
};
|
||||
exports.bl = exports.butlast;
|
||||
|
||||
/*
|
||||
The nth member of the list
|
||||
*/
|
||||
exports.nth = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1;
|
||||
if(!$tw.utils.isArray(source)) {
|
||||
source = Object.keys(source).sort();
|
||||
}
|
||||
return source.slice(count-1,count);
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -16,6 +16,30 @@ Filter operator for sorting
|
||||
Export our filter function
|
||||
*/
|
||||
exports.sort = function(source,operator,options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",false,false);
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.nsort = function(source,operator,options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",false,true);
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.sortcs = function(source,operator,options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true,false);
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.nsortcs = function(source,operator,options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true,true);
|
||||
return results;
|
||||
};
|
||||
|
||||
var prepare_results = function (source) {
|
||||
var results;
|
||||
if($tw.utils.isArray(source)) {
|
||||
results = source;
|
||||
@@ -25,8 +49,7 @@ exports.sort = function(source,operator,options) {
|
||||
results.push(title);
|
||||
});
|
||||
}
|
||||
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!");
|
||||
return results;
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/sortcs.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for case-sensitive sorting
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.sortcs = function(source,operator,options) {
|
||||
var results;
|
||||
if($tw.utils.isArray(source)) {
|
||||
results = source;
|
||||
} else {
|
||||
results = [];
|
||||
$tw.utils.each(source,function(element,title) {
|
||||
results.push(title);
|
||||
});
|
||||
}
|
||||
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true);
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -38,6 +38,7 @@ exports["image/jpeg"] = ImageParser;
|
||||
exports["image/png"] = ImageParser;
|
||||
exports["image/gif"] = ImageParser;
|
||||
exports["application/pdf"] = ImageParser;
|
||||
exports["image/x-icon"] = ImageParser;
|
||||
|
||||
})();
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ exports["text/x-tiddlywiki"] = TextParser;
|
||||
exports["application/javascript"] = TextParser;
|
||||
exports["application/json"] = TextParser;
|
||||
exports["text/css"] = TextParser;
|
||||
exports["application/x-tiddler-dictionary"] = TextParser;
|
||||
|
||||
})();
|
||||
|
||||
|
||||
@@ -23,14 +23,15 @@ exports.types = {block: true};
|
||||
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /```\r?\n/mg;
|
||||
// Regexp to match and get language if defined
|
||||
this.matchRegExp = /```([\w-]*)\r?\n/mg;
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
var reEnd = /(\r?\n```$)/mg;
|
||||
// Move past the match
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
|
||||
// Look for the end of the block
|
||||
reEnd.lastIndex = this.parser.pos;
|
||||
var match = reEnd.exec(this.parser.source),
|
||||
@@ -43,14 +44,14 @@ exports.parse = function() {
|
||||
text = this.parser.source.substr(this.parser.pos);
|
||||
this.parser.pos = this.parser.sourceLength;
|
||||
}
|
||||
// Return the pre element
|
||||
// Return the $codeblock widget
|
||||
return [{
|
||||
type: "element",
|
||||
tag: "pre",
|
||||
children: [{
|
||||
type: "text",
|
||||
text: text
|
||||
}]
|
||||
type: "element",
|
||||
tag: "$codeblock",
|
||||
attributes: {
|
||||
code: {type: "string", value: text},
|
||||
language: {type: "string", value: this.match[1]}
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ Wiki text inline rule for code runs. For example:
|
||||
|
||||
```
|
||||
This is a `code run`.
|
||||
This is another ``code run``
|
||||
```
|
||||
|
||||
\*/
|
||||
@@ -22,13 +23,13 @@ exports.types = {inline: true};
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /`/mg;
|
||||
this.matchRegExp = /(``?)/mg;
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
// Move past the match
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
var reEnd = /`/mg;
|
||||
var reEnd = new RegExp(this.match[1], "mg");
|
||||
// Look for the end marker
|
||||
reEnd.lastIndex = this.parser.pos;
|
||||
var match = reEnd.exec(this.parser.source),
|
||||
|
||||
@@ -22,7 +22,7 @@ exports.types = {block: true};
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /-{3,}\r?\n/mg;
|
||||
this.matchRegExp = /-{3,}\r?(?:\n|$)/mg;
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
|
||||
@@ -59,7 +59,7 @@ exports.parse = function() {
|
||||
// before handling the cite, parse the body of the quote
|
||||
var tree= this.parser.parseBlocks(reEndString);
|
||||
// If we got a cite, put it before the text
|
||||
if ( cite.length > 0 ) {
|
||||
if(cite.length > 0) {
|
||||
tree.unshift({
|
||||
type: "element",
|
||||
tag: "cite",
|
||||
@@ -71,7 +71,7 @@ exports.parse = function() {
|
||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||
// If we got a cite, push it
|
||||
if ( cite.length > 0 ) {
|
||||
if(cite.length > 0) {
|
||||
tree.push({
|
||||
type: "element",
|
||||
tag: "cite",
|
||||
|
||||
@@ -18,11 +18,11 @@ exports.types = {block: true};
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\|(?:[^\n]*)\|(?:[fhck]?)\r?\n/mg;
|
||||
this.matchRegExp = /^\|(?:[^\n]*)\|(?:[fhck]?)\r?(?:\n|$)/mg;
|
||||
};
|
||||
|
||||
var processRow = function(prevColumns) {
|
||||
var cellRegExp = /(?:\|([^\n\|]*)\|)|(\|[fhck]?\r?\n)/mg,
|
||||
var cellRegExp = /(?:\|([^\n\|]*)\|)|(\|[fhck]?\r?(?:\n|$))/mg,
|
||||
cellTermRegExp = /((?:\x20*)\|)/mg,
|
||||
tree = [],
|
||||
col = 0,
|
||||
@@ -38,7 +38,8 @@ var processRow = function(prevColumns) {
|
||||
if(last) {
|
||||
last.rowSpanCount++;
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"rowspan",last.rowSpanCount);
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"valign","center");
|
||||
var vAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,"valign","center");
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"valign",vAlign);
|
||||
if(colSpanCount > 1) {
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"colspan",colSpanCount);
|
||||
colSpanCount = 1;
|
||||
@@ -51,9 +52,20 @@ var processRow = function(prevColumns) {
|
||||
colSpanCount++;
|
||||
// Move to just before the `|` terminating the cell
|
||||
this.parser.pos = cellRegExp.lastIndex - 1;
|
||||
} else if(cellMatch[1] === "<" && prevCell) {
|
||||
colSpanCount = 1 + $tw.utils.getAttributeValueFromParseTreeNode(prevCell,"colspan",1);
|
||||
$tw.utils.addAttributeToParseTreeNode(prevCell,"colspan",colSpanCount);
|
||||
colSpanCount = 1;
|
||||
// Move to just before the `|` terminating the cell
|
||||
this.parser.pos = cellRegExp.lastIndex - 1;
|
||||
} else if(cellMatch[2]) {
|
||||
// End of row
|
||||
if(prevCell && colSpanCount > 1) {
|
||||
if(prevCell.attributes && prevCell.attributes && prevCell.attributes.colspan) {
|
||||
colSpanCount += prevCell.attributes.colspan.value;
|
||||
} else {
|
||||
colSpanCount -= 1;
|
||||
}
|
||||
$tw.utils.addAttributeToParseTreeNode(prevCell,"colspan",colSpanCount);
|
||||
}
|
||||
this.parser.pos = cellRegExp.lastIndex - 1;
|
||||
@@ -63,7 +75,16 @@ var processRow = function(prevColumns) {
|
||||
this.parser.pos++;
|
||||
// Look for a space at the start of the cell
|
||||
var spaceLeft = false,
|
||||
chr = this.parser.source.substr(this.parser.pos,1);
|
||||
vAlign = null;
|
||||
if(this.parser.source.substr(this.parser.pos).search(/^\^([^\^]|\^\^)/) === 0) {
|
||||
vAlign = "top";
|
||||
} else if(this.parser.source.substr(this.parser.pos).search(/^,([^,]|,,)/) === 0) {
|
||||
vAlign = "bottom";
|
||||
}
|
||||
if(vAlign) {
|
||||
this.parser.pos++;
|
||||
}
|
||||
var chr = this.parser.source.substr(this.parser.pos,1);
|
||||
while(chr === " ") {
|
||||
spaceLeft = true;
|
||||
this.parser.pos++;
|
||||
@@ -89,7 +110,10 @@ var processRow = function(prevColumns) {
|
||||
// Parse the cell
|
||||
cell.children = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true});
|
||||
// Set the alignment for the cell
|
||||
if(cellMatch[1].substr(cellMatch[1].length-1,1) === " ") { // spaceRight
|
||||
if(vAlign) {
|
||||
$tw.utils.addAttributeToParseTreeNode(cell,"valign",vAlign);
|
||||
}
|
||||
if(this.parser.source.substr(this.parser.pos - 2,1) === " ") { // spaceRight
|
||||
$tw.utils.addAttributeToParseTreeNode(cell,"align",spaceLeft ? "center" : "left");
|
||||
} else if(spaceLeft) {
|
||||
$tw.utils.addAttributeToParseTreeNode(cell,"align","right");
|
||||
@@ -107,8 +131,8 @@ var processRow = function(prevColumns) {
|
||||
exports.parse = function() {
|
||||
var rowContainerTypes = {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"},
|
||||
table = {type: "element", tag: "table", children: []},
|
||||
rowRegExp = /^\|([^\n]*)\|([fhck]?)\r?\n/mg,
|
||||
rowTermRegExp = /(\|(?:[fhck]?)\r?\n)/mg,
|
||||
rowRegExp = /^\|([^\n]*)\|([fhck]?)\r?(?:\n|$)/mg,
|
||||
rowTermRegExp = /(\|(?:[fhck]?)\r?(?:\n|$))/mg,
|
||||
prevColumns = [],
|
||||
currRowType,
|
||||
rowContainer,
|
||||
@@ -124,7 +148,7 @@ exports.parse = function() {
|
||||
this.parser.pos = rowMatch.index + rowMatch[0].length;
|
||||
} else {
|
||||
// Otherwise, create a new row if this one is of a different type
|
||||
if(rowType != currRowType) {
|
||||
if(rowType !== currRowType) {
|
||||
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: []};
|
||||
table.children.push(rowContainer);
|
||||
currRowType = rowType;
|
||||
|
||||
@@ -40,7 +40,7 @@ exports.init = function(parser) {
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
var reEnd = /\r?\n\$\$\$\r?\n/mg;
|
||||
var reEnd = /\r?\n\$\$\$\r?(?:\n|$)/mg;
|
||||
// Save the type
|
||||
var parseType = this.match[1],
|
||||
renderType = this.match[2];
|
||||
@@ -66,7 +66,7 @@ exports.parse = function() {
|
||||
} else {
|
||||
// Otherwise, render to the rendertype and return in a <PRE> tag
|
||||
var widgetNode = this.parser.wiki.makeWidget(parser),
|
||||
container = $tw.document.createElement("div");
|
||||
container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
var text = renderType === "text/html" ? container.innerHTML : container.textContent;
|
||||
return [{
|
||||
|
||||
@@ -28,7 +28,7 @@ DownloadSaver.prototype.save = function(text,method,callback) {
|
||||
// Set up the link
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("target","_blank");
|
||||
if(Blob != undefined) {
|
||||
if(Blob !== undefined) {
|
||||
var blob = new Blob([text], {type: "text/html"});
|
||||
link.setAttribute("href", URL.createObjectURL(blob));
|
||||
} else {
|
||||
|
||||
@@ -32,7 +32,7 @@ FSOSaver.prototype.save = function(text,method,callback) {
|
||||
if(/^\/[A-Z]\:\\[^\\]+/i.test(pathname)) { // ie: ^/[a-z]:/[^/]+
|
||||
// Remove the leading slash
|
||||
pathname = pathname.substr(1);
|
||||
} else if (document.location.hostname !== "" && /^\/\\[^\\]+\\[^\\]+/i.test(pathname)) { // test for \\server\share\blah... - ^/[^/]+/[^/]+
|
||||
} else if(document.location.hostname !== "" && /^\/\\[^\\]+\\[^\\]+/i.test(pathname)) { // test for \\server\share\blah... - ^/[^/]+/[^/]+
|
||||
// Remove the leading slash
|
||||
pathname = pathname.substr(1);
|
||||
// reconstruct UNC path
|
||||
|
||||
@@ -27,10 +27,11 @@ UploadSaver.prototype.save = function(text,method,callback) {
|
||||
return false;
|
||||
}
|
||||
// Get the various parameters we need
|
||||
var backupDir = ".",
|
||||
var backupDir = this.wiki.getTextReference("$:/UploadBackupDir") || ".",
|
||||
username = this.wiki.getTextReference("$:/UploadName"),
|
||||
password = $tw.utils.getPassword("upload"),
|
||||
uploadDir = ".",
|
||||
uploadDir = this.wiki.getTextReference("$:/UploadDir") || ".",
|
||||
uploadFilename = this.wiki.getTextReference("$:/UploadFilename") || "index.html",
|
||||
url = this.wiki.getTextReference("$:/UploadURL");
|
||||
// Bail out if we don't have the bits we need
|
||||
if(!username || username.toString().trim() === "" || !password || password.toString().trim() === "") {
|
||||
@@ -47,7 +48,7 @@ UploadSaver.prototype.save = function(text,method,callback) {
|
||||
head.push("--" + boundary + "\r\nContent-disposition: form-data; name=\"UploadPlugin\"\r\n");
|
||||
head.push("backupDir=" + backupDir + ";user=" + username + ";password=" + password + ";uploaddir=" + uploadDir + ";;");
|
||||
head.push("\r\n" + "--" + boundary);
|
||||
head.push("Content-disposition: form-data; name=\"userfile\"; filename=\"index.html\"");
|
||||
head.push("Content-disposition: form-data; name=\"userfile\"; filename=\"" + uploadFilename + "\"");
|
||||
head.push("Content-Type: text/html;charset=UTF-8");
|
||||
head.push("Content-Length: " + text.length + "\r\n");
|
||||
head.push("");
|
||||
@@ -60,7 +61,7 @@ UploadSaver.prototype.save = function(text,method,callback) {
|
||||
http.setRequestHeader("Content-Type","multipart/form-data; ;charset=UTF-8; boundary=" + boundary);
|
||||
http.onreadystatechange = function() {
|
||||
if(http.readyState == 4 && http.status == 200) {
|
||||
if(http.responseText.trim() === "0 - Fileindex.html") {
|
||||
if(http.responseText.substr(0,4) === "0 - ") {
|
||||
callback(null);
|
||||
} else {
|
||||
callback(http.responseText);
|
||||
@@ -77,7 +78,7 @@ Information about this saver
|
||||
*/
|
||||
UploadSaver.prototype.info = {
|
||||
name: "upload",
|
||||
priority: 500
|
||||
priority: 2000
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,10 +16,13 @@ var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
exports.startup = function() {
|
||||
var modules,n,m,f,commander;
|
||||
// Load modules
|
||||
// Load utility modules and initialise the logger
|
||||
$tw.modules.applyMethods("utils",$tw.utils);
|
||||
$tw.logger = new $tw.utils.Logger();
|
||||
$tw.log = $tw.logger.log;
|
||||
// Load other modules
|
||||
$tw.modules.applyMethods("global",$tw);
|
||||
$tw.modules.applyMethods("config",$tw.config);
|
||||
$tw.modules.applyMethods("utils",$tw.utils);
|
||||
if($tw.browser) {
|
||||
$tw.utils.getBrowserInfo($tw.browser);
|
||||
}
|
||||
@@ -103,8 +106,11 @@ exports.startup = function() {
|
||||
serviceName: "Set a new password for this TiddlyWiki",
|
||||
noUserName: true,
|
||||
submitText: "Set password",
|
||||
canCancel: true,
|
||||
callback: function(data) {
|
||||
$tw.crypto.setPassword(data.password);
|
||||
if(data) {
|
||||
$tw.crypto.setPassword(data.password);
|
||||
}
|
||||
return true; // Get rid of the password prompt
|
||||
}
|
||||
});
|
||||
@@ -112,11 +118,26 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
||||
$tw.crypto.setPassword(null);
|
||||
});
|
||||
// Set up the favicon
|
||||
var faviconTitle = "$:/favicon.ico",
|
||||
faviconLink = document.getElementById("faviconLink"),
|
||||
setFavicon = function() {
|
||||
var tiddler = $tw.wiki.getTiddler(faviconTitle);
|
||||
if(tiddler) {
|
||||
faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text);
|
||||
}
|
||||
};
|
||||
setFavicon();
|
||||
$tw.wiki.addEventListener("change",function(changes) {
|
||||
if($tw.utils.hop(changes,faviconTitle)) {
|
||||
setFavicon();
|
||||
}
|
||||
});
|
||||
// Set up the styles
|
||||
var styleTemplateTitle = "$:/core/ui/PageStylesheet",
|
||||
styleParser = $tw.wiki.parseTiddler(styleTemplateTitle);
|
||||
$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.document});
|
||||
$tw.styleContainer = $tw.document.createElement("style");
|
||||
$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.fakeDocument});
|
||||
$tw.styleContainer = $tw.fakeDocument.createElement("style");
|
||||
$tw.styleWidgetNode.render($tw.styleContainer,null);
|
||||
$tw.styleElement = document.createElement("style");
|
||||
$tw.styleElement.innerHTML = $tw.styleContainer.textContent;
|
||||
|
||||
@@ -19,6 +19,8 @@ wiki: wiki to be synced
|
||||
function Syncer(options) {
|
||||
var self = this;
|
||||
this.wiki = options.wiki;
|
||||
// Make a logger
|
||||
this.log = $tw.logger.makeLog("syncer");
|
||||
// Find a working syncadaptor
|
||||
this.syncadaptor = undefined;
|
||||
$tw.modules.forEachModuleOfType("syncadaptor",function(title,module) {
|
||||
@@ -36,18 +38,7 @@ function Syncer(options) {
|
||||
Error handling
|
||||
*/
|
||||
Syncer.prototype.showError = function(error) {
|
||||
alert("Syncer error: " + error);
|
||||
$tw.utils.log("Syncer error: " + error);
|
||||
};
|
||||
|
||||
/*
|
||||
Message logging
|
||||
*/
|
||||
Syncer.prototype.log = function(/* arguments */) {
|
||||
var args = Array.prototype.slice.call(arguments,0);
|
||||
args[0] = "Syncer: " + args[0];
|
||||
// Temporarily disable logging to help the wood vs. trees situation; we need better filtering of log messages
|
||||
//$tw.utils.log.apply(null,args);
|
||||
this.log("Error: " + error);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -384,7 +375,7 @@ Syncer.prototype.processTaskQueue = function() {
|
||||
// Dispatch the task
|
||||
this.dispatchTask(task,function(err) {
|
||||
if(err) {
|
||||
console.log("Sync error while processing '" + task.title + "':\n" + err);
|
||||
self.showError("Sync error while processing '" + task.title + "':\n" + err);
|
||||
}
|
||||
// Mark that this task is no longer in progress
|
||||
delete self.taskInProgress[task.title];
|
||||
|
||||
81
core/modules/utils/crypto.js
Normal file
81
core/modules/utils/crypto.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/*\
|
||||
title: $:/core/modules/utils/crypto.js
|
||||
type: application/javascript
|
||||
module-type: utils
|
||||
|
||||
Utility functions related to crypto.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Look for an encrypted store area in the text of a TiddlyWiki file
|
||||
*/
|
||||
exports.extractEncryptedStoreArea = function(text) {
|
||||
var encryptedStoreAreaStartMarker = "<pre id=\"encryptedStoreArea\" type=\"text/plain\" style=\"display:none;\">",
|
||||
encryptedStoreAreaStart = text.indexOf(encryptedStoreAreaStartMarker);
|
||||
if(encryptedStoreAreaStart !== -1) {
|
||||
var encryptedStoreAreaEnd = text.indexOf("</pre>",encryptedStoreAreaStart);
|
||||
if(encryptedStoreAreaEnd !== -1) {
|
||||
return $tw.utils.htmlDecode(text.substring(encryptedStoreAreaStart + encryptedStoreAreaStartMarker.length,encryptedStoreAreaEnd-1));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
Attempt to extract the tiddlers from an encrypted store area using the current password. If the password is not provided then the password in the password store will be used
|
||||
*/
|
||||
exports.decryptStoreArea = function(encryptedStoreArea,password) {
|
||||
var decryptedText = $tw.crypto.decrypt(encryptedStoreArea,password);
|
||||
if(decryptedText) {
|
||||
var json = JSON.parse(decryptedText),
|
||||
tiddlers = [];
|
||||
for(var title in json) {
|
||||
if(title !== "$:/isEncrypted") {
|
||||
tiddlers.push(json[title]);
|
||||
}
|
||||
}
|
||||
return tiddlers;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
exports.decryptStoreAreaInteractive = function(encryptedStoreArea,callback) {
|
||||
// Try to decrypt with the current password
|
||||
var tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea);
|
||||
if(tiddlers) {
|
||||
callback(tiddlers);
|
||||
} else {
|
||||
// Prompt for a new password and keep trying
|
||||
$tw.passwordPrompt.createPrompt({
|
||||
serviceName: "Enter a password to decrypt the imported TiddlyWiki",
|
||||
noUserName: true,
|
||||
canCancel: true,
|
||||
submitText: "Decrypt",
|
||||
callback: function(data) {
|
||||
// Exit if the user cancelled
|
||||
if(!data) {
|
||||
return false;
|
||||
}
|
||||
// Attempt to decrypt the tiddlers
|
||||
var tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea,data.password);
|
||||
if(tiddlers) {
|
||||
callback(tiddlers);
|
||||
// Exit and remove the password prompt
|
||||
return true;
|
||||
} else {
|
||||
// We didn't decrypt everything, so continue to prompt for password
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -18,9 +18,11 @@ Set style properties of an element
|
||||
styles: ordered array of {name: value} pairs
|
||||
*/
|
||||
exports.setStyle = function(element,styles) {
|
||||
for(var t=0; t<styles.length; t++) {
|
||||
for(var styleName in styles[t]) {
|
||||
element.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];
|
||||
if(element.nodeType === 1) { // Element.ELEMENT_NODE
|
||||
for(var t=0; t<styles.length; t++) {
|
||||
for(var styleName in styles[t]) {
|
||||
element.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ Code thanks to John Resig, http://ejohn.org/blog/comparing-document-position/
|
||||
*/
|
||||
exports.domContains = function(a,b) {
|
||||
return a.contains ?
|
||||
a != b && a.contains(b) :
|
||||
a !== b && a.contains(b) :
|
||||
!!(a.compareDocumentPosition(b) & 16);
|
||||
};
|
||||
|
||||
|
||||
@@ -67,13 +67,12 @@ Notifier.prototype.display = function(title,options) {
|
||||
{opacity: "0.0"},
|
||||
{transform: "translateX(" + (notification.offsetWidth) + "px)"}
|
||||
]);
|
||||
// Set up an event for the transition end
|
||||
notification.addEventListener($tw.utils.convertEventName("transitionEnd"),function(event) {
|
||||
// Remove the modal message from the DOM once the transition ends
|
||||
setTimeout(function() {
|
||||
if(notification.parentNode) {
|
||||
// Remove the modal message from the DOM
|
||||
document.body.removeChild(notification);
|
||||
}
|
||||
},false);
|
||||
},duration);
|
||||
},$tw.config.preferences.notificationDuration);
|
||||
};
|
||||
|
||||
|
||||
@@ -182,6 +182,6 @@ var document = {
|
||||
},
|
||||
};
|
||||
|
||||
exports.document = document;
|
||||
exports.fakeDocument = document;
|
||||
|
||||
})();
|
||||
|
||||
43
core/modules/utils/logger.js
Normal file
43
core/modules/utils/logger.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/*\
|
||||
title: $:/core/modules/utils/logger.js
|
||||
type: application/javascript
|
||||
module-type: utils
|
||||
|
||||
A basic logging implementation
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Make a new logger
|
||||
*/
|
||||
function Logger() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Make a log function for a particular component
|
||||
*/
|
||||
Logger.prototype.makeLog = function(componentName) {
|
||||
var self = this;
|
||||
return function(/* args */) {
|
||||
self.log.apply(self.log,[componentName + ":"].concat(Array.prototype.slice.call(arguments,0)));
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
Log a message
|
||||
*/
|
||||
Logger.prototype.log = function(/* args */) {
|
||||
if(console !== undefined && console.log !== undefined) {
|
||||
return Function.apply.call(console.log, console, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
exports.Logger = Logger;
|
||||
|
||||
})();
|
||||
@@ -19,6 +19,13 @@ exports.addAttributeToParseTreeNode = function(node,name,value) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) {
|
||||
if(node.type === "element" && node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) {
|
||||
return node.attributes[name].value;
|
||||
}
|
||||
return defaultValue;
|
||||
};
|
||||
|
||||
exports.addClassToParseTreeNode = function(node,classString) {
|
||||
var classes = [];
|
||||
if(node.type === "element") {
|
||||
|
||||
@@ -275,7 +275,7 @@ exports.unescapeLineBreaks = function(s) {
|
||||
// Copied from peg.js, thanks to David Majda
|
||||
exports.escape = function(ch) {
|
||||
var charCode = ch.charCodeAt(0);
|
||||
if (charCode <= 0xFF) {
|
||||
if(charCode <= 0xFF) {
|
||||
return '\\x' + $tw.utils.pad(charCode.toString(16).toUpperCase());
|
||||
} else {
|
||||
return '\\u' + $tw.utils.pad(charCode.toString(16).toUpperCase(),4);
|
||||
|
||||
@@ -39,8 +39,8 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
||||
domNode.setAttribute("multiple","multiple");
|
||||
// Add a click event handler
|
||||
domNode.addEventListener("change",function (event) {
|
||||
self.wiki.readFiles(event.target.files,function(tiddlerFields) {
|
||||
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
});
|
||||
return false;
|
||||
},false);
|
||||
|
||||
64
core/modules/widgets/codeblock.js
Normal file
64
core/modules/widgets/codeblock.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/codeblock.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Code block node widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var CodeBlockWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
CodeBlockWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
CodeBlockWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
var codeNode = this.document.createElement("code");
|
||||
if(this.getAttribute("language")) {
|
||||
codeNode.setAttribute("class",this.getAttribute("language"));
|
||||
}
|
||||
var domNode = this.document.createElement("pre");
|
||||
codeNode.appendChild(this.document.createTextNode(this.getAttribute("code")));
|
||||
domNode.appendChild(codeNode);
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.domNodes.push(domNode);
|
||||
|
||||
if(this.postRender) {
|
||||
this.postRender();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
CodeBlockWidget.prototype.execute = function() {
|
||||
// Nothing to do for a text node
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
CodeBlockWidget.prototype.refresh = function(changedTiddlers) {
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.codeblock = CodeBlockWidget;
|
||||
|
||||
})();
|
||||
@@ -87,12 +87,14 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
this.dragEnterCount = 0;
|
||||
// Remove highlighting
|
||||
$tw.utils.removeClass(this.domNodes[0],"tw-dragover");
|
||||
// Try to import the various data types we understand
|
||||
this.importData(dataTransfer);
|
||||
// Import any files in the drop
|
||||
this.wiki.readFiles(dataTransfer.files,function(tiddlerFields) {
|
||||
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||
var numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
});
|
||||
// Try to import the various data types we understand
|
||||
if(numFiles === 0) {
|
||||
this.importData(dataTransfer);
|
||||
}
|
||||
// Tell the browser that we handled the drop
|
||||
event.preventDefault();
|
||||
// Stop the drop ripple up to any parent handlers
|
||||
|
||||
@@ -37,11 +37,12 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
// Create our element
|
||||
var editInfo = this.getEditInfo();
|
||||
var domNode = this.document.createElement(this.editTag);
|
||||
if(this.editType) {
|
||||
domNode.setAttribute("type",this.editType);
|
||||
}
|
||||
if(this.editPlaceholder) {
|
||||
if(editInfo.value === "" && this.editPlaceholder) {
|
||||
domNode.setAttribute("placeholder",this.editPlaceholder);
|
||||
}
|
||||
// Assign classes
|
||||
@@ -49,7 +50,6 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
|
||||
domNode.className = this.editClass;
|
||||
}
|
||||
// Set the text
|
||||
var editInfo = this.getEditInfo();
|
||||
if(this.editTag === "textarea") {
|
||||
domNode.appendChild(this.document.createTextNode(editInfo.value));
|
||||
} else {
|
||||
|
||||
@@ -33,16 +33,8 @@ EditWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
// Mappings from content type to editor type
|
||||
// TODO: This information should be configurable/extensible
|
||||
var editorTypeMappings = {
|
||||
"text/vnd.tiddlywiki": "text",
|
||||
"image/svg+xml": "text",
|
||||
"image/jpg": "bitmap",
|
||||
"image/jpeg": "bitmap",
|
||||
"image/gif": "bitmap",
|
||||
"image/png": "bitmap"
|
||||
};
|
||||
// Mappings from content type to editor type are stored in tiddlers with this prefix
|
||||
var EDITOR_MAPPING_PREFIX = "$:/config/EditorTypeMappings/";
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
@@ -64,7 +56,7 @@ EditWidget.prototype.execute = function() {
|
||||
}
|
||||
type = type || "text/vnd.tiddlywiki";
|
||||
// Choose the appropriate edit widget
|
||||
var editorType = editorTypeMappings[type] || "text";
|
||||
var editorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type) || "text";
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets([{
|
||||
type: "edit-" + editorType,
|
||||
|
||||
@@ -91,6 +91,9 @@ FieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {
|
||||
var modification = this.wiki.getModificationFields();
|
||||
modification.tags = (tiddler.fields.tags || []).slice(0);
|
||||
modification.tags.splice(p,1);
|
||||
if(modification.tags.length === 0) {
|
||||
modification.tags = undefined;
|
||||
}
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +330,9 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
var draftTitle = this.generateDraftTitle(title),
|
||||
draftTiddler = new $tw.Tiddler({
|
||||
text: ""
|
||||
},templateTiddler,{
|
||||
},templateTiddler,
|
||||
this.wiki.getCreationFields(),
|
||||
{
|
||||
title: draftTitle,
|
||||
"draft.title": title,
|
||||
"draft.of": title
|
||||
|
||||
@@ -84,7 +84,7 @@ RadioWidget.prototype.setValue = function() {
|
||||
};
|
||||
|
||||
RadioWidget.prototype.handleChangeEvent = function(event) {
|
||||
if (this.inputDomNode.checked) {
|
||||
if(this.inputDomNode.checked) {
|
||||
this.setValue();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -157,7 +157,8 @@ RevealWidget.prototype.refresh = function(changedTiddlers) {
|
||||
} else {
|
||||
var refreshed = false;
|
||||
if(changedTiddlers[this.stateTitle]) {
|
||||
this.updateState();
|
||||
// this.updateState();
|
||||
this.refreshSelf();
|
||||
refreshed = true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||
|
||||
@@ -28,8 +28,10 @@ Render this widget into the DOM
|
||||
*/
|
||||
TextNodeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
var textNode = this.document.createTextNode(this.parseTreeNode.text);
|
||||
var text = this.getAttribute("text",this.parseTreeNode.text),
|
||||
textNode = this.document.createTextNode(text);
|
||||
parent.insertBefore(textNode,nextSibling);
|
||||
this.domNodes.push(textNode);
|
||||
};
|
||||
|
||||
@@ -148,7 +148,7 @@ ViewWidget.prototype.getValueAsDoubleUrlEncoded = function() {
|
||||
};
|
||||
|
||||
ViewWidget.prototype.getValueAsDate = function(format) {
|
||||
format = format || "YYYY MM DD 0hh:0ss";
|
||||
format = format || "YYYY MM DD 0hh:0mm";
|
||||
var value = $tw.utils.parseDate(this.getValue());
|
||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||
return $tw.utils.formatDateString(value,format);
|
||||
@@ -158,8 +158,8 @@ ViewWidget.prototype.getValueAsDate = function(format) {
|
||||
};
|
||||
|
||||
ViewWidget.prototype.getValueAsRelativeDate = function(format) {
|
||||
var value = this.getValue();
|
||||
if(value) {
|
||||
var value = $tw.utils.parseDate(this.getValue());
|
||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||
return $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;
|
||||
} else {
|
||||
return "";
|
||||
|
||||
@@ -204,10 +204,12 @@ exports.addTiddler = function(tiddler) {
|
||||
// Get the title
|
||||
var title = tiddler.fields.title;
|
||||
// Save the tiddler
|
||||
this.tiddlers[title] = tiddler;
|
||||
this.clearCache(title);
|
||||
this.clearGlobalCache();
|
||||
this.enqueueTiddlerEvent(title);
|
||||
if(title) {
|
||||
this.tiddlers[title] = tiddler;
|
||||
this.clearCache(title);
|
||||
this.clearGlobalCache();
|
||||
this.enqueueTiddlerEvent(title);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -305,21 +307,27 @@ Sort an array of tiddler titles by a specified field
|
||||
isDescending: true if the sort should be descending
|
||||
isCaseSensitive: true if the sort should consider upper and lower case letters to be different
|
||||
*/
|
||||
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive) {
|
||||
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric) {
|
||||
var self = this;
|
||||
titles.sort(function(a,b) {
|
||||
if(sortField !== "title") {
|
||||
a = self.getTiddler(a).fields[sortField] || "";
|
||||
b = self.getTiddler(b).fields[sortField] || "";
|
||||
}
|
||||
if(!isCaseSensitive) {
|
||||
if(typeof a === "string") {
|
||||
a = a.toLowerCase();
|
||||
}
|
||||
if(typeof b === "string") {
|
||||
b = b.toLowerCase();
|
||||
if(!isNumeric || isNaN(a) || isNaN(b)) {
|
||||
if(!isCaseSensitive) {
|
||||
if(typeof a === "string") {
|
||||
a = a.toLowerCase();
|
||||
}
|
||||
if(typeof b === "string") {
|
||||
b = b.toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
a-= 0;
|
||||
b-= 0;
|
||||
}
|
||||
if(a < b) {
|
||||
return isDescending ? +1 : -1;
|
||||
} else {
|
||||
@@ -603,10 +611,14 @@ exports.setTiddlerData = function(title,data) {
|
||||
/*
|
||||
Return the content of a tiddler as an array containing each line
|
||||
*/
|
||||
exports.getTiddlerList = function(title) {
|
||||
exports.getTiddlerList = function(title,field,index) {
|
||||
if(index) {
|
||||
return $tw.utils.parseStringArray(this.extractTiddlerDataItem(title,index,""));
|
||||
}
|
||||
field = field || "list";
|
||||
var tiddler = this.getTiddler(title);
|
||||
if(tiddler && $tw.utils.isArray(tiddler.fields.list)) {
|
||||
return tiddler.fields.list.slice(0);
|
||||
if(tiddler) {
|
||||
return ($tw.utils.parseStringArray(tiddler.fields[field]) || []).slice(0);
|
||||
}
|
||||
return [];
|
||||
};
|
||||
@@ -813,7 +825,7 @@ exports.makeWidget = function(parser,options) {
|
||||
// Create the widget
|
||||
return new widget.widget(widgetNode,{
|
||||
wiki: this,
|
||||
document: options.document || $tw.document,
|
||||
document: options.document || $tw.fakeDocument,
|
||||
parentWidget: options.parentWidget
|
||||
});
|
||||
};
|
||||
@@ -832,7 +844,7 @@ exports.renderText = function(outputType,textType,text,options) {
|
||||
options = options || {};
|
||||
var parser = this.parseText(textType,text,options),
|
||||
widgetNode = this.makeWidget(parser,options);
|
||||
var container = $tw.document.createElement("div");
|
||||
var container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
return outputType === "text/html" ? container.innerHTML : container.textContent;
|
||||
};
|
||||
@@ -850,7 +862,7 @@ exports.renderTiddler = function(outputType,title,options) {
|
||||
options = options || {};
|
||||
var parser = this.parseTiddler(title),
|
||||
widgetNode = this.makeWidget(parser,options);
|
||||
var container = $tw.document.createElement("div");
|
||||
var container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
return outputType === "text/html" ? container.innerHTML : container.textContent;
|
||||
};
|
||||
@@ -1024,16 +1036,24 @@ exports.getTiddlerText = function(title,defaultText) {
|
||||
};
|
||||
|
||||
/*
|
||||
Read an array of browser File objects, invoking callback(tiddlerFields) for each loaded file
|
||||
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
||||
*/
|
||||
exports.readFiles = function(files,callback) {
|
||||
var result = [],
|
||||
outstanding = files.length;
|
||||
for(var f=0; f<files.length; f++) {
|
||||
this.readFile(files[f],callback);
|
||||
this.readFile(files[f],function(tiddlerFieldsArray) {
|
||||
result.push.apply(result,tiddlerFieldsArray);
|
||||
if(--outstanding === 0) {
|
||||
callback(result);
|
||||
}
|
||||
});
|
||||
};
|
||||
return files.length;
|
||||
};
|
||||
|
||||
/*
|
||||
Read a browser File object, invoking callback(tiddlerFields) with the tiddler fields object
|
||||
Read a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects
|
||||
*/
|
||||
exports.readFile = function(file,callback) {
|
||||
// Get the type, falling back to the filename extension
|
||||
@@ -1056,21 +1076,27 @@ exports.readFile = function(file,callback) {
|
||||
// Onload
|
||||
reader.onload = function(event) {
|
||||
// Deserialise the file contents
|
||||
var tiddlerFields = {title: file.name || "Untitled", type: type};
|
||||
var text = event.target.result,
|
||||
tiddlerFields = {title: file.name || "Untitled", type: type};
|
||||
// Are we binary?
|
||||
if(isBinary) {
|
||||
// The base64 section starts after the first comma in the data URI
|
||||
var commaPos = event.target.result.indexOf(",");
|
||||
var commaPos = text.indexOf(",");
|
||||
if(commaPos !== -1) {
|
||||
tiddlerFields.text = event.target.result.substr(commaPos+1);
|
||||
callback(tiddlerFields);
|
||||
tiddlerFields.text = text.substr(commaPos+1);
|
||||
callback([tiddlerFields]);
|
||||
}
|
||||
} else {
|
||||
var tiddlers = self.deserializeTiddlers(type,event.target.result,tiddlerFields);
|
||||
if(tiddlers) {
|
||||
$tw.utils.each(tiddlers,function(tiddlerFields) {
|
||||
callback(tiddlerFields);
|
||||
// Check whether this is an encrypted TiddlyWiki file
|
||||
var encryptedJson = $tw.utils.extractEncryptedStoreArea(text);
|
||||
if(encryptedJson) {
|
||||
// If so, attempt to decrypt it with the current password
|
||||
$tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) {
|
||||
callback(tiddlers);
|
||||
});
|
||||
} else {
|
||||
// Otherwise, just try to deserialise any tiddlers in the file
|
||||
callback(self.deserializeTiddlers(type,text,tiddlerFields));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
3
core/templates/alltiddlers.content.tid
Normal file
3
core/templates/alltiddlers.content.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/core/templates/alltiddlers.content
|
||||
|
||||
{{{ [!is[system]sort[title]] ||$:/core/templates/static-tiddler}}}
|
||||
28
core/templates/alltiddlers.template.html.tid
Normal file
28
core/templates/alltiddlers.template.html.tid
Normal file
@@ -0,0 +1,28 @@
|
||||
title: $:/core/templates/alltiddlers.template.html
|
||||
type: text/vnd.tiddlywiki-html
|
||||
|
||||
\define tw-wikilink-template() #$uri_encoded$
|
||||
\rules only filteredtranscludeinline transcludeinline
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="generator" content="TiddlyWiki" />
|
||||
<meta name="tiddlywiki-version" content="{{$:/core/templates/version}}" />
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
|
||||
<title>{{$:/core/wiki/title}}</title>
|
||||
<div id="styleArea">
|
||||
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}
|
||||
</div>
|
||||
<style type="text/css">
|
||||
{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}
|
||||
</style>
|
||||
</head>
|
||||
<body class="tw-body">
|
||||
{{$:/StaticBanner||$:/core/templates/html-tiddler}}
|
||||
<section class="story-river">
|
||||
{{$:/core/templates/alltiddlers.content||$:/core/templates/html-tiddler}}
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/core/save/all
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
[is[tiddler]] -[type[text/css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/core/save/empty
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
[is[system]] -[type[text/css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
||||
5
core/templates/static-tiddler.tid
Normal file
5
core/templates/static-tiddler.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
title: $:/core/templates/static-tiddler
|
||||
|
||||
<a name=<<currentTiddler>>>
|
||||
<$transclude tiddler="$:/core/ui/ViewTemplate"/>
|
||||
</a>
|
||||
@@ -10,6 +10,7 @@ type: text/vnd.tiddlywiki-html
|
||||
<meta name="generator" content="TiddlyWiki" />
|
||||
<meta name="tiddlywiki-version" content="{{$:/core/templates/version}}" />
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
|
||||
<title>{{$:/core/wiki/title}}</title>
|
||||
<div id="styleArea">
|
||||
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}
|
||||
|
||||
@@ -8,6 +8,7 @@ title: $:/core/templates/static.tiddler.html
|
||||
<meta name="generator" content="TiddlyWiki" />
|
||||
<meta name="tiddlywiki-version" content="`{{$:/core/templates/version}}`" />
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="stylesheet" href="static.css">
|
||||
<title>`{{$:/core/wiki/title}}`</title>
|
||||
</head>
|
||||
|
||||
@@ -14,7 +14,7 @@ title: $:/core/templates/tiddlywiki5.html
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="copyright" content="{{$:/core/copyright.txt}}" />
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
|
||||
<title>{{$:/core/wiki/title}}</title>
|
||||
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->
|
||||
|
||||
@@ -42,10 +42,6 @@ title: $:/core/templates/tiddlywiki5.html
|
||||
<div id="bootKernelPrefix" style="display:none;">
|
||||
{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}
|
||||
</div>
|
||||
<!--~~ Plugin modules ~~-->
|
||||
<div id="modules" style="display:none;">
|
||||
{{{ [is[system]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}
|
||||
</div>
|
||||
<!--~~ Boot kernel ~~-->
|
||||
<div id="bootKernel" style="display:none;">
|
||||
{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}
|
||||
|
||||
3
core/ui/AdvancedSearch.tid
Normal file
3
core/ui/AdvancedSearch.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/AdvancedSearch
|
||||
|
||||
<div class="tw-advanced-search"><<tabs "[is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] [!is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] +[tag[$:/tags/AdvancedSearch]]" "$:/core/ui/AdvancedSearch/System">></div>
|
||||
27
core/ui/AdvancedSearch/Shadows.tid
Normal file
27
core/ui/AdvancedSearch/Shadows.tid
Normal file
@@ -0,0 +1,27 @@
|
||||
title: $:/core/ui/AdvancedSearch/Shadows
|
||||
tags: $:/tags/AdvancedSearch
|
||||
caption: Shadows
|
||||
|
||||
<$linkcatcher to="$:/temp/advancedsearch">
|
||||
|
||||
Search for shadow tiddlers:
|
||||
|
||||
<div class="tw-search"><$edit-text tiddler="$:/temp/advancedsearch" type="search" tag="input"/><$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> <$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$reveal></div>
|
||||
|
||||
</$linkcatcher>
|
||||
|
||||
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
|
||||
|
||||
<div class="tw-search-results">
|
||||
|
||||
//<small><$count filter="[is[shadow]search{$:/temp/advancedsearch}]"/> matches</small>//
|
||||
|
||||
<$list filter="[is[shadow]search{$:/temp/advancedsearch}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
</div>
|
||||
|
||||
</$reveal>
|
||||
|
||||
<$reveal state="$:/temp/advancedsearch" type="match" text="">
|
||||
|
||||
</$reveal>
|
||||
27
core/ui/AdvancedSearch/System.tid
Normal file
27
core/ui/AdvancedSearch/System.tid
Normal file
@@ -0,0 +1,27 @@
|
||||
title: $:/core/ui/AdvancedSearch/System
|
||||
tags: $:/tags/AdvancedSearch
|
||||
caption: System
|
||||
|
||||
<$linkcatcher to="$:/temp/advancedsearch">
|
||||
|
||||
Search for system tiddlers:
|
||||
|
||||
<div class="tw-search"><$edit-text tiddler="$:/temp/advancedsearch" type="search" tag="input"/><$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> <$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$reveal></div>
|
||||
|
||||
</$linkcatcher>
|
||||
|
||||
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
|
||||
|
||||
<div class="tw-search-results">
|
||||
|
||||
//<small><$count filter="[is[system]search{$:/temp/advancedsearch}]"/> matches</small>//
|
||||
|
||||
<$list filter="[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
</div>
|
||||
|
||||
</$reveal>
|
||||
|
||||
<$reveal state="$:/temp/advancedsearch" type="match" text="">
|
||||
|
||||
</$reveal>
|
||||
@@ -7,7 +7,7 @@ caption: Basics
|
||||
|[[Subtitle|SiteSubtitle]] |<$edit-text tiddler="SiteSubtitle" default="" tag="input"/> |
|
||||
|[[Username for signing edits|$:/status/UserName]] |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> |
|
||||
|[[Animation duration|$:/config/AnimationDuration]] |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> |
|
||||
|[[DefaultTiddlers|$:/DefaultTiddlers]] |Choose which tiddlers are displayed at startup:<br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/> |
|
||||
|[[DefaultTiddlers|$:/DefaultTiddlers]] |Choose which tiddlers are displayed at startup:<br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//Use [[double square brackets]] for titles with spaces. Or you can choose to <$button set="$:/DefaultTiddlers" setTo="[list[$:/StoryList]]">retain story ordering</$button>// |
|
||||
|Tiddlers |''<$count filter="[!is[system]]"/>'' |
|
||||
|System tiddlers |''<$count filter="[is[system]]"/>'' |
|
||||
|Shadow tiddlers |''<$count filter="[is[shadow]]"/>'' |
|
||||
|
||||
@@ -16,7 +16,14 @@ http://$(userName)$.tiddlyspot.com/backup/
|
||||
|
||||
|[[Wiki name|$:/UploadName]] |<$edit-text tiddler="$:/UploadName" default="" tag="input"/> |
|
||||
|Password |<$password name="upload"/> |
|
||||
|Server URL |<$edit-text tiddler="$:/UploadURL" default="" tag="input"/> |
|
||||
|Backups |<<backupLink>> |
|
||||
|
||||
!! Advanced settings
|
||||
|
||||
|Server URL |<$edit-text tiddler="$:/UploadURL" default="" tag="input"/> |
|
||||
|Upload filename |<$edit-text tiddler="$:/UploadFilename" default="index.html" tag="input"/> |
|
||||
|Upload directory |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> |
|
||||
|Backup directory |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> |
|
||||
|
||||
|
||||
//The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address//
|
||||
|
||||
@@ -8,6 +8,10 @@ caption: Tools
|
||||
|
||||
Browse for files on your computer to import their contents (the individual tiddlers within TiddlyWiki HTML files are imported separately). You can also drag and drop files directly to the browser window.
|
||||
|
||||
! Export
|
||||
|
||||
<$button message="tw-download-file" param="$:/core/templates/alltiddlers.template.html" class="btn-big-green">Download all tiddlers as static HTML {{$:/core/images/save-button}}</$button>
|
||||
|
||||
! Encryption
|
||||
|
||||
{{$:/snippets/encryptionstatus}}
|
||||
|
||||
@@ -5,7 +5,7 @@ tags: $:/tags/EditTemplate
|
||||
Type the text for this tiddler
|
||||
\end
|
||||
<$reveal state="$:/ShowEditPreview" type="match" text="yes">
|
||||
//<$transclude tiddler="$:/core/ui/EditorHint"/>// <$button type="set" set="$:/ShowEditPreview" setTo="no">hide preview</$button>
|
||||
<em class="tw-edit"><$transclude tiddler="$:/core/ui/EditorHint"/></em> <$button type="set" set="$:/ShowEditPreview" setTo="no">hide preview</$button>
|
||||
<div class="tw-tiddler-preview">
|
||||
<div class="tw-tiddler-preview-preview">
|
||||
<$transclude />
|
||||
@@ -16,6 +16,6 @@ Type the text for this tiddler
|
||||
</div>
|
||||
</$reveal>
|
||||
<$reveal state="$:/ShowEditPreview" type="nomatch" text="yes">
|
||||
//<$transclude tiddler="$:/core/ui/EditorHint"/>// <$button type="set" set="$:/ShowEditPreview" setTo="yes">show preview</$button>
|
||||
<em class="tw-edit"><$transclude tiddler="$:/core/ui/EditorHint"/></em> <$button type="set" set="$:/ShowEditPreview" setTo="yes">show preview</$button>
|
||||
<$edit field="text" class="tw-edit-texteditor" placeholder=<<prompt>>/>
|
||||
</$reveal>
|
||||
|
||||
@@ -9,6 +9,6 @@ tags: $:/tags/EditTemplate
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="tw-edit-field-add">//Add a new field:// <span class="tw-edit-field-add-name"><$edit-text tiddler="$:/NewFieldName" tag="input" default="" placeholder="field name" class="tw-edit-texteditor"/></span> <span class="tw-edit-field-add-button"><$button message="tw-add-field" param={{$:/NewFieldName}} set="$:/NewFieldName" setTo="" class="">add</$button></span></div>
|
||||
<div class="tw-edit-field-add"><em class="tw-edit">Add a new field:</em> <span class="tw-edit-field-add-name"><$edit-text tiddler="$:/NewFieldName" tag="input" default="" placeholder="field name" class="tw-edit-texteditor"/></span> <span class="tw-edit-field-add-button"><$button message="tw-add-field" param={{$:/NewFieldName}} set="$:/NewFieldName" setTo="" class="">add</$button></span></div>
|
||||
|
||||
</$fieldmangler>
|
||||
|
||||
@@ -4,7 +4,7 @@ tags: $:/tags/EditTemplate
|
||||
\define tag-styles()
|
||||
background-color:$(backgroundColor)$;
|
||||
\end
|
||||
<div class="tw-edit-tags"><$fieldmangler><$list filter="[is[current]tags[]sort[title]]" storyview="pop" itemClass="tw-tag-editor-label"><$set name="backgroundColor" value={{!!color}}><span style=<<tag-styles>> class="tw-tag-label"><$view field="title" format="text" /><$button message="tw-remove-tag" param={{!!title}} class="btn-invisible tw-remove-tag-button">×</$button></span></$set>
|
||||
<div class="tw-edit-tags"><$fieldmangler><$list filter="[is[current]tags[]sort[title]]" storyview="pop"><$set name="backgroundColor" value={{!!color}}><span style=<<tag-styles>> class="tw-tag-label"><$view field="title" format="text" /><$button message="tw-remove-tag" param={{!!title}} class="btn-invisible tw-remove-tag-button">×</$button></span></$set>
|
||||
</$list>
|
||||
|
||||
<div class="tw-edit-add-tag"><span class="tw-add-tag-name"><$edit-text tiddler="$:/NewTagName" tag="input" default="" placeholder="tag name" focusPopup=<<qualify "$:/state/tagsAutoComplete">> class="tw-edit-texteditor"/></span> <$button popup=<<qualify "$:/state/tagsAutoComplete">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <span class="tw-add-tag-button"><$button message="tw-add-tag" param={{$:/NewTagName}} set="$:/NewTagName" setTo="" class="">add</$button></span></div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
title: $:/core/ui/EditTemplate/type
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
<p>//Type:// <$edit-text field="type" tag="input" default="" placeholder="type" focusPopup=<<qualify "$:/state/typeDropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/typeDropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button></p>
|
||||
<p><$fieldmangler><em class="tw-edit">Type:</em> <$edit-text field="type" tag="input" default="" placeholder="type" focusPopup=<<qualify "$:/state/typeDropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/typeDropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <$button message="tw-remove-field" param="type" class="btn-invisible btn-icon">{{$:/core/images/delete-button}}</$button></$fieldmangler></p>
|
||||
|
||||
<div class="tw-block-dropdown-wrapper">
|
||||
<$reveal state=<<qualify "$:/state/typeDropdown">> type="nomatch" text="" default="">
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/All
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: All
|
||||
|
||||
<$list filter="[!is[system]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[!is[system]sort[title]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Drafts
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: Drafts
|
||||
|
||||
<$list filter="[has[draft.of]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[has[draft.of]sort[title]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Missing
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: Missing
|
||||
|
||||
<$list filter="[is[missing]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/MissingTemplate"/>
|
||||
<$list filter="[is[missing]sort[title]]" template="$:/core/ui/MissingTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Orphans
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: Orphans
|
||||
|
||||
<$list filter="[is[orphan]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[is[orphan]sort[title]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Shadows
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: Shadows
|
||||
|
||||
<$list filter="[is[shadow]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[is[shadow]sort[title]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/System
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: System
|
||||
|
||||
<$list filter="[is[system]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[is[system]sort[title]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,7 +2,7 @@ title: $:/core/ui/MoreSideBar/Tags
|
||||
tags: $:/tags/MoreSideBar
|
||||
caption: Tags
|
||||
|
||||
<$list filter="[tags[]sort[title]]" itemClass="tw-menu-list-item">
|
||||
<$list filter="[tags[]sort[title]]">
|
||||
<$transclude tiddler="$:/core/ui/TagTemplate"/> <small class="tw-menu-list-count"><$count filter="[is[current]tagging[]]"/></small>
|
||||
</$list>
|
||||
----
|
||||
|
||||
@@ -2,7 +2,7 @@ title: $:/core/ui/SideBar/Open
|
||||
tags: $:/tags/SideBar
|
||||
caption: Open
|
||||
|
||||
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop" itemClass="tw-menu-list-item tw-open-tiddler-list">
|
||||
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop">
|
||||
<$button message="tw-close-tiddler" class="btn-invisible btn-mini">×</$button> <$link to={{!!title}}><$view field="title"/></$link>
|
||||
</$list>
|
||||
<$button message="tw-close-all-tiddlers" class="btn-invisible btn-mini">close all</$button>
|
||||
|
||||
@@ -6,6 +6,10 @@ caption: Tools
|
||||
|
||||
---
|
||||
|
||||
[[AdvancedSearch|$:/AdvancedSearch]]
|
||||
|
||||
---
|
||||
|
||||
{{$:/snippets/minithemeswitcher}}
|
||||
|
||||
---
|
||||
|
||||
@@ -2,11 +2,7 @@ title: $:/core/ui/SideBarLists
|
||||
|
||||
<div class="tw-sidebar-lists">
|
||||
|
||||
<$linkcatcher to="$:/temp/search">
|
||||
|
||||
<div class="tw-search"><$edit-text tiddler="$:/temp/search" type="search" tag="input"/><$reveal state="$:/temp/search" type="nomatch" text=""> <$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$reveal></div>
|
||||
|
||||
</$linkcatcher>
|
||||
<div class="tw-search"><$edit-text tiddler="$:/temp/search" type="search" tag="input"/> <$reveal state="$:/temp/search" type="nomatch" text=""><$linkcatcher to="$:/temp/search"><$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$linkcatcher></$reveal><$reveal state="$:/temp/search" type="match" text=""> <$link to="$:/AdvancedSearch" class="btn-invisible">…</$link></$reveal></div>
|
||||
|
||||
<$reveal state="$:/temp/search" type="nomatch" text="">
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/TiddlerInfo/List
|
||||
tags: $:/tags/TiddlerInfo
|
||||
caption: List
|
||||
|
||||
<$list filter="[list{!!title}]" itemClass="tw-menu-list-item" emptyMessage="This tiddler does not have a list" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[list{!!title}]" emptyMessage="This tiddler does not have a list" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/TiddlerInfo/Listed
|
||||
tags: $:/tags/TiddlerInfo
|
||||
caption: Listed
|
||||
|
||||
<$list filter="[is[current]listed[]!is[system]]" itemClass="tw-menu-list-item" emptyMessage="This tiddler is not listed by any others" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[is[current]listed[]!is[system]]" emptyMessage="This tiddler is not listed by any others" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/TiddlerInfo/Tagging
|
||||
tags: $:/tags/TiddlerInfo
|
||||
caption: Tagging
|
||||
|
||||
<$list filter="[is[current]tagging[]]" itemClass="tw-menu-list-item" emptyMessage="No tiddlers are tagged with this one" template="$:/core/ui/ListItemTemplate"/>
|
||||
<$list filter="[is[current]tagging[]]" emptyMessage="No tiddlers are tagged with this one" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/ViewTemplate/tags
|
||||
tags: $:/tags/ViewTemplate
|
||||
|
||||
<div class="tw-tags-wrapper"><$list filter="[is[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop" itemClass="tw-tag-list-item"/></div>
|
||||
<div class="tw-tags-wrapper"><$list filter="[is[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/DefaultTiddlers
|
||||
|
||||
GettingStarted
|
||||
GettingStarted
|
||||
[!is[system]sort[modified]limit[25]]
|
||||
@@ -7,7 +7,7 @@ To get started, first verify that you can save changes successfully - see http:/
|
||||
Then you can:
|
||||
|
||||
* Create new tiddlers using the 'plus' button in the sidebar
|
||||
* Visit the [[control panel|$:/ControlPanel]] using the 'cog' button in the sidebar to customise your wiki
|
||||
** Stop this message appearing by changing the default tiddlers under the ''Basics'' tab
|
||||
* Save changes using the 'download' button in the sidebar
|
||||
* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to determine which tiddlers appear when you open this wiki
|
||||
* Edit the SiteTitle and SiteSubtitle
|
||||
* Learn more about [[WikiText|http://tiddlywiki.com/static/WikiText.html]]
|
||||
|
||||
2
core/wiki/advancedsearch.tid
Normal file
2
core/wiki/advancedsearch.tid
Normal file
@@ -0,0 +1,2 @@
|
||||
title: $:/temp/advancedsearch
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
title: $:/snippets/recentchanges
|
||||
|
||||
<$list filter="[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]" itemClass="tw-menu-list-item">
|
||||
<$list filter="[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]">
|
||||
<div class="tw-menu-list-item">
|
||||
<$view field="modified" format="date" template="DDth MMM YYYY"/>
|
||||
<$list filter="[sameday{!!modified}!is[system]!sort[modified]]" itemClass="tw-menu-list-subitem">
|
||||
<$list filter="[sameday{!!modified}!is[system]!sort[modified]]">
|
||||
<div class="tw-menu-list-subitem">
|
||||
<$link to={{!!title}}>
|
||||
<$view field="title"/>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb",
|
||||
"tiddlywiki/filesystem",
|
||||
"tiddlywiki/codemirror"
|
||||
"tiddlywiki/codemirror",
|
||||
"tiddlywiki/highlight"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
@@ -17,4 +18,4 @@
|
||||
"includeWikis": [
|
||||
"../tw5.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,3 +7,5 @@ Try editing the tiddler LoremIpsum to try out the editor.
|
||||
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
|
||||
|
||||
[[$:/plugins/tiddlywiki/codemirror]]
|
||||
|
||||
{{$:/plugins/tiddlywiki/codemirror/instructions}}
|
||||
|
||||
4
editions/highlightdemo/tiddlers/DefaultTiddlers.tid
Normal file
4
editions/highlightdemo/tiddlers/DefaultTiddlers.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/DefaultTiddlers
|
||||
|
||||
[[HelloThere]]
|
||||
[[HighlightExample]]
|
||||
13
editions/highlightdemo/tiddlers/HelloThere.tid
Normal file
13
editions/highlightdemo/tiddlers/HelloThere.tid
Normal file
@@ -0,0 +1,13 @@
|
||||
title: HelloThere
|
||||
|
||||
This is a demo of TiddlyWiki5 incorporating a plugin for the [[highlight.js|https://github.com/isagalaev/highlight.js]] Syntax highlighting for the Web from Ivan Sagalaev.
|
||||
|
||||
The HighlightExample tiddler have fenced blocks of code.
|
||||
|
||||
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
|
||||
|
||||
[[$:/plugins/tiddlywiki/highlight]]
|
||||
|
||||
To add your prefered [[theme|http://highlightjs.org/static/test.html]] append to your:
|
||||
|
||||
[[$:/tags/stylesheet]]
|
||||
57
editions/highlightdemo/tiddlers/HighlightExample.tid
Normal file
57
editions/highlightdemo/tiddlers/HighlightExample.tid
Normal file
@@ -0,0 +1,57 @@
|
||||
title: HighlightExample
|
||||
|
||||
''Javascript'' fenced code:
|
||||
|
||||
```javascript
|
||||
(function(a,b){
|
||||
var result = a+b;
|
||||
return result;
|
||||
})(10,20)
|
||||
```
|
||||
|
||||
''CSS'' fenced code:
|
||||
|
||||
```css
|
||||
* { margin: 0; padding: 0; } /* micro reset */
|
||||
|
||||
html { font-size: 62.5%; }
|
||||
body { font-size: 14px; font-size: 1.4rem; } /* =14px */
|
||||
h1 { font-size: 24px; font-size: 2.4rem; } /* =24px */
|
||||
```
|
||||
|
||||
''Perl'' fenced code:
|
||||
|
||||
```perl
|
||||
package Name;
|
||||
my $singleton;
|
||||
|
||||
BEGIN {
|
||||
$singleton = {
|
||||
attribute => 'value',
|
||||
another => 'something',
|
||||
};
|
||||
bless $singleton, "Name";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
return $singleton;
|
||||
}
|
||||
```
|
||||
|
||||
''Python'' fenced code:
|
||||
|
||||
```
|
||||
class Singleton:
|
||||
__single = None
|
||||
def __init__( self ):
|
||||
if Singleton.__single:
|
||||
raise Singleton.__single
|
||||
Singleton.__single = self
|
||||
```
|
||||
|
||||
''~No-Highlight'' now
|
||||
|
||||
```no-highlight
|
||||
$ TW5_BUILD_OUTPUT=tmp/ ./bld.sh
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user