mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-22 10:54:46 +00:00
Compare commits
440 Commits
v5.1.14
...
print-wind
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60ab25bf6e | ||
|
|
33e636cbe7 | ||
|
|
760c80c655 | ||
|
|
1436196758 | ||
|
|
c252d7c945 | ||
|
|
4fd980debe | ||
|
|
38b24906c1 | ||
|
|
9e8a0653b0 | ||
|
|
398b715bb8 | ||
|
|
d54f599269 | ||
|
|
f355f07ff9 | ||
|
|
6e2b4ebf3e | ||
|
|
c5511854ab | ||
|
|
577a87a502 | ||
|
|
731759e20b | ||
|
|
85648590e5 | ||
|
|
944010c3bf | ||
|
|
78e734797b | ||
|
|
98bafd0b69 | ||
|
|
4e12c93b90 | ||
|
|
280cc39434 | ||
|
|
7468ad7acf | ||
|
|
737e9ae4cb | ||
|
|
e11282cc08 | ||
|
|
2beae0db2e | ||
|
|
523060e823 | ||
|
|
b95aa6ec6a | ||
|
|
e6466b2c32 | ||
|
|
0ab9ec1ad3 | ||
|
|
715cb1d1bc | ||
|
|
230c13129a | ||
|
|
a2606781b7 | ||
|
|
4c89bbabbe | ||
|
|
3816819705 | ||
|
|
f9be417204 | ||
|
|
d4b4c3c936 | ||
|
|
c64fc164fc | ||
|
|
2c7f467514 | ||
|
|
46e8e4343a | ||
|
|
38baa70bc6 | ||
|
|
36d321746b | ||
|
|
ab5e5795e8 | ||
|
|
8464101430 | ||
|
|
c569df4bd4 | ||
|
|
215c8bb9ea | ||
|
|
55453d463a | ||
|
|
b2173d11ea | ||
|
|
c95a32abdf | ||
|
|
ac26c8829d | ||
|
|
8feb07e429 | ||
|
|
3aaa7357f6 | ||
|
|
895447c40c | ||
|
|
5626148202 | ||
|
|
aab408109f | ||
|
|
34ce15638c | ||
|
|
d84a03c2d7 | ||
|
|
9499af9a70 | ||
|
|
d77a3795b7 | ||
|
|
75709d745f | ||
|
|
3e707f6a51 | ||
|
|
c397004cfb | ||
|
|
466566502c | ||
|
|
7f2ad15464 | ||
|
|
df50d675f2 | ||
|
|
19085a1277 | ||
|
|
200e854814 | ||
|
|
6bbf36f903 | ||
|
|
c974858cf5 | ||
|
|
f26bcb273b | ||
|
|
61f9adb710 | ||
|
|
7e58866499 | ||
|
|
7f1541464a | ||
|
|
141629c63b | ||
|
|
07887c1226 | ||
|
|
8bf7dd7172 | ||
|
|
df809bcb87 | ||
|
|
848d9cc4cb | ||
|
|
462d0a9402 | ||
|
|
5ea6c9a273 | ||
|
|
2163302190 | ||
|
|
3af0487f29 | ||
|
|
99d8da9fc4 | ||
|
|
06a10d7180 | ||
|
|
d4fc913012 | ||
|
|
afe14b47b5 | ||
|
|
b783d0f5af | ||
|
|
f092d08358 | ||
|
|
ea763d0eab | ||
|
|
f4496d8fd3 | ||
|
|
df1f7e9798 | ||
|
|
ce7cb020fb | ||
|
|
1d6edfbfcb | ||
|
|
4139690447 | ||
|
|
6cf508ef27 | ||
|
|
3c92512a2d | ||
|
|
a07fe6f016 | ||
|
|
3d64d7d126 | ||
|
|
02529a51d0 | ||
|
|
67bab83902 | ||
|
|
bafe447e1c | ||
|
|
0c3e549235 | ||
|
|
038f19ca9d | ||
|
|
df0b8b5a1e | ||
|
|
df9b8c5505 | ||
|
|
9e03264ebe | ||
|
|
53f2cc9814 | ||
|
|
0080728d36 | ||
|
|
47cdf55133 | ||
|
|
52319ee88a | ||
|
|
43b4ded2cc | ||
|
|
2e8eb15536 | ||
|
|
e4660a8cc1 | ||
|
|
6401b5c886 | ||
|
|
501ad2798f | ||
|
|
a8bd22f363 | ||
|
|
e19a9e6ff6 | ||
|
|
274bea1258 | ||
|
|
1280984e78 | ||
|
|
633208958c | ||
|
|
f4fd5e76f8 | ||
|
|
be375c40f2 | ||
|
|
b7746b0c55 | ||
|
|
019cb6a542 | ||
|
|
44a7ca7e43 | ||
|
|
1c6942402e | ||
|
|
28e713caac | ||
|
|
1b31004941 | ||
|
|
8e9330e484 | ||
|
|
033feda02d | ||
|
|
f1b38c42f9 | ||
|
|
1dc7647640 | ||
|
|
a62e7d218c | ||
|
|
6963a54c66 | ||
|
|
ac154e1452 | ||
|
|
45bf58b920 | ||
|
|
c4f6ba3a3f | ||
|
|
54f2c4c34f | ||
|
|
e92e109162 | ||
|
|
92c1a82492 | ||
|
|
bbccb60c0b | ||
|
|
aa7b18427f | ||
|
|
0d354fe57f | ||
|
|
b43ff430b7 | ||
|
|
f78190ef61 | ||
|
|
47264c8cd5 | ||
|
|
11b21d3583 | ||
|
|
de984366b9 | ||
|
|
eae573b9dd | ||
|
|
c9b8319801 | ||
|
|
de6e0d1c1e | ||
|
|
c0569849d2 | ||
|
|
22a15bed67 | ||
|
|
cb28065d8e | ||
|
|
bc87c3e3ae | ||
|
|
a5f3968304 | ||
|
|
2e9f0b29d0 | ||
|
|
0a1152b83a | ||
|
|
dbfe28094c | ||
|
|
7cb54f32c6 | ||
|
|
de6c9aff9d | ||
|
|
33cdf1550a | ||
|
|
1a52fdd626 | ||
|
|
6acf36e898 | ||
|
|
3361d749bf | ||
|
|
540cd1a286 | ||
|
|
634eb222ca | ||
|
|
25d667868d | ||
|
|
5fe80ec122 | ||
|
|
80e9c39b75 | ||
|
|
25fc4aa3ae | ||
|
|
ee0ccd4cc4 | ||
|
|
8030ea0fd6 | ||
|
|
22cd017c2f | ||
|
|
74c1fe16c8 | ||
|
|
51ad1deaf2 | ||
|
|
308c644fc1 | ||
|
|
521c1f6068 | ||
|
|
7f5a2f96ef | ||
|
|
8a5c357f23 | ||
|
|
8abe626957 | ||
|
|
64ca68e8e9 | ||
|
|
29e4965d2b | ||
|
|
fb3b7aa1cd | ||
|
|
2b0204422d | ||
|
|
cc39a86430 | ||
|
|
da0ffce2d6 | ||
|
|
b252abd4d1 | ||
|
|
24c6eece1b | ||
|
|
b1cd450889 | ||
|
|
0b9a3923bf | ||
|
|
5341d2887f | ||
|
|
4435afc726 | ||
|
|
042e9185a9 | ||
|
|
cda43f2ef8 | ||
|
|
220f73fde6 | ||
|
|
5963adf92e | ||
|
|
477cb0c47e | ||
|
|
86266c506f | ||
|
|
5754216479 | ||
|
|
38cf4c7ccf | ||
|
|
1c8170463c | ||
|
|
7534a97518 | ||
|
|
ab2ac78620 | ||
|
|
55d7f43f0c | ||
|
|
3e81921eea | ||
|
|
028888edff | ||
|
|
c194cec520 | ||
|
|
327fed30c8 | ||
|
|
42660b05a7 | ||
|
|
ff6aa0570f | ||
|
|
6350f55e25 | ||
|
|
eaf0869c94 | ||
|
|
df7f4fedb2 | ||
|
|
460a07ca03 | ||
|
|
4e1f9bf5ed | ||
|
|
a88e28cb5a | ||
|
|
ad116be7f6 | ||
|
|
949c178f45 | ||
|
|
a4623a8ebb | ||
|
|
293c2fce07 | ||
|
|
92870c0b2d | ||
|
|
4e433966f4 | ||
|
|
43108926de | ||
|
|
302b6a93de | ||
|
|
48a98bad02 | ||
|
|
89e8f689bb | ||
|
|
b4c7c59d5d | ||
|
|
a3dae612fe | ||
|
|
6fa1602c2c | ||
|
|
3b34f60b90 | ||
|
|
25f76a5996 | ||
|
|
5fee52beac | ||
|
|
413894e3e7 | ||
|
|
50950d8143 | ||
|
|
a7a3748bca | ||
|
|
de4eb5ca89 | ||
|
|
3f5e8aed3d | ||
|
|
17bd6b76a8 | ||
|
|
edeab188a9 | ||
|
|
4bc592c9e8 | ||
|
|
6a96cd1284 | ||
|
|
47d065b239 | ||
|
|
642a6505a1 | ||
|
|
57e1fc6cd8 | ||
|
|
358d416526 | ||
|
|
e4b10d42f9 | ||
|
|
7e71fcfab8 | ||
|
|
254e1ca7f7 | ||
|
|
e27497d43d | ||
|
|
cbfbd0c2bc | ||
|
|
ca43a28d0e | ||
|
|
34306983b2 | ||
|
|
1b6a06a4d7 | ||
|
|
6c7f8e5381 | ||
|
|
c83231871d | ||
|
|
d2ff164c07 | ||
|
|
e344c38349 | ||
|
|
f128650c6e | ||
|
|
d96b4f4d90 | ||
|
|
f478fa97fc | ||
|
|
49b3ed4770 | ||
|
|
cd32b627b3 | ||
|
|
6928c411d6 | ||
|
|
2b21b74c50 | ||
|
|
7ba9cbc052 | ||
|
|
451150ebd6 | ||
|
|
56940e49c2 | ||
|
|
920d225f37 | ||
|
|
a2c764d407 | ||
|
|
feace8d26b | ||
|
|
38fbc4f35a | ||
|
|
661bff4f5b | ||
|
|
4d2d202935 | ||
|
|
9b2d916946 | ||
|
|
be4c108ed9 | ||
|
|
abec14af9b | ||
|
|
b02ee28968 | ||
|
|
c507d4e2dd | ||
|
|
525e07f259 | ||
|
|
bd2ff7a4c9 | ||
|
|
e64c42e661 | ||
|
|
06fa483b7d | ||
|
|
ca2225b940 | ||
|
|
c65ca8060c | ||
|
|
5acfc012cb | ||
|
|
0b3e637880 | ||
|
|
54b1e284fa | ||
|
|
8d00d6cb22 | ||
|
|
031fd8fb22 | ||
|
|
304eb99d41 | ||
|
|
021b5e072b | ||
|
|
2fd2ae993e | ||
|
|
464ef889f9 | ||
|
|
0224da34a9 | ||
|
|
29364cbd08 | ||
|
|
6b575f5404 | ||
|
|
9e90be47bf | ||
|
|
7abfa9e2e7 | ||
|
|
a097b259d7 | ||
|
|
f366a74f68 | ||
|
|
c5b478efe7 | ||
|
|
b4ec32ca70 | ||
|
|
c4e2793b06 | ||
|
|
967b123b51 | ||
|
|
ae8fb3e98b | ||
|
|
95b84dd0ca | ||
|
|
6555fecbf3 | ||
|
|
d7a6816307 | ||
|
|
e646d207c3 | ||
|
|
518f57f4bb | ||
|
|
7bdaabce78 | ||
|
|
49fad6dae9 | ||
|
|
ce5865ba16 | ||
|
|
afea0ba9bf | ||
|
|
1c16c494eb | ||
|
|
05a3d9a302 | ||
|
|
1dcc8c99e5 | ||
|
|
e5f96d6415 | ||
|
|
73953080e3 | ||
|
|
59505449d2 | ||
|
|
9ada7a0bb1 | ||
|
|
06f70d0a03 | ||
|
|
ce3832e275 | ||
|
|
148a4eea4d | ||
|
|
3c62ef0d71 | ||
|
|
db8fd9ea74 | ||
|
|
8ee66d617f | ||
|
|
a8622cdd72 | ||
|
|
46453d23cb | ||
|
|
c069d48a2a | ||
|
|
489f9a0079 | ||
|
|
4e278d0cd7 | ||
|
|
7a714da9cb | ||
|
|
24c325611b | ||
|
|
35a7a66b01 | ||
|
|
378e00aee8 | ||
|
|
11da58355e | ||
|
|
aa417fe899 | ||
|
|
1b7d9d65f4 | ||
|
|
5a5d648127 | ||
|
|
51b1ead5c9 | ||
|
|
50b0004481 | ||
|
|
08ae7321c1 | ||
|
|
06ea4060cb | ||
|
|
2381fb5312 | ||
|
|
90c1c6242e | ||
|
|
5cdf86b307 | ||
|
|
d3a2cfb2bc | ||
|
|
8293a77c6e | ||
|
|
94f9929c80 | ||
|
|
b6f948b61e | ||
|
|
2ebf4285e8 | ||
|
|
7e88dd788c | ||
|
|
3fb8d9b848 | ||
|
|
509a474f4a | ||
|
|
1088b01f96 | ||
|
|
523280362b | ||
|
|
68e17f92de | ||
|
|
34404dcfc9 | ||
|
|
687cb226f5 | ||
|
|
9ca9c188c9 | ||
|
|
8fc80cbf3c | ||
|
|
3a73d2e4ee | ||
|
|
9ac784a468 | ||
|
|
e471bd54d4 | ||
|
|
a4d919f45c | ||
|
|
0d0b841b5c | ||
|
|
e951047461 | ||
|
|
c6e4b7a123 | ||
|
|
5dd3d97760 | ||
|
|
c25a1eef33 | ||
|
|
f59809e9a4 | ||
|
|
d966583854 | ||
|
|
596dfa1d50 | ||
|
|
41b6c5c088 | ||
|
|
95ef1c4580 | ||
|
|
7bca39842f | ||
|
|
dc295b2536 | ||
|
|
16d867d380 | ||
|
|
69528093d9 | ||
|
|
17fbe49f2b | ||
|
|
a346888213 | ||
|
|
c179dc93cb | ||
|
|
4db950cc45 | ||
|
|
1919f0e9b0 | ||
|
|
ccac0258af | ||
|
|
a7b57d7f97 | ||
|
|
847727146e | ||
|
|
b71583e9d7 | ||
|
|
d7315126e7 | ||
|
|
6091b12eb0 | ||
|
|
f9e1188b3a | ||
|
|
4759f73770 | ||
|
|
e9173b7a71 | ||
|
|
cee7baa183 | ||
|
|
37cbaa08f1 | ||
|
|
48e0186ba9 | ||
|
|
2d0ac7245f | ||
|
|
5d74513a97 | ||
|
|
5892c4d8bc | ||
|
|
6085b1171a | ||
|
|
bf51acd8d6 | ||
|
|
1905a3f343 | ||
|
|
96ff7ab86f | ||
|
|
f75e97f308 | ||
|
|
d5b50e0854 | ||
|
|
efd0c270d7 | ||
|
|
c40fd7f7f2 | ||
|
|
a5e565e198 | ||
|
|
ef9efbc399 | ||
|
|
cf9085b5ce | ||
|
|
534f5e7c13 | ||
|
|
a4989f5c4d | ||
|
|
d89010752a | ||
|
|
de81984973 | ||
|
|
58234b755d | ||
|
|
ab064e15a9 | ||
|
|
c97458f0d4 | ||
|
|
9ea178e327 | ||
|
|
a4035d3424 | ||
|
|
0bc325025a | ||
|
|
18cd37c2de | ||
|
|
7436fc7374 | ||
|
|
b99a1b6496 | ||
|
|
881e834f89 | ||
|
|
f2f5afa106 | ||
|
|
9c57ebb05d | ||
|
|
1e9d214f67 | ||
|
|
4b9fcdf958 | ||
|
|
432542bbcc | ||
|
|
1733a2c39c | ||
|
|
e3544ff3c2 | ||
|
|
3edf3892e8 | ||
|
|
683285d449 | ||
|
|
93771fdf27 | ||
|
|
684e4feff5 | ||
|
|
cb0ccb22b1 | ||
|
|
982792a22a | ||
|
|
e631e59f00 | ||
|
|
17110169a9 |
@@ -1,3 +1,3 @@
|
||||
<h1 class="">Script Files</h1><p>The <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a> repository contains several scripts in the <code>bin</code> folder that you can use to automate common tasks, or as a useful starting point for your own scripts. See <a class="tc-tiddlylink tc-tiddlylink-missing" href="http://tiddlywiki.com/static/Scripts%2520for%2520building%2520tiddlywiki.com.html">Scripts for building tiddlywiki.com</a> for details of the scripts used to build and release <a class="tc-tiddlylink-external" href="http://tiddlywiki.com/" rel="noopener noreferrer" target="_blank">http://tiddlywiki.com/</a>.</p><p>All the scripts expect to be run from the root folder of the repository.</p><h2 class=""><code>serve</code>: serves tw5.com</h2><pre><code>./bin/serve.sh -h
|
||||
<h1 class="">Script Files</h1><p>The <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a> repository contains several scripts in the <code>bin</code> folder that you can use to automate common tasks, or as a useful starting point for your own scripts. See <a class="tc-tiddlylink tc-tiddlylink-missing" href="https://tiddlywiki.com/static/Scripts%2520for%2520building%2520tiddlywiki.com.html">Scripts for building tiddlywiki.com</a> for details of the scripts used to build and release <a class="tc-tiddlylink-external" href="https://tiddlywiki.com/" rel="noopener noreferrer" target="_blank">https://tiddlywiki.com/</a>.</p><p>All the scripts expect to be run from the root folder of the repository.</p><h2 class=""><code>serve</code>: serves tw5.com</h2><pre><code>./bin/serve.sh -h
|
||||
./bin/serve.sh [edition dir] [username] [password] [host] [port]</code></pre><p>Or:</p><pre><code>./bin/serve.cmd -h
|
||||
./bin/serve.cmd [edition dir] [username] [password] [host] [port]</code></pre><p>This script starts <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a> running as an HTTP server, defaulting to the content from the <code>tw5.com-server</code> edition. By default, the Node.js serves on port 8080. If the optional <code>username</code> parameter is provided, it is used for signing edits. If the <code>password</code> is provided then HTTP basic authentication is used. Run the script with the <code>-h</code> parameter to see online help.</p><p>To experiment with this configuration, run the script and then visit <code>http://127.0.0.1:8080</code> in a browser.</p><p>Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).</p><h2 class=""><code>test</code>: build and run tests</h2><p>This script runs the <code>test</code> edition of <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> on the server to perform the server-side tests and to build <code>test.html</code> for running the tests in the browser.</p><h2 class=""><code>lazy</code>: serves tw5.com with lazily loaded images</h2><pre><code>./bin/lazy.sh <username> [<password>]</code></pre><p>Or:</p><pre><code>./bin/lazy.cmd <username> [<password>]</code></pre><p>This script serves the <code>tw5.com-server</code> edition content with <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/LazyLoading.html">LazyLoading</a> applied to images.</p><h2 class=""><code>2bld</code>: builds <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> 2.6.5</h2><p>This script builds <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> 2.6.5 from the original source and then displays the differences between them (<code>diff</code> is used for *nix, <code>fc</code> for Windows).</p>
|
||||
./bin/serve.cmd [edition dir] [username] [password] [host] [port]</code></pre><p>This script starts <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a> running as an HTTP server, defaulting to the content from the <code>tw5.com-server</code> edition. By default, the Node.js serves on port 8080. If the optional <code>username</code> parameter is provided, it is used for signing edits. If the <code>password</code> is provided then HTTP basic authentication is used. Run the script with the <code>-h</code> parameter to see online help.</p><p>To experiment with this configuration, run the script and then visit <code>http://127.0.0.1:8080</code> in a browser.</p><p>Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).</p><h2 class=""><code>test</code>: build and run tests</h2><p>This script runs the <code>test</code> edition of <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> on the server to perform the server-side tests and to build <code>test.html</code> for running the tests in the browser.</p><h2 class=""><code>lazy</code>: serves tw5.com with lazily loaded images</h2><pre><code>./bin/lazy.sh <username> [<password>]</code></pre><p>Or:</p><pre><code>./bin/lazy.cmd <username> [<password>]</code></pre><p>This script serves the <code>tw5.com-server</code> edition content with <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/LazyLoading.html">LazyLoading</a> applied to images.</p><h2 class=""><code>2bld</code>: builds <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> 2.6.5</h2><p>This script builds <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> 2.6.5 from the original source and then displays the differences between them (<code>diff</code> is used for *nix, <code>fc</code> for Windows).</p>
|
||||
@@ -9,37 +9,50 @@ Basic styles used before we boot up the parsing engine
|
||||
Error message and password prompt
|
||||
*/
|
||||
|
||||
.tc-password-wrapper, .tc-error-form {
|
||||
.tc-error-form {
|
||||
font-family: sans-serif;
|
||||
color: #fff;
|
||||
z-index: 20000;
|
||||
position: fixed;
|
||||
background-color: rgb(255, 75, 75);
|
||||
border: 8px solid rgb(255, 0, 0);
|
||||
border-radius: 8px;
|
||||
width: 50%;
|
||||
margin-left: 25%;
|
||||
margin-top: 4em;
|
||||
padding: 0 2em 1em 2em;
|
||||
}
|
||||
|
||||
.tc-error-form h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tc-error-prompt {
|
||||
text-align: center;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.tc-error-message {
|
||||
overflow: auto;
|
||||
max-height: 40em;
|
||||
padding-right: 1em;
|
||||
margin: 1em 0;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.tc-password-wrapper {
|
||||
font-family: sans-serif;
|
||||
z-index: 20000;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
top: 4em;
|
||||
left: 50%;
|
||||
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
|
||||
left: 50%;
|
||||
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
|
||||
padding: 16px 16px 16px 16px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.tc-error-form {
|
||||
color: #fff;
|
||||
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 */
|
||||
}
|
||||
|
||||
.tc-error-form div {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.tc-error-prompt {
|
||||
color: #000;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.tc-password-wrapper {
|
||||
color: #000;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
|
||||
114
boot/boot.js
114
boot/boot.js
@@ -135,8 +135,8 @@ $tw.utils.error = function(err) {
|
||||
var dm = $tw.utils.domMaker,
|
||||
heading = dm("h1",{text: errHeading}),
|
||||
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
||||
message = dm("div",{text: err}),
|
||||
button = dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )}),
|
||||
message = dm("div",{text: err, "class":"tc-error-message"}),
|
||||
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
||||
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"});
|
||||
document.body.insertBefore(form,document.body.firstChild);
|
||||
form.addEventListener("submit",function(event) {
|
||||
@@ -902,9 +902,23 @@ $tw.Wiki = function(options) {
|
||||
options = options || {};
|
||||
var self = this,
|
||||
tiddlers = Object.create(null), // Hashmap of tiddlers
|
||||
tiddlerTitles = null, // Array of tiddler titles
|
||||
getTiddlerTitles = function() {
|
||||
if(!tiddlerTitles) {
|
||||
tiddlerTitles = Object.keys(tiddlers);
|
||||
}
|
||||
return tiddlerTitles;
|
||||
},
|
||||
pluginTiddlers = [], // Array of tiddlers containing registered plugins, ordered by priority
|
||||
pluginInfo = Object.create(null), // Hashmap of parsed plugin content
|
||||
shadowTiddlers = options.shadowTiddlers || Object.create(null); // Hashmap by title of {source:, tiddler:}
|
||||
shadowTiddlers = options.shadowTiddlers || Object.create(null), // Hashmap by title of {source:, tiddler:}
|
||||
shadowTiddlerTitles = null,
|
||||
getShadowTiddlerTitles = function() {
|
||||
if(!shadowTiddlerTitles) {
|
||||
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||||
}
|
||||
return shadowTiddlerTitles;
|
||||
};
|
||||
|
||||
// Add a tiddler to the store
|
||||
this.addTiddler = function(tiddler) {
|
||||
@@ -918,6 +932,9 @@ $tw.Wiki = function(options) {
|
||||
// Uncomment the following line for detailed logs of all tiddler writes
|
||||
// console.log("Adding",title,tiddler)
|
||||
tiddlers[title] = tiddler;
|
||||
if(tiddlerTitles && tiddlerTitles.indexOf(title) === -1) {
|
||||
tiddlerTitles.push(title);
|
||||
}
|
||||
this.clearCache(title);
|
||||
this.clearGlobalCache();
|
||||
this.enqueueTiddlerEvent(title);
|
||||
@@ -931,6 +948,12 @@ $tw.Wiki = function(options) {
|
||||
// console.log("Deleting",title)
|
||||
if($tw.utils.hop(tiddlers,title)) {
|
||||
delete tiddlers[title];
|
||||
if(tiddlerTitles) {
|
||||
var index = tiddlerTitles.indexOf(title);
|
||||
if(index !== -1) {
|
||||
tiddlerTitles.splice(index,1);
|
||||
}
|
||||
}
|
||||
this.clearCache(title);
|
||||
this.clearGlobalCache();
|
||||
this.enqueueTiddlerEvent(title,true);
|
||||
@@ -943,7 +966,7 @@ $tw.Wiki = function(options) {
|
||||
var t = tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
return t;
|
||||
} else if(title !== undefined && Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||
} else if(title !== undefined && shadowTiddlers[title]) {
|
||||
return shadowTiddlers[title].tiddler;
|
||||
}
|
||||
return undefined;
|
||||
@@ -952,12 +975,12 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Get an array of all tiddler titles
|
||||
this.allTitles = function() {
|
||||
return Object.keys(tiddlers);
|
||||
return getTiddlerTitles().slice(0);
|
||||
};
|
||||
|
||||
// Iterate through all tiddler titles
|
||||
this.each = function(callback) {
|
||||
var titles = Object.keys(tiddlers),
|
||||
var titles = getTiddlerTitles(),
|
||||
index,titlesLength,title;
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
@@ -967,12 +990,12 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Get an array of all shadow tiddler titles
|
||||
this.allShadowTitles = function() {
|
||||
return Object.keys(shadowTiddlers);
|
||||
return getShadowTiddlerTitles().slice(0);
|
||||
};
|
||||
|
||||
// Iterate through all shadow tiddler titles
|
||||
this.eachShadow = function(callback) {
|
||||
var titles = Object.keys(shadowTiddlers),
|
||||
var titles = getShadowTiddlerTitles(),
|
||||
index,titlesLength,title;
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
@@ -983,16 +1006,16 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Iterate through all tiddlers and then the shadows
|
||||
this.eachTiddlerPlusShadows = function(callback) {
|
||||
var titles = Object.keys(tiddlers),
|
||||
index,titlesLength,title;
|
||||
var index,titlesLength,title,
|
||||
titles = getTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
callback(tiddlers[title],title);
|
||||
}
|
||||
titles = Object.keys(shadowTiddlers);
|
||||
titles = getShadowTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
if(!Object.prototype.hasOwnProperty.call(tiddlers,title)) {
|
||||
if(!tiddlers[title]) {
|
||||
var shadowInfo = shadowTiddlers[title];
|
||||
callback(shadowInfo.tiddler,title);
|
||||
}
|
||||
@@ -1001,21 +1024,21 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Iterate through all the shadows and then the tiddlers
|
||||
this.eachShadowPlusTiddlers = function(callback) {
|
||||
var titles = Object.keys(shadowTiddlers),
|
||||
index,titlesLength,title;
|
||||
var index,titlesLength,title,
|
||||
titles = getShadowTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
if(Object.prototype.hasOwnProperty.call(tiddlers,title)) {
|
||||
if(tiddlers[title]) {
|
||||
callback(tiddlers[title],title);
|
||||
} else {
|
||||
var shadowInfo = shadowTiddlers[title];
|
||||
callback(shadowInfo.tiddler,title);
|
||||
}
|
||||
}
|
||||
titles = Object.keys(tiddlers);
|
||||
titles = getTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
if(!Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||
if(!shadowTiddlers[title]) {
|
||||
callback(tiddlers[title],title);
|
||||
}
|
||||
}
|
||||
@@ -1130,6 +1153,7 @@ $tw.Wiki = function(options) {
|
||||
});
|
||||
}
|
||||
});
|
||||
shadowTiddlerTitles = null;
|
||||
this.clearCache(null);
|
||||
this.clearGlobalCache();
|
||||
};
|
||||
@@ -1202,7 +1226,7 @@ $tw.Wiki.prototype.processSafeMode = function() {
|
||||
// Assemble a report tiddler
|
||||
var titleReportTiddler = "TiddlyWiki Safe Mode",
|
||||
report = [];
|
||||
report.push("TiddlyWiki has been started in [[safe mode|http://tiddlywiki.com/static/SafeMode.html]]. All plugins are temporarily disabled. Most customisations have been disabled by renaming the following tiddlers:")
|
||||
report.push("TiddlyWiki has been started in [[safe mode|https://tiddlywiki.com/static/SafeMode.html]]. All plugins are temporarily disabled. Most customisations have been disabled by renaming the following tiddlers:")
|
||||
// Delete the overrides
|
||||
overrides.forEach(function(title) {
|
||||
var tiddler = self.getTiddler(title),
|
||||
@@ -1220,10 +1244,14 @@ $tw.Wiki.prototype.processSafeMode = function() {
|
||||
/*
|
||||
Extracts tiddlers from a typed block of text, specifying default field values
|
||||
*/
|
||||
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) {
|
||||
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
|
||||
srcFields = srcFields || Object.create(null);
|
||||
var deserializer = $tw.Wiki.tiddlerDeserializerModules[type],
|
||||
options = options || {};
|
||||
var deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],
|
||||
fields = Object.create(null);
|
||||
if(!deserializer) {
|
||||
deserializer = $tw.Wiki.tiddlerDeserializerModules[type];
|
||||
}
|
||||
if(!deserializer && $tw.utils.getFileExtensionInfo(type)) {
|
||||
// If we didn't find the serializer, try converting it from an extension to a content type
|
||||
type = $tw.utils.getFileExtensionInfo(type).type;
|
||||
@@ -1253,8 +1281,7 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) {
|
||||
/*
|
||||
Register the built in tiddler deserializer modules
|
||||
*/
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
|
||||
"application/javascript": function(text,fields) {
|
||||
var deserializeHeaderComment = function(text,fields) {
|
||||
var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"),
|
||||
match = headerCommentRegExp.exec(text);
|
||||
fields.text = text;
|
||||
@@ -1262,7 +1289,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
|
||||
fields = $tw.utils.parseFields(match[1].split(/\r?\n\r?\n/mg)[0],fields);
|
||||
}
|
||||
return [fields];
|
||||
}
|
||||
};
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
|
||||
"application/javascript": deserializeHeaderComment
|
||||
});
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/css","tiddlerdeserializer",{
|
||||
"text/css": deserializeHeaderComment
|
||||
});
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{
|
||||
"application/x-tiddler": function(text,fields) {
|
||||
@@ -1523,7 +1555,7 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
||||
});
|
||||
}
|
||||
} else if(stat.isFile()) {
|
||||
tiddlers.push($tw.loadTiddlersFromFile(filepath));
|
||||
tiddlers.push($tw.loadTiddlersFromFile(filepath,{title: filepath}));
|
||||
}
|
||||
}
|
||||
return tiddlers;
|
||||
@@ -1634,9 +1666,14 @@ Load the tiddlers from a plugin folder, and package them up into a proper JSON p
|
||||
*/
|
||||
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
||||
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
|
||||
var infoPath = filepath + path.sep + "plugin.info";
|
||||
if(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory()) {
|
||||
// Read the plugin information
|
||||
var pluginInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "plugin.info","utf8"));
|
||||
if(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) {
|
||||
console.log("Warning: missing plugin.info file in " + filepath);
|
||||
return null;
|
||||
}
|
||||
var pluginInfo = JSON.parse(fs.readFileSync(infoPath,"utf8"));
|
||||
// Read the plugin files
|
||||
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||||
// Save the plugin tiddlers into the plugin info
|
||||
@@ -1797,9 +1834,13 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
||||
// Save the original tiddler file locations if requested
|
||||
var config = wikiInfo.config || {};
|
||||
if(config["retain-original-tiddler-path"]) {
|
||||
var output = {};
|
||||
var output = {}, relativePath;
|
||||
for(var title in $tw.boot.files) {
|
||||
output[title] = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
|
||||
relativePath = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
|
||||
output[title] =
|
||||
path.sep === path.posix.sep ?
|
||||
relativePath :
|
||||
relativePath.split(path.sep).join(path.posix.sep);
|
||||
}
|
||||
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
||||
}
|
||||
@@ -1905,7 +1946,7 @@ $tw.boot.startup = function(options) {
|
||||
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
|
||||
$tw.boot.files = Object.create(null);
|
||||
// System paths and filenames
|
||||
$tw.boot.bootPath = path.dirname(module.filename);
|
||||
$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);
|
||||
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
|
||||
// If there's no arguments then default to `--help`
|
||||
if($tw.boot.argv.length === 0) {
|
||||
@@ -1947,6 +1988,7 @@ $tw.boot.startup = function(options) {
|
||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||||
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
||||
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
||||
@@ -1957,6 +1999,7 @@ $tw.boot.startup = function(options) {
|
||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
||||
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
||||
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
||||
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||||
// Create the wiki store for the app
|
||||
@@ -2017,7 +2060,7 @@ $tw.boot.startup = function(options) {
|
||||
$tw.boot.executedStartupModules = Object.create(null);
|
||||
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
|
||||
// Repeatedly execute the next eligible task
|
||||
$tw.boot.executeNextStartupTask();
|
||||
$tw.boot.executeNextStartupTask(options.callback);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -2032,14 +2075,14 @@ $tw.addUnloadTask = function(task) {
|
||||
/*
|
||||
Execute the remaining eligible startup tasks
|
||||
*/
|
||||
$tw.boot.executeNextStartupTask = function() {
|
||||
$tw.boot.executeNextStartupTask = function(callback) {
|
||||
// Find the next eligible task
|
||||
var taskIndex = 0, task,
|
||||
asyncTaskCallback = function() {
|
||||
if(task.name) {
|
||||
$tw.boot.executedStartupModules[task.name] = true;
|
||||
}
|
||||
return $tw.boot.executeNextStartupTask();
|
||||
return $tw.boot.executeNextStartupTask(callback);
|
||||
};
|
||||
while(taskIndex < $tw.boot.remainingStartupModules.length) {
|
||||
task = $tw.boot.remainingStartupModules[taskIndex];
|
||||
@@ -2064,7 +2107,7 @@ $tw.boot.executeNextStartupTask = function() {
|
||||
if(task.name) {
|
||||
$tw.boot.executedStartupModules[task.name] = true;
|
||||
}
|
||||
return $tw.boot.executeNextStartupTask();
|
||||
return $tw.boot.executeNextStartupTask(callback);
|
||||
} else {
|
||||
task.startup(asyncTaskCallback);
|
||||
return true;
|
||||
@@ -2072,6 +2115,9 @@ $tw.boot.executeNextStartupTask = function() {
|
||||
}
|
||||
taskIndex++;
|
||||
}
|
||||
if(typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -2157,7 +2203,7 @@ $tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
||||
|
||||
/////////////////////////// Main boot function to decrypt tiddlers and then startup
|
||||
|
||||
$tw.boot.boot = function() {
|
||||
$tw.boot.boot = function(callback) {
|
||||
// Initialise crypto object
|
||||
$tw.crypto = new $tw.utils.Crypto();
|
||||
// Initialise password prompter
|
||||
@@ -2167,7 +2213,7 @@ $tw.boot.boot = function() {
|
||||
// Preload any encrypted tiddlers
|
||||
$tw.boot.decryptEncryptedTiddlers(function() {
|
||||
// Startup
|
||||
$tw.boot.startup();
|
||||
$tw.boot.startup({callback: callback});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes
|
||||
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.$(a.slice(b/32),32-(b&31)).slice(1);return void 0===c?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.$(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===
|
||||
b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b=b&31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return!1;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===
|
||||
c},$:function(a,b,c,d){var e;e=0;for(void 0===d&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1));return d},i:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};
|
||||
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>24),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};
|
||||
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>8>>>8>>>8),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};
|
||||
sjcl.codec.hex={fromBits:function(a){var b="",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\s|0x/g,"");d=a.length;a=a+"00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};
|
||||
sjcl.codec.base32={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",X:"0123456789ABCDEFGHIJKLMNOPQRSTUV",BITS:32,BASE:5,REMAINING:27,fromBits:function(a,b,c){var d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f="",g=0,h=sjcl.codec.base32.B,k=0,l=sjcl.bitArray.bitLength(a);c&&(h=sjcl.codec.base32.X);for(c=0;f.length*d<l;)f+=h.charAt((k^a[c]>>>g)>>>e),g<d?(k=a[c]<<d-g,g+=e,c++):(k<<=d,g-=d);for(;f.length&7&&!b;)f+="=";return f},toBits:function(a,b){a=a.replace(/\s|=/g,"").toUpperCase();var c=sjcl.codec.base32.BITS,
|
||||
d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f=[],g,h=0,k=sjcl.codec.base32.B,l=0,n,m="base32";b&&(k=sjcl.codec.base32.X,m="base32hex");for(g=0;g<a.length;g++){n=k.indexOf(a.charAt(g));if(0>n){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}throw new sjcl.exception.invalid("this isn't "+m+"!");}h>e?(h-=e,f.push(l^n>>>h),l=n<<c-h):(h+=d,l^=n<<c-h)}h&56&&f.push(sjcl.bitArray.partial(h&56,l,1));return f}};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1 class="">Contributing to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a></h1><p>We welcome contributions to the code and documentation of <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> in several ways:</p><ul><li><a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/ReportingBugs.html">ReportingBugs</a></li><li>Helping to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/Improving%2520TiddlyWiki%2520Documentation.html">improve our documentation</a></li><li>Contributing to the code via <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5" rel="noopener noreferrer" target="_blank">GitHub</a><ul><li>See <a class="tc-tiddlylink-external" href="http://tiddlywiki.com/dev" rel="noopener noreferrer" target="_blank">http://tiddlywiki.com/dev</a> for more details</li></ul></li></ul><p>There are other ways to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/HelpingTiddlyWiki.html">help TiddlyWiki</a> too.</p><h1 class="">Contributor License Agreement</h1><p>Like other <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/OpenSource.html">OpenSource</a> projects, <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a> needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the <a class="tc-tiddlylink tc-tiddlylink-missing" href="http://tiddlywiki.com/static/UnaMesa.html">UnaMesa</a> Association (the legal entity that owns <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> on behalf of the community).</p><ul><li>For individuals use: <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md" rel="noopener noreferrer" target="_blank">licenses/CLA-individual</a></li><li>For entities use: <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md" rel="noopener noreferrer" target="_blank">licenses/CLA-entity</a></li></ul><h1 class="">How to sign the CLA</h1><p>Create a <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/GitHub.html">GitHub</a> pull request to add your name to <code>cla-individual.md</code> or <code>cla-entity.md</code>, with the date in the format (YYYY/MM/DD).</p><p><strong>step by step</strong></p><ol><li>Navigate to <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md" rel="noopener noreferrer" target="_blank">licenses/CLA-individual</a> or <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md" rel="noopener noreferrer" target="_blank">licenses/CLA-entity</a> according to whether you are signing as an individual or representative of an organisation</li><li>Click the "edit" button at the top-right corner (clicking this button will fork the project so you can edit the file)</li><li>Add your name at the bottom<ul><li>eg: <code>Jeremy Ruston, @Jermolene, 2011/11/22</code></li></ul></li><li>Below the edit box for the CLA text you should see a box labelled <strong>Propose file change</strong></li><li>Enter a brief title to explain the change (eg, "Signing the CLA")</li><li>Click the green button labelled <strong>Propose file change</strong></li><li>On the following screen, click the green button labelled <strong>Create pull request</strong></li></ol><hr><p><em>The CLA documents used for this project were created using <a class="tc-tiddlylink-external" href="http://www.harmonyagreements.org" rel="noopener noreferrer" target="_blank">Harmony Project Templates</a>. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity".</em></p><p>Remarks
|
||||
<h1 class="">Contributing to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a></h1><p>We welcome contributions to the code and documentation of <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> in several ways:</p><ul><li><a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/ReportingBugs.html">ReportingBugs</a></li><li>Helping to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/Improving%2520TiddlyWiki%2520Documentation.html">improve our documentation</a></li><li>Contributing to the code via <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5" rel="noopener noreferrer" target="_blank">GitHub</a><ul><li>See <a class="tc-tiddlylink-external" href="https://tiddlywiki.com/dev" rel="noopener noreferrer" target="_blank">https://tiddlywiki.com/dev</a> for more details</li></ul></li></ul><p>There are other ways to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/HelpingTiddlyWiki.html">help TiddlyWiki</a> too.</p><h1 class="">Contributor License Agreement</h1><p>Like other <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/OpenSource.html">OpenSource</a> projects, <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a> needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the <a class="tc-tiddlylink tc-tiddlylink-missing" href="https://tiddlywiki.com/static/UnaMesa.html">UnaMesa</a> Association (the legal entity that owns <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> on behalf of the community).</p><ul><li>For individuals use: <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md" rel="noopener noreferrer" target="_blank">licenses/CLA-individual</a></li><li>For entities use: <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md" rel="noopener noreferrer" target="_blank">licenses/CLA-entity</a></li></ul><h1 class="">How to sign the CLA</h1><p>Create a <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/GitHub.html">GitHub</a> pull request to add your name to <code>cla-individual.md</code> or <code>cla-entity.md</code>, with the date in the format (YYYY/MM/DD).</p><p><strong>step by step</strong></p><ol><li>Navigate to <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md" rel="noopener noreferrer" target="_blank">licenses/CLA-individual</a> or <a class="tc-tiddlylink-external" href="https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md" rel="noopener noreferrer" target="_blank">licenses/CLA-entity</a> according to whether you are signing as an individual or representative of an organisation</li><li>Click the "edit" button at the top-right corner (clicking this button will fork the project so you can edit the file)</li><li>Add your name at the bottom<ul><li>eg: <code>Jeremy Ruston, @Jermolene, 2011/11/22</code></li></ul></li><li>Below the edit box for the CLA text you should see a box labelled <strong>Propose file change</strong></li><li>Enter a brief title to explain the change (eg, "Signing the CLA")</li><li>Click the green button labelled <strong>Propose file change</strong></li><li>On the following screen, click the green button labelled <strong>Create pull request</strong></li></ol><hr><p><em>The CLA documents used for this project were created using <a class="tc-tiddlylink-external" href="http://www.harmonyagreements.org" rel="noopener noreferrer" target="_blank">Harmony Project Templates</a>. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity".</em></p><p>Remarks
|
||||
----—</p><ul><li><ul><li>When not owning the copyright in the entire work of authorship**</li></ul></li></ul><p>In this case, please clearly state so, since otherwise we assume that you are the legal copyright holder of the contributed work! Please provide links and additional information that clarify under which license the rest of the code is distributed.
|
||||
</p><p><em>This file was automatically generated by <a class="tc-tiddlylink tc-tiddlylink-resolves" href="http://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a></em>
|
||||
</p><p><em>This file was automatically generated by <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki5.html">TiddlyWiki5</a></em>
|
||||
</p>
|
||||
@@ -1,5 +1,4 @@
|
||||
title: $:/Acknowledgements
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
TiddlyWiki incorporates code from these fine OpenSource projects:
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ type: text/plain
|
||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||
|
||||
Copyright (c) 2004-2007, Jeremy Ruston
|
||||
Copyright (c) 2007-2017, UnaMesa Association
|
||||
Copyright (c) 2007-2018, UnaMesa Association
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
4
core/images/linkify.tid
Normal file
4
core/images/linkify.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/linkify
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-linkify-button tc-image-button" viewBox="0 0 128 128" width="22pt" height="22pt"><path d="M17.031 31.919H9.048V96.85h7.983v6.92H0V25h17.031v6.919zm24.66 0h-7.983V96.85h7.983v6.92H24.66V25h17.03v6.919zM67.77 56.422l11.975-3.903 2.306 7.096-12.063 3.903 7.628 10.379-6.12 4.435-7.63-10.467-7.45 10.2-5.943-4.523L58.1 63.518 45.95 59.35l2.306-7.096 12.064 4.17V43.825h7.45v12.596zM86.31 96.85h7.982V31.92H86.31V25h17.031v78.77H86.31v-6.92zm24.659 0h7.983V31.92h-7.983V25H128v78.77h-17.031v-6.92z" fill-rule="evenodd"/></svg>
|
||||
4
core/images/rotate-left.tid
Normal file
4
core/images/rotate-left.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/rotate-left
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-rotate-left tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128"><g fill-rule="evenodd"><rect width="32" height="80" rx="8"/><rect x="48" y="96" width="80" height="32" rx="8"/><path d="M61.32 36.65c19.743 2.45 35.023 19.287 35.023 39.693a4 4 0 0 1-8 0c0-15.663-11.254-28.698-26.117-31.46l3.916 3.916a4 4 0 1 1-5.657 5.657L49.172 43.142a4 4 0 0 1 0-5.657l11.313-11.313a4 4 0 1 1 5.657 5.656l-4.821 4.822z"/></g></svg>
|
||||
4
core/images/transcludify.tid
Normal file
4
core/images/transcludify.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/transcludify
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-transcludify-button tc-image-button" viewBox="0 0 128 128" width="22pt" height="22pt"><path d="M0 59.482c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 0 0 2.75-.932 6.762 6.762 0 0 0 2.306-1.907c.651-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 0 0-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 0 0-2.75-1.02C1.36 67.377.591 67.288 0 67.288v-7.806zm24.66 0c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 0 0 2.75-.932 6.762 6.762 0 0 0 2.306-1.907c.65-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 0 0-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 0 0-2.75-1.02c-.946-.177-1.715-.266-2.306-.266v-7.806zm43.965-3.538L80.6 52.041l2.306 7.097-12.063 3.903 7.628 10.378-6.12 4.435-7.63-10.467-7.45 10.201-5.943-4.524 7.628-10.023-12.152-4.17 2.306-7.096 12.064 4.17V43.347h7.451v12.596zm34.425 11.344c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 0 0-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 0 0 .71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 0 0-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 0 0 2.262 2.084 8.868 8.868 0 0 0 2.75 1.02c.946.177 1.745.266 2.395.266v7.806zm24.66 0c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 0 0-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 0 0 .71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 0 0-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 0 0 2.262 2.084 8.868 8.868 0 0 0 2.75 1.02c.946.177 1.745.266 2.395.266v7.806z" fill-rule="evenodd"/></svg>
|
||||
@@ -14,6 +14,8 @@ CloseOthers/Caption: close others
|
||||
CloseOthers/Hint: Close other tiddlers
|
||||
ControlPanel/Caption: control panel
|
||||
ControlPanel/Hint: Open control panel
|
||||
CopyToClipboard/Caption: copy to clipboard
|
||||
CopyToClipboard/Hint: Copy this text to the clipboard
|
||||
Delete/Caption: delete
|
||||
Delete/Hint: Delete this tiddler
|
||||
Edit/Caption: edit
|
||||
@@ -80,6 +82,8 @@ Permaview/Caption: permaview
|
||||
Permaview/Hint: Set browser address bar to a direct link to all the tiddlers in this story
|
||||
Print/Caption: print page
|
||||
Print/Hint: Print the current page
|
||||
PrintWindow/Caption: print in new window
|
||||
PrintWindow/Hint: Print tiddler in new window
|
||||
Refresh/Caption: refresh
|
||||
Refresh/Hint: Perform a full refresh of the wiki
|
||||
Save/Caption: ok
|
||||
@@ -139,6 +143,8 @@ LineWidth/Caption: line width
|
||||
LineWidth/Hint: Set line width for painting
|
||||
Link/Caption: link
|
||||
Link/Hint: Create wikitext link
|
||||
Linkify/Caption: wikilink
|
||||
Linkify/Hint: Wrap selection in square brackets
|
||||
ListBullet/Caption: bulleted list
|
||||
ListBullet/Hint: Apply bulleted list formatting to lines containing selection
|
||||
ListNumber/Caption: numbered list
|
||||
@@ -159,6 +165,8 @@ PreviewType/Caption: preview type
|
||||
PreviewType/Hint: Choose preview type
|
||||
Quote/Caption: quote
|
||||
Quote/Hint: Apply quoted text formatting to lines containing selection
|
||||
RotateLeft/Caption: rotate left
|
||||
RotateLeft/Hint: Rotate image left by 90 degrees
|
||||
Size/Caption: image size
|
||||
Size/Caption/Height: Height:
|
||||
Size/Caption/Resize: Resize image
|
||||
@@ -175,5 +183,7 @@ Subscript/Caption: subscript
|
||||
Subscript/Hint: Apply subscript formatting to selection
|
||||
Superscript/Caption: superscript
|
||||
Superscript/Hint: Apply superscript formatting to selection
|
||||
Transcludify/Caption: transclusion
|
||||
Transcludify/Hint: Wrap selection in curly brackets
|
||||
Underline/Caption: underline
|
||||
Underline/Hint: Apply underline formatting to selection
|
||||
|
||||
@@ -13,6 +13,7 @@ Basics/Language/Prompt: Hello! Current language:
|
||||
Basics/NewJournal/Title/Prompt: Title of new journal tiddlers
|
||||
Basics/NewJournal/Text/Prompt: Text for new journal tiddlers
|
||||
Basics/NewJournal/Tags/Prompt: Tags for new journal tiddlers
|
||||
Basics/NewTiddler/Title/Prompt: Title of new tiddlers
|
||||
Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers:
|
||||
Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers:
|
||||
Basics/Subtitle/Prompt: Subtitle:
|
||||
@@ -53,7 +54,7 @@ Palette/HideEditor/Caption: hide editor
|
||||
Palette/Prompt: Current palette:
|
||||
Palette/ShowEditor/Caption: show editor
|
||||
Parsing/Caption: Parsing
|
||||
Parsing/Hint: Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text="TiddlyWiki"/> from functioning correctly. Use [[safe mode|http://tiddlywiki.com/#SafeMode]] to restore normal operation.
|
||||
Parsing/Hint: Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text="TiddlyWiki"/> from functioning correctly. Use [[safe mode|https://tiddlywiki.com/#SafeMode]] to restore normal operation.
|
||||
Parsing/Block/Caption: Block Parse Rules
|
||||
Parsing/Inline/Caption: Inline Parse Rules
|
||||
Parsing/Pragma/Caption: Pragma Parse Rules
|
||||
@@ -72,7 +73,6 @@ Plugins/Installed/Hint: Currently installed plugins:
|
||||
Plugins/Languages/Caption: Languages
|
||||
Plugins/Languages/Hint: Language pack plugins
|
||||
Plugins/NoInfoFound/Hint: No ''"<$text text=<<currentTab>>/>"'' found
|
||||
Plugins/NoInformation/Hint: No information provided
|
||||
Plugins/NotInstalled/Hint: This plugin is not currently installed
|
||||
Plugins/OpenPluginLibrary: open plugin library
|
||||
Plugins/ClosePluginLibrary: close plugin library
|
||||
@@ -140,6 +140,8 @@ Settings/ToolbarButtons/Icons/Description: Include icon
|
||||
Settings/ToolbarButtons/Text/Description: Include text
|
||||
Settings/DefaultSidebarTab/Caption: Default Sidebar Tab
|
||||
Settings/DefaultSidebarTab/Hint: Specify which sidebar tab is displayed by default
|
||||
Settings/DefaultMoreSidebarTab/Caption: Default More Sidebar Tab
|
||||
Settings/DefaultMoreSidebarTab/Hint: Specify which More sidebar tab is displayed by default
|
||||
Settings/LinkToBehaviour/Caption: Tiddler Opening Behaviour
|
||||
Settings/LinkToBehaviour/InsideRiver/Hint: Navigation from //within// the story river
|
||||
Settings/LinkToBehaviour/OutsideRiver/Hint: Navigation from //outside// the story river
|
||||
@@ -156,6 +158,10 @@ Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist
|
||||
Settings/MissingLinks/Description: Enable links to missing tiddlers
|
||||
StoryView/Caption: Story View
|
||||
StoryView/Prompt: Current view:
|
||||
Stylesheets/Caption: Stylesheets
|
||||
Stylesheets/Expand/Caption: Expand All
|
||||
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
|
||||
Stylesheets/Restore/Caption: Restore
|
||||
Theme/Caption: Theme
|
||||
Theme/Prompt: Current theme:
|
||||
TiddlerFields/Caption: Tiddler Fields
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
title: $:/language/EditTemplate/
|
||||
|
||||
Body/External/Hint: This is an external tiddler stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself
|
||||
Body/External/Hint: This tiddler shows content stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself
|
||||
Body/Placeholder: Type the text for this tiddler
|
||||
Body/Preview/Type/Output: output
|
||||
Field/Remove/Caption: remove field
|
||||
Field/Remove/Hint: Remove field
|
||||
Field/Dropdown/Caption: field list
|
||||
Field/Dropdown/Hint: Show field list
|
||||
Fields/Add/Button: add
|
||||
Fields/Add/Name/Placeholder: field name
|
||||
Fields/Add/Prompt: Add a new field:
|
||||
|
||||
@@ -18,7 +18,7 @@ icon: The title of the tiddler containing the icon associated with a tiddler
|
||||
library: If set to "yes" indicates that a tiddler should be saved as a JavaScript library
|
||||
list: An ordered list of tiddler titles associated with a tiddler
|
||||
list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty
|
||||
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles
|
||||
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty
|
||||
modified: The date and time at which a tiddler was last modified
|
||||
modifier: The tiddler title associated with the person who last modified a tiddler
|
||||
name: The human readable name associated with a plugin tiddler
|
||||
|
||||
@@ -3,7 +3,7 @@ title: GettingStarted
|
||||
\define lingo-base() $:/language/ControlPanel/Basics/
|
||||
Welcome to ~TiddlyWiki and the ~TiddlyWiki community
|
||||
|
||||
Before you start storing important information in ~TiddlyWiki it is important to make sure that you can reliably save changes. See http://tiddlywiki.com/#GettingStarted for details
|
||||
Before you start storing important information in ~TiddlyWiki it is vital to make sure that you can reliably save changes. See https://tiddlywiki.com/#GettingStarted for details
|
||||
|
||||
!! Set up this ~TiddlyWiki
|
||||
|
||||
|
||||
@@ -6,23 +6,33 @@ Fetch one or more files over HTTP/HTTPS, and import the tiddlers matching a filt
|
||||
```
|
||||
--fetch file <url> <import-filter> <transform-filter>
|
||||
--fetch files <url-filter> <import-filter> <transform-filter>
|
||||
--fetch raw-file <url> <transform-filter>
|
||||
--fetch raw-files <url-filter> <transform-filter>
|
||||
```
|
||||
|
||||
With the "file" variant only a single file is fetched and the first parameter is the URL of the file to read.
|
||||
The "file" and "files" variants fetch the specified files and attempt to import the tiddlers within them (the same processing as if the files were dragged into the browser window). The "raw-file" and "raw-files" variants fetch the specified files and then store the raw file data in tiddlers, without applying the import logic.
|
||||
|
||||
With the "files" variant, multiple files are fetched and the first parameter is a filter yielding a list of URLs of the files to read. For example, given a set of tiddlers tagged "remote-server" that have a field "url" the filter `[tag[remote-server]get[url]]` will retrieve all the available URLs.
|
||||
With the "file" and "raw-file" variants only a single file is fetched and the first parameter is the URL of the file to read.
|
||||
|
||||
The `<import-filter>` parameter specifies a filter determining which tiddlers are imported. It defaults to `[all[tiddlers]]` if not provided.
|
||||
With the "files" and "raw-files" variants, multiple files are fetched and the first parameter is a filter yielding a list of URLs of the files to read. For example, given a set of tiddlers tagged "remote-server" that have a field "url" the filter `[tag[remote-server]get[url]]` will retrieve all the available URLs.
|
||||
|
||||
The `<transform-filter>` parameter specifies an optional filter that transforms the titles of the imported tiddlers. For example, `[addprefix[$:/myimports/]]` would add the prefix `$:/myimports/` to each title.
|
||||
For the "file" and "files" variants, the `<import-filter>` parameter specifies a filter determining which tiddlers are imported. It defaults to `[all[tiddlers]]` if not provided.
|
||||
|
||||
For all variants, the `<transform-filter>` parameter specifies an optional filter that transforms the titles of the imported tiddlers. For example, `[addprefix[$:/myimports/]]` would add the prefix `$:/myimports/` to each title.
|
||||
|
||||
Preceding the `--fetch` command with `--verbose` will output progress information during the import.
|
||||
|
||||
Note that TiddlyWiki will not fetch an older version of an already loaded plugin.
|
||||
|
||||
The following example retrieves all the non-system tiddlers from http://tiddlywiki.com and saves them to a JSON file:
|
||||
The following example retrieves all the non-system tiddlers from https://tiddlywiki.com and saves them to a JSON file:
|
||||
|
||||
```
|
||||
tiddlywiki --verbose --fetch file "http://tiddlywiki.com/" "[!is[system]]" "" --rendertiddler "$:/core/templates/exporters/JsonFile" output.json text/plain "" exportFilter "[!is[system]]"
|
||||
tiddlywiki --verbose --fetch file "https://tiddlywiki.com/" "[!is[system]]" "" --rendertiddler "$:/core/templates/exporters/JsonFile" output.json text/plain "" exportFilter "[!is[system]]"
|
||||
```
|
||||
|
||||
The following example retrieves the "favicon" file from tiddlywiki.com and saves it in a file called "output.ico". Note that the intermediate tiddler "Icon Tiddler" is quoted in the "--fetch" command because it is being used as a transformation filter to replace the default title, while there are no quotes for the "--savetiddler" command because it is being used directly as a title.
|
||||
|
||||
```
|
||||
tiddlywiki --verbose --fetch raw-file "https://tiddlywiki.com/favicon.ico" "[[Icon Tiddler]]" --savetiddler "Icon Tiddler" output.ico
|
||||
```
|
||||
|
||||
|
||||
24
core/language/en-GB/Help/import.tid
Normal file
24
core/language/en-GB/Help/import.tid
Normal file
@@ -0,0 +1,24 @@
|
||||
title: $:/language/Help/import
|
||||
description: Import tiddlers from a file
|
||||
|
||||
Import tiddlers from TiddlyWiki (`.html`), `.tiddler`, `.tid`, `.json` or other local files. The deserializer must be explicitly specified, unlike the `load` command which infers the deserializer from the file extension.
|
||||
|
||||
```
|
||||
--import <filepath> <deserializer> [<title>] [<encoding>]
|
||||
```
|
||||
|
||||
The deserializers in the core include:
|
||||
|
||||
* application/javascript
|
||||
* application/json
|
||||
* application/x-tiddler
|
||||
* application/x-tiddler-html-div
|
||||
* application/x-tiddlers
|
||||
* text/html
|
||||
* text/plain
|
||||
|
||||
The title of the imported tiddler defaults to the filename.
|
||||
|
||||
The encoding defaults to "utf8", but can be "base64" for importing binary files.
|
||||
|
||||
Note that TiddlyWiki will not import an older version of an already loaded plugin.
|
||||
@@ -1,10 +1,11 @@
|
||||
title: $:/language/Help/load
|
||||
description: Load tiddlers from a file
|
||||
|
||||
Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files
|
||||
Load tiddlers from TiddlyWiki (`.html`), `.tiddler`, `.tid`, `.json` or other local files. The processing applied to incoming files is determined by the file extension. Use the alternative `import` command if you need to specify the deserializer and encoding explicitly.
|
||||
|
||||
```
|
||||
--load <filepath>
|
||||
--load <dirpath>
|
||||
```
|
||||
|
||||
To load tiddlers from an encrypted TiddlyWiki file you should first specify the password with the PasswordCommand. For example:
|
||||
|
||||
34
core/language/en-GB/Help/render.tid
Normal file
34
core/language/en-GB/Help/render.tid
Normal file
@@ -0,0 +1,34 @@
|
||||
title: $:/language/Help/render
|
||||
description: Renders individual tiddlers to files
|
||||
|
||||
Render individual tiddlers identified by a filter and save the results to the specified files.
|
||||
|
||||
Optionally, the title of a template tiddler can be specified. In this case, instead of directly rendering each tiddler, the template tiddler is rendered with the "currentTiddler" variable set to the title of the tiddler that is being rendered.
|
||||
|
||||
A name and value for an additional variable may optionally also be specified.
|
||||
|
||||
```
|
||||
--render <tiddler-filter> [<filename-filter>] [<render-type>] [<template>] [<name>] [<value>]
|
||||
```
|
||||
|
||||
* ''tiddler-filter'': A filter identifying the tiddler(s) to be rendered
|
||||
* ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]addsuffix[.html]]`, which uses the unchanged tiddler title as the filename
|
||||
* ''template'': Optional template through which each tiddler is rendered
|
||||
* ''render-type'': Optional render type: `text/html` (the default) returns the full HTML text and `text/plain` just returns the text content (ie it ignores HTML tags and other unprintable material)
|
||||
* ''name'': Name of optional variable
|
||||
* ''value'': Value of optional variable
|
||||
|
||||
By default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
|
||||
|
||||
Notes:
|
||||
|
||||
* The output directory is not cleared of any existing files
|
||||
* Any missing directories in the path to the filename are automatically created.
|
||||
* When referring to a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets : `--render "[[Motovun Jack.jpg]]"`
|
||||
* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being rendered, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`
|
||||
* The `--render` command is a more flexible replacement for both the `--rendertiddler` and `--rendertiddlers` commands, which are deprecated
|
||||
|
||||
Examples:
|
||||
|
||||
* `--render "[!is[system]]" "[encodeuricomponent[]addprefix[tiddlers/]addsuffix[.html]]"` -- renders all non-system tiddlers as files in the subdirectory "tiddlers" with URL-encoded titles and the extension HTML
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
title: $:/language/Help/rendertiddler
|
||||
description: Render an individual tiddler as a specified ContentType
|
||||
|
||||
(Note: The `--rendertiddler` command is deprecated in favour of the new, more flexible `--render` command)
|
||||
|
||||
Render an individual tiddler as a specified ContentType, defaulting to `text/html` and save it to the specified filename.
|
||||
|
||||
Optionally the title of a template tiddler can be specified, in which case the template tiddler is rendered with the "currentTiddler" variable set to the tiddler that is being rendered (the first parameter value).
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
title: $:/language/Help/rendertiddlers
|
||||
description: Render tiddlers matching a filter to a specified ContentType
|
||||
|
||||
(Note: The `--rendertiddlers` command is deprecated in favour of the new, more flexible `--render` command)
|
||||
|
||||
Render a set of tiddlers matching a filter to separate files of a specified ContentType (defaults to `text/html`) and extension (defaults to `.html`).
|
||||
|
||||
```
|
||||
|
||||
25
core/language/en-GB/Help/save.tid
Normal file
25
core/language/en-GB/Help/save.tid
Normal file
@@ -0,0 +1,25 @@
|
||||
title: $:/language/Help/save
|
||||
description: Saves individual raw tiddlers to files
|
||||
|
||||
Saves individual tiddlers identified by a filter in their raw text or binary format to the specified files.
|
||||
|
||||
```
|
||||
--save <tiddler-filter> <filename-filter>
|
||||
```
|
||||
|
||||
* ''tiddler-filter'': A filter identifying the tiddler(s) to be saved
|
||||
* ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]]`, which uses the unchanged tiddler title as the filename
|
||||
|
||||
By default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
|
||||
|
||||
Notes:
|
||||
|
||||
* The output directory is not cleared of any existing files
|
||||
* Any missing directories in the path to the filename are automatically created.
|
||||
* When saving a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets : `--save "[[Motovun Jack.jpg]]"`
|
||||
* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being saved, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`
|
||||
* The `--save` command is a more flexible replacement for both the `--savetiddler` and `--savetiddlers` commands, which are deprecated
|
||||
|
||||
Examples:
|
||||
|
||||
* `--save "[!is[system]is[image]]" "[encodeuricomponent[]addprefix[tiddlers/]]"` -- saves all non-system image tiddlers as files in the subdirectory "tiddlers" with URL-encoded titles
|
||||
@@ -1,6 +1,8 @@
|
||||
title: $:/language/Help/savetiddler
|
||||
description: Saves a raw tiddler to a file
|
||||
|
||||
(Note: The `--savetiddler` command is deprecated in favour of the new, more flexible `--save` command)
|
||||
|
||||
Saves an individual tiddler in its raw text or binary format to the specified filename.
|
||||
|
||||
```
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
title: $:/language/Help/savetiddlers
|
||||
description: Saves a group of raw tiddlers to a directory
|
||||
|
||||
(Note: The `--savetiddlers` command is deprecated in favour of the new, more flexible `--save` command)
|
||||
|
||||
Saves a group of tiddlers in their raw text or binary format to the specified directory.
|
||||
|
||||
```
|
||||
|
||||
@@ -11,7 +11,7 @@ At the root, it serves a rendering of a specified tiddler. Away from the root, i
|
||||
|
||||
The parameters are:
|
||||
|
||||
* ''port'' - port number to serve from (defaults to "8080")
|
||||
* ''port'' - port number on which to listen; non-numeric values are interpreted as a system environment variable from which the port number is extracted (defaults to "8080")
|
||||
* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
||||
* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
||||
* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html")
|
||||
@@ -34,4 +34,9 @@ The username and password can be specified as empty strings if you need to set t
|
||||
--server 8080 $:/core/save/all text/plain text/html "" "" 192.168.0.245
|
||||
```
|
||||
|
||||
To run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port.
|
||||
To run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port. It can be useful to use an environment variable to pass the port number to the Node.js process. This example references an environment variable called "MY_PORT_NUMBER":
|
||||
|
||||
|
||||
```
|
||||
--server MY_PORT_NUMBER $:/core/save/all text/plain text/html MyUserName passw0rd
|
||||
```
|
||||
|
||||
@@ -7,6 +7,12 @@ Listing/Import/Caption: Import
|
||||
Listing/Select/Caption: Select
|
||||
Listing/Status/Caption: Status
|
||||
Listing/Title/Caption: Title
|
||||
Listing/Preview: Preview:
|
||||
Listing/Preview/Text: Text
|
||||
Listing/Preview/TextRaw: Text (Raw)
|
||||
Listing/Preview/Fields: Fields
|
||||
Listing/Preview/Diff: Diff
|
||||
Listing/Preview/DiffFields: Diff (Fields)
|
||||
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
||||
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
|
||||
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
title: $:/language/
|
||||
|
||||
AboveStory/ClassicPlugin/Warning: It looks like you are trying to load a plugin designed for ~TiddlyWiki Classic. Please note that [[these plugins do not work with TiddlyWiki version 5.x.x|http://tiddlywiki.com/#TiddlyWikiClassic]]. ~TiddlyWiki Classic plugins detected:
|
||||
AboveStory/ClassicPlugin/Warning: It looks like you are trying to load a plugin designed for ~TiddlyWiki Classic. Please note that [[these plugins do not work with TiddlyWiki version 5.x.x|https://tiddlywiki.com/#TiddlyWikiClassic]]. ~TiddlyWiki Classic plugins detected:
|
||||
BinaryWarning/Prompt: This tiddler contains binary data
|
||||
ClassicWarning/Hint: This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See http://tiddlywiki.com/static/Upgrading.html for more details.
|
||||
ClassicWarning/Hint: This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See https://tiddlywiki.com/static/Upgrading.html for more details.
|
||||
ClassicWarning/Upgrade/Caption: upgrade
|
||||
CloseAll/Button: close all
|
||||
ColourPicker/Recent: Recent:
|
||||
@@ -12,6 +12,7 @@ ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<tit
|
||||
ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"?
|
||||
Count: count
|
||||
DefaultNewTiddlerTitle: New Tiddler
|
||||
Diffs/CountMessage: <<diff-count>> differences
|
||||
DropMessage: Drop here (or use the 'Escape' key to cancel)
|
||||
Encryption/Cancel: Cancel
|
||||
Encryption/ConfirmClearPassword: Do you wish to clear the password? This will remove the encryption applied when saving this wiki
|
||||
@@ -35,7 +36,7 @@ Error/XMLHttpRequest: XMLHttpRequest error code
|
||||
InternalJavaScriptError/Title: Internal JavaScript Error
|
||||
InternalJavaScriptError/Hint: Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
|
||||
InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)
|
||||
LazyLoadingWarning: <p>Loading external text from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText</p>
|
||||
LazyLoadingWarning: <p>Trying to load external content from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear, either the tiddler content type doesn't match the type of the external content, or you may be using a browser that doesn't support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText</p>
|
||||
LoginToTiddlySpace: Login to TiddlySpace
|
||||
Manager/Controls/FilterByTag/None: (none)
|
||||
Manager/Controls/FilterByTag/Prompt: Filter by tag:
|
||||
@@ -54,7 +55,7 @@ Manager/Item/RawText: Raw text
|
||||
Manager/Item/Tags: Tags
|
||||
Manager/Item/Tools: Tools
|
||||
Manager/Item/WikifiedText: Wikified text
|
||||
MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" - click {{$:/core/images/edit-button}} to create
|
||||
MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" -- click {{||$:/core/ui/Buttons/edit}} to create
|
||||
No: No
|
||||
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
||||
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
title: $:/language/Modals/Download
|
||||
type: text/vnd.tiddlywiki
|
||||
subtitle: Download changes
|
||||
footer: <$button message="tm-close-tiddler">Close</$button>
|
||||
help: http://tiddlywiki.com/static/DownloadingChanges.html
|
||||
help: https://tiddlywiki.com/static/DownloadingChanges.html
|
||||
|
||||
Your browser only supports manual saving.
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
title: $:/language/Modals/SaveInstructions
|
||||
type: text/vnd.tiddlywiki
|
||||
subtitle: Save your work
|
||||
footer: <$button message="tm-close-tiddler">Close</$button>
|
||||
help: http://tiddlywiki.com/static/SavingChanges.html
|
||||
help: https://tiddlywiki.com/static/SavingChanges.html
|
||||
|
||||
Your changes to this wiki need to be saved as a ~TiddlyWiki HTML file.
|
||||
|
||||
|
||||
@@ -2,3 +2,5 @@ title: $:/language/Notifications/
|
||||
|
||||
Save/Done: Saved wiki
|
||||
Save/Starting: Starting to save wiki
|
||||
CopiedToClipboard/Succeeded: Copied!
|
||||
CopiedToClipboard/Failed: Failed to copy to clipboard!
|
||||
|
||||
@@ -2,7 +2,7 @@ title: $:/language/Search/
|
||||
|
||||
DefaultResults/Caption: List
|
||||
Filter/Caption: Filter
|
||||
Filter/Hint: Search via a [[filter expression|http://tiddlywiki.com/static/Filters.html]]
|
||||
Filter/Hint: Search via a [[filter expression|https://tiddlywiki.com/static/Filters.html]]
|
||||
Filter/Matches: //<small><<resultCount>> matches</small>//
|
||||
Matches: //<small><<resultCount>> matches</small>//
|
||||
Matches/All: All matches:
|
||||
|
||||
@@ -3,6 +3,7 @@ title: $:/language/SideBar/
|
||||
All/Caption: All
|
||||
Contents/Caption: Contents
|
||||
Drafts/Caption: Drafts
|
||||
Explorer/Caption: Explorer
|
||||
Missing/Caption: Missing
|
||||
More/Caption: More
|
||||
Open/Caption: Open
|
||||
|
||||
@@ -7,11 +7,12 @@ Options/SidebarLayout: Sidebar layout
|
||||
Options/SidebarLayout/Fixed-Fluid: Fixed story, fluid sidebar
|
||||
Options/SidebarLayout/Fluid-Fixed: Fluid story, fixed sidebar
|
||||
Options/StickyTitles: Sticky titles
|
||||
Options/StickyTitles/Hint: Causes tiddler titles to "stick" to the top of the browser window. Caution: Does not work at all with Chrome, and causes some layout issues in Firefox
|
||||
Options/StickyTitles/Hint: Causes tiddler titles to "stick" to the top of the browser window
|
||||
Options/CodeWrapping: Wrap long lines in code blocks
|
||||
Settings: Settings
|
||||
Settings/FontFamily: Font family
|
||||
Settings/CodeFontFamily: Code font family
|
||||
Settings/EditorFontFamily: Editor font family
|
||||
Settings/BackgroundImage: Page background image
|
||||
Settings/BackgroundImageAttachment: Page background image attachment
|
||||
Settings/BackgroundImageAttachment/Scroll: Scroll with tiddlers
|
||||
|
||||
@@ -27,24 +27,36 @@ Command.prototype.execute = function() {
|
||||
if(this.params.length < 2) {
|
||||
return "Missing subcommand and url";
|
||||
}
|
||||
var subcommand = this.params[0],
|
||||
url = this.params[1],
|
||||
importFilter = this.params[2] || "[all[tiddlers]]",
|
||||
transformFilter = this.params[3] || "";
|
||||
switch(subcommand) {
|
||||
switch(this.params[0]) {
|
||||
case "raw-file":
|
||||
return this.fetchFiles({
|
||||
raw: true,
|
||||
url: this.params[1],
|
||||
transformFilter: this.params[2] || "",
|
||||
callback: this.callback
|
||||
});
|
||||
break;
|
||||
case "file":
|
||||
return this.fetchFiles({
|
||||
url: url,
|
||||
importFilter: importFilter,
|
||||
transformFilter: transformFilter,
|
||||
url: this.params[1],
|
||||
importFilter: this.params[2],
|
||||
transformFilter: this.params[3] || "",
|
||||
callback: this.callback
|
||||
});
|
||||
break;
|
||||
case "raw-files":
|
||||
return this.fetchFiles({
|
||||
raw: true,
|
||||
urlFilter: this.params[1],
|
||||
transformFilter: this.params[2] || "",
|
||||
callback: this.callback
|
||||
});
|
||||
break;
|
||||
case "files":
|
||||
return this.fetchFiles({
|
||||
urlFilter: url,
|
||||
importFilter: importFilter,
|
||||
transformFilter: transformFilter,
|
||||
urlFilter: this.params[1],
|
||||
importFilter: this.params[2],
|
||||
transformFilter: this.params[3] || "",
|
||||
callback: this.callback
|
||||
});
|
||||
break;
|
||||
@@ -80,24 +92,31 @@ Command.prototype.fetchFiles = function(options) {
|
||||
return null;
|
||||
};
|
||||
|
||||
Command.prototype.fetchFile = function(url,options,callback) {
|
||||
Command.prototype.fetchFile = function(url,options,callback,redirectCount) {
|
||||
if(redirectCount > 10) {
|
||||
return callback("Error too many redirects retrieving " + url);
|
||||
}
|
||||
var self = this,
|
||||
lib = url.substr(0,8) === "https://" ? require("https") : require("http");
|
||||
lib.get(url).on("response",function(response) {
|
||||
var type = (response.headers["content-type"] || "").split(";")[0],
|
||||
body = "";
|
||||
data = [];
|
||||
self.commander.write("Reading " + url + ": ");
|
||||
response.on("data",function(chunk) {
|
||||
body += chunk;
|
||||
data.push(chunk);
|
||||
self.commander.write(".");
|
||||
});
|
||||
response.on("end",function() {
|
||||
self.commander.write("\n");
|
||||
if(response.statusCode === 200) {
|
||||
self.processBody(body,type,options);
|
||||
self.processBody(Buffer.concat(data),type,options,url);
|
||||
callback(null);
|
||||
} else {
|
||||
callback("Error " + response.statusCode + " retrieving " + url)
|
||||
if(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
||||
return self.fetchFile(response.headers.location,options,callback,redirectCount + 1);
|
||||
} else {
|
||||
return callback("Error " + response.statusCode + " retrieving " + url)
|
||||
}
|
||||
}
|
||||
});
|
||||
response.on("error",function(e) {
|
||||
@@ -108,16 +127,27 @@ Command.prototype.fetchFile = function(url,options,callback) {
|
||||
return null;
|
||||
};
|
||||
|
||||
Command.prototype.processBody = function(body,type,options) {
|
||||
// Deserialise the HTML file and put the tiddlers in their own wiki
|
||||
var self = this,
|
||||
incomingWiki = new $tw.Wiki(),
|
||||
tiddlers = this.commander.wiki.deserializeTiddlers(type || "text/html",body,{});
|
||||
$tw.utils.each(tiddlers,function(tiddler) {
|
||||
incomingWiki.addTiddler(new $tw.Tiddler(tiddler));
|
||||
});
|
||||
Command.prototype.processBody = function(body,type,options,url) {
|
||||
var self = this;
|
||||
// Collect the tiddlers in a wiki
|
||||
var incomingWiki = new $tw.Wiki();
|
||||
if(options.raw) {
|
||||
var typeInfo = type ? $tw.config.contentTypeInfo[type] : null,
|
||||
encoding = typeInfo ? typeInfo.encoding : "utf8";
|
||||
incomingWiki.addTiddler(new $tw.Tiddler({
|
||||
title: url,
|
||||
type: type,
|
||||
text: body.toString(encoding)
|
||||
}));
|
||||
} else {
|
||||
// Deserialise the file to extract the tiddlers
|
||||
var tiddlers = this.commander.wiki.deserializeTiddlers(type || "text/html",body.toString("utf8"),{});
|
||||
$tw.utils.each(tiddlers,function(tiddler) {
|
||||
incomingWiki.addTiddler(new $tw.Tiddler(tiddler));
|
||||
});
|
||||
}
|
||||
// Filter the tiddlers to select the ones we want
|
||||
var filteredTitles = incomingWiki.filterTiddlers(options.importFilter);
|
||||
var filteredTitles = incomingWiki.filterTiddlers(options.importFilter || "[all[tiddlers]]");
|
||||
// Import the selected tiddlers
|
||||
var count = 0;
|
||||
incomingWiki.each(function(tiddler,title) {
|
||||
|
||||
48
core/modules/commands/import.js
Normal file
48
core/modules/commands/import.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/import.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to import tiddlers from a file
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "import",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path");
|
||||
if(this.params.length < 2) {
|
||||
return "Missing parameters";
|
||||
}
|
||||
var filename = self.params[0],
|
||||
deserializer = self.params[1],
|
||||
title = self.params[2] || filename,
|
||||
encoding = self.params[3] || "utf8",
|
||||
text = fs.readFileSync(filename,encoding),
|
||||
tiddlers = this.commander.wiki.deserializeTiddlers(null,text,{title: title},{deserializer: deserializer});
|
||||
$tw.utils.each(tiddlers,function(tiddler) {
|
||||
self.commander.wiki.importTiddler(new $tw.Tiddler(tiddler));
|
||||
});
|
||||
this.commander.log(tiddlers.length + " tiddler(s) imported");
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
@@ -3,7 +3,7 @@ title: $:/core/modules/commands/load.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to load tiddlers from a file
|
||||
Command to load tiddlers from a file or directory
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@@ -30,9 +30,7 @@ Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing filename";
|
||||
}
|
||||
var ext = path.extname(self.params[0]),
|
||||
stat = fs.statSync(self.params[0]),
|
||||
tiddlers = $tw.loadTiddlersFromPath(self.params[0]),
|
||||
var tiddlers = $tw.loadTiddlersFromPath(self.params[0]),
|
||||
count = 0;
|
||||
$tw.utils.each(tiddlers,function(tiddlerInfo) {
|
||||
$tw.utils.each(tiddlerInfo.tiddlers,function(tiddler) {
|
||||
|
||||
65
core/modules/commands/render.js
Normal file
65
core/modules/commands/render.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/render.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Render individual tiddlers and save the results to the specified files
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
exports.info = {
|
||||
name: "render",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing tiddler filter";
|
||||
}
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
wiki = this.commander.wiki,
|
||||
tiddlerFilter = this.params[0],
|
||||
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
|
||||
type = this.params[2] || "text/html",
|
||||
template = this.params[3],
|
||||
varName = this.params[4],
|
||||
varValue = this.params[5],
|
||||
tiddlers = wiki.filterTiddlers(tiddlerFilter);
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var parser = wiki.parseTiddler(template || title),
|
||||
variables = {currentTiddler: title};
|
||||
if(varName) {
|
||||
variables[varName] = varValue || "";
|
||||
}
|
||||
var widgetNode = wiki.makeWidget(parser,{variables: variables}),
|
||||
container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
||||
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||
if(self.commander.verbose) {
|
||||
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
||||
}
|
||||
$tw.utils.createFileDirectories(filepath);
|
||||
fs.writeFileSync(filepath,text,"utf8");
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
53
core/modules/commands/save.js
Normal file
53
core/modules/commands/save.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/save.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Saves individual tiddlers in their raw text or binary format to the specified files
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "save",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing filename filter";
|
||||
}
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
wiki = this.commander.wiki,
|
||||
tiddlerFilter = this.params[0],
|
||||
filenameFilter = this.params[1] || "[is[tiddler]]",
|
||||
tiddlers = wiki.filterTiddlers(tiddlerFilter);
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var tiddler = self.commander.wiki.getTiddler(title),
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||
if(self.commander.verbose) {
|
||||
console.log("Saving \"" + title + "\" to \"" + filepath + "\"");
|
||||
}
|
||||
$tw.utils.createFileDirectories(filepath);
|
||||
fs.writeFileSync(filepath,tiddler.fields.text,contentTypeInfo.encoding);
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
@@ -143,7 +143,7 @@ SimpleServer.prototype.requestHandler = function(request,response) {
|
||||
};
|
||||
|
||||
SimpleServer.prototype.listen = function(port,host) {
|
||||
http.createServer(this.requestHandler.bind(this)).listen(port,host);
|
||||
return http.createServer(this.requestHandler.bind(this)).listen(port,host);
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
@@ -291,6 +291,9 @@ Command.prototype.execute = function() {
|
||||
password = this.params[5],
|
||||
host = this.params[6] || "127.0.0.1",
|
||||
pathprefix = this.params[7];
|
||||
if(parseInt(port,10).toString() !== port) {
|
||||
port = process.env[port] || 8080;
|
||||
}
|
||||
this.server.set({
|
||||
rootTiddler: rootTiddler,
|
||||
renderType: renderType,
|
||||
@@ -299,13 +302,14 @@ Command.prototype.execute = function() {
|
||||
password: password,
|
||||
pathprefix: pathprefix
|
||||
});
|
||||
this.server.listen(port,host);
|
||||
console.log("Serving on " + host + ":" + port);
|
||||
console.log("(press ctrl-C to exit)");
|
||||
var nodeServer = this.server.listen(port,host);
|
||||
$tw.utils.log("Serving on " + host + ":" + port,"brown/orange");
|
||||
$tw.utils.log("(press ctrl-C to exit)","red");
|
||||
// Warn if required plugins are missing
|
||||
if(!$tw.wiki.getTiddler("$:/plugins/tiddlywiki/tiddlyweb") || !$tw.wiki.getTiddler("$:/plugins/tiddlywiki/filesystem")) {
|
||||
$tw.utils.warning("Warning: Plugins required for client-server operation (\"tiddlywiki/filesystem\" and \"tiddlywiki/tiddlyweb\") are missing from tiddlywiki.info file");
|
||||
}
|
||||
$tw.hooks.invokeHook('th-server-command-post-start', this.server, nodeServer);
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ function FramedEngine(options) {
|
||||
this.copyStyles();
|
||||
// Add event listeners
|
||||
$tw.utils.addEventListeners(this.domNode,[
|
||||
{name: "click",handlerObject: this,handlerMethod: "handleClickEvent"},
|
||||
{name: "input",handlerObject: this,handlerMethod: "handleInputEvent"},
|
||||
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"}
|
||||
]);
|
||||
@@ -147,6 +148,14 @@ FramedEngine.prototype.focus = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a click
|
||||
*/
|
||||
FramedEngine.prototype.handleClickEvent = function(event) {
|
||||
this.fixHeight();
|
||||
return true;
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a dom "input" event which occurs when the text has changed
|
||||
*/
|
||||
|
||||
@@ -198,7 +198,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
this.makeChildWidgets();
|
||||
// Determine whether to show the toolbar
|
||||
this.editShowToolbar = this.wiki.getTiddlerText(ENABLE_TOOLBAR_TITLE,"yes");
|
||||
this.editShowToolbar = (this.editShowToolbar === "yes") && !!(this.children && this.children.length > 0);
|
||||
this.editShowToolbar = (this.editShowToolbar === "yes") && !!(this.children && this.children.length > 0) && (!this.document.isTiddlyWikiFakeDom);
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
24
core/modules/editor/operations/bitmap/rotate-left.js
Normal file
24
core/modules/editor/operations/bitmap/rotate-left.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/*\
|
||||
title: $:/core/modules/editor/operations/bitmap/rotate-left.js
|
||||
type: application/javascript
|
||||
module-type: bitmapeditoroperation
|
||||
|
||||
Bitmap editor operation to rotate the image left by 90 degrees
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports["rotate-left"] = function(event) {
|
||||
// Rotate the canvas left by 90 degrees
|
||||
this.rotateCanvasLeft();
|
||||
// Update the input controls
|
||||
this.refreshToolbar();
|
||||
// Save the image into the tiddler
|
||||
this.saveChanges();
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -18,18 +18,34 @@ Export our filter function
|
||||
*/
|
||||
exports.each = function(source,operator,options) {
|
||||
var results =[] ,
|
||||
value,values = {},
|
||||
field = operator.operand || "title";
|
||||
if(operator.suffix !== "list-item") {
|
||||
value,values = {},
|
||||
field = operator.operand || "title";
|
||||
if(operator.suffix === "value" && field === "title") {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
value = (field === "title") ? title : tiddler.getFieldString(field);
|
||||
if(!$tw.utils.hop(values,value)) {
|
||||
values[value] = true;
|
||||
results.push(title);
|
||||
}
|
||||
if(!$tw.utils.hop(values,title)) {
|
||||
values[title] = true;
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else if(operator.suffix !== "list-item") {
|
||||
if(field === "title") {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && !$tw.utils.hop(values,title)) {
|
||||
values[title] = true;
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
value = tiddler.getFieldString(field);
|
||||
if(!$tw.utils.hop(values,value)) {
|
||||
values[value] = true;
|
||||
results.push(title);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
|
||||
@@ -72,6 +72,14 @@ exports.stringify = function(source,operator,options) {
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.jsonstringify = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push($tw.utils.jsonStringify(title));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.escaperegexp = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
|
||||
@@ -45,4 +45,4 @@ exports.is = function(source,operator,options) {
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
})();
|
||||
@@ -24,7 +24,7 @@ exports.order = function(source,operator,options) {
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
});
|
||||
}
|
||||
return results;
|
||||
};
|
||||
@@ -44,7 +44,7 @@ exports.reverse = function(source,operator,options) {
|
||||
First entry/entries in list
|
||||
*/
|
||||
exports.first = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -56,7 +56,7 @@ exports.first = function(source,operator,options) {
|
||||
Last entry/entries in list
|
||||
*/
|
||||
exports.last = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -68,7 +68,7 @@ exports.last = function(source,operator,options) {
|
||||
All but the first entry/entries of the list
|
||||
*/
|
||||
exports.rest = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -82,7 +82,7 @@ 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,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -95,7 +95,7 @@ exports.bl = exports.butlast;
|
||||
The nth member of the list
|
||||
*/
|
||||
exports.nth = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
|
||||
30
core/modules/filters/lookup.js
Normal file
30
core/modules/filters/lookup.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/lookup.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator that looks up values via a title prefix
|
||||
|
||||
[lookup:<field>[<prefix>]]
|
||||
|
||||
Prepends the prefix to the selected items and returns the specified field value
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.lookup = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(options.wiki.getTiddlerText(operator.operand + title) || options.wiki.getTiddlerText(operator.operand + operator.suffix));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -27,6 +27,12 @@ exports.nsort = function(source,operator,options) {
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.sortan = function(source, operator, options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results, operator.operand || "title", operator.prefix === "!",false,false,true);
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.sortcs = function(source,operator,options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results,operator.operand || "title",operator.prefix === "!",true,false);
|
||||
|
||||
31
core/modules/filters/subtiddlerfields.js
Normal file
31
core/modules/filters/subtiddlerfields.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/subtiddlerfields.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for returning the names of the fields on the selected subtiddlers of the plugin named in the operand
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.subtiddlerfields = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var subtiddler = options.wiki.getSubTiddler(operator.operand,title);
|
||||
if(subtiddler) {
|
||||
for(var fieldName in subtiddler.fields) {
|
||||
$tw.utils.pushTop(results,fieldName);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -25,17 +25,18 @@ exports.tag = function(source,operator,options) {
|
||||
});
|
||||
} else {
|
||||
// Old semantics:
|
||||
var tiddlers = options.wiki.getTiddlersWithTag(operator.operand);
|
||||
if(operator.prefix === "!") {
|
||||
// Returns a copy of the input if operator.operand is missing
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && !tiddler.hasTag(operator.operand)) {
|
||||
if(tiddlers.indexOf(title) === -1) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Returns empty results if operator.operand is missing
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && tiddler.hasTag(operator.operand)) {
|
||||
if(tiddlers.indexOf(title) !== -1) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.putbefore = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return (index === -1) ?
|
||||
results.slice(0, -1) :
|
||||
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index, -count));
|
||||
@@ -41,7 +41,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.putafter = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return (index === -1) ?
|
||||
results.slice(0, -1) :
|
||||
results.slice(0, index + 1).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
||||
@@ -53,7 +53,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.replace = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return (index === -1) ?
|
||||
results.slice(0, -count) :
|
||||
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
||||
@@ -64,7 +64,7 @@ Extended filter operators to manipulate the current list.
|
||||
*/
|
||||
exports.putfirst = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return results.slice(-count).concat(results.slice(0, -count));
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ Extended filter operators to manipulate the current list.
|
||||
*/
|
||||
exports.putlast = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return results.slice(count).concat(results.slice(0, count));
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.move = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1,
|
||||
count = $tw.utils.getInt(operator.suffix,1),
|
||||
marker = results.splice(index, 1),
|
||||
offset = (index + count) > 0 ? index + count : 0;
|
||||
return results.slice(0, offset).concat(marker).concat(results.slice(offset));
|
||||
@@ -106,7 +106,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.allbefore = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand);
|
||||
return (index <= 0) ? [] :
|
||||
return (index < 0) ? [] :
|
||||
(operator.suffix) ? results.slice(0, index + 1) :
|
||||
results.slice(0, index);
|
||||
};
|
||||
@@ -129,7 +129,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.prepend = function (source, operator) {
|
||||
var prepend = $tw.utils.parseStringArray(operator.operand, "true"),
|
||||
results = prepare_results(source),
|
||||
count = parseInt(operator.suffix) || prepend.length;
|
||||
count = $tw.utils.getInt(operator.suffix,prepend.length);
|
||||
return (prepend.length === 0) ? results :
|
||||
(operator.prefix) ? prepend.slice(-count).concat(results) :
|
||||
prepend.slice(0, count).concat(results);
|
||||
|
||||
@@ -18,8 +18,8 @@ exports.getInfoTiddlerFields = function() {
|
||||
// Basics
|
||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||
infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)});
|
||||
// Document location
|
||||
if($tw.browser) {
|
||||
// Document location
|
||||
var setLocationProperty = function(name,value) {
|
||||
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
||||
},
|
||||
@@ -32,6 +32,9 @@ exports.getInfoTiddlerFields = function() {
|
||||
setLocationProperty("pathname", location.pathname);
|
||||
setLocationProperty("search", location.search);
|
||||
setLocationProperty("origin", location.origin);
|
||||
// Screen size
|
||||
infoTiddlerFields.push({title: "$:/info/browser/screen/width", text: window.screen.width.toString()});
|
||||
infoTiddlerFields.push({title: "$:/info/browser/screen/height", text: window.screen.height.toString()});
|
||||
}
|
||||
return infoTiddlerFields;
|
||||
};
|
||||
|
||||
@@ -17,8 +17,7 @@ var ImageParser = function(type,text,options) {
|
||||
type: "element",
|
||||
tag: "img",
|
||||
attributes: {}
|
||||
},
|
||||
src;
|
||||
};
|
||||
if(options._canonical_uri) {
|
||||
element.attributes.src = {type: "string", value: options._canonical_uri};
|
||||
} else if(text) {
|
||||
|
||||
@@ -6,7 +6,7 @@ module-type: wikirule
|
||||
Wiki text inline rule for external links. For example:
|
||||
|
||||
```
|
||||
An external link: http://www.tiddlywiki.com/
|
||||
An external link: https://www.tiddlywiki.com/
|
||||
|
||||
A suppressed external link: ~http://www.tiddlyspace.com/
|
||||
```
|
||||
|
||||
@@ -97,6 +97,9 @@ exports.parseTag = function(source,pos,options) {
|
||||
return null;
|
||||
}
|
||||
node.tag = token.match[1];
|
||||
if(node.tag.slice(1).indexOf("$") !== -1) {
|
||||
return null;
|
||||
}
|
||||
if(node.tag.charAt(0) === "$") {
|
||||
node.type = node.tag.substr(1);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ module-type: wikirule
|
||||
Wiki text inline rule for embedding images. For example:
|
||||
|
||||
```
|
||||
[img[http://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img width=23 height=24 [http://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img width={{!!width}} height={{!!height}} [http://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img[Description of image|http://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img[https://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img width=23 height=24 [https://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img width={{!!width}} height={{!!height}} [https://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img[Description of image|https://tiddlywiki.com/fractalveg.jpg]]
|
||||
[img[TiddlerTitle]]
|
||||
[img[Description of image|TiddlerTitle]]
|
||||
```
|
||||
|
||||
@@ -6,8 +6,8 @@ module-type: wikirule
|
||||
Wiki text inline rule for external links. For example:
|
||||
|
||||
```
|
||||
[ext[http://tiddlywiki.com/fractalveg.jpg]]
|
||||
[ext[Tooltip|http://tiddlywiki.com/fractalveg.jpg]]
|
||||
[ext[https://tiddlywiki.com/fractalveg.jpg]]
|
||||
[ext[Tooltip|https://tiddlywiki.com/fractalveg.jpg]]
|
||||
```
|
||||
|
||||
\*/
|
||||
|
||||
72
core/modules/parsers/wikiparser/rules/whitespace.js
Normal file
72
core/modules/parsers/wikiparser/rules/whitespace.js
Normal file
@@ -0,0 +1,72 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/wikiparser/rules/whitespace.js
|
||||
type: application/javascript
|
||||
module-type: wikirule
|
||||
|
||||
Wiki pragma rule for whitespace specifications
|
||||
|
||||
```
|
||||
\whitespace trim
|
||||
\whitespace notrim
|
||||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.name = "whitespace";
|
||||
exports.types = {pragma: true};
|
||||
|
||||
/*
|
||||
Instantiate parse rule
|
||||
*/
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\whitespace[^\S\n]/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
Parse the most recent match
|
||||
*/
|
||||
exports.parse = function() {
|
||||
var self = this;
|
||||
// Move past the pragma invocation
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Parse whitespace delimited tokens terminated by a line break
|
||||
var reMatch = /[^\S\n]*(\S+)|(\r?\n)/mg,
|
||||
tokens = [];
|
||||
reMatch.lastIndex = this.parser.pos;
|
||||
var match = reMatch.exec(this.parser.source);
|
||||
while(match && match.index === this.parser.pos) {
|
||||
this.parser.pos = reMatch.lastIndex;
|
||||
// Exit if we've got the line break
|
||||
if(match[2]) {
|
||||
break;
|
||||
}
|
||||
// Process the token
|
||||
if(match[1]) {
|
||||
tokens.push(match[1]);
|
||||
}
|
||||
// Match the next token
|
||||
match = reMatch.exec(this.parser.source);
|
||||
}
|
||||
// Process the tokens
|
||||
$tw.utils.each(tokens,function(token) {
|
||||
switch(token) {
|
||||
case "trim":
|
||||
self.parser.configTrimWhiteSpace = true;
|
||||
break;
|
||||
case "notrim":
|
||||
self.parser.configTrimWhiteSpace = false;
|
||||
break;
|
||||
}
|
||||
});
|
||||
// No parse tree nodes to return
|
||||
return [];
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -50,6 +50,8 @@ var WikiParser = function(type,text,options) {
|
||||
this.type = type || "text/vnd.tiddlywiki";
|
||||
this.source = text || "";
|
||||
this.sourceLength = this.source.length;
|
||||
// Flag for ignoring whitespace
|
||||
this.configTrimWhiteSpace = false;
|
||||
// Set current parse position
|
||||
this.pos = 0;
|
||||
// Instantiate the pragma parse rules
|
||||
@@ -285,7 +287,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
||||
while(this.pos < this.sourceLength && nextMatch) {
|
||||
// Process the text preceding the run rule
|
||||
if(nextMatch.matchIndex > this.pos) {
|
||||
tree.push({type: "text", text: this.source.substring(this.pos,nextMatch.matchIndex)});
|
||||
this.pushTextWidget(tree,this.source.substring(this.pos,nextMatch.matchIndex));
|
||||
this.pos = nextMatch.matchIndex;
|
||||
}
|
||||
// Process the run rule
|
||||
@@ -295,7 +297,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
||||
}
|
||||
// Process the remaining text
|
||||
if(this.pos < this.sourceLength) {
|
||||
tree.push({type: "text", text: this.source.substr(this.pos)});
|
||||
this.pushTextWidget(tree,this.source.substr(this.pos));
|
||||
}
|
||||
this.pos = this.sourceLength;
|
||||
return tree;
|
||||
@@ -315,7 +317,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
||||
if(terminatorMatch) {
|
||||
if(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {
|
||||
if(terminatorMatch.index > this.pos) {
|
||||
tree.push({type: "text", text: this.source.substring(this.pos,terminatorMatch.index)});
|
||||
this.pushTextWidget(tree,this.source.substring(this.pos,terminatorMatch.index));
|
||||
}
|
||||
this.pos = terminatorMatch.index;
|
||||
if(options.eatTerminator) {
|
||||
@@ -328,7 +330,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
||||
if(inlineRuleMatch) {
|
||||
// Preceding text
|
||||
if(inlineRuleMatch.matchIndex > this.pos) {
|
||||
tree.push({type: "text", text: this.source.substring(this.pos,inlineRuleMatch.matchIndex)});
|
||||
this.pushTextWidget(tree,this.source.substring(this.pos,inlineRuleMatch.matchIndex));
|
||||
this.pos = inlineRuleMatch.matchIndex;
|
||||
}
|
||||
// Process the inline rule
|
||||
@@ -342,12 +344,24 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
||||
}
|
||||
// Process the remaining text
|
||||
if(this.pos < this.sourceLength) {
|
||||
tree.push({type: "text", text: this.source.substr(this.pos)});
|
||||
this.pushTextWidget(tree,this.source.substr(this.pos));
|
||||
}
|
||||
this.pos = this.sourceLength;
|
||||
return tree;
|
||||
};
|
||||
|
||||
/*
|
||||
Push a text widget onto an array, respecting the configTrimWhiteSpace setting
|
||||
*/
|
||||
WikiParser.prototype.pushTextWidget = function(array,text) {
|
||||
if(this.configTrimWhiteSpace) {
|
||||
text = $tw.utils.trim(text);
|
||||
}
|
||||
if(text) {
|
||||
array.push({type: "text", text: text});
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Parse zero or more class specifiers `.classname`
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ type: application/javascript
|
||||
module-type: saver
|
||||
|
||||
Saves files using the Beaker browser's (https://beakerbrowser.com) Dat protocol (https://datproject.org/)
|
||||
Compatible with beaker >= V0.7.2
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@@ -20,16 +21,17 @@ var BeakerSaver = function(wiki) {
|
||||
};
|
||||
|
||||
BeakerSaver.prototype.save = function(text,method,callback) {
|
||||
var url = (location.toString()).split("#")[0];
|
||||
dat.stat(url).then(function(value) {
|
||||
if(value.type === "directory") {
|
||||
url = url + "/index.html";
|
||||
var dat = new DatArchive("" + window.location),
|
||||
pathname = ("" + window.location.pathname).split("#")[0];
|
||||
dat.stat(pathname).then(function(value) {
|
||||
if(value.isDirectory()) {
|
||||
pathname = pathname + "/index.html";
|
||||
}
|
||||
dat.writeFile(url,text,"utf8").then(function(value) {
|
||||
dat.writeFile(pathname,text,"utf8").then(function(value) {
|
||||
callback(null);
|
||||
},function(reason) {
|
||||
callback("Beaker Saver Write Error: " + reason);
|
||||
});
|
||||
});
|
||||
},function(reason) {
|
||||
callback("Beaker Saver Stat Error: " + reason);
|
||||
});
|
||||
@@ -49,7 +51,7 @@ BeakerSaver.prototype.info = {
|
||||
Static method that returns true if this saver is capable of working
|
||||
*/
|
||||
exports.canSave = function(wiki) {
|
||||
return !!window.dat;
|
||||
return !!window.DatArchive && location.protocol==="dat:";
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,7 +25,8 @@ DownloadSaver.prototype.save = function(text,method,callback,options) {
|
||||
if(!filename) {
|
||||
var p = document.location.pathname.lastIndexOf("/");
|
||||
if(p !== -1) {
|
||||
filename = document.location.pathname.substr(p+1);
|
||||
// We decode the pathname because document.location is URL encoded by the browser
|
||||
filename = decodeURIComponent(document.location.pathname.substr(p+1));
|
||||
}
|
||||
}
|
||||
if(!filename) {
|
||||
|
||||
@@ -15,6 +15,25 @@ to the current URL, such as a WebDAV server.
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Retrieve ETag if available
|
||||
*/
|
||||
var RetrieveETag = function(self) {
|
||||
var headers = { "Accept": "*/*;charset=UTF-8" };
|
||||
$tw.utils.httpRequest({
|
||||
url: self.uri(),
|
||||
type: "HEAD",
|
||||
headers: headers,
|
||||
callback: function(err, data, xhr) {
|
||||
if(err) return;
|
||||
var etag = xhr.getResponseHeader("ETag");
|
||||
if(!etag) return;
|
||||
self.etag = etag.replace(/^W\//,"");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Select the appropriate saver module and set it up
|
||||
*/
|
||||
@@ -34,20 +53,11 @@ var PutSaver = function(wiki) {
|
||||
}
|
||||
}
|
||||
});
|
||||
// Retrieve ETag if available
|
||||
$tw.utils.httpRequest({
|
||||
url: uri,
|
||||
type: "HEAD",
|
||||
callback: function(err, data, xhr) {
|
||||
if(!err) {
|
||||
self.etag = xhr.getResponseHeader("ETag");
|
||||
}
|
||||
}
|
||||
});
|
||||
RetrieveETag(this);
|
||||
};
|
||||
|
||||
PutSaver.prototype.uri = function() {
|
||||
return encodeURI(document.location.toString().split("#")[0]);
|
||||
return document.location.toString().split("#")[0];
|
||||
};
|
||||
|
||||
// TODO: in case of edit conflict
|
||||
@@ -69,15 +79,20 @@ PutSaver.prototype.save = function(text, method, callback) {
|
||||
data: text,
|
||||
callback: function(err, data, xhr) {
|
||||
if(err) {
|
||||
callback(err);
|
||||
} if(xhr.status === 200 || xhr.status === 201) {
|
||||
self.etag = xhr.getResponseHeader("ETag");
|
||||
callback(null); // success
|
||||
} else if(xhr.status === 412) { // edit conflict
|
||||
var message = $tw.language.getString("Error/EditConflict");
|
||||
callback(message);
|
||||
// response is textual: "XMLHttpRequest error code: 412"
|
||||
const status = Number(err.substring(err.indexOf(':') + 2, err.length))
|
||||
if(status === 412) { // edit conflict
|
||||
var message = $tw.language.getString("Error/EditConflict");
|
||||
callback(message);
|
||||
} else {
|
||||
callback(err); // fail
|
||||
}
|
||||
} else {
|
||||
callback(xhr.responseText); // fail
|
||||
self.etag = xhr.getResponseHeader("ETag");
|
||||
if (self.etag == null) {
|
||||
RetrieveETag(self);
|
||||
}
|
||||
callback(null); // success
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -57,6 +57,7 @@ exports.startup = function() {
|
||||
$tw.utils.addClass($tw.pageContainer,"tc-page-container-wrapper");
|
||||
document.body.insertBefore($tw.pageContainer,document.body.firstChild);
|
||||
$tw.pageWidgetNode.render($tw.pageContainer,null);
|
||||
$tw.hooks.invokeHook("th-page-refreshed");
|
||||
})();
|
||||
// Prepare refresh mechanism
|
||||
var deferredChanges = Object.create(null),
|
||||
@@ -65,6 +66,7 @@ exports.startup = function() {
|
||||
// Process the refresh
|
||||
$tw.pageWidgetNode.refresh(deferredChanges);
|
||||
deferredChanges = Object.create(null);
|
||||
$tw.hooks.invokeHook("th-page-refreshed");
|
||||
}
|
||||
// Add the change event handler
|
||||
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
||||
|
||||
@@ -30,6 +30,10 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tm-notify",function(event) {
|
||||
$tw.notifier.display(event.param,{variables: event.paramObject});
|
||||
});
|
||||
// Install the copy-to-clipboard mechanism
|
||||
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
|
||||
$tw.utils.copyToClipboard(event.param);
|
||||
});
|
||||
// Install the scroller
|
||||
$tw.pageScroller = new $tw.utils.PageScroller();
|
||||
$tw.rootWidget.addEventListener("tm-scroll",function(event) {
|
||||
|
||||
@@ -87,18 +87,29 @@ exports.startup = function() {
|
||||
});
|
||||
// Kick off the keyboard manager
|
||||
$tw.keyboardManager = new $tw.KeyboardManager();
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: $tw.browser ? document : $tw.fakeDocument
|
||||
});
|
||||
// Execute any startup actions
|
||||
var executeStartupTiddlers = function(tag) {
|
||||
$tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) {
|
||||
$tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget);
|
||||
});
|
||||
};
|
||||
executeStartupTiddlers("$:/tags/StartupAction");
|
||||
if($tw.browser) {
|
||||
executeStartupTiddlers("$:/tags/StartupAction/Browser");
|
||||
}
|
||||
if($tw.node) {
|
||||
executeStartupTiddlers("$:/tags/StartupAction/Node");
|
||||
}
|
||||
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
|
||||
$tw.wiki.clearTiddlerEventQueue();
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
if($tw.browser) {
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: document
|
||||
});
|
||||
}
|
||||
// Find a working syncadaptor
|
||||
$tw.syncadaptor = undefined;
|
||||
$tw.modules.forEachModuleOfType("syncadaptor",function(title,module) {
|
||||
|
||||
@@ -29,6 +29,7 @@ exports.startup = function() {
|
||||
title = event.param || event.tiddlerTitle,
|
||||
paramObject = event.paramObject || {},
|
||||
template = paramObject.template || "$:/core/templates/single.tiddler.window",
|
||||
print = paramObject.print === "yes",
|
||||
width = paramObject.width || "700",
|
||||
height = paramObject.height || "600",
|
||||
variables = $tw.utils.extend({},paramObject,{currentTiddler: title});
|
||||
@@ -62,6 +63,10 @@ exports.startup = function() {
|
||||
var parser = $tw.wiki.parseTiddler(template),
|
||||
widgetNode = $tw.wiki.makeWidget(parser,{document: srcDocument, parentWidget: $tw.rootWidget, variables: variables});
|
||||
widgetNode.render(srcDocument.body,srcDocument.body.firstChild);
|
||||
// Print the window if required
|
||||
if(print) {
|
||||
srcWindow.print();
|
||||
}
|
||||
// Function to handle refreshes
|
||||
refreshHandler = function(changes) {
|
||||
if(styleWidgetNode.refresh(changes,styleContainer,null)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ function Syncer(options) {
|
||||
var self = this;
|
||||
this.wiki = options.wiki;
|
||||
this.syncadaptor = options.syncadaptor;
|
||||
this.disableUI = !!options.disableUI;
|
||||
this.titleIsLoggedIn = options.titleIsLoggedIn || this.titleIsLoggedIn;
|
||||
this.titleUserName = options.titleUserName || this.titleUserName;
|
||||
this.titleSyncFilter = options.titleSyncFilter || this.titleSyncFilter;
|
||||
@@ -41,8 +42,12 @@ function Syncer(options) {
|
||||
this.throttleInterval = options.throttleInterval || this.throttleInterval;
|
||||
this.fallbackInterval = options.fallbackInterval || this.fallbackInterval;
|
||||
this.pollTimerInterval = options.pollTimerInterval || this.pollTimerInterval;
|
||||
this.logging = "logging" in options ? options.logging : true;
|
||||
// Make a logger
|
||||
this.logger = new $tw.utils.Logger("syncer" + ($tw.browser ? "-browser" : "") + ($tw.node ? "-server" : "") + (this.syncadaptor.name ? ("-" + this.syncadaptor.name) : ""));
|
||||
this.logger = new $tw.utils.Logger("syncer" + ($tw.browser ? "-browser" : "") + ($tw.node ? "-server" : "") + (this.syncadaptor.name ? ("-" + this.syncadaptor.name) : ""),{
|
||||
colour: "cyan",
|
||||
enable: this.logging
|
||||
});
|
||||
// Compile the dirty tiddler filter
|
||||
this.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter));
|
||||
// Record information for known tiddlers
|
||||
@@ -57,7 +62,7 @@ function Syncer(options) {
|
||||
self.syncToServer(changes);
|
||||
});
|
||||
// Browser event handlers
|
||||
if($tw.browser) {
|
||||
if($tw.browser && !this.disableUI) {
|
||||
// Set up our beforeunload handler
|
||||
$tw.addUnloadTask(function(event) {
|
||||
var confirmationMessage;
|
||||
@@ -79,9 +84,11 @@ function Syncer(options) {
|
||||
});
|
||||
}
|
||||
// Listen out for lazyLoad events
|
||||
this.wiki.addEventListener("lazyLoad",function(title) {
|
||||
self.handleLazyLoadEvent(title);
|
||||
});
|
||||
if(!this.disableUI) {
|
||||
this.wiki.addEventListener("lazyLoad",function(title) {
|
||||
self.handleLazyLoadEvent(title);
|
||||
});
|
||||
}
|
||||
// Get the login status
|
||||
this.getStatus(function(err,isLoggedIn) {
|
||||
// Do a sync from the server
|
||||
@@ -134,7 +141,7 @@ Syncer.prototype.isDirty = function() {
|
||||
Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes
|
||||
*/
|
||||
Syncer.prototype.updateDirtyStatus = function() {
|
||||
if($tw.browser) {
|
||||
if($tw.browser && !this.disableUI) {
|
||||
$tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
|
||||
}
|
||||
};
|
||||
@@ -171,8 +178,6 @@ Syncer.prototype.getStatus = function(callback) {
|
||||
self.wiki.addTiddler({title: self.titleIsLoggedIn,text: isLoggedIn ? "yes" : "no"});
|
||||
if(isLoggedIn) {
|
||||
self.wiki.addTiddler({title: self.titleUserName,text: username || ""});
|
||||
} else {
|
||||
self.wiki.deleteTiddler(self.titleUserName);
|
||||
}
|
||||
// Invoke the callback
|
||||
if(callback) {
|
||||
@@ -264,13 +269,16 @@ Syncer.prototype.handleLazyLoadEvent = function(title) {
|
||||
// Don't lazy load the same tiddler twice
|
||||
var info = this.tiddlerInfo[title];
|
||||
if(!info || !info.hasBeenLazyLoaded) {
|
||||
this.createTiddlerInfo(title);
|
||||
this.tiddlerInfo[title].hasBeenLazyLoaded = true;
|
||||
// Queue up a sync task to load this tiddler
|
||||
this.enqueueSyncTask({
|
||||
type: "load",
|
||||
title: title
|
||||
});
|
||||
// Don't lazy load if the tiddler isn't included in the sync filter
|
||||
if(this.filterFn.call(this.wiki).indexOf(title) !== -1) {
|
||||
this.createTiddlerInfo(title);
|
||||
this.tiddlerInfo[title].hasBeenLazyLoaded = true;
|
||||
// Queue up a sync task to load this tiddler
|
||||
this.enqueueSyncTask({
|
||||
type: "load",
|
||||
title: title
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
202
core/modules/utils/diff-match-patch/LICENSE
Executable file
202
core/modules/utils/diff-match-patch/LICENSE
Executable file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
41
core/modules/utils/diff-match-patch/README.md
Executable file
41
core/modules/utils/diff-match-patch/README.md
Executable file
@@ -0,0 +1,41 @@
|
||||
The Diff Match and Patch libraries offer robust algorithms to perform the
|
||||
operations required for synchronizing plain text.
|
||||
|
||||
1. Diff:
|
||||
* Compare two blocks of plain text and efficiently return a list of differences.
|
||||
* [Diff Demo](https://neil.fraser.name/software/diff_match_patch/demos/diff.html)
|
||||
2. Match:
|
||||
* Given a search string, find its best fuzzy match in a block of plain text. Weighted for both accuracy and location.
|
||||
* [Match Demo](https://neil.fraser.name/software/diff_match_patch/demos/match.html)
|
||||
3. Patch:
|
||||
* Apply a list of patches onto plain text. Use best-effort to apply patch even when the underlying text doesn't match.
|
||||
* [Patch Demo](https://neil.fraser.name/software/diff_match_patch/demos/patch.html)
|
||||
|
||||
Originally built in 2006 to power Google Docs, this library is now available in C++, C#, Dart, Java, JavaScript, Lua, Objective C, and Python.
|
||||
|
||||
### Reference
|
||||
|
||||
* [API](https://github.com/google/diff-match-patch/wiki/API) - Common API across all languages.
|
||||
* [Line or Word Diffs](https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs) - Less detailed diffs.
|
||||
* [Plain Text vs. Structured Content](https://github.com/google/diff-match-patch/wiki/Plain-Text-vs.-Structured-Content) - How to deal with data like XML.
|
||||
* [Unidiff](https://github.com/google/diff-match-patch/wiki/Unidiff) - The patch serialization format.
|
||||
* [Support](https://groups.google.com/forum/#!forum/diff-match-patch) - Newsgroup for developers.
|
||||
|
||||
### Languages
|
||||
Although each language port of Diff Match Patch uses the same API, there are some language-specific notes.
|
||||
|
||||
* [C++](https://github.com/google/diff-match-patch/wiki/Language:-Cpp)
|
||||
* [C#](https://github.com/google/diff-match-patch/wiki/Language:-C%23)
|
||||
* [Dart](https://github.com/google/diff-match-patch/wiki/Language:-Dart)
|
||||
* [Java](https://github.com/google/diff-match-patch/wiki/Language:-Java)
|
||||
* [JavaScript](https://github.com/google/diff-match-patch/wiki/Language:-JavaScript)
|
||||
* [Lua](https://github.com/google/diff-match-patch/wiki/Language:-Lua)
|
||||
* [Objective-C](https://github.com/google/diff-match-patch/wiki/Language:-Objective-C)
|
||||
* [Python](https://github.com/google/diff-match-patch/wiki/Language:-Python)
|
||||
|
||||
A standardized speed test tracks the [relative performance of diffs](https://docs.google.com/spreadsheets/d/1zpZccuBpjMZTvL1nGDMKJc7rWL_m_drF4XKOJvB27Kc/edit#gid=0) in each language.
|
||||
|
||||
### Algorithms
|
||||
This library implements [Myer's diff algorithm](https://neil.fraser.name/writing/diff/myers.pdf) which is generally considered to be the best general-purpose diff. A layer of [pre-diff speedups and post-diff cleanups](https://neil.fraser.name/writing/diff/) surround the diff algorithm, improving both performance and output quality.
|
||||
|
||||
This library also implements a [Bitap matching algorithm](https://neil.fraser.name/writing/patch/bitap.ps) at the heart of a [flexible matching and patching strategy](https://neil.fraser.name/writing/patch/).
|
||||
53
core/modules/utils/diff-match-patch/diff_match_patch.js
Executable file
53
core/modules/utils/diff-match-patch/diff_match_patch.js
Executable file
@@ -0,0 +1,53 @@
|
||||
function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=.5;this.Patch_Margin=4;this.Match_MaxBits=32}var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;
|
||||
diff_match_patch.prototype.diff_main=function(a,b,c,d){"undefined"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error("Null input. (diff_main)");if(a==b)return a?[[DIFF_EQUAL,a]]:[];"undefined"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b);c=a.substring(0,f);a=a.substring(f);b=b.substring(f);f=this.diff_commonSuffix(a,b);var g=a.substring(a.length-f);a=a.substring(0,a.length-f);b=b.substring(0,b.length-f);a=this.diff_compute_(a,
|
||||
b,e,d);c&&a.unshift([DIFF_EQUAL,c]);g&&a.push([DIFF_EQUAL,g]);this.diff_cleanupMerge(a);return a};
|
||||
diff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[DIFF_INSERT,b]];if(!b)return[[DIFF_DELETE,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);return-1!=g?(c=[[DIFF_INSERT,e.substring(0,g)],[DIFF_EQUAL,f],[DIFF_INSERT,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=DIFF_DELETE),c):1==f.length?[[DIFF_DELETE,a],[DIFF_INSERT,b]]:(e=this.diff_halfMatch_(a,b))?(b=e[1],f=e[3],a=e[4],e=this.diff_main(e[0],e[2],c,d),c=this.diff_main(b,f,c,d),e.concat([[DIFF_EQUAL,
|
||||
a]],c)):c&&100<a.length&&100<b.length?this.diff_lineMode_(a,b,d):this.diff_bisect_(a,b,d)};
|
||||
diff_match_patch.prototype.diff_lineMode_=function(a,b,c){var d=this.diff_linesToChars_(a,b);a=d.chars1;b=d.chars2;d=d.lineArray;a=this.diff_main(a,b,!1,c);this.diff_charsToLines_(a,d);this.diff_cleanupSemantic(a);a.push([DIFF_EQUAL,""]);for(var e=d=b=0,f="",g="";b<a.length;){switch(a[b][0]){case DIFF_INSERT:e++;g+=a[b][1];break;case DIFF_DELETE:d++;f+=a[b][1];break;case DIFF_EQUAL:if(1<=d&&1<=e){a.splice(b-d-e,d+e);b=b-d-e;d=this.diff_main(f,g,!1,c);for(e=d.length-1;0<=e;e--)a.splice(b,0,d[e]);b+=
|
||||
d.length}d=e=0;g=f=""}b++}a.pop();return a};
|
||||
diff_match_patch.prototype.diff_bisect_=function(a,b,c){for(var d=a.length,e=b.length,f=Math.ceil((d+e)/2),g=2*f,h=Array(g),l=Array(g),k=0;k<g;k++)h[k]=-1,l[k]=-1;h[f+1]=0;l[f+1]=0;k=d-e;for(var m=0!=k%2,p=0,x=0,w=0,q=0,t=0;t<f&&!((new Date).getTime()>c);t++){for(var v=-t+p;v<=t-x;v+=2){var n=f+v;var r=v==-t||v!=t&&h[n-1]<h[n+1]?h[n+1]:h[n-1]+1;for(var y=r-v;r<d&&y<e&&a.charAt(r)==b.charAt(y);)r++,y++;h[n]=r;if(r>d)x+=2;else if(y>e)p+=2;else if(m&&(n=f+k-v,0<=n&&n<g&&-1!=l[n])){var u=d-l[n];if(r>=
|
||||
u)return this.diff_bisectSplit_(a,b,r,y,c)}}for(v=-t+w;v<=t-q;v+=2){n=f+v;u=v==-t||v!=t&&l[n-1]<l[n+1]?l[n+1]:l[n-1]+1;for(r=u-v;u<d&&r<e&&a.charAt(d-u-1)==b.charAt(e-r-1);)u++,r++;l[n]=u;if(u>d)q+=2;else if(r>e)w+=2;else if(!m&&(n=f+k-v,0<=n&&n<g&&-1!=h[n]&&(r=h[n],y=f+r-n,u=d-u,r>=u)))return this.diff_bisectSplit_(a,b,r,y,c)}}return[[DIFF_DELETE,a],[DIFF_INSERT,b]]};
|
||||
diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)};
|
||||
diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,f=-1,g=d.length;f<a.length-1;){f=a.indexOf("\n",c);-1==f&&(f=a.length-1);var h=a.substring(c,f+1);c=f+1;(e.hasOwnProperty?e.hasOwnProperty(h):void 0!==e[h])?b+=String.fromCharCode(e[h]):(b+=String.fromCharCode(g),e[h]=g,d[g++]=h)}return b}var d=[],e={};d[0]="";var f=c(a),g=c(b);return{chars1:f,chars2:g,lineArray:d}};
|
||||
diff_match_patch.prototype.diff_charsToLines_=function(a,b){for(var c=0;c<a.length;c++){for(var d=a[c][1],e=[],f=0;f<d.length;f++)e[f]=b[d.charCodeAt(f)];a[c][1]=e.join("")}};diff_match_patch.prototype.diff_commonPrefix=function(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(f,e)==b.substring(f,e)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
|
||||
diff_match_patch.prototype.diff_commonSuffix=function(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
|
||||
diff_match_patch.prototype.diff_commonOverlap_=function(a,b){var c=a.length,d=b.length;if(0==c||0==d)return 0;c>d?a=a.substring(c-d):c<d&&(b=b.substring(0,c));c=Math.min(c,d);if(a==b)return c;d=0;for(var e=1;;){var f=a.substring(c-e);f=b.indexOf(f);if(-1==f)return d;e+=f;if(0==f||a.substring(c-e)==b.substring(0,e))d=e,e++}};
|
||||
diff_match_patch.prototype.diff_halfMatch_=function(a,b){function c(a,b,c){for(var d=a.substring(c,c+Math.floor(a.length/4)),e=-1,g="",h,k,l,m;-1!=(e=b.indexOf(d,e+1));){var p=f.diff_commonPrefix(a.substring(c),b.substring(e)),u=f.diff_commonSuffix(a.substring(0,c),b.substring(0,e));g.length<u+p&&(g=b.substring(e-u,e)+b.substring(e,e+p),h=a.substring(0,c-u),k=a.substring(c+p),l=b.substring(0,e-u),m=b.substring(e+p))}return 2*g.length>=a.length?[h,k,l,m,g]:null}if(0>=this.Diff_Timeout)return null;
|
||||
var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.length<d.length)return null;var f=this,g=c(d,e,Math.ceil(d.length/4));d=c(d,e,Math.ceil(d.length/2));if(g||d)g=d?g?g[4].length>d[4].length?g:d:d:g;else return null;if(a.length>b.length){d=g[0];e=g[1];var h=g[2];var l=g[3]}else h=g[0],l=g[1],d=g[2],e=g[3];return[d,e,h,l,g[4]]};
|
||||
diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,l=0,k=0;f<a.length;)a[f][0]==DIFF_EQUAL?(c[d++]=f,g=l,h=k,k=l=0,e=a[f][1]):(a[f][0]==DIFF_INSERT?l+=a[f][1].length:k+=a[f][1].length,e&&e.length<=Math.max(g,h)&&e.length<=Math.max(l,k)&&(a.splice(c[d-1],0,[DIFF_DELETE,e]),a[c[d-1]+1][0]=DIFF_INSERT,d--,d--,f=0<d?c[d-1]:-1,k=l=h=g=0,e=null,b=!0)),f++;b&&this.diff_cleanupMerge(a);this.diff_cleanupSemanticLossless(a);for(f=1;f<a.length;){if(a[f-1][0]==
|
||||
DIFF_DELETE&&a[f][0]==DIFF_INSERT){b=a[f-1][1];c=a[f][1];d=this.diff_commonOverlap_(b,c);e=this.diff_commonOverlap_(c,b);if(d>=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[DIFF_EQUAL,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[DIFF_EQUAL,b.substring(0,e)]),a[f-1][0]=DIFF_INSERT,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=DIFF_DELETE,a[f+1][1]=b.substring(e),f++;f++}f++}};
|
||||
diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_);c=g&&c.match(diff_match_patch.linebreakRegex_);d=h&&d.match(diff_match_patch.linebreakRegex_);var k=c&&a.match(diff_match_patch.blanklineEndRegex_),l=d&&b.match(diff_match_patch.blanklineStartRegex_);
|
||||
return k||l?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c<a.length-1;){if(a[c-1][0]==DIFF_EQUAL&&a[c+1][0]==DIFF_EQUAL){var d=a[c-1][1],e=a[c][1],f=a[c+1][1],g=this.diff_commonSuffix(d,e);if(g){var h=e.substring(e.length-g);d=d.substring(0,d.length-g);e=h+e.substring(0,e.length-g);f=h+f}g=d;h=e;for(var l=f,k=b(d,e)+b(e,f);e.charAt(0)===f.charAt(0);){d+=e.charAt(0);e=e.substring(1)+f.charAt(0);f=f.substring(1);var m=b(d,e)+b(e,f);m>=k&&(k=m,g=d,h=e,l=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-
|
||||
1,1),c--),a[c][1]=h,l?a[c+1][1]=l:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/;
|
||||
diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,l=!1,k=!1;f<a.length;)a[f][0]==DIFF_EQUAL?(a[f][1].length<this.Diff_EditCost&&(l||k)?(c[d++]=f,g=l,h=k,e=a[f][1]):(d=0,e=null),l=k=!1):(a[f][0]==DIFF_DELETE?k=!0:l=!0,e&&(g&&h&&l&&k||e.length<this.Diff_EditCost/2&&3==g+h+l+k)&&(a.splice(c[d-1],0,[DIFF_DELETE,e]),a[c[d-1]+1][0]=DIFF_INSERT,d--,e=null,g&&h?(l=k=!0,d=0):(d--,f=0<d?c[d-1]:-1,l=k=!1),b=!0)),f++;b&&this.diff_cleanupMerge(a)};
|
||||
diff_match_patch.prototype.diff_cleanupMerge=function(a){a.push([DIFF_EQUAL,""]);for(var b=0,c=0,d=0,e="",f="",g;b<a.length;)switch(a[b][0]){case DIFF_INSERT:d++;f+=a[b][1];b++;break;case DIFF_DELETE:c++;e+=a[b][1];b++;break;case DIFF_EQUAL:1<c+d?(0!==c&&0!==d&&(g=this.diff_commonPrefix(f,e),0!==g&&(0<b-c-d&&a[b-c-d-1][0]==DIFF_EQUAL?a[b-c-d-1][1]+=f.substring(0,g):(a.splice(0,0,[DIFF_EQUAL,f.substring(0,g)]),b++),f=f.substring(g),e=e.substring(g)),g=this.diff_commonSuffix(f,e),0!==g&&(a[b][1]=f.substring(f.length-
|
||||
g)+a[b][1],f=f.substring(0,f.length-g),e=e.substring(0,e.length-g))),0===c?a.splice(b-d,c+d,[DIFF_INSERT,f]):0===d?a.splice(b-c,c+d,[DIFF_DELETE,e]):a.splice(b-c-d,c+d,[DIFF_DELETE,e],[DIFF_INSERT,f]),b=b-c-d+(c?1:0)+(d?1:0)+1):0!==b&&a[b-1][0]==DIFF_EQUAL?(a[b-1][1]+=a[b][1],a.splice(b,1)):b++,c=d=0,f=e=""}""===a[a.length-1][1]&&a.pop();c=!1;for(b=1;b<a.length-1;)a[b-1][0]==DIFF_EQUAL&&a[b+1][0]==DIFF_EQUAL&&(a[b][1].substring(a[b][1].length-a[b-1][1].length)==a[b-1][1]?(a[b][1]=a[b-1][1]+a[b][1].substring(0,
|
||||
a[b][1].length-a[b-1][1].length),a[b+1][1]=a[b-1][1]+a[b+1][1],a.splice(b-1,1),c=!0):a[b][1].substring(0,a[b+1][1].length)==a[b+1][1]&&(a[b-1][1]+=a[b+1][1],a[b][1]=a[b][1].substring(a[b+1][1].length)+a[b+1][1],a.splice(b+1,1),c=!0)),b++;c&&this.diff_cleanupMerge(a)};
|
||||
diff_match_patch.prototype.diff_xIndex=function(a,b){var c=0,d=0,e=0,f=0,g;for(g=0;g<a.length;g++){a[g][0]!==DIFF_INSERT&&(c+=a[g][1].length);a[g][0]!==DIFF_DELETE&&(d+=a[g][1].length);if(c>b)break;e=c;f=d}return a.length!=g&&a[g][0]===DIFF_DELETE?f:f+(b-e)};
|
||||
diff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=/</g,e=/>/g,f=/\n/g,g=0;g<a.length;g++){var h=a[g][0],l=a[g][1].replace(c,"&").replace(d,"<").replace(e,">").replace(f,"¶<br>");switch(h){case DIFF_INSERT:b[g]='<ins style="background:#e6ffe6;">'+l+"</ins>";break;case DIFF_DELETE:b[g]='<del style="background:#ffe6e6;">'+l+"</del>";break;case DIFF_EQUAL:b[g]="<span>"+l+"</span>"}}return b.join("")};
|
||||
diff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_INSERT&&(b[c]=a[c][1]);return b.join("")};diff_match_patch.prototype.diff_text2=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_DELETE&&(b[c]=a[c][1]);return b.join("")};
|
||||
diff_match_patch.prototype.diff_levenshtein=function(a){for(var b=0,c=0,d=0,e=0;e<a.length;e++){var f=a[e][1];switch(a[e][0]){case DIFF_INSERT:c+=f.length;break;case DIFF_DELETE:d+=f.length;break;case DIFF_EQUAL:b+=Math.max(c,d),d=c=0}}return b+=Math.max(c,d)};
|
||||
diff_match_patch.prototype.diff_toDelta=function(a){for(var b=[],c=0;c<a.length;c++)switch(a[c][0]){case DIFF_INSERT:b[c]="+"+encodeURI(a[c][1]);break;case DIFF_DELETE:b[c]="-"+a[c][1].length;break;case DIFF_EQUAL:b[c]="="+a[c][1].length}return b.join("\t").replace(/%20/g," ")};
|
||||
diff_match_patch.prototype.diff_fromDelta=function(a,b){for(var c=[],d=0,e=0,f=b.split(/\t/g),g=0;g<f.length;g++){var h=f[g].substring(1);switch(f[g].charAt(0)){case "+":try{c[d++]=[DIFF_INSERT,decodeURI(h)]}catch(k){throw Error("Illegal escape in diff_fromDelta: "+h);}break;case "-":case "=":var l=parseInt(h,10);if(isNaN(l)||0>l)throw Error("Invalid number in diff_fromDelta: "+h);h=a.substring(e,e+=l);"="==f[g].charAt(0)?c[d++]=[DIFF_EQUAL,h]:c[d++]=[DIFF_DELETE,h];break;default:if(f[g])throw Error("Invalid diff operation in diff_fromDelta: "+
|
||||
f[g]);}}if(e!=a.length)throw Error("Delta length ("+e+") does not equal source text length ("+a.length+").");return c};diff_match_patch.prototype.match_main=function(a,b,c){if(null==a||null==b||null==c)throw Error("Null input. (match_main)");c=Math.max(0,Math.min(c,a.length));return a==b?0:a.length?a.substring(c,c+b.length)==b?c:this.match_bitap_(a,b,c):-1};
|
||||
diff_match_patch.prototype.match_bitap_=function(a,b,c){function d(a,d){var e=a/b.length,g=Math.abs(c-d);return f.Match_Distance?e+g/f.Match_Distance:g?1:e}if(b.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));var l=1<<b.length-1;h=-1;for(var k,m,p=b.length+a.length,x,w=0;w<b.length;w++){k=0;for(m=p;k<m;)d(w,
|
||||
c+m)<=g?k=m:p=m,m=Math.floor((p-k)/2+k);p=m;k=Math.max(1,c-m+1);var q=Math.min(c+m,a.length)+b.length;m=Array(q+2);for(m[q+1]=(1<<w)-1;q>=k;q--){var t=e[a.charAt(q-1)];m[q]=0===w?(m[q+1]<<1|1)&t:(m[q+1]<<1|1)&t|(x[q+1]|x[q])<<1|1|x[q+1];if(m[q]&l&&(t=d(w,q-1),t<=g))if(g=t,h=q-1,h>c)k=Math.max(1,2*c-h);else break}if(d(w+1,c)>g)break;x=m}return h};
|
||||
diff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=0;for(c=0;c<a.length;c++)b[a.charAt(c)]|=1<<a.length-c-1;return b};
|
||||
diff_match_patch.prototype.patch_addContext_=function(a,b){if(0!=b.length){for(var c=b.substring(a.start2,a.start2+a.length1),d=0;b.indexOf(c)!=b.lastIndexOf(c)&&c.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)d+=this.Patch_Margin,c=b.substring(a.start2-d,a.start2+a.length1+d);d+=this.Patch_Margin;(c=b.substring(a.start2-d,a.start2))&&a.diffs.unshift([DIFF_EQUAL,c]);(d=b.substring(a.start2+a.length1,a.start2+a.length1+d))&&a.diffs.push([DIFF_EQUAL,d]);a.start1-=c.length;a.start2-=
|
||||
c.length;a.length1+=c.length+d.length;a.length2+=c.length+d.length}};
|
||||
diff_match_patch.prototype.patch_make=function(a,b,c){if("string"==typeof a&&"string"==typeof b&&"undefined"==typeof c){var d=a;b=this.diff_main(d,b,!0);2<b.length&&(this.diff_cleanupSemantic(b),this.diff_cleanupEfficiency(b))}else if(a&&"object"==typeof a&&"undefined"==typeof b&&"undefined"==typeof c)b=a,d=this.diff_text1(b);else if("string"==typeof a&&b&&"object"==typeof b&&"undefined"==typeof c)d=a;else if("string"==typeof a&&"string"==typeof b&&c&&"object"==typeof c)d=a,b=c;else throw Error("Unknown call format to patch_make.");
|
||||
if(0===b.length)return[];c=[];a=new diff_match_patch.patch_obj;for(var e=0,f=0,g=0,h=d,l=0;l<b.length;l++){var k=b[l][0],m=b[l][1];e||k===DIFF_EQUAL||(a.start1=f,a.start2=g);switch(k){case DIFF_INSERT:a.diffs[e++]=b[l];a.length2+=m.length;d=d.substring(0,g)+m+d.substring(g);break;case DIFF_DELETE:a.length1+=m.length;a.diffs[e++]=b[l];d=d.substring(0,g)+d.substring(g+m.length);break;case DIFF_EQUAL:m.length<=2*this.Patch_Margin&&e&&b.length!=l+1?(a.diffs[e++]=b[l],a.length1+=m.length,a.length2+=m.length):
|
||||
m.length>=2*this.Patch_Margin&&e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}k!==DIFF_INSERT&&(f+=m.length);k!==DIFF_DELETE&&(g+=m.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c};
|
||||
diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=new diff_match_patch.patch_obj;e.diffs=[];for(var f=0;f<d.diffs.length;f++)e.diffs[f]=d.diffs[f].slice();e.start1=d.start1;e.start2=d.start2;e.length1=d.length1;e.length2=d.length2;b[c]=e}return b};
|
||||
diff_match_patch.prototype.patch_apply=function(a,b){if(0==a.length)return[b,[]];a=this.patch_deepCopy(a);var c=this.patch_addPadding(a);b=c+b+c;this.patch_splitMax(a);for(var d=0,e=[],f=0;f<a.length;f++){var g=a[f].start2+d,h=this.diff_text1(a[f].diffs),l=-1;if(h.length>this.Match_MaxBits){var k=this.match_main(b,h.substring(0,this.Match_MaxBits),g);-1!=k&&(l=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==l||k>=l)&&(k=-1)}else k=this.match_main(b,h,
|
||||
g);if(-1==k)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=k-g,g=-1==l?b.substring(k,k+h.length):b.substring(k,l+this.Match_MaxBits),h==g)b=b.substring(0,k)+this.diff_text2(a[f].diffs)+b.substring(k+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);h=0;var m;for(l=0;l<a[f].diffs.length;l++){var p=a[f].diffs[l];p[0]!==DIFF_EQUAL&&(m=this.diff_xIndex(g,h));p[0]===
|
||||
DIFF_INSERT?b=b.substring(0,k+m)+p[1]+b.substring(k+m):p[0]===DIFF_DELETE&&(b=b.substring(0,k+m)+b.substring(k+this.diff_xIndex(g,h+p[1].length)));p[0]!==DIFF_DELETE&&(h+=p[1].length)}}}b=b.substring(c.length,b.length-c.length);return[b,e]};
|
||||
diff_match_patch.prototype.patch_addPadding=function(a){for(var b=this.Patch_Margin,c="",d=1;d<=b;d++)c+=String.fromCharCode(d);for(d=0;d<a.length;d++)a[d].start1+=b,a[d].start2+=b;d=a[0];var e=d.diffs;if(0==e.length||e[0][0]!=DIFF_EQUAL)e.unshift([DIFF_EQUAL,c]),d.start1-=b,d.start2-=b,d.length1+=b,d.length2+=b;else if(b>e[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||e[e.length-
|
||||
1][0]!=DIFF_EQUAL?(e.push([DIFF_EQUAL,c]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c};
|
||||
diff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c<a.length;c++)if(!(a[c].length1<=b)){var d=a[c];a.splice(c--,1);for(var e=d.start1,f=d.start2,g="";0!==d.diffs.length;){var h=new diff_match_patch.patch_obj,l=!0;h.start1=e-g.length;h.start2=f-g.length;""!==g&&(h.length1=h.length2=g.length,h.diffs.push([DIFF_EQUAL,g]));for(;0!==d.diffs.length&&h.length1<b-this.Patch_Margin;){g=d.diffs[0][0];var k=d.diffs[0][1];g===DIFF_INSERT?(h.length2+=k.length,f+=k.length,h.diffs.push(d.diffs.shift()),
|
||||
l=!1):g===DIFF_DELETE&&1==h.diffs.length&&h.diffs[0][0]==DIFF_EQUAL&&k.length>2*b?(h.length1+=k.length,e+=k.length,l=!1,h.diffs.push([g,k]),d.diffs.shift()):(k=k.substring(0,b-h.length1-this.Patch_Margin),h.length1+=k.length,e+=k.length,g===DIFF_EQUAL?(h.length2+=k.length,f+=k.length):l=!1,h.diffs.push([g,k]),k==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(k.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);k=this.diff_text1(d.diffs).substring(0,
|
||||
this.Patch_Margin);""!==k&&(h.length1+=k.length,h.length2+=k.length,0!==h.diffs.length&&h.diffs[h.diffs.length-1][0]===DIFF_EQUAL?h.diffs[h.diffs.length-1][1]+=k:h.diffs.push([DIFF_EQUAL,k]));l||a.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=a[c];return b.join("")};
|
||||
diff_match_patch.prototype.patch_fromText=function(a){var b=[];if(!a)return b;a=a.split("\n");for(var c=0,d=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;c<a.length;){var e=a[c].match(d);if(!e)throw Error("Invalid patch string: "+a[c]);var f=new diff_match_patch.patch_obj;b.push(f);f.start1=parseInt(e[1],10);""===e[2]?(f.start1--,f.length1=1):"0"==e[2]?f.length1=0:(f.start1--,f.length1=parseInt(e[2],10));f.start2=parseInt(e[3],10);""===e[4]?(f.start2--,f.length2=1):"0"==e[4]?f.length2=0:(f.start2--,f.length2=
|
||||
parseInt(e[4],10));for(c++;c<a.length;){e=a[c].charAt(0);try{var g=decodeURI(a[c].substring(1))}catch(h){throw Error("Illegal escape in patch_fromText: "+g);}if("-"==e)f.diffs.push([DIFF_DELETE,g]);else if("+"==e)f.diffs.push([DIFF_INSERT,g]);else if(" "==e)f.diffs.push([DIFF_EQUAL,g]);else if("@"==e)break;else if(""!==e)throw Error('Invalid patch mode "'+e+'" in: '+g);c++}}return b};diff_match_patch.patch_obj=function(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0};
|
||||
diff_match_patch.patch_obj.prototype.toString=function(){for(var a=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],b,c=0;c<this.diffs.length;c++){switch(this.diffs[c][0]){case DIFF_INSERT:b="+";break;case DIFF_DELETE:b="-";break;case DIFF_EQUAL:b=" "}a[c+1]=b+encodeURI(this.diffs[c][1])+"\n"}return a.join("").replace(/%20/g," ")};
|
||||
this.diff_match_patch=diff_match_patch;this.DIFF_DELETE=DIFF_DELETE;this.DIFF_INSERT=DIFF_INSERT;this.DIFF_EQUAL=DIFF_EQUAL;
|
||||
2192
core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
Executable file
2192
core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
Executable file
File diff suppressed because it is too large
Load Diff
14
core/modules/utils/diff-match-patch/tiddlywiki.files
Normal file
14
core/modules/utils/diff-match-patch/tiddlywiki.files
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"file": "diff_match_patch.js",
|
||||
"fields": {
|
||||
"type": "application/javascript",
|
||||
"title": "$:/core/modules/utils/diff-match-patch/diff_match_patch.js",
|
||||
"module-type": "library"
|
||||
},
|
||||
"prefix": "(function(){",
|
||||
"suffix": "}).call(exports);"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -99,7 +99,7 @@ exports.resizeTextAreaToFit = function(domNode,minHeight) {
|
||||
scrollTop = container.scrollTop;
|
||||
// Measure the specified minimum height
|
||||
domNode.style.height = minHeight;
|
||||
var measuredHeight = domNode.offsetHeight;
|
||||
var measuredHeight = domNode.offsetHeight || parseInt(minHeight,10);
|
||||
// Set its height to auto so that it snaps to the correct height
|
||||
domNode.style.height = "auto";
|
||||
// Calculate the revised height
|
||||
@@ -231,4 +231,36 @@ exports.copyStyles = function(srcDomNode,dstDomNode) {
|
||||
$tw.utils.setStyles(dstDomNode,$tw.utils.getComputedStyles(srcDomNode));
|
||||
};
|
||||
|
||||
/*
|
||||
Copy plain text to the clipboard on browsers that support it
|
||||
*/
|
||||
exports.copyToClipboard = function(text,options) {
|
||||
options = options || {};
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.style.position = "fixed";
|
||||
textArea.style.top = 0;
|
||||
textArea.style.left = 0;
|
||||
textArea.style.fontSize = "12pt";
|
||||
textArea.style.width = "2em";
|
||||
textArea.style.height = "2em";
|
||||
textArea.style.padding = 0;
|
||||
textArea.style.border = "none";
|
||||
textArea.style.outline = "none";
|
||||
textArea.style.boxShadow = "none";
|
||||
textArea.style.background = "transparent";
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
textArea.setSelectionRange(0,text.length);
|
||||
var succeeded = false;
|
||||
try {
|
||||
succeeded = document.execCommand("copy");
|
||||
} catch (err) {
|
||||
}
|
||||
if(!options.doNotNotify) {
|
||||
$tw.notifier.display(succeeded ? "$:/language/Notifications/CopiedToClipboard/Succeeded" : "$:/language/Notifications/CopiedToClipboard/Failed");
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -32,10 +32,14 @@ exports.makeDraggable = function(options) {
|
||||
// Add event handlers
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
{name: "dragstart", handlerFunction: function(event) {
|
||||
if(event.dataTransfer === undefined) {
|
||||
return false;
|
||||
}
|
||||
// Collect the tiddlers being dragged
|
||||
var dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),
|
||||
dragFilter = options.dragFilterFn && options.dragFilterFn(),
|
||||
titles = dragTiddler ? [dragTiddler] : [];
|
||||
titles = dragTiddler ? [dragTiddler] : [],
|
||||
startActions = options.startActions;
|
||||
if(dragFilter) {
|
||||
titles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));
|
||||
}
|
||||
@@ -46,6 +50,10 @@ exports.makeDraggable = function(options) {
|
||||
$tw.dragInProgress = domNode;
|
||||
// Set the dragging class on the element being dragged
|
||||
$tw.utils.addClass(event.target,"tc-dragging");
|
||||
// Invoke drag-start actions if given
|
||||
if(startActions !== undefined) {
|
||||
options.widget.invokeActionString(startActions,options.widget,event,{actionTiddler: titleString});
|
||||
}
|
||||
// Create the drag image elements
|
||||
dragImage = options.widget.document.createElement("div");
|
||||
dragImage.className = "tc-tiddler-dragger";
|
||||
@@ -97,7 +105,20 @@ exports.makeDraggable = function(options) {
|
||||
}},
|
||||
{name: "dragend", handlerFunction: function(event) {
|
||||
if(event.target === domNode) {
|
||||
// Collect the tiddlers being dragged
|
||||
var dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),
|
||||
dragFilter = options.dragFilterFn && options.dragFilterFn(),
|
||||
titles = dragTiddler ? [dragTiddler] : [],
|
||||
endActions = options.endActions;
|
||||
if(dragFilter) {
|
||||
titles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));
|
||||
}
|
||||
var titleString = $tw.utils.stringifyList(titles);
|
||||
$tw.dragInProgress = null;
|
||||
// Invoke drag-end actions if given
|
||||
if(endActions !== undefined) {
|
||||
options.widget.invokeActionString(endActions,options.widget,event,{actionTiddler: titleString});
|
||||
}
|
||||
// Remove the dragging class on the element being dragged
|
||||
$tw.utils.removeClass(event.target,"tc-dragging");
|
||||
// Delete the drag image element
|
||||
|
||||
@@ -54,51 +54,35 @@ PageScroller.prototype.handleEvent = function(event) {
|
||||
Handle a scroll event hitting the page document
|
||||
*/
|
||||
PageScroller.prototype.scrollIntoView = function(element) {
|
||||
var duration = $tw.utils.getAnimationDuration();
|
||||
var self = this,
|
||||
duration = $tw.utils.getAnimationDuration();
|
||||
// Now get ready to scroll the body
|
||||
this.cancelScroll();
|
||||
this.startTime = Date.now();
|
||||
var scrollPosition = $tw.utils.getScrollPosition();
|
||||
// Get the client bounds of the element and adjust by the scroll position
|
||||
var clientBounds = element.getBoundingClientRect(),
|
||||
bounds = {
|
||||
left: clientBounds.left + scrollPosition.x,
|
||||
top: clientBounds.top + scrollPosition.y,
|
||||
width: clientBounds.width,
|
||||
height: clientBounds.height
|
||||
};
|
||||
// We'll consider the horizontal and vertical scroll directions separately via this function
|
||||
// targetPos/targetSize - position and size of the target element
|
||||
// currentPos/currentSize - position and size of the current scroll viewport
|
||||
// returns: new position of the scroll viewport
|
||||
var getEndPos = function(targetPos,targetSize,currentPos,currentSize) {
|
||||
var newPos = currentPos;
|
||||
// If the target is above/left of the current view, then scroll to it's top/left
|
||||
if(targetPos <= currentPos) {
|
||||
newPos = targetPos;
|
||||
// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window
|
||||
} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {
|
||||
newPos = targetPos + targetSize - currentSize;
|
||||
// If the target is big, then just scroll to the top
|
||||
} else if(currentPos < targetPos) {
|
||||
newPos = targetPos;
|
||||
// Otherwise, stay where we are
|
||||
} else {
|
||||
newPos = currentPos;
|
||||
}
|
||||
var getBounds = function() {
|
||||
var clientBounds = element.getBoundingClientRect(),
|
||||
scrollPosition = $tw.utils.getScrollPosition();
|
||||
return {
|
||||
left: clientBounds.left + scrollPosition.x,
|
||||
top: clientBounds.top + scrollPosition.y,
|
||||
width: clientBounds.width,
|
||||
height: clientBounds.height
|
||||
};
|
||||
},
|
||||
// We'll consider the horizontal and vertical scroll directions separately via this function
|
||||
// targetPos/targetSize - position and size of the target element
|
||||
// currentPos/currentSize - position and size of the current scroll viewport
|
||||
// returns: new position of the scroll viewport
|
||||
getEndPos = function(targetPos,targetSize,currentPos,currentSize) {
|
||||
var newPos = targetPos;
|
||||
// If we are scrolling within 50 pixels of the top/left then snap to zero
|
||||
if(newPos < 50) {
|
||||
newPos = 0;
|
||||
}
|
||||
return newPos;
|
||||
},
|
||||
endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth),
|
||||
endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);
|
||||
// Only scroll if the position has changed
|
||||
if(endX !== scrollPosition.x || endY !== scrollPosition.y) {
|
||||
var self = this,
|
||||
drawFrame;
|
||||
drawFrame = function () {
|
||||
drawFrame = function drawFrame() {
|
||||
var t;
|
||||
if(duration <= 0) {
|
||||
t = 1;
|
||||
@@ -110,13 +94,16 @@ PageScroller.prototype.scrollIntoView = function(element) {
|
||||
t = 1;
|
||||
}
|
||||
t = $tw.utils.slowInSlowOut(t);
|
||||
var scrollPosition = $tw.utils.getScrollPosition(),
|
||||
bounds = getBounds(),
|
||||
endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth),
|
||||
endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);
|
||||
window.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t);
|
||||
if(t < 1) {
|
||||
self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);
|
||||
}
|
||||
};
|
||||
drawFrame();
|
||||
}
|
||||
drawFrame();
|
||||
};
|
||||
|
||||
exports.PageScroller = PageScroller;
|
||||
|
||||
@@ -224,8 +224,7 @@ Object.defineProperty(TW_Element.prototype, "textContent", {
|
||||
get: function() {
|
||||
if(this.isRaw) {
|
||||
if(this.rawTextContent === null) {
|
||||
console.log(booboo)
|
||||
throw "Cannot get textContent on a raw TW_Element";
|
||||
return "";
|
||||
} else {
|
||||
return this.rawTextContent;
|
||||
}
|
||||
@@ -245,7 +244,7 @@ Object.defineProperty(TW_Element.prototype, "textContent", {
|
||||
Object.defineProperty(TW_Element.prototype, "formattedTextContent", {
|
||||
get: function() {
|
||||
if(this.isRaw) {
|
||||
throw "Cannot get formattedTextContent on a raw TW_Element";
|
||||
return "";
|
||||
} else {
|
||||
var b = [],
|
||||
isBlock = $tw.config.htmlBlockElements.indexOf(this.tag) !== -1;
|
||||
|
||||
@@ -17,16 +17,19 @@ var ALERT_TAG = "$:/tags/Alert";
|
||||
/*
|
||||
Make a new logger
|
||||
*/
|
||||
function Logger(componentName) {
|
||||
function Logger(componentName,options) {
|
||||
options = options || {};
|
||||
this.componentName = componentName || "";
|
||||
this.colour = options.colour || "white";
|
||||
this.enable = "enable" in options ? options.enable : true;
|
||||
}
|
||||
|
||||
/*
|
||||
Log a message
|
||||
*/
|
||||
Logger.prototype.log = function(/* args */) {
|
||||
if(console !== undefined && console.log !== undefined) {
|
||||
return Function.apply.call(console.log, console, [this.componentName + ":"].concat(Array.prototype.slice.call(arguments,0)));
|
||||
if(this.enable && console !== undefined && console.log !== undefined) {
|
||||
return Function.apply.call(console.log, console, [$tw.utils.terminalColour(this.colour),this.componentName + ":"].concat(Array.prototype.slice.call(arguments,0)).concat($tw.utils.terminalColour()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,44 +37,46 @@ Logger.prototype.log = function(/* args */) {
|
||||
Alert a message
|
||||
*/
|
||||
Logger.prototype.alert = function(/* args */) {
|
||||
// Prepare the text of the alert
|
||||
var text = Array.prototype.join.call(arguments," ");
|
||||
// Create alert tiddlers in the browser
|
||||
if($tw.browser) {
|
||||
// Check if there is an existing alert with the same text and the same component
|
||||
var existingAlerts = $tw.wiki.getTiddlersWithTag(ALERT_TAG),
|
||||
alertFields,
|
||||
existingCount,
|
||||
self = this;
|
||||
$tw.utils.each(existingAlerts,function(title) {
|
||||
var tiddler = $tw.wiki.getTiddler(title);
|
||||
if(tiddler.fields.text === text && tiddler.fields.component === self.componentName && tiddler.fields.modified && (!alertFields || tiddler.fields.modified < alertFields.modified)) {
|
||||
alertFields = $tw.utils.extend({},tiddler.fields);
|
||||
if(this.enable) {
|
||||
// Prepare the text of the alert
|
||||
var text = Array.prototype.join.call(arguments," ");
|
||||
// Create alert tiddlers in the browser
|
||||
if($tw.browser) {
|
||||
// Check if there is an existing alert with the same text and the same component
|
||||
var existingAlerts = $tw.wiki.getTiddlersWithTag(ALERT_TAG),
|
||||
alertFields,
|
||||
existingCount,
|
||||
self = this;
|
||||
$tw.utils.each(existingAlerts,function(title) {
|
||||
var tiddler = $tw.wiki.getTiddler(title);
|
||||
if(tiddler.fields.text === text && tiddler.fields.component === self.componentName && tiddler.fields.modified && (!alertFields || tiddler.fields.modified < alertFields.modified)) {
|
||||
alertFields = $tw.utils.extend({},tiddler.fields);
|
||||
}
|
||||
});
|
||||
if(alertFields) {
|
||||
existingCount = alertFields.count || 1;
|
||||
} else {
|
||||
alertFields = {
|
||||
title: $tw.wiki.generateNewTitle("$:/temp/alerts/alert",{prefix: ""}),
|
||||
text: text,
|
||||
tags: [ALERT_TAG],
|
||||
component: this.componentName
|
||||
};
|
||||
existingCount = 0;
|
||||
}
|
||||
});
|
||||
if(alertFields) {
|
||||
existingCount = alertFields.count || 1;
|
||||
alertFields.modified = new Date();
|
||||
if(++existingCount > 1) {
|
||||
alertFields.count = existingCount;
|
||||
} else {
|
||||
alertFields.count = undefined;
|
||||
}
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler(alertFields));
|
||||
// Log the alert as well
|
||||
this.log.apply(this,Array.prototype.slice.call(arguments,0));
|
||||
} else {
|
||||
alertFields = {
|
||||
title: $tw.wiki.generateNewTitle("$:/temp/alerts/alert",{prefix: ""}),
|
||||
text: text,
|
||||
tags: [ALERT_TAG],
|
||||
component: this.componentName
|
||||
};
|
||||
existingCount = 0;
|
||||
}
|
||||
alertFields.modified = new Date();
|
||||
if(++existingCount > 1) {
|
||||
alertFields.count = existingCount;
|
||||
} else {
|
||||
alertFields.count = undefined;
|
||||
}
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler(alertFields));
|
||||
// Log the alert as well
|
||||
this.log.apply(this,Array.prototype.slice.call(arguments,0));
|
||||
} else {
|
||||
// Print an orange message to the console if not in the browser
|
||||
console.error("\x1b[1;33m" + text + "\x1b[0m");
|
||||
// Print an orange message to the console if not in the browser
|
||||
console.error("\x1b[1;33m" + text + "\x1b[0m");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
919
core/modules/utils/transliterate.js
Normal file
919
core/modules/utils/transliterate.js
Normal file
@@ -0,0 +1,919 @@
|
||||
/*\
|
||||
title: $:/core/modules/utils/transliterate.js
|
||||
type: application/javascript
|
||||
module-type: utils
|
||||
|
||||
Transliteration static utility functions.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Transliterate string to ASCII
|
||||
|
||||
(Some pairs taken from http://semplicewebsites.com/removing-accents-javascript)
|
||||
*/
|
||||
exports.transliterationPairs = {
|
||||
"Á":"A",
|
||||
"Ă":"A",
|
||||
"Ắ":"A",
|
||||
"Ặ":"A",
|
||||
"Ằ":"A",
|
||||
"Ẳ":"A",
|
||||
"Ẵ":"A",
|
||||
"Ǎ":"A",
|
||||
"Â":"A",
|
||||
"Ấ":"A",
|
||||
"Ậ":"A",
|
||||
"Ầ":"A",
|
||||
"Ẩ":"A",
|
||||
"Ẫ":"A",
|
||||
"Ä":"A",
|
||||
"Ǟ":"A",
|
||||
"Ȧ":"A",
|
||||
"Ǡ":"A",
|
||||
"Ạ":"A",
|
||||
"Ȁ":"A",
|
||||
"À":"A",
|
||||
"Ả":"A",
|
||||
"Ȃ":"A",
|
||||
"Ā":"A",
|
||||
"Ą":"A",
|
||||
"Å":"A",
|
||||
"Ǻ":"A",
|
||||
"Ḁ":"A",
|
||||
"Ⱥ":"A",
|
||||
"Ã":"A",
|
||||
"Ꜳ":"AA",
|
||||
"Æ":"AE",
|
||||
"Ǽ":"AE",
|
||||
"Ǣ":"AE",
|
||||
"Ꜵ":"AO",
|
||||
"Ꜷ":"AU",
|
||||
"Ꜹ":"AV",
|
||||
"Ꜻ":"AV",
|
||||
"Ꜽ":"AY",
|
||||
"Ḃ":"B",
|
||||
"Ḅ":"B",
|
||||
"Ɓ":"B",
|
||||
"Ḇ":"B",
|
||||
"Ƀ":"B",
|
||||
"Ƃ":"B",
|
||||
"Ć":"C",
|
||||
"Č":"C",
|
||||
"Ç":"C",
|
||||
"Ḉ":"C",
|
||||
"Ĉ":"C",
|
||||
"Ċ":"C",
|
||||
"Ƈ":"C",
|
||||
"Ȼ":"C",
|
||||
"Ď":"D",
|
||||
"Ḑ":"D",
|
||||
"Ḓ":"D",
|
||||
"Ḋ":"D",
|
||||
"Ḍ":"D",
|
||||
"Ɗ":"D",
|
||||
"Ḏ":"D",
|
||||
"Dz":"D",
|
||||
"Dž":"D",
|
||||
"Đ":"D",
|
||||
"Ƌ":"D",
|
||||
"DZ":"DZ",
|
||||
"DŽ":"DZ",
|
||||
"É":"E",
|
||||
"Ĕ":"E",
|
||||
"Ě":"E",
|
||||
"Ȩ":"E",
|
||||
"Ḝ":"E",
|
||||
"Ê":"E",
|
||||
"Ế":"E",
|
||||
"Ệ":"E",
|
||||
"Ề":"E",
|
||||
"Ể":"E",
|
||||
"Ễ":"E",
|
||||
"Ḙ":"E",
|
||||
"Ë":"E",
|
||||
"Ė":"E",
|
||||
"Ẹ":"E",
|
||||
"Ȅ":"E",
|
||||
"È":"E",
|
||||
"Ẻ":"E",
|
||||
"Ȇ":"E",
|
||||
"Ē":"E",
|
||||
"Ḗ":"E",
|
||||
"Ḕ":"E",
|
||||
"Ę":"E",
|
||||
"Ɇ":"E",
|
||||
"Ẽ":"E",
|
||||
"Ḛ":"E",
|
||||
"Ꝫ":"ET",
|
||||
"Ḟ":"F",
|
||||
"Ƒ":"F",
|
||||
"Ǵ":"G",
|
||||
"Ğ":"G",
|
||||
"Ǧ":"G",
|
||||
"Ģ":"G",
|
||||
"Ĝ":"G",
|
||||
"Ġ":"G",
|
||||
"Ɠ":"G",
|
||||
"Ḡ":"G",
|
||||
"Ǥ":"G",
|
||||
"Ḫ":"H",
|
||||
"Ȟ":"H",
|
||||
"Ḩ":"H",
|
||||
"Ĥ":"H",
|
||||
"Ⱨ":"H",
|
||||
"Ḧ":"H",
|
||||
"Ḣ":"H",
|
||||
"Ḥ":"H",
|
||||
"Ħ":"H",
|
||||
"Í":"I",
|
||||
"Ĭ":"I",
|
||||
"Ǐ":"I",
|
||||
"Î":"I",
|
||||
"Ï":"I",
|
||||
"Ḯ":"I",
|
||||
"İ":"I",
|
||||
"Ị":"I",
|
||||
"Ȉ":"I",
|
||||
"Ì":"I",
|
||||
"Ỉ":"I",
|
||||
"Ȋ":"I",
|
||||
"Ī":"I",
|
||||
"Į":"I",
|
||||
"Ɨ":"I",
|
||||
"Ĩ":"I",
|
||||
"Ḭ":"I",
|
||||
"Ꝺ":"D",
|
||||
"Ꝼ":"F",
|
||||
"Ᵹ":"G",
|
||||
"Ꞃ":"R",
|
||||
"Ꞅ":"S",
|
||||
"Ꞇ":"T",
|
||||
"Ꝭ":"IS",
|
||||
"Ĵ":"J",
|
||||
"Ɉ":"J",
|
||||
"Ḱ":"K",
|
||||
"Ǩ":"K",
|
||||
"Ķ":"K",
|
||||
"Ⱪ":"K",
|
||||
"Ꝃ":"K",
|
||||
"Ḳ":"K",
|
||||
"Ƙ":"K",
|
||||
"Ḵ":"K",
|
||||
"Ꝁ":"K",
|
||||
"Ꝅ":"K",
|
||||
"Ĺ":"L",
|
||||
"Ƚ":"L",
|
||||
"Ľ":"L",
|
||||
"Ļ":"L",
|
||||
"Ḽ":"L",
|
||||
"Ḷ":"L",
|
||||
"Ḹ":"L",
|
||||
"Ⱡ":"L",
|
||||
"Ꝉ":"L",
|
||||
"Ḻ":"L",
|
||||
"Ŀ":"L",
|
||||
"Ɫ":"L",
|
||||
"Lj":"L",
|
||||
"Ł":"L",
|
||||
"LJ":"LJ",
|
||||
"Ḿ":"M",
|
||||
"Ṁ":"M",
|
||||
"Ṃ":"M",
|
||||
"Ɱ":"M",
|
||||
"Ń":"N",
|
||||
"Ň":"N",
|
||||
"Ņ":"N",
|
||||
"Ṋ":"N",
|
||||
"Ṅ":"N",
|
||||
"Ṇ":"N",
|
||||
"Ǹ":"N",
|
||||
"Ɲ":"N",
|
||||
"Ṉ":"N",
|
||||
"Ƞ":"N",
|
||||
"Nj":"N",
|
||||
"Ñ":"N",
|
||||
"NJ":"NJ",
|
||||
"Ó":"O",
|
||||
"Ŏ":"O",
|
||||
"Ǒ":"O",
|
||||
"Ô":"O",
|
||||
"Ố":"O",
|
||||
"Ộ":"O",
|
||||
"Ồ":"O",
|
||||
"Ổ":"O",
|
||||
"Ỗ":"O",
|
||||
"Ö":"O",
|
||||
"Ȫ":"O",
|
||||
"Ȯ":"O",
|
||||
"Ȱ":"O",
|
||||
"Ọ":"O",
|
||||
"Ő":"O",
|
||||
"Ȍ":"O",
|
||||
"Ò":"O",
|
||||
"Ỏ":"O",
|
||||
"Ơ":"O",
|
||||
"Ớ":"O",
|
||||
"Ợ":"O",
|
||||
"Ờ":"O",
|
||||
"Ở":"O",
|
||||
"Ỡ":"O",
|
||||
"Ȏ":"O",
|
||||
"Ꝋ":"O",
|
||||
"Ꝍ":"O",
|
||||
"Ō":"O",
|
||||
"Ṓ":"O",
|
||||
"Ṑ":"O",
|
||||
"Ɵ":"O",
|
||||
"Ǫ":"O",
|
||||
"Ǭ":"O",
|
||||
"Ø":"O",
|
||||
"Ǿ":"O",
|
||||
"Õ":"O",
|
||||
"Ṍ":"O",
|
||||
"Ṏ":"O",
|
||||
"Ȭ":"O",
|
||||
"Ƣ":"OI",
|
||||
"Ꝏ":"OO",
|
||||
"Ɛ":"E",
|
||||
"Ɔ":"O",
|
||||
"Ȣ":"OU",
|
||||
"Ṕ":"P",
|
||||
"Ṗ":"P",
|
||||
"Ꝓ":"P",
|
||||
"Ƥ":"P",
|
||||
"Ꝕ":"P",
|
||||
"Ᵽ":"P",
|
||||
"Ꝑ":"P",
|
||||
"Ꝙ":"Q",
|
||||
"Ꝗ":"Q",
|
||||
"Ŕ":"R",
|
||||
"Ř":"R",
|
||||
"Ŗ":"R",
|
||||
"Ṙ":"R",
|
||||
"Ṛ":"R",
|
||||
"Ṝ":"R",
|
||||
"Ȑ":"R",
|
||||
"Ȓ":"R",
|
||||
"Ṟ":"R",
|
||||
"Ɍ":"R",
|
||||
"Ɽ":"R",
|
||||
"Ꜿ":"C",
|
||||
"Ǝ":"E",
|
||||
"Ś":"S",
|
||||
"Ṥ":"S",
|
||||
"Š":"S",
|
||||
"Ṧ":"S",
|
||||
"Ş":"S",
|
||||
"Ŝ":"S",
|
||||
"Ș":"S",
|
||||
"Ṡ":"S",
|
||||
"Ṣ":"S",
|
||||
"Ṩ":"S",
|
||||
"Ť":"T",
|
||||
"Ţ":"T",
|
||||
"Ṱ":"T",
|
||||
"Ț":"T",
|
||||
"Ⱦ":"T",
|
||||
"Ṫ":"T",
|
||||
"Ṭ":"T",
|
||||
"Ƭ":"T",
|
||||
"Ṯ":"T",
|
||||
"Ʈ":"T",
|
||||
"Ŧ":"T",
|
||||
"Ɐ":"A",
|
||||
"Ꞁ":"L",
|
||||
"Ɯ":"M",
|
||||
"Ʌ":"V",
|
||||
"Ꜩ":"TZ",
|
||||
"Ú":"U",
|
||||
"Ŭ":"U",
|
||||
"Ǔ":"U",
|
||||
"Û":"U",
|
||||
"Ṷ":"U",
|
||||
"Ü":"U",
|
||||
"Ǘ":"U",
|
||||
"Ǚ":"U",
|
||||
"Ǜ":"U",
|
||||
"Ǖ":"U",
|
||||
"Ṳ":"U",
|
||||
"Ụ":"U",
|
||||
"Ű":"U",
|
||||
"Ȕ":"U",
|
||||
"Ù":"U",
|
||||
"Ủ":"U",
|
||||
"Ư":"U",
|
||||
"Ứ":"U",
|
||||
"Ự":"U",
|
||||
"Ừ":"U",
|
||||
"Ử":"U",
|
||||
"Ữ":"U",
|
||||
"Ȗ":"U",
|
||||
"Ū":"U",
|
||||
"Ṻ":"U",
|
||||
"Ų":"U",
|
||||
"Ů":"U",
|
||||
"Ũ":"U",
|
||||
"Ṹ":"U",
|
||||
"Ṵ":"U",
|
||||
"Ꝟ":"V",
|
||||
"Ṿ":"V",
|
||||
"Ʋ":"V",
|
||||
"Ṽ":"V",
|
||||
"Ꝡ":"VY",
|
||||
"Ẃ":"W",
|
||||
"Ŵ":"W",
|
||||
"Ẅ":"W",
|
||||
"Ẇ":"W",
|
||||
"Ẉ":"W",
|
||||
"Ẁ":"W",
|
||||
"Ⱳ":"W",
|
||||
"Ẍ":"X",
|
||||
"Ẋ":"X",
|
||||
"Ý":"Y",
|
||||
"Ŷ":"Y",
|
||||
"Ÿ":"Y",
|
||||
"Ẏ":"Y",
|
||||
"Ỵ":"Y",
|
||||
"Ỳ":"Y",
|
||||
"Ƴ":"Y",
|
||||
"Ỷ":"Y",
|
||||
"Ỿ":"Y",
|
||||
"Ȳ":"Y",
|
||||
"Ɏ":"Y",
|
||||
"Ỹ":"Y",
|
||||
"Ź":"Z",
|
||||
"Ž":"Z",
|
||||
"Ẑ":"Z",
|
||||
"Ⱬ":"Z",
|
||||
"Ż":"Z",
|
||||
"Ẓ":"Z",
|
||||
"Ȥ":"Z",
|
||||
"Ẕ":"Z",
|
||||
"Ƶ":"Z",
|
||||
"IJ":"IJ",
|
||||
"Œ":"OE",
|
||||
"ᴀ":"A",
|
||||
"ᴁ":"AE",
|
||||
"ʙ":"B",
|
||||
"ᴃ":"B",
|
||||
"ᴄ":"C",
|
||||
"ᴅ":"D",
|
||||
"ᴇ":"E",
|
||||
"ꜰ":"F",
|
||||
"ɢ":"G",
|
||||
"ʛ":"G",
|
||||
"ʜ":"H",
|
||||
"ɪ":"I",
|
||||
"ʁ":"R",
|
||||
"ᴊ":"J",
|
||||
"ᴋ":"K",
|
||||
"ʟ":"L",
|
||||
"ᴌ":"L",
|
||||
"ᴍ":"M",
|
||||
"ɴ":"N",
|
||||
"ᴏ":"O",
|
||||
"ɶ":"OE",
|
||||
"ᴐ":"O",
|
||||
"ᴕ":"OU",
|
||||
"ᴘ":"P",
|
||||
"ʀ":"R",
|
||||
"ᴎ":"N",
|
||||
"ᴙ":"R",
|
||||
"ꜱ":"S",
|
||||
"ᴛ":"T",
|
||||
"ⱻ":"E",
|
||||
"ᴚ":"R",
|
||||
"ᴜ":"U",
|
||||
"ᴠ":"V",
|
||||
"ᴡ":"W",
|
||||
"ʏ":"Y",
|
||||
"ᴢ":"Z",
|
||||
"á":"a",
|
||||
"ă":"a",
|
||||
"ắ":"a",
|
||||
"ặ":"a",
|
||||
"ằ":"a",
|
||||
"ẳ":"a",
|
||||
"ẵ":"a",
|
||||
"ǎ":"a",
|
||||
"â":"a",
|
||||
"ấ":"a",
|
||||
"ậ":"a",
|
||||
"ầ":"a",
|
||||
"ẩ":"a",
|
||||
"ẫ":"a",
|
||||
"ä":"a",
|
||||
"ǟ":"a",
|
||||
"ȧ":"a",
|
||||
"ǡ":"a",
|
||||
"ạ":"a",
|
||||
"ȁ":"a",
|
||||
"à":"a",
|
||||
"ả":"a",
|
||||
"ȃ":"a",
|
||||
"ā":"a",
|
||||
"ą":"a",
|
||||
"ᶏ":"a",
|
||||
"ẚ":"a",
|
||||
"å":"a",
|
||||
"ǻ":"a",
|
||||
"ḁ":"a",
|
||||
"ⱥ":"a",
|
||||
"ã":"a",
|
||||
"ꜳ":"aa",
|
||||
"æ":"ae",
|
||||
"ǽ":"ae",
|
||||
"ǣ":"ae",
|
||||
"ꜵ":"ao",
|
||||
"ꜷ":"au",
|
||||
"ꜹ":"av",
|
||||
"ꜻ":"av",
|
||||
"ꜽ":"ay",
|
||||
"ḃ":"b",
|
||||
"ḅ":"b",
|
||||
"ɓ":"b",
|
||||
"ḇ":"b",
|
||||
"ᵬ":"b",
|
||||
"ᶀ":"b",
|
||||
"ƀ":"b",
|
||||
"ƃ":"b",
|
||||
"ɵ":"o",
|
||||
"ć":"c",
|
||||
"č":"c",
|
||||
"ç":"c",
|
||||
"ḉ":"c",
|
||||
"ĉ":"c",
|
||||
"ɕ":"c",
|
||||
"ċ":"c",
|
||||
"ƈ":"c",
|
||||
"ȼ":"c",
|
||||
"ď":"d",
|
||||
"ḑ":"d",
|
||||
"ḓ":"d",
|
||||
"ȡ":"d",
|
||||
"ḋ":"d",
|
||||
"ḍ":"d",
|
||||
"ɗ":"d",
|
||||
"ᶑ":"d",
|
||||
"ḏ":"d",
|
||||
"ᵭ":"d",
|
||||
"ᶁ":"d",
|
||||
"đ":"d",
|
||||
"ɖ":"d",
|
||||
"ƌ":"d",
|
||||
"ı":"i",
|
||||
"ȷ":"j",
|
||||
"ɟ":"j",
|
||||
"ʄ":"j",
|
||||
"dz":"dz",
|
||||
"dž":"dz",
|
||||
"é":"e",
|
||||
"ĕ":"e",
|
||||
"ě":"e",
|
||||
"ȩ":"e",
|
||||
"ḝ":"e",
|
||||
"ê":"e",
|
||||
"ế":"e",
|
||||
"ệ":"e",
|
||||
"ề":"e",
|
||||
"ể":"e",
|
||||
"ễ":"e",
|
||||
"ḙ":"e",
|
||||
"ë":"e",
|
||||
"ė":"e",
|
||||
"ẹ":"e",
|
||||
"ȅ":"e",
|
||||
"è":"e",
|
||||
"ẻ":"e",
|
||||
"ȇ":"e",
|
||||
"ē":"e",
|
||||
"ḗ":"e",
|
||||
"ḕ":"e",
|
||||
"ⱸ":"e",
|
||||
"ę":"e",
|
||||
"ᶒ":"e",
|
||||
"ɇ":"e",
|
||||
"ẽ":"e",
|
||||
"ḛ":"e",
|
||||
"ꝫ":"et",
|
||||
"ḟ":"f",
|
||||
"ƒ":"f",
|
||||
"ᵮ":"f",
|
||||
"ᶂ":"f",
|
||||
"ǵ":"g",
|
||||
"ğ":"g",
|
||||
"ǧ":"g",
|
||||
"ģ":"g",
|
||||
"ĝ":"g",
|
||||
"ġ":"g",
|
||||
"ɠ":"g",
|
||||
"ḡ":"g",
|
||||
"ᶃ":"g",
|
||||
"ǥ":"g",
|
||||
"ḫ":"h",
|
||||
"ȟ":"h",
|
||||
"ḩ":"h",
|
||||
"ĥ":"h",
|
||||
"ⱨ":"h",
|
||||
"ḧ":"h",
|
||||
"ḣ":"h",
|
||||
"ḥ":"h",
|
||||
"ɦ":"h",
|
||||
"ẖ":"h",
|
||||
"ħ":"h",
|
||||
"ƕ":"hv",
|
||||
"í":"i",
|
||||
"ĭ":"i",
|
||||
"ǐ":"i",
|
||||
"î":"i",
|
||||
"ï":"i",
|
||||
"ḯ":"i",
|
||||
"ị":"i",
|
||||
"ȉ":"i",
|
||||
"ì":"i",
|
||||
"ỉ":"i",
|
||||
"ȋ":"i",
|
||||
"ī":"i",
|
||||
"į":"i",
|
||||
"ᶖ":"i",
|
||||
"ɨ":"i",
|
||||
"ĩ":"i",
|
||||
"ḭ":"i",
|
||||
"ꝺ":"d",
|
||||
"ꝼ":"f",
|
||||
"ᵹ":"g",
|
||||
"ꞃ":"r",
|
||||
"ꞅ":"s",
|
||||
"ꞇ":"t",
|
||||
"ꝭ":"is",
|
||||
"ǰ":"j",
|
||||
"ĵ":"j",
|
||||
"ʝ":"j",
|
||||
"ɉ":"j",
|
||||
"ḱ":"k",
|
||||
"ǩ":"k",
|
||||
"ķ":"k",
|
||||
"ⱪ":"k",
|
||||
"ꝃ":"k",
|
||||
"ḳ":"k",
|
||||
"ƙ":"k",
|
||||
"ḵ":"k",
|
||||
"ᶄ":"k",
|
||||
"ꝁ":"k",
|
||||
"ꝅ":"k",
|
||||
"ĺ":"l",
|
||||
"ƚ":"l",
|
||||
"ɬ":"l",
|
||||
"ľ":"l",
|
||||
"ļ":"l",
|
||||
"ḽ":"l",
|
||||
"ȴ":"l",
|
||||
"ḷ":"l",
|
||||
"ḹ":"l",
|
||||
"ⱡ":"l",
|
||||
"ꝉ":"l",
|
||||
"ḻ":"l",
|
||||
"ŀ":"l",
|
||||
"ɫ":"l",
|
||||
"ᶅ":"l",
|
||||
"ɭ":"l",
|
||||
"ł":"l",
|
||||
"lj":"lj",
|
||||
"ſ":"s",
|
||||
"ẜ":"s",
|
||||
"ẛ":"s",
|
||||
"ẝ":"s",
|
||||
"ḿ":"m",
|
||||
"ṁ":"m",
|
||||
"ṃ":"m",
|
||||
"ɱ":"m",
|
||||
"ᵯ":"m",
|
||||
"ᶆ":"m",
|
||||
"ń":"n",
|
||||
"ň":"n",
|
||||
"ņ":"n",
|
||||
"ṋ":"n",
|
||||
"ȵ":"n",
|
||||
"ṅ":"n",
|
||||
"ṇ":"n",
|
||||
"ǹ":"n",
|
||||
"ɲ":"n",
|
||||
"ṉ":"n",
|
||||
"ƞ":"n",
|
||||
"ᵰ":"n",
|
||||
"ᶇ":"n",
|
||||
"ɳ":"n",
|
||||
"ñ":"n",
|
||||
"nj":"nj",
|
||||
"ó":"o",
|
||||
"ŏ":"o",
|
||||
"ǒ":"o",
|
||||
"ô":"o",
|
||||
"ố":"o",
|
||||
"ộ":"o",
|
||||
"ồ":"o",
|
||||
"ổ":"o",
|
||||
"ỗ":"o",
|
||||
"ö":"o",
|
||||
"ȫ":"o",
|
||||
"ȯ":"o",
|
||||
"ȱ":"o",
|
||||
"ọ":"o",
|
||||
"ő":"o",
|
||||
"ȍ":"o",
|
||||
"ò":"o",
|
||||
"ỏ":"o",
|
||||
"ơ":"o",
|
||||
"ớ":"o",
|
||||
"ợ":"o",
|
||||
"ờ":"o",
|
||||
"ở":"o",
|
||||
"ỡ":"o",
|
||||
"ȏ":"o",
|
||||
"ꝋ":"o",
|
||||
"ꝍ":"o",
|
||||
"ⱺ":"o",
|
||||
"ō":"o",
|
||||
"ṓ":"o",
|
||||
"ṑ":"o",
|
||||
"ǫ":"o",
|
||||
"ǭ":"o",
|
||||
"ø":"o",
|
||||
"ǿ":"o",
|
||||
"õ":"o",
|
||||
"ṍ":"o",
|
||||
"ṏ":"o",
|
||||
"ȭ":"o",
|
||||
"ƣ":"oi",
|
||||
"ꝏ":"oo",
|
||||
"ɛ":"e",
|
||||
"ᶓ":"e",
|
||||
"ɔ":"o",
|
||||
"ᶗ":"o",
|
||||
"ȣ":"ou",
|
||||
"ṕ":"p",
|
||||
"ṗ":"p",
|
||||
"ꝓ":"p",
|
||||
"ƥ":"p",
|
||||
"ᵱ":"p",
|
||||
"ᶈ":"p",
|
||||
"ꝕ":"p",
|
||||
"ᵽ":"p",
|
||||
"ꝑ":"p",
|
||||
"ꝙ":"q",
|
||||
"ʠ":"q",
|
||||
"ɋ":"q",
|
||||
"ꝗ":"q",
|
||||
"ŕ":"r",
|
||||
"ř":"r",
|
||||
"ŗ":"r",
|
||||
"ṙ":"r",
|
||||
"ṛ":"r",
|
||||
"ṝ":"r",
|
||||
"ȑ":"r",
|
||||
"ɾ":"r",
|
||||
"ᵳ":"r",
|
||||
"ȓ":"r",
|
||||
"ṟ":"r",
|
||||
"ɼ":"r",
|
||||
"ᵲ":"r",
|
||||
"ᶉ":"r",
|
||||
"ɍ":"r",
|
||||
"ɽ":"r",
|
||||
"ↄ":"c",
|
||||
"ꜿ":"c",
|
||||
"ɘ":"e",
|
||||
"ɿ":"r",
|
||||
"ś":"s",
|
||||
"ṥ":"s",
|
||||
"š":"s",
|
||||
"ṧ":"s",
|
||||
"ş":"s",
|
||||
"ŝ":"s",
|
||||
"ș":"s",
|
||||
"ṡ":"s",
|
||||
"ṣ":"s",
|
||||
"ṩ":"s",
|
||||
"ʂ":"s",
|
||||
"ᵴ":"s",
|
||||
"ᶊ":"s",
|
||||
"ȿ":"s",
|
||||
"ɡ":"g",
|
||||
"ᴑ":"o",
|
||||
"ᴓ":"o",
|
||||
"ᴝ":"u",
|
||||
"ť":"t",
|
||||
"ţ":"t",
|
||||
"ṱ":"t",
|
||||
"ț":"t",
|
||||
"ȶ":"t",
|
||||
"ẗ":"t",
|
||||
"ⱦ":"t",
|
||||
"ṫ":"t",
|
||||
"ṭ":"t",
|
||||
"ƭ":"t",
|
||||
"ṯ":"t",
|
||||
"ᵵ":"t",
|
||||
"ƫ":"t",
|
||||
"ʈ":"t",
|
||||
"ŧ":"t",
|
||||
"ᵺ":"th",
|
||||
"ɐ":"a",
|
||||
"ᴂ":"ae",
|
||||
"ǝ":"e",
|
||||
"ᵷ":"g",
|
||||
"ɥ":"h",
|
||||
"ʮ":"h",
|
||||
"ʯ":"h",
|
||||
"ᴉ":"i",
|
||||
"ʞ":"k",
|
||||
"ꞁ":"l",
|
||||
"ɯ":"m",
|
||||
"ɰ":"m",
|
||||
"ᴔ":"oe",
|
||||
"ɹ":"r",
|
||||
"ɻ":"r",
|
||||
"ɺ":"r",
|
||||
"ⱹ":"r",
|
||||
"ʇ":"t",
|
||||
"ʌ":"v",
|
||||
"ʍ":"w",
|
||||
"ʎ":"y",
|
||||
"ꜩ":"tz",
|
||||
"ú":"u",
|
||||
"ŭ":"u",
|
||||
"ǔ":"u",
|
||||
"û":"u",
|
||||
"ṷ":"u",
|
||||
"ü":"u",
|
||||
"ǘ":"u",
|
||||
"ǚ":"u",
|
||||
"ǜ":"u",
|
||||
"ǖ":"u",
|
||||
"ṳ":"u",
|
||||
"ụ":"u",
|
||||
"ű":"u",
|
||||
"ȕ":"u",
|
||||
"ù":"u",
|
||||
"ủ":"u",
|
||||
"ư":"u",
|
||||
"ứ":"u",
|
||||
"ự":"u",
|
||||
"ừ":"u",
|
||||
"ử":"u",
|
||||
"ữ":"u",
|
||||
"ȗ":"u",
|
||||
"ū":"u",
|
||||
"ṻ":"u",
|
||||
"ų":"u",
|
||||
"ᶙ":"u",
|
||||
"ů":"u",
|
||||
"ũ":"u",
|
||||
"ṹ":"u",
|
||||
"ṵ":"u",
|
||||
"ᵫ":"ue",
|
||||
"ꝸ":"um",
|
||||
"ⱴ":"v",
|
||||
"ꝟ":"v",
|
||||
"ṿ":"v",
|
||||
"ʋ":"v",
|
||||
"ᶌ":"v",
|
||||
"ⱱ":"v",
|
||||
"ṽ":"v",
|
||||
"ꝡ":"vy",
|
||||
"ẃ":"w",
|
||||
"ŵ":"w",
|
||||
"ẅ":"w",
|
||||
"ẇ":"w",
|
||||
"ẉ":"w",
|
||||
"ẁ":"w",
|
||||
"ⱳ":"w",
|
||||
"ẘ":"w",
|
||||
"ẍ":"x",
|
||||
"ẋ":"x",
|
||||
"ᶍ":"x",
|
||||
"ý":"y",
|
||||
"ŷ":"y",
|
||||
"ÿ":"y",
|
||||
"ẏ":"y",
|
||||
"ỵ":"y",
|
||||
"ỳ":"y",
|
||||
"ƴ":"y",
|
||||
"ỷ":"y",
|
||||
"ỿ":"y",
|
||||
"ȳ":"y",
|
||||
"ẙ":"y",
|
||||
"ɏ":"y",
|
||||
"ỹ":"y",
|
||||
"ź":"z",
|
||||
"ž":"z",
|
||||
"ẑ":"z",
|
||||
"ʑ":"z",
|
||||
"ⱬ":"z",
|
||||
"ż":"z",
|
||||
"ẓ":"z",
|
||||
"ȥ":"z",
|
||||
"ẕ":"z",
|
||||
"ᵶ":"z",
|
||||
"ᶎ":"z",
|
||||
"ʐ":"z",
|
||||
"ƶ":"z",
|
||||
"ɀ":"z",
|
||||
"ff":"ff",
|
||||
"ffi":"ffi",
|
||||
"ffl":"ffl",
|
||||
"fi":"fi",
|
||||
"fl":"fl",
|
||||
"ij":"ij",
|
||||
"œ":"oe",
|
||||
"st":"st",
|
||||
"ₐ":"a",
|
||||
"ₑ":"e",
|
||||
"ᵢ":"i",
|
||||
"ⱼ":"j",
|
||||
"ₒ":"o",
|
||||
"ᵣ":"r",
|
||||
"ᵤ":"u",
|
||||
"ᵥ":"v",
|
||||
"ₓ":"x",
|
||||
"Ё":"YO",
|
||||
"Й":"I",
|
||||
"Ц":"TS",
|
||||
"У":"U",
|
||||
"К":"K",
|
||||
"Е":"E",
|
||||
"Н":"N",
|
||||
"Г":"G",
|
||||
"Ш":"SH",
|
||||
"Щ":"SCH",
|
||||
"З":"Z",
|
||||
"Х":"H",
|
||||
"Ъ":"'",
|
||||
"ё":"yo",
|
||||
"й":"i",
|
||||
"ц":"ts",
|
||||
"у":"u",
|
||||
"к":"k",
|
||||
"е":"e",
|
||||
"н":"n",
|
||||
"г":"g",
|
||||
"ш":"sh",
|
||||
"щ":"sch",
|
||||
"з":"z",
|
||||
"х":"h",
|
||||
"ъ":"'",
|
||||
"Ф":"F",
|
||||
"Ы":"I",
|
||||
"В":"V",
|
||||
"А":"a",
|
||||
"П":"P",
|
||||
"Р":"R",
|
||||
"О":"O",
|
||||
"Л":"L",
|
||||
"Д":"D",
|
||||
"Ж":"ZH",
|
||||
"Э":"E",
|
||||
"ф":"f",
|
||||
"ы":"i",
|
||||
"в":"v",
|
||||
"а":"a",
|
||||
"п":"p",
|
||||
"р":"r",
|
||||
"о":"o",
|
||||
"л":"l",
|
||||
"д":"d",
|
||||
"ж":"zh",
|
||||
"э":"e",
|
||||
"Я":"Ya",
|
||||
"Ч":"CH",
|
||||
"С":"S",
|
||||
"М":"M",
|
||||
"И":"I",
|
||||
"Т":"T",
|
||||
"Ь":"'",
|
||||
"Б":"B",
|
||||
"Ю":"YU",
|
||||
"я":"ya",
|
||||
"ч":"ch",
|
||||
"с":"s",
|
||||
"м":"m",
|
||||
"и":"i",
|
||||
"т":"t",
|
||||
"ь":"'",
|
||||
"б":"b",
|
||||
"ю":"yu"
|
||||
};
|
||||
|
||||
exports.transliterate = function(str) {
|
||||
return str.replace(/[^A-Za-z0-9\[\] ]/g,function(ch) {
|
||||
return exports.transliterationPairs[ch] || ch
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -12,13 +12,54 @@ Various static utility functions.
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Display a message, in colour if we're on a terminal
|
||||
*/
|
||||
exports.log = function(text,colour) {
|
||||
console.log($tw.node ? exports.terminalColour(colour) + text + exports.terminalColour() : text);
|
||||
};
|
||||
|
||||
exports.terminalColour = function(colour) {
|
||||
if(!$tw.browser && $tw.node && process.stdout.isTTY) {
|
||||
if(colour) {
|
||||
var code = exports.terminalColourLookup[colour];
|
||||
if(code) {
|
||||
return "\x1b[" + code + "m";
|
||||
}
|
||||
} else {
|
||||
return "\x1b[0m"; // Cancel colour
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
exports.terminalColourLookup = {
|
||||
"black": "0;30",
|
||||
"red": "0;31",
|
||||
"green": "0;32",
|
||||
"brown/orange": "0;33",
|
||||
"blue": "0;34",
|
||||
"purple": "0;35",
|
||||
"cyan": "0;36",
|
||||
"light gray": "0;37"
|
||||
};
|
||||
|
||||
/*
|
||||
Display a warning, in colour if we're on a terminal
|
||||
*/
|
||||
exports.warning = function(text) {
|
||||
console.log($tw.node ? "\x1b[1;33m" + text + "\x1b[0m" : text);
|
||||
exports.log(text,"brown/orange");
|
||||
};
|
||||
|
||||
/*
|
||||
Return the integer represented by the str (string).
|
||||
Return the dflt (default) parameter if str is not a base-10 number.
|
||||
*/
|
||||
exports.getInt = function(str,deflt) {
|
||||
var i = parseInt(str,10);
|
||||
return isNaN(i) ? deflt : i;
|
||||
}
|
||||
|
||||
/*
|
||||
Repeatedly replaces a substring within a string. Like String.prototype.replace, but without any of the default special handling of $ sequences in the replace string
|
||||
*/
|
||||
@@ -267,6 +308,9 @@ exports.formatDateString = function(date,template) {
|
||||
[/^0ss/, function() {
|
||||
return $tw.utils.pad(date.getSeconds());
|
||||
}],
|
||||
[/^0XXX/, function() {
|
||||
return $tw.utils.pad(date.getMilliseconds());
|
||||
}],
|
||||
[/^0DD/, function() {
|
||||
return $tw.utils.pad(date.getDate());
|
||||
}],
|
||||
@@ -308,6 +352,9 @@ exports.formatDateString = function(date,template) {
|
||||
[/^ss/, function() {
|
||||
return date.getSeconds();
|
||||
}],
|
||||
[/^XXX/, function() {
|
||||
return date.getMilliseconds();
|
||||
}],
|
||||
[/^[AP]M/, function() {
|
||||
return $tw.utils.getAmPm(date).toUpperCase();
|
||||
}],
|
||||
@@ -324,6 +371,16 @@ exports.formatDateString = function(date,template) {
|
||||
return $tw.utils.pad(date.getFullYear() - 2000);
|
||||
}]
|
||||
];
|
||||
// If the user wants everything in UTC, shift the datestamp
|
||||
// Optimize for format string that essentially means
|
||||
// 'return raw UTC (tiddlywiki style) date string.'
|
||||
if(t.indexOf("[UTC]") == 0 ) {
|
||||
if(t == "[UTC]YYYY0MM0DD0hh0mm0ssXXX")
|
||||
return $tw.utils.stringifyDate(new Date());
|
||||
var offset = date.getTimezoneOffset() ; // in minutes
|
||||
date = new Date(date.getTime()+offset*60*1000) ;
|
||||
t = t.substr(5) ;
|
||||
}
|
||||
while(t.length){
|
||||
var matchString = "";
|
||||
$tw.utils.each(matches, function(m) {
|
||||
@@ -443,7 +500,7 @@ exports.entityDecode = function(s) {
|
||||
e = s.substr(1,s.length-2); // Strip the & and the ;
|
||||
if(e.charAt(0) === "#") {
|
||||
if(e.charAt(1) === "x" || e.charAt(1) === "X") {
|
||||
return converter(parseInt(e.substr(2),16));
|
||||
return converter(parseInt(e.substr(2),16));
|
||||
} else {
|
||||
return converter(parseInt(e.substr(1),10));
|
||||
}
|
||||
@@ -495,7 +552,24 @@ exports.stringify = function(s) {
|
||||
.replace(/'/g, "\\'") // single quote character
|
||||
.replace(/\r/g, '\\r') // carriage return
|
||||
.replace(/\n/g, '\\n') // line feed
|
||||
.replace(/[\x80-\uFFFF]/g, exports.escape); // non-ASCII characters
|
||||
.replace(/[\x00-\x1f\x80-\uFFFF]/g, exports.escape); // non-ASCII characters
|
||||
};
|
||||
|
||||
// Turns a string into a legal JSON string
|
||||
// Derived from peg.js, thanks to David Majda
|
||||
exports.jsonStringify = function(s) {
|
||||
// See http://www.json.org/
|
||||
return (s || "")
|
||||
.replace(/\\/g, '\\\\') // backslash
|
||||
.replace(/"/g, '\\"') // double quote character
|
||||
.replace(/\r/g, '\\r') // carriage return
|
||||
.replace(/\n/g, '\\n') // line feed
|
||||
.replace(/\x08/g, '\\b') // backspace
|
||||
.replace(/\x0c/g, '\\f') // formfeed
|
||||
.replace(/\t/g, '\\t') // tab
|
||||
.replace(/[\x00-\x1f\x80-\uFFFF]/g,function(s) {
|
||||
return '\\u' + $tw.utils.pad(s.charCodeAt(0).toString(16).toUpperCase(),4);
|
||||
}); // non-ASCII characters
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -659,7 +733,7 @@ High resolution microsecond timer for profiling
|
||||
exports.timer = function(base) {
|
||||
var m;
|
||||
if($tw.node) {
|
||||
var r = process.hrtime();
|
||||
var r = process.hrtime();
|
||||
m = r[0] * 1e3 + (r[1] / 1e6);
|
||||
} else if(window.performance) {
|
||||
m = performance.now();
|
||||
@@ -726,82 +800,4 @@ exports.strEndsWith = function(str,ending,position) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Transliterate string from eg. Cyrillic Russian to Latin
|
||||
*/
|
||||
var transliterationPairs = {
|
||||
"Ё":"YO",
|
||||
"Й":"I",
|
||||
"Ц":"TS",
|
||||
"У":"U",
|
||||
"К":"K",
|
||||
"Е":"E",
|
||||
"Н":"N",
|
||||
"Г":"G",
|
||||
"Ш":"SH",
|
||||
"Щ":"SCH",
|
||||
"З":"Z",
|
||||
"Х":"H",
|
||||
"Ъ":"'",
|
||||
"ё":"yo",
|
||||
"й":"i",
|
||||
"ц":"ts",
|
||||
"у":"u",
|
||||
"к":"k",
|
||||
"е":"e",
|
||||
"н":"n",
|
||||
"г":"g",
|
||||
"ш":"sh",
|
||||
"щ":"sch",
|
||||
"з":"z",
|
||||
"х":"h",
|
||||
"ъ":"'",
|
||||
"Ф":"F",
|
||||
"Ы":"I",
|
||||
"В":"V",
|
||||
"А":"a",
|
||||
"П":"P",
|
||||
"Р":"R",
|
||||
"О":"O",
|
||||
"Л":"L",
|
||||
"Д":"D",
|
||||
"Ж":"ZH",
|
||||
"Э":"E",
|
||||
"ф":"f",
|
||||
"ы":"i",
|
||||
"в":"v",
|
||||
"а":"a",
|
||||
"п":"p",
|
||||
"р":"r",
|
||||
"о":"o",
|
||||
"л":"l",
|
||||
"д":"d",
|
||||
"ж":"zh",
|
||||
"э":"e",
|
||||
"Я":"Ya",
|
||||
"Ч":"CH",
|
||||
"С":"S",
|
||||
"М":"M",
|
||||
"И":"I",
|
||||
"Т":"T",
|
||||
"Ь":"'",
|
||||
"Б":"B",
|
||||
"Ю":"YU",
|
||||
"я":"ya",
|
||||
"ч":"ch",
|
||||
"с":"s",
|
||||
"м":"m",
|
||||
"и":"i",
|
||||
"т":"t",
|
||||
"ь":"'",
|
||||
"б":"b",
|
||||
"ю":"yu"
|
||||
};
|
||||
|
||||
exports.transliterate = function(str) {
|
||||
return str.split("").map(function(char) {
|
||||
return transliterationPairs[char] || char;
|
||||
}).join("");
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -46,17 +46,23 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.nwsaveas) {
|
||||
domNode.setAttribute("nwsaveas",this.nwsaveas);
|
||||
}
|
||||
// Nw.js supports "webkitdirectory" to allow a directory to be selected
|
||||
// Nw.js supports "webkitdirectory" and "nwdirectory" to allow a directory to be selected
|
||||
if(this.webkitdirectory) {
|
||||
domNode.setAttribute("webkitdirectory",this.webkitdirectory);
|
||||
}
|
||||
if(this.nwdirectory) {
|
||||
domNode.setAttribute("nwdirectory",this.nwdirectory);
|
||||
}
|
||||
// Add a click event handler
|
||||
domNode.addEventListener("change",function (event) {
|
||||
if(self.message) {
|
||||
self.dispatchEvent({type: self.message, param: self.param, files: event.target.files});
|
||||
} else {
|
||||
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
self.wiki.readFiles(event.target.files,{
|
||||
callback: function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
},
|
||||
deserializer: self.deserializer
|
||||
});
|
||||
}
|
||||
return false;
|
||||
@@ -72,11 +78,13 @@ Compute the internal state of the widget
|
||||
*/
|
||||
BrowseWidget.prototype.execute = function() {
|
||||
this.browseMultiple = this.getAttribute("multiple");
|
||||
this.deserializer = this.getAttribute("deserializer");
|
||||
this.message = this.getAttribute("message");
|
||||
this.param = this.getAttribute("param");
|
||||
this.tooltip = this.getAttribute("tooltip");
|
||||
this.nwsaveas = this.getAttribute("nwsaveas");
|
||||
this.webkitdirectory = this.getAttribute("webkitdirectory");
|
||||
this.nwdirectory = this.getAttribute("nwdirectory");
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -67,7 +67,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
||||
// Add a click event handler
|
||||
domNode.addEventListener("click",function (event) {
|
||||
var handled = false;
|
||||
if(self.invokeActions(this,event)) {
|
||||
if(self.invokeActions(self,event)) {
|
||||
handled = true;
|
||||
}
|
||||
if(self.to) {
|
||||
|
||||
@@ -156,6 +156,9 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||
if(this.checkboxActions) {
|
||||
this.invokeActionString(this.checkboxActions,this,event);
|
||||
}
|
||||
if(this.checkboxUncheckActions && !checked) {
|
||||
this.invokeActionString(this.checkboxUncheckActions,this,event);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -164,6 +167,7 @@ Compute the internal state of the widget
|
||||
CheckboxWidget.prototype.execute = function() {
|
||||
// Get the parameters from the attributes
|
||||
this.checkboxActions = this.getAttribute("actions");
|
||||
this.checkboxUncheckActions = this.getAttribute("uncheckactions");
|
||||
this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.checkboxTag = this.getAttribute("tag");
|
||||
this.checkboxField = this.getAttribute("field");
|
||||
@@ -197,4 +201,4 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||
|
||||
exports.checkbox = CheckboxWidget;
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
148
core/modules/widgets/diff-text.js
Normal file
148
core/modules/widgets/diff-text.js
Normal file
@@ -0,0 +1,148 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/diff-text.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Widget to display a diff between two texts
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget,
|
||||
dmp = require("$:/core/modules/utils/diff-match-patch/diff_match_patch.js");
|
||||
|
||||
var DiffTextWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
DiffTextWidget.prototype = new Widget();
|
||||
|
||||
DiffTextWidget.prototype.invisibleCharacters = {
|
||||
"\n": "↩︎\n",
|
||||
"\r": "⇠",
|
||||
"\t": "⇥\t"
|
||||
};
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
DiffTextWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
// Create the diff
|
||||
var dmpObject = new dmp.diff_match_patch(),
|
||||
diffs = dmpObject.diff_main(this.getAttribute("source"),this.getAttribute("dest"));
|
||||
// Apply required cleanup
|
||||
switch(this.getAttribute("cleanup","semantic")) {
|
||||
case "none":
|
||||
// No cleanup
|
||||
break;
|
||||
case "efficiency":
|
||||
dmpObject.diff_cleanupEfficiency(diffs);
|
||||
break;
|
||||
default: // case "semantic"
|
||||
dmpObject.diff_cleanupSemantic(diffs);
|
||||
break;
|
||||
}
|
||||
// Create the elements
|
||||
var domContainer = this.document.createElement("div"),
|
||||
domDiff = this.createDiffDom(diffs);
|
||||
parent.insertBefore(domContainer,nextSibling);
|
||||
// Set variables
|
||||
this.setVariable("diff-count",diffs.reduce(function(acc,diff) {
|
||||
if(diff[0] !== dmp.DIFF_EQUAL) {
|
||||
acc++;
|
||||
}
|
||||
return acc;
|
||||
},0).toString());
|
||||
// Render child widgets
|
||||
this.renderChildren(domContainer,null);
|
||||
// Render the diff
|
||||
domContainer.appendChild(domDiff);
|
||||
// Save our container
|
||||
this.domNodes.push(domContainer);
|
||||
};
|
||||
|
||||
/*
|
||||
Create DOM elements representing a list of diffs
|
||||
*/
|
||||
DiffTextWidget.prototype.createDiffDom = function(diffs) {
|
||||
var self = this;
|
||||
// Create the element and assign the attributes
|
||||
var domPre = this.document.createElement("pre"),
|
||||
domCode = this.document.createElement("code");
|
||||
$tw.utils.each(diffs,function(diff) {
|
||||
var tag = diff[0] === dmp.DIFF_INSERT ? "ins" : (diff[0] === dmp.DIFF_DELETE ? "del" : "span"),
|
||||
className = diff[0] === dmp.DIFF_INSERT ? "tc-diff-insert" : (diff[0] === dmp.DIFF_DELETE ? "tc-diff-delete" : "tc-diff-equal"),
|
||||
dom = self.document.createElement(tag),
|
||||
text = diff[1],
|
||||
currPos = 0,
|
||||
re = /([\x00-\x1F])/mg,
|
||||
match = re.exec(text),
|
||||
span,
|
||||
printable;
|
||||
dom.className = className;
|
||||
while(match) {
|
||||
if(currPos < match.index) {
|
||||
dom.appendChild(self.document.createTextNode(text.slice(currPos,match.index)));
|
||||
}
|
||||
span = self.document.createElement("span");
|
||||
span.className = "tc-diff-invisible";
|
||||
printable = self.invisibleCharacters[match[0]] || ("[0x" + match[0].charCodeAt(0).toString(16) + "]");
|
||||
span.appendChild(self.document.createTextNode(printable));
|
||||
dom.appendChild(span);
|
||||
currPos = match.index + match[0].length;
|
||||
match = re.exec(text);
|
||||
}
|
||||
if(currPos < text.length) {
|
||||
dom.appendChild(self.document.createTextNode(text.slice(currPos)));
|
||||
}
|
||||
domCode.appendChild(dom);
|
||||
});
|
||||
domPre.appendChild(domCode);
|
||||
return domPre;
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
DiffTextWidget.prototype.execute = function() {
|
||||
// Make child widgets
|
||||
var parseTreeNodes;
|
||||
if(this.parseTreeNode && this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {
|
||||
parseTreeNodes = this.parseTreeNode.children;
|
||||
} else {
|
||||
parseTreeNodes = [{
|
||||
type: "transclude",
|
||||
attributes: {
|
||||
tiddler: {type: "string", value: "$:/language/Diffs/CountMessage"}
|
||||
}
|
||||
}];
|
||||
}
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
DiffTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.source || changedAttributes.dest || changedAttributes.cleanup) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
}
|
||||
};
|
||||
|
||||
exports["diff-text"] = DiffTextWidget;
|
||||
|
||||
})();
|
||||
@@ -52,6 +52,8 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||
domNode: domNode,
|
||||
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
||||
dragFilterFn: function() {return self.getAttribute("filter");},
|
||||
startActions: self.startActions,
|
||||
endActions: self.endActions,
|
||||
widget: this
|
||||
});
|
||||
// Insert the link into the DOM and render any children
|
||||
@@ -67,6 +69,8 @@ DraggableWidget.prototype.execute = function() {
|
||||
// Pick up our attributes
|
||||
this.draggableTag = this.getAttribute("tag","div");
|
||||
this.draggableClasses = this.getAttribute("class");
|
||||
this.startActions = this.getAttribute("startactions");
|
||||
this.endActions = this.getAttribute("endactions");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
@@ -128,7 +128,9 @@ DroppableWidget.prototype.handleDropEvent = function(event) {
|
||||
|
||||
DroppableWidget.prototype.performActions = function(title,event) {
|
||||
if(this.droppableActions) {
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title});
|
||||
var modifierKey = event.ctrlKey && ! event.shiftKey ? "ctrl" : event.shiftKey && !event.ctrlKey ? "shift" :
|
||||
event.ctrlKey && event.shiftKey ? "ctrl-shift" : "normal" ;
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title, modifier: modifierKey});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -104,7 +104,10 @@ DropZoneWidget.prototype.handleDragLeaveEvent = function(event) {
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
var self = this;
|
||||
var self = this,
|
||||
readFileCallback = function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
};
|
||||
this.leaveDrag(event);
|
||||
// Check for being over a TEXTAREA or INPUT
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
|
||||
@@ -121,15 +124,14 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
// Import any files in the drop
|
||||
var numFiles = 0;
|
||||
if(dataTransfer.files) {
|
||||
numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
numFiles = this.wiki.readFiles(dataTransfer.files,{
|
||||
callback: readFileCallback,
|
||||
deserializer: this.dropzoneDeserializer
|
||||
});
|
||||
}
|
||||
// Try to import the various data types we understand
|
||||
if(numFiles === 0) {
|
||||
$tw.utils.importDataTransfer(dataTransfer,this.wiki.generateNewTitle("Untitled"),function(fieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(fieldsArray)});
|
||||
});
|
||||
$tw.utils.importDataTransfer(dataTransfer,this.wiki.generateNewTitle("Untitled"),readFileCallback);
|
||||
}
|
||||
// Tell the browser that we handled the drop
|
||||
event.preventDefault();
|
||||
@@ -138,6 +140,10 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
var self = this,
|
||||
readFileCallback = function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
};
|
||||
// Let the browser handle it if we're in a textarea or input box
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) == -1) {
|
||||
var self = this,
|
||||
@@ -147,8 +153,9 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
var item = items[t];
|
||||
if(item.kind === "file") {
|
||||
// Import any files
|
||||
this.wiki.readFile(item.getAsFile(),function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
this.wiki.readFile(item.getAsFile(),{
|
||||
callback: readFileCallback,
|
||||
deserializer: this.dropzoneDeserializer
|
||||
});
|
||||
} else if(item.kind === "string") {
|
||||
// Create tiddlers from string items
|
||||
@@ -176,6 +183,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
DropZoneWidget.prototype.execute = function() {
|
||||
this.dropzoneDeserializer = this.getAttribute("deserializer");
|
||||
// Make child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
@@ -189,6 +189,35 @@ EditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) {
|
||||
ctx.drawImage(this.currCanvas,0,0);
|
||||
};
|
||||
|
||||
/*
|
||||
** Rotate the canvas left by 90 degrees
|
||||
*/
|
||||
EditBitmapWidget.prototype.rotateCanvasLeft = function() {
|
||||
// Get the current size of the image
|
||||
var origWidth = this.currCanvas.width,
|
||||
origHeight = this.currCanvas.height;
|
||||
// Create and size a new canvas
|
||||
var newCanvas = this.document.createElement("canvas"),
|
||||
newWidth = origHeight,
|
||||
newHeight = origWidth;
|
||||
this.initCanvas(newCanvas,newWidth,newHeight);
|
||||
// Copy the old image
|
||||
var ctx = newCanvas.getContext("2d");
|
||||
ctx.save();
|
||||
ctx.translate(newWidth / 2,newHeight / 2);
|
||||
ctx.rotate(-Math.PI / 2);
|
||||
ctx.drawImage(this.currCanvas,-origWidth / 2,-origHeight / 2);
|
||||
ctx.restore();
|
||||
// Set the new canvas as the current one
|
||||
this.currCanvas = newCanvas;
|
||||
// Set the size of the onscreen canvas
|
||||
this.canvasDomNode.width = newWidth;
|
||||
this.canvasDomNode.height = newHeight;
|
||||
// Paint the onscreen canvas with the offscreen canvas
|
||||
ctx = this.canvasDomNode.getContext("2d");
|
||||
ctx.drawImage(this.currCanvas,0,0);
|
||||
};
|
||||
|
||||
EditBitmapWidget.prototype.handleTouchStartEvent = function(event) {
|
||||
this.brushDown = true;
|
||||
this.strokeStart(event.touches[0].clientX,event.touches[0].clientY);
|
||||
|
||||
@@ -109,28 +109,28 @@ FieldManglerWidget.prototype.handleAddFieldEvent = function(event) {
|
||||
};
|
||||
|
||||
FieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {
|
||||
var tiddler = this.wiki.getTiddler(this.mangleTitle);
|
||||
var tiddler = this.wiki.getTiddler(this.mangleTitle),
|
||||
modification = this.wiki.getModificationFields();
|
||||
if(tiddler && tiddler.fields.tags) {
|
||||
var p = tiddler.fields.tags.indexOf(event.param);
|
||||
if(p !== -1) {
|
||||
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));
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
FieldManglerWidget.prototype.handleAddTagEvent = function(event) {
|
||||
var tiddler = this.wiki.getTiddler(this.mangleTitle);
|
||||
var tiddler = this.wiki.getTiddler(this.mangleTitle),
|
||||
modification = this.wiki.getModificationFields();
|
||||
if(tiddler && typeof event.param === "string") {
|
||||
var tag = event.param.trim();
|
||||
if(tag !== "") {
|
||||
var modification = this.wiki.getModificationFields();
|
||||
modification.tags = (tiddler.fields.tags || []).slice(0);
|
||||
$tw.utils.pushTop(modification.tags,tag);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));
|
||||
@@ -138,7 +138,7 @@ FieldManglerWidget.prototype.handleAddTagEvent = function(event) {
|
||||
} else if(typeof event.param === "string" && event.param.trim() !== "" && this.mangleTitle.trim() !== "") {
|
||||
var tag = [];
|
||||
tag.push(event.param.trim());
|
||||
this.wiki.addTiddler({title: this.mangleTitle, tags: tag});
|
||||
this.wiki.addTiddler(new $tw.Tiddler({title: this.mangleTitle, tags: tag},modification));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -64,30 +64,48 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
var domNode = this.document.createElement(tag);
|
||||
// Assign classes
|
||||
var classes = [];
|
||||
if(this.linkClasses) {
|
||||
classes.push(this.linkClasses);
|
||||
}
|
||||
classes.push("tc-tiddlylink");
|
||||
if(this.isShadow) {
|
||||
classes.push("tc-tiddlylink-shadow");
|
||||
}
|
||||
if(this.isMissing && !this.isShadow) {
|
||||
classes.push("tc-tiddlylink-missing");
|
||||
} else {
|
||||
if(!this.isMissing) {
|
||||
classes.push("tc-tiddlylink-resolves");
|
||||
if(this.overrideClasses === undefined) {
|
||||
classes.push("tc-tiddlylink");
|
||||
if(this.isShadow) {
|
||||
classes.push("tc-tiddlylink-shadow");
|
||||
}
|
||||
if(this.isMissing && !this.isShadow) {
|
||||
classes.push("tc-tiddlylink-missing");
|
||||
} else {
|
||||
if(!this.isMissing) {
|
||||
classes.push("tc-tiddlylink-resolves");
|
||||
}
|
||||
}
|
||||
if(this.linkClasses) {
|
||||
classes.push(this.linkClasses);
|
||||
}
|
||||
} else if(this.overrideClasses !== "") {
|
||||
classes.push(this.overrideClasses)
|
||||
}
|
||||
if(classes.length > 0) {
|
||||
domNode.setAttribute("class",classes.join(" "));
|
||||
}
|
||||
domNode.setAttribute("class",classes.join(" "));
|
||||
// Set an href
|
||||
var wikiLinkTemplateMacro = this.getVariable("tv-wikilink-template"),
|
||||
wikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : "#$uri_encoded$",
|
||||
var wikilinkTransformFilter = this.getVariable("tv-filter-export-link"),
|
||||
wikiLinkText;
|
||||
if(wikilinkTransformFilter) {
|
||||
// Use the filter to construct the href
|
||||
wikiLinkText = this.wiki.filterTiddlers(wikilinkTransformFilter,this,function(iterator) {
|
||||
iterator(self.wiki.getTiddler(self.to),self.to)
|
||||
})[0];
|
||||
} else {
|
||||
// Expand the tv-wikilink-template variable to construct the href
|
||||
var wikiLinkTemplateMacro = this.getVariable("tv-wikilink-template"),
|
||||
wikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : "#$uri_encoded$";
|
||||
wikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,"$uri_encoded$",encodeURIComponent(this.to));
|
||||
wikiLinkText = $tw.utils.replaceString(wikiLinkText,"$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to)));
|
||||
wikiLinkText = $tw.utils.replaceString(wikiLinkText,"$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to)));
|
||||
}
|
||||
// Override with the value of tv-get-export-link if defined
|
||||
wikiLinkText = this.getVariable("tv-get-export-link",{params: [{name: "to",value: this.to}],defaultValue: wikiLinkText});
|
||||
if(tag === "a") {
|
||||
domNode.setAttribute("href",wikiLinkText);
|
||||
}
|
||||
// Set the tabindex
|
||||
if(this.tabIndex) {
|
||||
domNode.setAttribute("tabindex",this.tabIndex);
|
||||
}
|
||||
@@ -135,7 +153,11 @@ LinkWidget.prototype.handleClickEvent = function(event) {
|
||||
navigateFromNode: this,
|
||||
navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height
|
||||
},
|
||||
navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1)
|
||||
navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1),
|
||||
metaKey: event.metaKey,
|
||||
ctrlKey: event.ctrlKey,
|
||||
altKey: event.altKey,
|
||||
shiftKey: event.shiftKey
|
||||
});
|
||||
if(this.domNodes[0].hasAttribute("href")) {
|
||||
event.preventDefault();
|
||||
@@ -153,6 +175,7 @@ LinkWidget.prototype.execute = function() {
|
||||
this.tooltip = this.getAttribute("tooltip");
|
||||
this["aria-label"] = this.getAttribute("aria-label");
|
||||
this.linkClasses = this.getAttribute("class");
|
||||
this.overrideClasses = this.getAttribute("overrideClass");
|
||||
this.tabIndex = this.getAttribute("tabindex");
|
||||
this.draggable = this.getAttribute("draggable","yes");
|
||||
this.linkTag = this.getAttribute("tag","a");
|
||||
|
||||
@@ -48,6 +48,8 @@ LinkCatcherWidget.prototype.execute = function() {
|
||||
this.catchActions = this.getAttribute("actions");
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets();
|
||||
// When executing actions we avoid trapping navigate events, so that we don't trigger ourselves recursively
|
||||
this.executingActions = false;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -67,23 +69,35 @@ LinkCatcherWidget.prototype.refresh = function(changedTiddlers) {
|
||||
Handle a tm-navigate event
|
||||
*/
|
||||
LinkCatcherWidget.prototype.handleNavigateEvent = function(event) {
|
||||
if(this.catchTo) {
|
||||
this.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable("currentTiddler"));
|
||||
}
|
||||
if(this.catchMessage && this.parentWidget) {
|
||||
if(!this.executingActions) {
|
||||
// Execute the actions
|
||||
if(this.catchTo) {
|
||||
this.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable("currentTiddler"));
|
||||
}
|
||||
if(this.catchMessage && this.parentWidget) {
|
||||
this.parentWidget.dispatchEvent({
|
||||
type: this.catchMessage,
|
||||
param: event.navigateTo,
|
||||
navigateTo: event.navigateTo
|
||||
});
|
||||
}
|
||||
if(this.catchSet) {
|
||||
var tiddler = this.wiki.getTiddler(this.catchSet);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.catchSet, text: this.catchSetTo}));
|
||||
}
|
||||
if(this.catchActions) {
|
||||
this.executingActions = true;
|
||||
this.invokeActionString(this.catchActions,this,event,{navigateTo: event.navigateTo});
|
||||
this.executingActions = false;
|
||||
}
|
||||
} else {
|
||||
// This is a navigate event generated by the actions of this linkcatcher, so we don't trap it again, but just pass it to the parent
|
||||
this.parentWidget.dispatchEvent({
|
||||
type: this.catchMessage,
|
||||
type: "tm-navigate",
|
||||
param: event.navigateTo,
|
||||
navigateTo: event.navigateTo
|
||||
});
|
||||
}
|
||||
if(this.catchSet) {
|
||||
var tiddler = this.wiki.getTiddler(this.catchSet);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.catchSet, text: this.catchSetTo}));
|
||||
}
|
||||
if(this.catchActions) {
|
||||
this.invokeActionString(this.catchActions,this);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -48,7 +48,9 @@ MacroCallWidget.prototype.execute = function() {
|
||||
}
|
||||
});
|
||||
// Get the macro value
|
||||
var text = this.getVariable(this.parseTreeNode.name || this.getAttribute("$name"),{params: params}),
|
||||
var macroName = this.parseTreeNode.name || this.getAttribute("$name"),
|
||||
variableInfo = this.getVariableInfo(macroName,{params: params}),
|
||||
text = variableInfo.text,
|
||||
parseTreeNodes;
|
||||
// Are we rendering to HTML?
|
||||
if(this.renderOutput === "text/html") {
|
||||
@@ -56,6 +58,21 @@ MacroCallWidget.prototype.execute = function() {
|
||||
var parser = this.wiki.parseText(this.parseType,text,
|
||||
{parseAsInline: !this.parseTreeNode.isBlock});
|
||||
parseTreeNodes = parser ? parser.tree : [];
|
||||
// Wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
||||
var attributes = {};
|
||||
$tw.utils.each(variableInfo.params,function(param) {
|
||||
var name = "__" + param.name + "__";
|
||||
attributes[name] = {
|
||||
name: name,
|
||||
type: "string",
|
||||
value: param.value
|
||||
};
|
||||
});
|
||||
parseTreeNodes = [{
|
||||
type: "vars",
|
||||
attributes: attributes,
|
||||
children: parseTreeNodes
|
||||
}];
|
||||
} else {
|
||||
// Otherwise, we'll render the text
|
||||
var plainText = this.wiki.renderText("text/plain",this.parseType,text,{parentWidget: this});
|
||||
|
||||
@@ -60,6 +60,8 @@ NavigatorWidget.prototype.execute = function() {
|
||||
// Get our parameters
|
||||
this.storyTitle = this.getAttribute("story");
|
||||
this.historyTitle = this.getAttribute("history");
|
||||
this.setVariable("tv-story-list",this.storyTitle);
|
||||
this.setVariable("tv-history-list",this.historyTitle);
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
@@ -209,6 +211,10 @@ NavigatorWidget.prototype.handleCloseOtherTiddlersEvent = function(event) {
|
||||
|
||||
// Place a tiddler in edit mode
|
||||
NavigatorWidget.prototype.handleEditTiddlerEvent = function(event) {
|
||||
var editTiddler = $tw.hooks.invokeHook("th-editing-tiddler",event);
|
||||
if(!editTiddler) {
|
||||
return false;
|
||||
}
|
||||
var self = this;
|
||||
function isUnmodifiedShadow(title) {
|
||||
return self.wiki.isShadowTiddler(title) && !self.wiki.tiddlerExists(title);
|
||||
@@ -388,6 +394,7 @@ console.log("Relinking '" + draftOf + "' to '" + draftTitle + "'");
|
||||
|
||||
// Take a tiddler out of edit mode without saving the changes
|
||||
NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
|
||||
event = $tw.hooks.invokeHook("th-cancelling-tiddler", event);
|
||||
// Flip the specified tiddler from draft back to the original
|
||||
var draftTitle = event.param || event.tiddlerTitle,
|
||||
draftTiddler = this.wiki.getTiddler(draftTitle),
|
||||
@@ -432,6 +439,7 @@ NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
|
||||
//
|
||||
// If a draft of the target tiddler already exists then it is reused
|
||||
NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
event = $tw.hooks.invokeHook("th-new-tiddler", event);
|
||||
// Get the story details
|
||||
var storyList = this.getStoryList(),
|
||||
templateTiddler, additionalFields, title, draftTitle, existingTiddler;
|
||||
@@ -452,6 +460,13 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
if(additionalFields && additionalFields.title) {
|
||||
title = additionalFields.title;
|
||||
}
|
||||
// Make a copy of the additional fields excluding any blank ones
|
||||
var filteredAdditionalFields = $tw.utils.extend({},additionalFields);
|
||||
Object.keys(filteredAdditionalFields).forEach(function(fieldName) {
|
||||
if(filteredAdditionalFields[fieldName] === "") {
|
||||
delete filteredAdditionalFields[fieldName];
|
||||
}
|
||||
});
|
||||
// Generate a title if we don't have one
|
||||
title = title || this.wiki.generateNewTitle($tw.language.getString("DefaultNewTiddlerTitle"));
|
||||
// Find any existing draft for this tiddler
|
||||
@@ -482,8 +497,9 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
"draft.title": title
|
||||
},
|
||||
templateTiddler,
|
||||
existingTiddler,
|
||||
additionalFields,
|
||||
existingTiddler,
|
||||
filteredAdditionalFields,
|
||||
this.wiki.getCreationFields(),
|
||||
{
|
||||
title: draftTitle,
|
||||
@@ -497,7 +513,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
storyList.splice(slot + 1,0,draftTitle);
|
||||
}
|
||||
if(storyList.indexOf(title) !== -1) {
|
||||
storyList.splice(storyList.indexOf(title),1);
|
||||
storyList.splice(storyList.indexOf(title),1);
|
||||
}
|
||||
this.saveStoryList(storyList);
|
||||
// Add a new record to the top of the history stack
|
||||
@@ -510,7 +526,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
|
||||
// Get the tiddlers
|
||||
var tiddlers = [];
|
||||
try {
|
||||
tiddlers = JSON.parse(event.param);
|
||||
tiddlers = JSON.parse(event.param);
|
||||
} catch(e) {
|
||||
}
|
||||
// Get the current $:/Import tiddler
|
||||
@@ -526,6 +542,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
|
||||
// Process each tiddler
|
||||
importData.tiddlers = importData.tiddlers || {};
|
||||
$tw.utils.each(tiddlers,function(tiddlerFields) {
|
||||
tiddlerFields.title = $tw.utils.trim(tiddlerFields.title);
|
||||
var title = tiddlerFields.title;
|
||||
if(title) {
|
||||
incomingTiddlers.push(title);
|
||||
@@ -563,7 +580,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
|
||||
return false;
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
|
||||
var self = this,
|
||||
importTiddler = this.wiki.getTiddler(event.param),
|
||||
@@ -628,6 +645,7 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
|
||||
};
|
||||
|
||||
NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
|
||||
event = $tw.hooks.invokeHook("th-renaming-tiddler", event);
|
||||
var paramObject = event.paramObject || {},
|
||||
from = paramObject.from || event.tiddlerTitle,
|
||||
to = paramObject.to;
|
||||
|
||||
@@ -33,12 +33,15 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.computeAttributes();
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
var isChecked = this.getValue() === this.radioValue;
|
||||
// Create our elements
|
||||
this.labelDomNode = this.document.createElement("label");
|
||||
this.labelDomNode.setAttribute("class",this.radioClass);
|
||||
this.labelDomNode.setAttribute("class",
|
||||
"tc-radio " + this.radioClass + (isChecked ? " tc-radio-selected" : "")
|
||||
);
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","radio");
|
||||
if(this.getValue() == this.radioValue) {
|
||||
if(isChecked) {
|
||||
this.inputDomNode.setAttribute("checked","true");
|
||||
}
|
||||
this.labelDomNode.appendChild(this.inputDomNode);
|
||||
@@ -92,10 +95,6 @@ RadioWidget.prototype.execute = function() {
|
||||
this.radioIndex = this.getAttribute("index");
|
||||
this.radioValue = this.getAttribute("value");
|
||||
this.radioClass = this.getAttribute("class","");
|
||||
if(this.radioClass !== "") {
|
||||
this.radioClass += " ";
|
||||
}
|
||||
this.radioClass += "tc-radio";
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
114
core/modules/widgets/range.js
Normal file
114
core/modules/widgets/range.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/range.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Range widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var RangeWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
RangeWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
RangeWidget.prototype.render = function(parent,nextSibling) {
|
||||
// Save the parent dom node
|
||||
this.parentDomNode = parent;
|
||||
// Compute our attributes
|
||||
this.computeAttributes();
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
// Create our elements
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","range");
|
||||
this.inputDomNode.setAttribute("class",this.elementClass);
|
||||
if(this.minValue){
|
||||
this.inputDomNode.setAttribute("min", this.minValue);
|
||||
}
|
||||
if(this.maxValue){
|
||||
this.inputDomNode.setAttribute("max", this.maxValue);
|
||||
}
|
||||
if(this.increment){
|
||||
this.inputDomNode.setAttribute("step", this.increment);
|
||||
}
|
||||
this.inputDomNode.value = this.getValue();
|
||||
|
||||
|
||||
// Add a click event handler
|
||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||
{name: "input", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
||||
]);
|
||||
// Insert the label into the DOM and render any children
|
||||
parent.insertBefore(this.inputDomNode,nextSibling);
|
||||
this.domNodes.push(this.inputDomNode);
|
||||
};
|
||||
|
||||
RangeWidget.prototype.getValue = function() {
|
||||
var tiddler = this.wiki.getTiddler(this.tiddlerTitle),
|
||||
value = this.defaultValue;
|
||||
if(tiddler) {
|
||||
if($tw.utils.hop(tiddler.fields,this.tiddlerField)) {
|
||||
value = tiddler.fields[this.tiddlerField] || "";
|
||||
} else {
|
||||
value = this.defaultValue || "";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
RangeWidget.prototype.handleChangeEvent = function(event) {
|
||||
this.wiki.setText(this.tiddlerTitle ,this.tiddlerField, null,this.inputDomNode.value);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
RangeWidget.prototype.execute = function() {
|
||||
// Get the parameters from the attributes
|
||||
this.tiddlerTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.tiddlerField = this.getAttribute("field");
|
||||
this.minValue = this.getAttribute("min");
|
||||
this.maxValue = this.getAttribute("max");
|
||||
this.increment = this.getAttribute("increment");
|
||||
this.defaultValue = this.getAttribute("default");
|
||||
this.elementClass = this.getAttribute("class","");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
RangeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes['min'] || changedAttributes['max'] || changedAttributes['increment'] || changedAttributes["default"] || changedAttributes["class"]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
var refreshed = false;
|
||||
if(changedTiddlers[this.tiddlerTitle]) {
|
||||
this.inputDomNode.checked = this.getValue();
|
||||
refreshed = true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||
}
|
||||
};
|
||||
|
||||
exports.range = RangeWidget;
|
||||
|
||||
})();
|
||||
@@ -121,17 +121,28 @@ RevealWidget.prototype.readState = function() {
|
||||
this.readPopupState(state);
|
||||
break;
|
||||
case "match":
|
||||
this.readMatchState(state);
|
||||
this.isOpen = !!(this.compareStateText(state) == 0);
|
||||
break;
|
||||
case "nomatch":
|
||||
this.readMatchState(state);
|
||||
this.isOpen = !this.isOpen;
|
||||
this.isOpen = !(this.compareStateText(state) == 0);
|
||||
break;
|
||||
case "lt":
|
||||
this.isOpen = !!(this.compareStateText(state) < 0);
|
||||
break;
|
||||
case "gt":
|
||||
this.isOpen = !!(this.compareStateText(state) > 0);
|
||||
break;
|
||||
case "lteq":
|
||||
this.isOpen = !(this.compareStateText(state) > 0);
|
||||
break;
|
||||
case "gteq":
|
||||
this.isOpen = !(this.compareStateText(state) < 0);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
RevealWidget.prototype.readMatchState = function(state) {
|
||||
this.isOpen = state === this.text;
|
||||
RevealWidget.prototype.compareStateText = function(state) {
|
||||
return state.localeCompare(this.text,undefined,{numeric: true,sensitivity: "case"});
|
||||
};
|
||||
|
||||
RevealWidget.prototype.readPopupState = function(state) {
|
||||
@@ -182,6 +193,7 @@ RevealWidget.prototype.refresh = function(changedTiddlers) {
|
||||
Called by refresh() to dynamically show or hide the content
|
||||
*/
|
||||
RevealWidget.prototype.updateState = function() {
|
||||
var self = this;
|
||||
// Read the current state
|
||||
this.readState();
|
||||
// Construct the child nodes if needed
|
||||
@@ -202,8 +214,12 @@ RevealWidget.prototype.updateState = function() {
|
||||
$tw.anim.perform(this.openAnimation,domNode);
|
||||
} else {
|
||||
$tw.anim.perform(this.closeAnimation,domNode,{callback: function() {
|
||||
domNode.setAttribute("hidden","true");
|
||||
}});
|
||||
//make sure that the state hasn't changed during the close animation
|
||||
self.readState()
|
||||
if(!self.isOpen) {
|
||||
domNode.setAttribute("hidden","true");
|
||||
}
|
||||
}});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
||||
var value = this.selectDefault;
|
||||
// Get the value
|
||||
if(this.selectIndex) {
|
||||
value = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex);
|
||||
value = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex,value);
|
||||
} else {
|
||||
var tiddler = this.wiki.getTiddler(this.selectTitle);
|
||||
if(tiddler) {
|
||||
|
||||
@@ -41,6 +41,10 @@ SetWidget.prototype.execute = function() {
|
||||
this.setName = this.getAttribute("name","currentTiddler");
|
||||
this.setFilter = this.getAttribute("filter");
|
||||
this.setSelect = this.getAttribute("select");
|
||||
this.setTiddler = this.getAttribute("tiddler");
|
||||
this.setSubTiddler = this.getAttribute("subtiddler");
|
||||
this.setField = this.getAttribute("field");
|
||||
this.setIndex = this.getAttribute("index");
|
||||
this.setValue = this.getAttribute("value");
|
||||
this.setEmptyValue = this.getAttribute("emptyValue");
|
||||
// Set context variable
|
||||
@@ -54,9 +58,25 @@ Get the value to be assigned
|
||||
*/
|
||||
SetWidget.prototype.getValue = function() {
|
||||
var value = this.setValue;
|
||||
if(this.setFilter) {
|
||||
if(this.setTiddler) {
|
||||
var tiddler;
|
||||
if(this.setSubTiddler) {
|
||||
tiddler = this.wiki.getSubTiddler(this.setTiddler,this.setSubTiddler);
|
||||
} else {
|
||||
tiddler = this.wiki.getTiddler(this.setTiddler);
|
||||
}
|
||||
if(!tiddler) {
|
||||
value = this.setEmptyValue;
|
||||
} else if(this.setField) {
|
||||
value = tiddler.getFieldString(this.setField) || this.setEmptyValue;
|
||||
} else if(this.setIndex) {
|
||||
value = this.wiki.extractTiddlerDataItem(this.setTiddler,this.setIndex,this.setEmptyValue);
|
||||
} else {
|
||||
value = tiddler.fields.text || this.setEmptyValue ;
|
||||
}
|
||||
} else if(this.setFilter) {
|
||||
var results = this.wiki.filterTiddlers(this.setFilter,this);
|
||||
if(!this.setValue) {
|
||||
if(this.setValue == null) {
|
||||
var select;
|
||||
if(this.setSelect) {
|
||||
select = parseInt(this.setSelect,10);
|
||||
@@ -73,7 +93,7 @@ SetWidget.prototype.getValue = function() {
|
||||
} else if(!value && this.setEmptyValue) {
|
||||
value = this.setEmptyValue;
|
||||
}
|
||||
return value;
|
||||
return value || "";
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -81,7 +101,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
SetWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.name || changedAttributes.filter || changedAttributes.select ||changedAttributes.value || changedAttributes.emptyValue ||
|
||||
if(changedAttributes.name || changedAttributes.filter || changedAttributes.select || changedAttributes.tiddler || (this.setTiddler && changedTiddlers[this.setTiddler]) || changedAttributes.field || changedAttributes.index || changedAttributes.value || changedAttributes.emptyValue ||
|
||||
(this.setFilter && this.getValue() != this.variables[this.setName].value)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
|
||||
@@ -51,15 +51,16 @@ ViewWidget.prototype.execute = function() {
|
||||
this.viewIndex = this.getAttribute("index");
|
||||
this.viewFormat = this.getAttribute("format","text");
|
||||
this.viewTemplate = this.getAttribute("template","");
|
||||
this.viewMode = this.getAttribute("mode","block");
|
||||
switch(this.viewFormat) {
|
||||
case "htmlwikified":
|
||||
this.text = this.getValueAsHtmlWikified();
|
||||
this.text = this.getValueAsHtmlWikified(this.viewMode);
|
||||
break;
|
||||
case "plainwikified":
|
||||
this.text = this.getValueAsPlainWikified();
|
||||
this.text = this.getValueAsPlainWikified(this.viewMode);
|
||||
break;
|
||||
case "htmlencodedplainwikified":
|
||||
this.text = this.getValueAsHtmlEncodedPlainWikified();
|
||||
this.text = this.getValueAsHtmlEncodedPlainWikified(this.viewMode);
|
||||
break;
|
||||
case "htmlencoded":
|
||||
this.text = this.getValueAsHtmlEncoded();
|
||||
@@ -134,16 +135,25 @@ ViewWidget.prototype.getValueAsText = function() {
|
||||
return this.getValue({asString: true});
|
||||
};
|
||||
|
||||
ViewWidget.prototype.getValueAsHtmlWikified = function() {
|
||||
return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this});
|
||||
ViewWidget.prototype.getValueAsHtmlWikified = function(mode) {
|
||||
return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),{
|
||||
parseAsInline: mode !== "block",
|
||||
parentWidget: this
|
||||
});
|
||||
};
|
||||
|
||||
ViewWidget.prototype.getValueAsPlainWikified = function() {
|
||||
return this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this});
|
||||
ViewWidget.prototype.getValueAsPlainWikified = function(mode) {
|
||||
return this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{
|
||||
parseAsInline: mode !== "block",
|
||||
parentWidget: this
|
||||
});
|
||||
};
|
||||
|
||||
ViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function() {
|
||||
return $tw.utils.htmlEncode(this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this}));
|
||||
ViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function(mode) {
|
||||
return $tw.utils.htmlEncode(this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{
|
||||
parseAsInline: mode !== "block",
|
||||
parentWidget: this
|
||||
}));
|
||||
};
|
||||
|
||||
ViewWidget.prototype.getValueAsHtmlEncoded = function() {
|
||||
|
||||
@@ -83,52 +83,73 @@ options: see below
|
||||
Options include
|
||||
params: array of {name:, value:} for each parameter
|
||||
defaultValue: default value if the variable is not defined
|
||||
|
||||
Returns an object with the following fields:
|
||||
|
||||
params: array of {name:,value:} of parameters passed to wikitext variables
|
||||
text: text of variable, with parameters properly substituted
|
||||
*/
|
||||
Widget.prototype.getVariable = function(name,options) {
|
||||
Widget.prototype.getVariableInfo = function(name,options) {
|
||||
options = options || {};
|
||||
var actualParams = options.params || [],
|
||||
parentWidget = this.parentWidget;
|
||||
// Check for the variable defined in the parent widget (or an ancestor in the prototype chain)
|
||||
if(parentWidget && name in parentWidget.variables) {
|
||||
var variable = parentWidget.variables[name],
|
||||
value = variable.value;
|
||||
value = variable.value,
|
||||
params = this.resolveVariableParameters(variable.params,actualParams);
|
||||
// Substitute any parameters specified in the definition
|
||||
value = this.substituteVariableParameters(value,variable.params,actualParams);
|
||||
$tw.utils.each(params,function(param) {
|
||||
value = $tw.utils.replaceString(value,new RegExp("\\$" + $tw.utils.escapeRegExp(param.name) + "\\$","mg"),param.value);
|
||||
});
|
||||
value = this.substituteVariableReferences(value);
|
||||
return value;
|
||||
return {
|
||||
text: value,
|
||||
params: params
|
||||
};
|
||||
}
|
||||
// If the variable doesn't exist in the parent widget then look for a macro module
|
||||
return this.evaluateMacroModule(name,actualParams,options.defaultValue);
|
||||
return {
|
||||
text: this.evaluateMacroModule(name,actualParams,options.defaultValue)
|
||||
};
|
||||
};
|
||||
|
||||
Widget.prototype.substituteVariableParameters = function(text,formalParams,actualParams) {
|
||||
if(formalParams) {
|
||||
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
||||
paramInfo, paramValue;
|
||||
// Step through each of the parameters in the macro definition
|
||||
for(var p=0; p<formalParams.length; p++) {
|
||||
// Check if we've got a macro call parameter with the same name
|
||||
paramInfo = formalParams[p];
|
||||
paramValue = undefined;
|
||||
for(var m=0; m<actualParams.length; m++) {
|
||||
if(actualParams[m].name === paramInfo.name) {
|
||||
paramValue = actualParams[m].value;
|
||||
}
|
||||
/*
|
||||
Simplified version of getVariableInfo() that just returns the text
|
||||
*/
|
||||
Widget.prototype.getVariable = function(name,options) {
|
||||
return this.getVariableInfo(name,options).text;
|
||||
};
|
||||
|
||||
Widget.prototype.resolveVariableParameters = function(formalParams,actualParams) {
|
||||
formalParams = formalParams || [];
|
||||
actualParams = actualParams || [];
|
||||
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
||||
paramInfo, paramValue,
|
||||
results = [];
|
||||
// Step through each of the parameters in the macro definition
|
||||
for(var p=0; p<formalParams.length; p++) {
|
||||
// Check if we've got a macro call parameter with the same name
|
||||
paramInfo = formalParams[p];
|
||||
paramValue = undefined;
|
||||
for(var m=0; m<actualParams.length; m++) {
|
||||
if(actualParams[m].name === paramInfo.name) {
|
||||
paramValue = actualParams[m].value;
|
||||
}
|
||||
// If not, use the next available anonymous macro call parameter
|
||||
while(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {
|
||||
nextAnonParameter++;
|
||||
}
|
||||
if(paramValue === undefined && nextAnonParameter < actualParams.length) {
|
||||
paramValue = actualParams[nextAnonParameter++].value;
|
||||
}
|
||||
// If we've still not got a value, use the default, if any
|
||||
paramValue = paramValue || paramInfo["default"] || "";
|
||||
// Replace any instances of this parameter
|
||||
text = $tw.utils.replaceString(text,new RegExp("\\$" + $tw.utils.escapeRegExp(paramInfo.name) + "\\$","mg"),paramValue);
|
||||
}
|
||||
// If not, use the next available anonymous macro call parameter
|
||||
while(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {
|
||||
nextAnonParameter++;
|
||||
}
|
||||
if(paramValue === undefined && nextAnonParameter < actualParams.length) {
|
||||
paramValue = actualParams[nextAnonParameter++].value;
|
||||
}
|
||||
// If we've still not got a value, use the default, if any
|
||||
paramValue = paramValue || paramInfo["default"] || "";
|
||||
// Store the parameter name and value
|
||||
results.push({name: paramInfo.name, value: paramValue});
|
||||
}
|
||||
return text;
|
||||
return results;
|
||||
};
|
||||
|
||||
Widget.prototype.substituteVariableReferences = function(text) {
|
||||
|
||||
@@ -329,7 +329,7 @@ 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,isNumeric) {
|
||||
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric,isAlphaNumeric) {
|
||||
var self = this;
|
||||
titles.sort(function(a,b) {
|
||||
var x,y,
|
||||
@@ -358,6 +358,8 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
|
||||
y = Number(b);
|
||||
if(isNumeric && (!isNaN(x) || !isNaN(y))) {
|
||||
return compareNumbers(x,y);
|
||||
} else if(isAlphaNumeric) {
|
||||
return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"});
|
||||
} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {
|
||||
return isDescending ? b - a : a - b;
|
||||
} else {
|
||||
@@ -567,6 +569,8 @@ exports.sortByList = function(array,listTitle) {
|
||||
afterTitle = tiddler.fields["list-after"];
|
||||
if(beforeTitle === "") {
|
||||
newPos = 0;
|
||||
} else if(afterTitle === "") {
|
||||
newPos = titles.length;
|
||||
} else if(beforeTitle) {
|
||||
newPos = titles.indexOf(beforeTitle);
|
||||
} else if(afterTitle) {
|
||||
@@ -1125,16 +1129,24 @@ exports.checkTiddlerText = function(title,targetText,options) {
|
||||
/*
|
||||
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
||||
*/
|
||||
exports.readFiles = function(files,callback) {
|
||||
exports.readFiles = function(files,options) {
|
||||
var callback;
|
||||
if(typeof options === "function") {
|
||||
callback = options;
|
||||
options = {};
|
||||
} else {
|
||||
callback = options.callback;
|
||||
}
|
||||
var result = [],
|
||||
outstanding = files.length;
|
||||
for(var f=0; f<files.length; f++) {
|
||||
this.readFile(files[f],function(tiddlerFieldsArray) {
|
||||
outstanding = files.length,
|
||||
readFileCallback = function(tiddlerFieldsArray) {
|
||||
result.push.apply(result,tiddlerFieldsArray);
|
||||
if(--outstanding === 0) {
|
||||
callback(result);
|
||||
}
|
||||
});
|
||||
};
|
||||
for(var f=0; f<files.length; f++) {
|
||||
this.readFile(files[f],Object.assign({},options,{callback: readFileCallback}));
|
||||
}
|
||||
return files.length;
|
||||
};
|
||||
@@ -1142,7 +1154,14 @@ exports.readFiles = function(files,callback) {
|
||||
/*
|
||||
Read a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects
|
||||
*/
|
||||
exports.readFile = function(file,callback) {
|
||||
exports.readFile = function(file,options) {
|
||||
var callback;
|
||||
if(typeof options === "function") {
|
||||
callback = options;
|
||||
options = {};
|
||||
} else {
|
||||
callback = options.callback;
|
||||
}
|
||||
// Get the type, falling back to the filename extension
|
||||
var self = this,
|
||||
type = file.type;
|
||||
@@ -1162,6 +1181,22 @@ exports.readFile = function(file,callback) {
|
||||
if($tw.log.IMPORT) {
|
||||
console.log("Importing file '" + file.name + "', type: '" + type + "', isBinary: " + isBinary);
|
||||
}
|
||||
// Give the hook a chance to process the drag
|
||||
if($tw.hooks.invokeHook("th-importing-file",{
|
||||
file: file,
|
||||
type: type,
|
||||
isBinary: isBinary,
|
||||
callback: callback
|
||||
}) !== true) {
|
||||
this.readFileContent(file,type,isBinary,options.deserializer,callback);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Lower level utility to read the content of a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects
|
||||
*/
|
||||
exports.readFileContent = function(file,type,isBinary,deserializer,callback) {
|
||||
var self = this;
|
||||
// Create the FileReader
|
||||
var reader = new FileReader();
|
||||
// Onload
|
||||
@@ -1183,7 +1218,7 @@ exports.readFile = function(file,callback) {
|
||||
});
|
||||
} else {
|
||||
// Otherwise, just try to deserialise any tiddlers in the file
|
||||
callback(self.deserializeTiddlers(type,text,tiddlerFields));
|
||||
callback(self.deserializeTiddlers(type,text,tiddlerFields,{deserializer: deserializer}));
|
||||
}
|
||||
};
|
||||
// Kick off the read
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user