mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-25 12:23:42 +00:00
Compare commits
788 Commits
parser-var
...
external-t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75c1e4b4d8 | ||
|
|
979f079c7a | ||
|
|
d695fca301 | ||
|
|
a0d2392f01 | ||
|
|
23b4e03cd5 | ||
|
|
d5f72cb282 | ||
|
|
5f57bf81cd | ||
|
|
e32c9e4658 | ||
|
|
2a73505508 | ||
|
|
4d87ef4231 | ||
|
|
c543036a0f | ||
|
|
8ae4428332 | ||
|
|
2f133a08aa | ||
|
|
6b17e688da | ||
|
|
8654066f03 | ||
|
|
56dae90425 | ||
|
|
1f6ef07860 | ||
|
|
f30a455ee3 | ||
|
|
03bd99cd11 | ||
|
|
cc389ec82b | ||
|
|
f85678b6dc | ||
|
|
8d7c869072 | ||
|
|
8f592d3f0a | ||
|
|
1f2e0ed189 | ||
|
|
4d6c428ba9 | ||
|
|
d095aa0182 | ||
|
|
15bf850280 | ||
|
|
62b273266e | ||
|
|
1d058177be | ||
|
|
14676b345a | ||
|
|
a50e6eed38 | ||
|
|
073a064ae8 | ||
|
|
e00a3d3cb4 | ||
|
|
68d9200a6b | ||
|
|
2551bb3e3f | ||
|
|
80b18e6315 | ||
|
|
e0561397f1 | ||
|
|
b9c3c38edc | ||
|
|
077ced0d1a | ||
|
|
e5ff84035c | ||
|
|
e18a983209 | ||
|
|
6f61fa07fb | ||
|
|
d5d73e02e9 | ||
|
|
4ba7454d8d | ||
|
|
5192a39830 | ||
|
|
aa5413b942 | ||
|
|
ef284e9bde | ||
|
|
9c41fe1d18 | ||
|
|
e577cf7302 | ||
|
|
ebf563ac70 | ||
|
|
909340c6fe | ||
|
|
df6d38df65 | ||
|
|
59a53e695b | ||
|
|
6d17505f7b | ||
|
|
36dd8ea1d2 | ||
|
|
b965ae926b | ||
|
|
f6eadbd1c9 | ||
|
|
bdbb884be0 | ||
|
|
0be39cfbc2 | ||
|
|
ef2aeac7de | ||
|
|
157afda2fc | ||
|
|
fb4d77ef46 | ||
|
|
575c233597 | ||
|
|
2e59d770f7 | ||
|
|
baf0ee9cde | ||
|
|
af89bb591d | ||
|
|
d0dec741ad | ||
|
|
33a82e395e | ||
|
|
f223896c26 | ||
|
|
de33b365ae | ||
|
|
e9d8547a81 | ||
|
|
dcff318a98 | ||
|
|
f725123690 | ||
|
|
e9e5d37ff0 | ||
|
|
f70cee6907 | ||
|
|
1491339f50 | ||
|
|
8a5ed59ff4 | ||
|
|
a2ca5e4d1e | ||
|
|
fba993502d | ||
|
|
9fae3a932b | ||
|
|
62610f0666 | ||
|
|
7282ec5286 | ||
|
|
9830e0104f | ||
|
|
e6fd0caf6b | ||
|
|
137df37bc7 | ||
|
|
d895706199 | ||
|
|
6ed7d418b5 | ||
|
|
62b8a83741 | ||
|
|
e795b501ac | ||
|
|
03228d8d20 | ||
|
|
c9c5d4cf79 | ||
|
|
f5cc5bc6a1 | ||
|
|
447494ad4d | ||
|
|
c9f178ec87 | ||
|
|
33be326ef6 | ||
|
|
c13f04d838 | ||
|
|
737685149c | ||
|
|
33eef0202d | ||
|
|
a67b1b8bb5 | ||
|
|
124b49456a | ||
|
|
24956087cc | ||
|
|
199ca57f1c | ||
|
|
64d53ac533 | ||
|
|
b3accbf9e0 | ||
|
|
99249a3160 | ||
|
|
f7cd8bad3a | ||
|
|
e9613d7f12 | ||
|
|
97dff042f7 | ||
|
|
32b36fb2af | ||
|
|
41535150dd | ||
|
|
8e69284e8c | ||
|
|
61cfac4eeb | ||
|
|
2720072b23 | ||
|
|
0413c3a38e | ||
|
|
f2b30c1fe0 | ||
|
|
3c86cf7d2e | ||
|
|
451074f7ed | ||
|
|
1e5601ca31 | ||
|
|
75c99cd235 | ||
|
|
bb2c2be9b6 | ||
|
|
53c247b9a1 | ||
|
|
82667d9d16 | ||
|
|
97ed2757f0 | ||
|
|
19fd5ca5f2 | ||
|
|
6ae78a770f | ||
|
|
04962b4cd6 | ||
|
|
f97850dd05 | ||
|
|
2cb3ed3ab9 | ||
|
|
a4421f50c6 | ||
|
|
cb726f40fa | ||
|
|
be026aa308 | ||
|
|
0924ca6365 | ||
|
|
39fec2decf | ||
|
|
dbfd45814d | ||
|
|
d455072f13 | ||
|
|
155525708b | ||
|
|
fdca11dec3 | ||
|
|
f83875331d | ||
|
|
be6deb054e | ||
|
|
b0604a9bf5 | ||
|
|
30925ee7bf | ||
|
|
7204f442cd | ||
|
|
23fec9e390 | ||
|
|
8d9dc0cd29 | ||
|
|
a1d9464011 | ||
|
|
0b71f25f74 | ||
|
|
315464372f | ||
|
|
56068d8215 | ||
|
|
b95f6ca084 | ||
|
|
4a7f078abd | ||
|
|
1b55eb9eee | ||
|
|
3094e06236 | ||
|
|
f87b3bfcdb | ||
|
|
a0a0df9655 | ||
|
|
31c1584b9a | ||
|
|
f1f951e849 | ||
|
|
041c3e817c | ||
|
|
70e60cd93f | ||
|
|
54d8b8a373 | ||
|
|
dd6bd58140 | ||
|
|
a6990128f1 | ||
|
|
338b7c92a2 | ||
|
|
a409536ad0 | ||
|
|
c9af04d0e5 | ||
|
|
076a04fbfb | ||
|
|
83ee363cb4 | ||
|
|
63fa0c4fa4 | ||
|
|
644062fc21 | ||
|
|
021e9b8c4d | ||
|
|
afa653a7aa | ||
|
|
0b56d5fd37 | ||
|
|
2da7ae0b73 | ||
|
|
4c56bd771a | ||
|
|
9c0d6a46cc | ||
|
|
06318b7617 | ||
|
|
8f9e8c1dee | ||
|
|
3cd80de5bb | ||
|
|
f2e26927c1 | ||
|
|
960160b3a2 | ||
|
|
4f33d2f35c | ||
|
|
b5db488438 | ||
|
|
6dd1887f0b | ||
|
|
a70b26cd55 | ||
|
|
219beb13cc | ||
|
|
c18b7527a7 | ||
|
|
2f1806ab6a | ||
|
|
afa4ea3d03 | ||
|
|
2b911ac11f | ||
|
|
c4a7ae3164 | ||
|
|
056e6541a1 | ||
|
|
753bf8fe62 | ||
|
|
4f9dd50382 | ||
|
|
2e695801b1 | ||
|
|
55c522ab8f | ||
|
|
9faaa31299 | ||
|
|
582b156d5f | ||
|
|
652e8b1262 | ||
|
|
82ec63e711 | ||
|
|
51fd02d9b6 | ||
|
|
1a6d3e686b | ||
|
|
e694145eec | ||
|
|
8b8f654c9c | ||
|
|
9b247f6d63 | ||
|
|
3a740b23bb | ||
|
|
082aeb92ac | ||
|
|
903cfd98a6 | ||
|
|
eaf1da66b6 | ||
|
|
c6ed4aa84e | ||
|
|
123666c240 | ||
|
|
f342fdc41d | ||
|
|
ca96f7f62b | ||
|
|
68930ceb1b | ||
|
|
2f31eab8f4 | ||
|
|
fcea51bb95 | ||
|
|
8d7930f660 | ||
|
|
7a41283c6b | ||
|
|
c30ce544d1 | ||
|
|
dcba17fc5f | ||
|
|
2ab0474e14 | ||
|
|
61714cbda3 | ||
|
|
8fbf52e419 | ||
|
|
3fe5b77770 | ||
|
|
485779f5b2 | ||
|
|
3fc7895af2 | ||
|
|
bf25c4d34a | ||
|
|
10b20657cc | ||
|
|
0003d70132 | ||
|
|
81b5fe944a | ||
|
|
c8528fd1f7 | ||
|
|
07ac85d9fa | ||
|
|
270ead4701 | ||
|
|
1ddc3ab037 | ||
|
|
05d38054c8 | ||
|
|
c7f6cedc43 | ||
|
|
ec1df7edf0 | ||
|
|
dbd3f835bf | ||
|
|
fe12a4adbf | ||
|
|
e84f214280 | ||
|
|
b267a71f2d | ||
|
|
e7b3f69162 | ||
|
|
f4d7b2c7f7 | ||
|
|
e699cf1fe8 | ||
|
|
9cd65efad9 | ||
|
|
d8ac00a108 | ||
|
|
cf56a17f28 | ||
|
|
3f98686153 | ||
|
|
cb44cc0f2b | ||
|
|
44df6fe52f | ||
|
|
41200ab6d7 | ||
|
|
cb34c695b5 | ||
|
|
07caa16e87 | ||
|
|
30d23196b6 | ||
|
|
bf773eb39a | ||
|
|
4a99e0cc7d | ||
|
|
e2379b599e | ||
|
|
8203ee06c3 | ||
|
|
ac15334bb0 | ||
|
|
8849ed0d46 | ||
|
|
62fdaa633a | ||
|
|
79f5e6b498 | ||
|
|
23bd7e7817 | ||
|
|
ca1cf7bb41 | ||
|
|
80133895ba | ||
|
|
792171c8fc | ||
|
|
5e236d35a5 | ||
|
|
051a468c63 | ||
|
|
85ba7ac041 | ||
|
|
a725da2b39 | ||
|
|
7878e77e96 | ||
|
|
c325380231 | ||
|
|
a6a2535c3a | ||
|
|
caec6bc3fe | ||
|
|
ac022ec79f | ||
|
|
89546b3357 | ||
|
|
55173c17a3 | ||
|
|
7f3fed2f50 | ||
|
|
eced60853f | ||
|
|
b9647b2c48 | ||
|
|
953fb9f237 | ||
|
|
b90aad9cea | ||
|
|
e2d35751e2 | ||
|
|
fdf89f83c2 | ||
|
|
dce425ecb8 | ||
|
|
55735d7552 | ||
|
|
a8fe653e3c | ||
|
|
013218b852 | ||
|
|
c976aad5e0 | ||
|
|
28521d82f3 | ||
|
|
54d3782167 | ||
|
|
ef6307a64e | ||
|
|
3b35411aba | ||
|
|
d6ea369f5e | ||
|
|
894fb1ad35 | ||
|
|
9a3c60173a | ||
|
|
55e44a9554 | ||
|
|
860568136f | ||
|
|
85835ebe42 | ||
|
|
3d608892bd | ||
|
|
5be647b610 | ||
|
|
a2e7cc51b5 | ||
|
|
c3955c3cf9 | ||
|
|
226df2ad7d | ||
|
|
8d763f7682 | ||
|
|
f5887d9e25 | ||
|
|
7f202f35b4 | ||
|
|
9c31ff1fb1 | ||
|
|
0beac47243 | ||
|
|
99bef2614c | ||
|
|
a44a8c31f0 | ||
|
|
8aad7b00ab | ||
|
|
a38dc17300 | ||
|
|
9af68297cd | ||
|
|
80ee5adb14 | ||
|
|
743d9c56c0 | ||
|
|
427eb6d085 | ||
|
|
715ce6b603 | ||
|
|
a6958bfe85 | ||
|
|
7b1a0c6e6a | ||
|
|
e157d16b72 | ||
|
|
05acf3dce4 | ||
|
|
37fd52e6c9 | ||
|
|
85646e5db3 | ||
|
|
9eda02868f | ||
|
|
8980927b54 | ||
|
|
c69a3e827a | ||
|
|
3c9ee052a3 | ||
|
|
81546c5bf4 | ||
|
|
5e4430dbf9 | ||
|
|
93f4b5dac9 | ||
|
|
b58e4236b7 | ||
|
|
60e40b5af9 | ||
|
|
6e93770459 | ||
|
|
d56e8764a1 | ||
|
|
e84c87ef37 | ||
|
|
ef76349c37 | ||
|
|
010fa140c7 | ||
|
|
625ea364c4 | ||
|
|
5ad1193eb6 | ||
|
|
0ed32fded9 | ||
|
|
50d0b6ee50 | ||
|
|
c0dc2669c0 | ||
|
|
40d21f607a | ||
|
|
bfa062f23d | ||
|
|
9f9ce6595b | ||
|
|
12f1847475 | ||
|
|
f2aba29d94 | ||
|
|
6a55069609 | ||
|
|
3eefb3cce6 | ||
|
|
2b41661721 | ||
|
|
a360adbba9 | ||
|
|
4c7dcb83d1 | ||
|
|
010158db81 | ||
|
|
45355a7fcf | ||
|
|
f77015ea18 | ||
|
|
8bab081c9e | ||
|
|
4667139864 | ||
|
|
2e47f277ac | ||
|
|
ea12994f47 | ||
|
|
b4605e3573 | ||
|
|
674d55db06 | ||
|
|
678ec7b3dd | ||
|
|
53ebfffedf | ||
|
|
1ec532ea50 | ||
|
|
3c3f1b60c6 | ||
|
|
ae273a08f1 | ||
|
|
36de5f65ff | ||
|
|
7be1e7e5f8 | ||
|
|
b205da2007 | ||
|
|
ffc8feea0c | ||
|
|
ce8c03250c | ||
|
|
82b7167d55 | ||
|
|
afa490a0c1 | ||
|
|
8344d13efb | ||
|
|
17b4f53ba2 | ||
|
|
a8457f7f9e | ||
|
|
ca95f1069f | ||
|
|
65ffe96cc2 | ||
|
|
b8a9826f23 | ||
|
|
65932a9b21 | ||
|
|
af897361c7 | ||
|
|
4858b24cfe | ||
|
|
5125b91b3f | ||
|
|
b632cea6b7 | ||
|
|
eadbd62e6d | ||
|
|
e280f89ca5 | ||
|
|
87b9dbcda1 | ||
|
|
5832002feb | ||
|
|
6a98106679 | ||
|
|
d5175e4fdc | ||
|
|
58010e089f | ||
|
|
6edcbfd0cd | ||
|
|
be70e5851d | ||
|
|
6f62c4fc7f | ||
|
|
4fe411be80 | ||
|
|
ac40ee4246 | ||
|
|
bbe94f3544 | ||
|
|
03626bc142 | ||
|
|
69e595abf9 | ||
|
|
e96a54c753 | ||
|
|
a8639c3129 | ||
|
|
3ae27cab9e | ||
|
|
9434e95396 | ||
|
|
fecf622616 | ||
|
|
d25e540dd2 | ||
|
|
4ee3ded04a | ||
|
|
87704b1770 | ||
|
|
493b45706f | ||
|
|
0ea89970d1 | ||
|
|
c2c8892aa5 | ||
|
|
7ec6d37031 | ||
|
|
24646e1993 | ||
|
|
1e1b52088f | ||
|
|
ac8f521303 | ||
|
|
2ab5fd9abb | ||
|
|
f6339d437e | ||
|
|
8e61e37f2b | ||
|
|
2632ed0078 | ||
|
|
7cb6dc0e4f | ||
|
|
8620b77b45 | ||
|
|
03ad396db1 | ||
|
|
9e70e89a84 | ||
|
|
2f8a100bab | ||
|
|
a9a36b641a | ||
|
|
625c3de6f7 | ||
|
|
ddda9a34ae | ||
|
|
c0a56e790d | ||
|
|
dc83ee411d | ||
|
|
3c003364d2 | ||
|
|
1e9cc2b747 | ||
|
|
f968130696 | ||
|
|
e046d5ad76 | ||
|
|
3c3cd4673e | ||
|
|
d50f6b406e | ||
|
|
c1a1e272cc | ||
|
|
81947edd5c | ||
|
|
88e29b4558 | ||
|
|
8798ebadbd | ||
|
|
a17fa35c28 | ||
|
|
0911d99813 | ||
|
|
93309b0b7d | ||
|
|
c0dd13d446 | ||
|
|
ae61b08ae5 | ||
|
|
f60d0ef109 | ||
|
|
6ca89304a1 | ||
|
|
78c2beb640 | ||
|
|
e34a88e3e4 | ||
|
|
0d2b6cf837 | ||
|
|
1af1f6621a | ||
|
|
50d8325d4c | ||
|
|
3016b3d094 | ||
|
|
da5d12d6fb | ||
|
|
cd5d9bd5b9 | ||
|
|
1e1aeefd93 | ||
|
|
1d7091e637 | ||
|
|
4334de88a0 | ||
|
|
bb6d41f3dd | ||
|
|
a878d82c7a | ||
|
|
85ff47366c | ||
|
|
ce5d20b8fc | ||
|
|
2c76cfa67a | ||
|
|
90f05295a2 | ||
|
|
5df0225356 | ||
|
|
c3e34b469c | ||
|
|
e8815b79ff | ||
|
|
958f57f2c0 | ||
|
|
43a3228200 | ||
|
|
96d4f87e78 | ||
|
|
a8c1e6a3bd | ||
|
|
36fe519eff | ||
|
|
b2d270a7e8 | ||
|
|
005f7c55b6 | ||
|
|
122306fc24 | ||
|
|
0b1a05d10d | ||
|
|
b0f6d50b60 | ||
|
|
a3a7d6450d | ||
|
|
a857b4ab9a | ||
|
|
c4dcf510ef | ||
|
|
7fd24de372 | ||
|
|
396703c478 | ||
|
|
bfc4b447da | ||
|
|
d957b3e4e6 | ||
|
|
f798eab33f | ||
|
|
fbe5bb229a | ||
|
|
ae5d78b4dd | ||
|
|
9825b5b4a0 | ||
|
|
8799911162 | ||
|
|
813e28e1ea | ||
|
|
911e23ee6d | ||
|
|
046746ba20 | ||
|
|
8ffe138942 | ||
|
|
15be409c42 | ||
|
|
c92f9dd404 | ||
|
|
2bbcc94b4d | ||
|
|
1f5e1205ec | ||
|
|
6b03105bed | ||
|
|
9d5babc248 | ||
|
|
e620aaed80 | ||
|
|
552843369c | ||
|
|
f0eba7fdc6 | ||
|
|
9871c1a6a9 | ||
|
|
a1ef66ec6d | ||
|
|
fc797f3722 | ||
|
|
c6bb783308 | ||
|
|
c3055f92a9 | ||
|
|
4079f72310 | ||
|
|
cc1f32067f | ||
|
|
880930da8b | ||
|
|
68cb08749f | ||
|
|
13b69a9c10 | ||
|
|
b63049b4df | ||
|
|
6a91dbfe2f | ||
|
|
dde4182830 | ||
|
|
abe9af1369 | ||
|
|
6f09a5ee65 | ||
|
|
706fc3e06e | ||
|
|
6a319940d3 | ||
|
|
fe8606759e | ||
|
|
1de747b182 | ||
|
|
3406b98af6 | ||
|
|
80191903b6 | ||
|
|
367854c81b | ||
|
|
4f13848ca2 | ||
|
|
fd3e77d38f | ||
|
|
8fc6910c03 | ||
|
|
4623c45d29 | ||
|
|
5cbe4c5317 | ||
|
|
4d9e6831bb | ||
|
|
5887c6621e | ||
|
|
ce937595d7 | ||
|
|
cc850d7151 | ||
|
|
a21428a33a | ||
|
|
12bb938463 | ||
|
|
e54f3368e9 | ||
|
|
eb7f59a855 | ||
|
|
b3cbd7d733 | ||
|
|
28724138d1 | ||
|
|
62a2a0e579 | ||
|
|
98e60758a9 | ||
|
|
c655ec5469 | ||
|
|
7d2703bffb | ||
|
|
09d7a77f1b | ||
|
|
8005c91e79 | ||
|
|
86a9f922bf | ||
|
|
2175be27b0 | ||
|
|
9637a29e55 | ||
|
|
8320a55fef | ||
|
|
2267e31546 | ||
|
|
e3bf1f43cf | ||
|
|
64ac29adca | ||
|
|
94ffb50e04 | ||
|
|
3e3f185562 | ||
|
|
6c98bb706a | ||
|
|
4f88d79d8b | ||
|
|
0e247c991d | ||
|
|
ce27492b96 | ||
|
|
a9d583b85e | ||
|
|
5769cf9784 | ||
|
|
c854e518fa | ||
|
|
7327a3fb92 | ||
|
|
50a3c5526f | ||
|
|
77971ff720 | ||
|
|
e0f4d82214 | ||
|
|
af72fdf245 | ||
|
|
519962b4a9 | ||
|
|
c9a77c5877 | ||
|
|
3d93790573 | ||
|
|
cb62c8c96d | ||
|
|
aa6f152d35 | ||
|
|
72b32946aa | ||
|
|
60850ee69b | ||
|
|
8c4d67ba2b | ||
|
|
3c195b05cb | ||
|
|
530b4308e3 | ||
|
|
fa63ac5d1e | ||
|
|
51ca14861e | ||
|
|
d2f87d6200 | ||
|
|
a0f145197c | ||
|
|
c97003238b | ||
|
|
4f07539164 | ||
|
|
5945506169 | ||
|
|
483fd941f5 | ||
|
|
1339c23b3a | ||
|
|
89541edcff | ||
|
|
fd14e94610 | ||
|
|
f591a78f37 | ||
|
|
e2bea854b6 | ||
|
|
0d434583ec | ||
|
|
a81b7fc9f4 | ||
|
|
da66323dc5 | ||
|
|
0be778fc27 | ||
|
|
37f4421ed1 | ||
|
|
f61906501d | ||
|
|
1a8c6fdc4b | ||
|
|
6f8dca956b | ||
|
|
061b75741b | ||
|
|
d181b96518 | ||
|
|
527638d5e6 | ||
|
|
b95f9e6000 | ||
|
|
6d5ea90bfd | ||
|
|
eae3da0e9d | ||
|
|
684f13fbcb | ||
|
|
8cd13e2f89 | ||
|
|
3b75297168 | ||
|
|
2b60ab1fdc | ||
|
|
d6e055368d | ||
|
|
fc1721709a | ||
|
|
43061e64a6 | ||
|
|
d8d88c67e3 | ||
|
|
ffd6a8cce7 | ||
|
|
a637f7fb60 | ||
|
|
ca4cdc81dd | ||
|
|
13499557bf | ||
|
|
a2b2e117e3 | ||
|
|
d9b8a800c6 | ||
|
|
2aa6e761fd | ||
|
|
7078ca2c1e | ||
|
|
04bf6e0fd8 | ||
|
|
bb6fee4e1c | ||
|
|
f087a62c99 | ||
|
|
1b31c25ea7 | ||
|
|
02a956b1bb | ||
|
|
cc3462999b | ||
|
|
b63c90e401 | ||
|
|
497b334d60 | ||
|
|
fa373a1c6f | ||
|
|
1eac5c051f | ||
|
|
568990409a | ||
|
|
09f7ad84b2 | ||
|
|
445c15e719 | ||
|
|
27bed615ab | ||
|
|
1ec8b7877e | ||
|
|
59c6f4447e | ||
|
|
343207fc35 | ||
|
|
519ce3e89d | ||
|
|
71194d8767 | ||
|
|
480e4e2ce9 | ||
|
|
db48ce5f2c | ||
|
|
4d85d267a1 | ||
|
|
98f67373b1 | ||
|
|
e574cb4724 | ||
|
|
e72d90c227 | ||
|
|
c729115506 | ||
|
|
9854a4fc08 | ||
|
|
9fe4c4889a | ||
|
|
750f56a235 | ||
|
|
66636d1a86 | ||
|
|
2a7cdb22c0 | ||
|
|
b69b84b38e | ||
|
|
ee250bf6c9 | ||
|
|
de69ab0d0e | ||
|
|
cf58dcf116 | ||
|
|
53922d3558 | ||
|
|
c41e34793d | ||
|
|
5aa4e4cb68 | ||
|
|
2b31c7a509 | ||
|
|
0bd866e2f9 | ||
|
|
93e7380188 | ||
|
|
9003c81039 | ||
|
|
900a29fbb3 | ||
|
|
1b226c7556 | ||
|
|
b3d0303139 | ||
|
|
feefc4cceb | ||
|
|
d51975b183 | ||
|
|
15e8772170 | ||
|
|
bc5143f190 | ||
|
|
458460354e | ||
|
|
78c72b85fb | ||
|
|
22e25c05eb | ||
|
|
4394b8e723 | ||
|
|
2bd9cc45fa | ||
|
|
d5c4aa250a | ||
|
|
70561bd481 | ||
|
|
2f5f0db00f | ||
|
|
4a6aa865b3 | ||
|
|
f29d24a1f5 | ||
|
|
2818f52f95 | ||
|
|
9453c4d684 | ||
|
|
42b965c9f0 | ||
|
|
e9a635dc81 | ||
|
|
26ade60e93 | ||
|
|
e7245a709c | ||
|
|
a6efc14a7c | ||
|
|
9fbcdeb29e | ||
|
|
ef1b7d619a | ||
|
|
ec70e5c179 | ||
|
|
4de0dc301b | ||
|
|
769ffa19b7 | ||
|
|
c0b021f509 | ||
|
|
635ec65d3f | ||
|
|
da06b64845 | ||
|
|
ecb3c86e7b | ||
|
|
c6cd4d33e6 | ||
|
|
77fe6244a2 | ||
|
|
f6e485b897 | ||
|
|
4b5d287c90 | ||
|
|
c01e9cef12 | ||
|
|
655501140b | ||
|
|
cae32d39a5 | ||
|
|
bc5609820f | ||
|
|
4914208011 | ||
|
|
b8fa6f0f0a | ||
|
|
9605d94b6c | ||
|
|
49b11bc493 | ||
|
|
9a4eb1e835 | ||
|
|
e71bf27dae | ||
|
|
c985fd63f9 | ||
|
|
f5ad5010bc | ||
|
|
12be7ac7e9 | ||
|
|
651619076a | ||
|
|
57ba4c8cba | ||
|
|
6a01ab20a0 | ||
|
|
81e3ab0bc5 | ||
|
|
e43ffe860b | ||
|
|
d0081a7247 | ||
|
|
972456ca07 | ||
|
|
9eec6ff915 | ||
|
|
c9efa23f02 | ||
|
|
3843c61132 | ||
|
|
f6938d6abb | ||
|
|
aa7a00d080 | ||
|
|
4c6de22711 | ||
|
|
83f976ea54 | ||
|
|
3153c588ec | ||
|
|
0ce1843070 | ||
|
|
15338e60e8 | ||
|
|
f7f55e8eff | ||
|
|
5cc1600072 | ||
|
|
1a91f81976 | ||
|
|
b9234fe238 | ||
|
|
4cdbe6540b | ||
|
|
4877891980 | ||
|
|
a1b486436e | ||
|
|
c3a8cc7eb4 | ||
|
|
707e9d8926 | ||
|
|
adf0c1a12a | ||
|
|
fd4cfaeb02 | ||
|
|
ae8ee5b955 | ||
|
|
7686be7b14 | ||
|
|
84479bc403 | ||
|
|
794dfb96f2 | ||
|
|
d254612826 | ||
|
|
c8721b38fd | ||
|
|
f863acf8ac | ||
|
|
7e7ecbe7a5 | ||
|
|
4ecd885a0c | ||
|
|
dbda09b9fc | ||
|
|
41931082e6 | ||
|
|
5af76c5ea1 | ||
|
|
1446a1e44c | ||
|
|
69c12618d9 | ||
|
|
651fb777ab | ||
|
|
34a51d2e23 | ||
|
|
2fc62c1a52 | ||
|
|
5ebd98779a | ||
|
|
405c618b6b | ||
|
|
773dcce713 | ||
|
|
87dc67d0cd | ||
|
|
68b455565b | ||
|
|
c60402b06d | ||
|
|
c187f4b238 | ||
|
|
4eda601a32 | ||
|
|
8bfd8f3a26 | ||
|
|
ba9de17b87 | ||
|
|
2b4619dcbe | ||
|
|
bb20d43cbf | ||
|
|
9c29b15fcd | ||
|
|
994a91001d | ||
|
|
c85c172fe4 | ||
|
|
eeb06a75a6 | ||
|
|
ff9539059a | ||
|
|
5831df9ece | ||
|
|
b7f758bbbe | ||
|
|
36509509bc | ||
|
|
e83d0fb6f5 | ||
|
|
a65e9a7b42 | ||
|
|
9b912f6d65 | ||
|
|
4b45afc11f | ||
|
|
e714693cfe | ||
|
|
dffd4e56b5 | ||
|
|
a0b3e1a564 | ||
|
|
4efd5288d0 | ||
|
|
a2d3778465 | ||
|
|
f2917c3355 | ||
|
|
4fcbaa2b12 | ||
|
|
d29b9c2726 | ||
|
|
97bb1fa8c9 | ||
|
|
2e5035ec2a | ||
|
|
b292985df3 |
15
.eslintignore
Normal file
15
.eslintignore
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Known minified files
|
||||||
|
/boot/sjcl.js
|
||||||
|
/core/modules/utils/base64-utf8/base64-utf8.module.min.js
|
||||||
|
/core/modules/utils/diff-match-patch/diff_match_patch.js
|
||||||
|
/plugins/tiddlywiki/async/files/async.min.v1.5.0.js
|
||||||
|
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js
|
||||||
|
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js
|
||||||
|
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js
|
||||||
|
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js
|
||||||
|
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js
|
||||||
|
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js
|
||||||
|
/plugins/tiddlywiki/codemirror-closebrackets/files/addon/edit/closebrackets.js
|
||||||
|
/plugins/tiddlywiki/codemirror-closebrackets/files/addon/edit/matchbrackets.js
|
||||||
|
/plugins/tiddlywiki/codemirror-closetag/files/addon/edit/closetag.js
|
||||||
|
/plugins/tiddlywiki/codemirror-closetag/files/addon/fold/xml-fold.js
|
||||||
267
.eslintrc.yml
Normal file
267
.eslintrc.yml
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
env:
|
||||||
|
browser: true
|
||||||
|
commonjs: true
|
||||||
|
es2021: true
|
||||||
|
node: true
|
||||||
|
extends: 'eslint:recommended'
|
||||||
|
globals:
|
||||||
|
"$tw": "writable" # temporary
|
||||||
|
parserOptions:
|
||||||
|
ecmaVersion: 5
|
||||||
|
rules:
|
||||||
|
array-bracket-newline: 'off'
|
||||||
|
array-bracket-spacing: 'off'
|
||||||
|
array-callback-return: 'off'
|
||||||
|
array-element-newline: 'off'
|
||||||
|
arrow-body-style: error
|
||||||
|
arrow-parens:
|
||||||
|
- error
|
||||||
|
- as-needed
|
||||||
|
arrow-spacing:
|
||||||
|
- error
|
||||||
|
- after: true
|
||||||
|
before: true
|
||||||
|
block-scoped-var: 'off'
|
||||||
|
block-spacing: 'off'
|
||||||
|
brace-style: 'off'
|
||||||
|
callback-return: 'off'
|
||||||
|
camelcase: 'off'
|
||||||
|
capitalized-comments: 'off'
|
||||||
|
class-methods-use-this: error
|
||||||
|
comma-dangle: 'off'
|
||||||
|
comma-spacing: 'off'
|
||||||
|
comma-style: 'off'
|
||||||
|
complexity: 'off'
|
||||||
|
computed-property-spacing: 'off'
|
||||||
|
consistent-return: 'off'
|
||||||
|
consistent-this: 'off'
|
||||||
|
curly: 'off'
|
||||||
|
default-case: 'off'
|
||||||
|
default-case-last: error
|
||||||
|
default-param-last: error
|
||||||
|
dot-location: 'off'
|
||||||
|
dot-notation: 'off'
|
||||||
|
eol-last: 'off'
|
||||||
|
eqeqeq: 'off'
|
||||||
|
func-call-spacing: 'off'
|
||||||
|
func-name-matching: 'off'
|
||||||
|
func-names: 'off'
|
||||||
|
func-style: 'off'
|
||||||
|
function-call-argument-newline: 'off'
|
||||||
|
function-paren-newline: 'off'
|
||||||
|
generator-star-spacing: error
|
||||||
|
global-require: 'off'
|
||||||
|
grouped-accessor-pairs: error
|
||||||
|
guard-for-in: 'off'
|
||||||
|
handle-callback-err: 'off'
|
||||||
|
id-blacklist: error
|
||||||
|
id-denylist: error
|
||||||
|
id-length: 'off'
|
||||||
|
id-match: error
|
||||||
|
implicit-arrow-linebreak: error
|
||||||
|
indent: 'off'
|
||||||
|
indent-legacy: 'off'
|
||||||
|
init-declarations: 'off'
|
||||||
|
jsx-quotes: error
|
||||||
|
key-spacing: 'off'
|
||||||
|
keyword-spacing: 'off'
|
||||||
|
line-comment-position: 'off'
|
||||||
|
linebreak-style: 'off'
|
||||||
|
lines-around-comment: 'off'
|
||||||
|
lines-around-directive: 'off'
|
||||||
|
lines-between-class-members: error
|
||||||
|
max-classes-per-file: error
|
||||||
|
max-depth: 'off'
|
||||||
|
max-len: 'off'
|
||||||
|
max-lines: 'off'
|
||||||
|
max-lines-per-function: 'off'
|
||||||
|
max-nested-callbacks: error
|
||||||
|
max-params: 'off'
|
||||||
|
max-statements: 'off'
|
||||||
|
max-statements-per-line: 'off'
|
||||||
|
multiline-comment-style: 'off'
|
||||||
|
multiline-ternary: 'off'
|
||||||
|
new-parens: 'off'
|
||||||
|
newline-after-var: 'off'
|
||||||
|
newline-before-return: 'off'
|
||||||
|
newline-per-chained-call: 'off'
|
||||||
|
no-alert: 'off'
|
||||||
|
no-array-constructor: 'off'
|
||||||
|
no-await-in-loop: error
|
||||||
|
no-bitwise: 'off'
|
||||||
|
no-buffer-constructor: 'off'
|
||||||
|
no-caller: error
|
||||||
|
no-catch-shadow: 'off'
|
||||||
|
no-confusing-arrow: error
|
||||||
|
no-console: 'off'
|
||||||
|
no-constant-condition:
|
||||||
|
- error
|
||||||
|
- checkLoops: false
|
||||||
|
no-constructor-return: error
|
||||||
|
no-continue: 'off'
|
||||||
|
no-div-regex: 'off'
|
||||||
|
no-duplicate-imports: error
|
||||||
|
no-else-return: 'off'
|
||||||
|
no-empty-function: 'off'
|
||||||
|
no-eq-null: 'off'
|
||||||
|
no-eval: 'off'
|
||||||
|
no-extend-native: 'off'
|
||||||
|
no-extra-bind: 'off'
|
||||||
|
no-extra-label: 'off'
|
||||||
|
no-extra-parens: 'off'
|
||||||
|
no-floating-decimal: 'off'
|
||||||
|
no-implicit-coercion:
|
||||||
|
- error
|
||||||
|
- boolean: false
|
||||||
|
number: false
|
||||||
|
string: false
|
||||||
|
no-implicit-globals: 'off'
|
||||||
|
no-implied-eval: error
|
||||||
|
no-inline-comments: 'off'
|
||||||
|
no-invalid-this: 'off'
|
||||||
|
no-iterator: error
|
||||||
|
no-label-var: 'off'
|
||||||
|
no-labels: 'off'
|
||||||
|
no-lone-blocks: 'off'
|
||||||
|
no-lonely-if: 'off'
|
||||||
|
no-loop-func: 'off'
|
||||||
|
no-loss-of-precision: error
|
||||||
|
no-magic-numbers: 'off'
|
||||||
|
no-mixed-operators: 'off'
|
||||||
|
no-mixed-requires: 'off'
|
||||||
|
no-multi-assign: 'off'
|
||||||
|
no-multi-spaces: 'off'
|
||||||
|
no-multi-str: error
|
||||||
|
no-multiple-empty-lines: 'off'
|
||||||
|
no-native-reassign: 'off'
|
||||||
|
no-negated-condition: 'off'
|
||||||
|
no-negated-in-lhs: error
|
||||||
|
no-nested-ternary: 'off'
|
||||||
|
no-new: 'off'
|
||||||
|
no-new-func: 'off'
|
||||||
|
no-new-object: 'off'
|
||||||
|
no-new-require: error
|
||||||
|
no-new-wrappers: error
|
||||||
|
no-octal-escape: error
|
||||||
|
no-param-reassign: 'off'
|
||||||
|
no-path-concat: error
|
||||||
|
no-plusplus: 'off'
|
||||||
|
no-process-env: 'off'
|
||||||
|
no-process-exit: 'off'
|
||||||
|
no-promise-executor-return: error
|
||||||
|
no-proto: 'off'
|
||||||
|
no-restricted-exports: error
|
||||||
|
no-restricted-globals: error
|
||||||
|
no-restricted-imports: error
|
||||||
|
no-restricted-modules: error
|
||||||
|
no-restricted-properties: error
|
||||||
|
no-restricted-syntax: error
|
||||||
|
no-return-assign: 'off'
|
||||||
|
no-return-await: error
|
||||||
|
no-script-url: 'off'
|
||||||
|
no-self-compare: 'off'
|
||||||
|
no-sequences: 'off'
|
||||||
|
no-shadow: 'off'
|
||||||
|
no-spaced-func: 'off'
|
||||||
|
no-sync: 'off'
|
||||||
|
no-tabs: 'off'
|
||||||
|
no-template-curly-in-string: error
|
||||||
|
no-ternary: 'off'
|
||||||
|
no-throw-literal: 'off'
|
||||||
|
no-trailing-spaces: 'off'
|
||||||
|
no-undef-init: 'off'
|
||||||
|
no-undefined: 'off'
|
||||||
|
no-underscore-dangle: 'off'
|
||||||
|
no-unmodified-loop-condition: 'off'
|
||||||
|
no-unneeded-ternary: 'off'
|
||||||
|
no-unreachable-loop: error
|
||||||
|
no-unused-expressions: 'off'
|
||||||
|
no-use-before-define: 'off'
|
||||||
|
no-useless-backreference: error
|
||||||
|
no-useless-call: 'off'
|
||||||
|
no-useless-computed-key: error
|
||||||
|
no-useless-concat: 'off'
|
||||||
|
no-useless-constructor: error
|
||||||
|
no-useless-rename: error
|
||||||
|
no-useless-return: 'off'
|
||||||
|
no-var: 'off'
|
||||||
|
no-void: 'off'
|
||||||
|
no-warning-comments: 'off'
|
||||||
|
no-whitespace-before-property: error
|
||||||
|
nonblock-statement-body-position:
|
||||||
|
- error
|
||||||
|
- any
|
||||||
|
object-curly-newline: 'off'
|
||||||
|
object-curly-spacing: 'off'
|
||||||
|
object-property-newline: 'off'
|
||||||
|
object-shorthand: 'off'
|
||||||
|
one-var: 'off'
|
||||||
|
one-var-declaration-per-line: 'off'
|
||||||
|
operator-assignment: 'off'
|
||||||
|
operator-linebreak: 'off'
|
||||||
|
padded-blocks: 'off'
|
||||||
|
padding-line-between-statements: error
|
||||||
|
prefer-arrow-callback: 'off'
|
||||||
|
prefer-const: 'off'
|
||||||
|
prefer-destructuring: 'off'
|
||||||
|
prefer-exponentiation-operator: 'off'
|
||||||
|
prefer-named-capture-group: 'off'
|
||||||
|
prefer-numeric-literals: error
|
||||||
|
prefer-object-spread: 'off'
|
||||||
|
prefer-promise-reject-errors: error
|
||||||
|
prefer-reflect: 'off'
|
||||||
|
prefer-regex-literals: 'off'
|
||||||
|
prefer-rest-params: 'off'
|
||||||
|
prefer-spread: 'off'
|
||||||
|
prefer-template: 'off'
|
||||||
|
quote-props: 'off'
|
||||||
|
quotes: 'off'
|
||||||
|
radix: 'off'
|
||||||
|
require-atomic-updates: error
|
||||||
|
require-await: error
|
||||||
|
require-jsdoc: 'off'
|
||||||
|
require-unicode-regexp: 'off'
|
||||||
|
rest-spread-spacing: error
|
||||||
|
semi: 'off'
|
||||||
|
semi-spacing: 'off'
|
||||||
|
semi-style: 'off'
|
||||||
|
sort-imports: error
|
||||||
|
sort-keys: 'off'
|
||||||
|
sort-vars: 'off'
|
||||||
|
space-before-blocks: 'off'
|
||||||
|
space-before-function-paren: 'off'
|
||||||
|
space-in-parens: 'off'
|
||||||
|
space-infix-ops: 'off'
|
||||||
|
space-unary-ops: 'off'
|
||||||
|
spaced-comment: 'off'
|
||||||
|
strict: 'off'
|
||||||
|
switch-colon-spacing: 'off'
|
||||||
|
symbol-description: error
|
||||||
|
template-curly-spacing: error
|
||||||
|
template-tag-spacing: error
|
||||||
|
unicode-bom:
|
||||||
|
- error
|
||||||
|
- never
|
||||||
|
valid-jsdoc: 'off'
|
||||||
|
valid-typeof:
|
||||||
|
- error
|
||||||
|
- requireStringLiterals: false
|
||||||
|
vars-on-top: 'off'
|
||||||
|
wrap-iife: 'off'
|
||||||
|
wrap-regex: 'off'
|
||||||
|
yield-star-spacing: error
|
||||||
|
yoda: 'off'
|
||||||
|
|
||||||
|
# temporary rules
|
||||||
|
no-useless-escape: 'off'
|
||||||
|
no-unused-vars: 'off'
|
||||||
|
no-empty: 'off'
|
||||||
|
no-extra-semi: 'off'
|
||||||
|
no-redeclare: 'off'
|
||||||
|
no-control-regex: "off"
|
||||||
|
no-mixed-spaces-and-tabs: "off"
|
||||||
|
no-extra-boolean-cast: "off"
|
||||||
|
no-prototype-builtins: "off"
|
||||||
|
no-undef: "off"
|
||||||
|
no-unreachable: "off"
|
||||||
|
no-self-assign: "off"
|
||||||
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -23,6 +23,11 @@ A clear and concise description of what you expected to happen.
|
|||||||
**Screenshots**
|
**Screenshots**
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**TiddlyWiki Configuration (please complete the following information):**
|
||||||
|
- Version [e.g. v5.1.24]
|
||||||
|
- Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc]
|
||||||
|
- Plugins installed [e.g. Freelinks, TiddlyMap]
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
- OS: [e.g. iOS]
|
||||||
- Browser [e.g. chrome, safari]
|
- Browser [e.g. chrome, safari]
|
||||||
|
|||||||
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -39,9 +39,9 @@ jobs:
|
|||||||
- name: "Set dynamic environment variables"
|
- name: "Set dynamic environment variables"
|
||||||
run: |
|
run: |
|
||||||
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||||
echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
|
echo "TW5_BUILD_BRANCH=${TW5_BUILD_BRANCH}" >> $GITHUB_ENV
|
||||||
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
echo "TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)" >> $GITHUB_ENV
|
||||||
echo ::set-env name=TW5_BUILD_DETAILS::Prerelease built from branch \'$TW5_BUILD_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
echo "TW5_BUILD_DETAILS=Prerelease built from branch '$TW5_BUILD_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" >> $GITHUB_ENV
|
||||||
- run: "./bin/build-site.sh"
|
- run: "./bin/build-site.sh"
|
||||||
- run: "./bin/ci-push.sh"
|
- run: "./bin/ci-push.sh"
|
||||||
env:
|
env:
|
||||||
@@ -65,9 +65,9 @@ jobs:
|
|||||||
- name: "Set dynamic environment variables"
|
- name: "Set dynamic environment variables"
|
||||||
run: |
|
run: |
|
||||||
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||||
echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
|
echo "TW5_BUILD_BRANCH=${TW5_BUILD_BRANCH}" >> $GITHUB_ENV
|
||||||
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
echo "TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)" >> $GITHUB_ENV
|
||||||
echo ::set-env name=TW5_BUILD_DETAILS::Built from branch \'$TW5_BUILD_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
echo "TW5_BUILD_DETAILS=Built from branch '$TW5_BUILD_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" >> $GITHUB_ENV
|
||||||
- run: "./bin/build-site.sh"
|
- run: "./bin/build-site.sh"
|
||||||
- run: "./bin/ci-push.sh"
|
- run: "./bin/ci-push.sh"
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Default to the current version number for building the plugin library
|
# Default to the current version number for building the plugin library
|
||||||
|
|
||||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||||
TW5_BUILD_VERSION=v5.1.23
|
TW5_BUILD_VERSION=v5.2.0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||||
@@ -107,7 +107,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /empty.html Empty
|
# /empty.html Empty
|
||||||
# /empty.hta For Internet Explorer
|
# /empty.hta For Internet Explorer
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/empty \
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
--verbose \
|
--verbose \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build empty \
|
--build empty \
|
||||||
|
|||||||
@@ -2,19 +2,14 @@
|
|||||||
|
|
||||||
# Push output back to GitHub
|
# Push output back to GitHub
|
||||||
|
|
||||||
|
# Exit script immediately if any command fails
|
||||||
|
set -e
|
||||||
|
|
||||||
cd output || exit 1
|
cd output
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
git config --global user.email "actions@github.com" || exit 1
|
git config --global user.name "GitHub Actions"
|
||||||
|
git add -A .
|
||||||
git config --global user.name "GitHub Actions" || exit 1
|
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))"
|
||||||
|
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null
|
||||||
git add -A . || exit 1
|
git push deploy master &>/dev/null
|
||||||
|
cd ..
|
||||||
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" || exit 1
|
|
||||||
|
|
||||||
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1
|
|
||||||
|
|
||||||
git push deploy master &>/dev/null || exit 1
|
|
||||||
|
|
||||||
cd .. || exit 1
|
|
||||||
|
|||||||
@@ -5,52 +5,52 @@ Optimise the SVGs in ./core/images using SVGO from https://github.com/svg/svgo
|
|||||||
|
|
||||||
Install SVGO with the following command in the root of the repo:
|
Install SVGO with the following command in the root of the repo:
|
||||||
|
|
||||||
npm install svgo
|
npm install svgo@2.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var fs = require("fs"),
|
var fs = require("fs"),
|
||||||
path = require("path"),
|
path = require("path"),
|
||||||
SVGO = require("svgo"),
|
{ optimize } = require("svgo"),
|
||||||
svgo = new SVGO({
|
config = {
|
||||||
plugins: [
|
plugins: [
|
||||||
{cleanupAttrs: true},
|
'cleanupAttrs',
|
||||||
{removeDoctype: true},
|
'removeDoctype',
|
||||||
{removeXMLProcInst: true},
|
'removeXMLProcInst',
|
||||||
{removeComments: true},
|
'removeComments',
|
||||||
{removeMetadata: true},
|
'removeMetadata',
|
||||||
{removeTitle: true},
|
'removeTitle',
|
||||||
{removeDesc: true},
|
'removeDesc',
|
||||||
{removeUselessDefs: true},
|
'removeUselessDefs',
|
||||||
{removeEditorsNSData: true},
|
'removeEditorsNSData',
|
||||||
{removeEmptyAttrs: true},
|
'removeEmptyAttrs',
|
||||||
{removeHiddenElems: true},
|
'removeHiddenElems',
|
||||||
{removeEmptyText: true},
|
'removeEmptyText',
|
||||||
{removeEmptyContainers: true},
|
'removeEmptyContainers',
|
||||||
{removeViewBox: false},
|
// 'removeViewBox',
|
||||||
{cleanupEnableBackground: true},
|
'cleanupEnableBackground',
|
||||||
{convertStyleToAttrs: true},
|
'convertStyleToAttrs',
|
||||||
{convertColors: true},
|
'convertColors',
|
||||||
{convertPathData: true},
|
'convertPathData',
|
||||||
{convertTransform: true},
|
'convertTransform',
|
||||||
{removeUnknownsAndDefaults: true},
|
'removeUnknownsAndDefaults',
|
||||||
{removeNonInheritableGroupAttrs: true},
|
'removeNonInheritableGroupAttrs',
|
||||||
{removeUselessStrokeAndFill: true},
|
'removeUselessStrokeAndFill',
|
||||||
{removeUnusedNS: true},
|
'removeUnusedNS',
|
||||||
{cleanupIDs: true},
|
'cleanupIDs',
|
||||||
{cleanupNumericValues: true},
|
'cleanupNumericValues',
|
||||||
{moveElemsAttrsToGroup: true},
|
'moveElemsAttrsToGroup',
|
||||||
{moveGroupAttrsToElems: true},
|
'moveGroupAttrsToElems',
|
||||||
{collapseGroups: true},
|
'collapseGroups',
|
||||||
{removeRasterImages: false},
|
// 'removeRasterImages',
|
||||||
{mergePaths: true},
|
'mergePaths',
|
||||||
{convertShapeToPath: true},
|
'convertShapeToPath',
|
||||||
{sortAttrs: true},
|
'sortAttrs',
|
||||||
{removeDimensions: false},
|
//'removeDimensions',
|
||||||
{removeAttrs: {attrs: "(stroke|fill)"}}
|
{name: 'removeAttrs', params: { attrs: '(stroke|fill)' } }
|
||||||
]
|
]
|
||||||
});
|
};
|
||||||
|
|
||||||
var basepath = "./core/images/",
|
var basepath = "./core/images/",
|
||||||
files = fs.readdirSync(basepath).sort();
|
files = fs.readdirSync(basepath).sort();
|
||||||
@@ -66,12 +66,14 @@ files.forEach(function(filename) {
|
|||||||
fakeSVG = body.join("\n");
|
fakeSVG = body.join("\n");
|
||||||
// A hack to make the new-journal-button work
|
// A hack to make the new-journal-button work
|
||||||
fakeSVG = fakeSVG.replace("<<now \"DD\">>","<<now "DD">>");
|
fakeSVG = fakeSVG.replace("<<now \"DD\">>","<<now "DD">>");
|
||||||
svgo.optimize(fakeSVG, {path: filepath}).then(function(result) {
|
config.path = filepath;
|
||||||
|
var result = optimize(fakeSVG,config);
|
||||||
|
if(result) {
|
||||||
var newSVG = header.join("\n") + "\n\n" + result.data.replace("<<now "DD">>","<<now \"DD\">>");
|
var newSVG = header.join("\n") + "\n\n" + result.data.replace("<<now "DD">>","<<now \"DD\">>");
|
||||||
fs.writeFileSync(filepath,newSVG);
|
fs.writeFileSync(filepath,newSVG);
|
||||||
},function(err) {
|
} else {
|
||||||
console.log("Error " + err + " with " + filename)
|
console.log("Error " + err + " with " + filename)
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
240
boot/boot.js
240
boot/boot.js
@@ -256,6 +256,28 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
|||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Convert a URIComponent encoded string to a string safely
|
||||||
|
*/
|
||||||
|
$tw.utils.decodeURIComponentSafe = function(s) {
|
||||||
|
var v = s;
|
||||||
|
try {
|
||||||
|
v = decodeURIComponent(s);
|
||||||
|
} catch(e) {}
|
||||||
|
return v;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Convert a URI encoded string to a string safely
|
||||||
|
*/
|
||||||
|
$tw.utils.decodeURISafe = function(s) {
|
||||||
|
var v = s;
|
||||||
|
try {
|
||||||
|
v = decodeURI(s);
|
||||||
|
} catch(e) {}
|
||||||
|
return v;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to "
|
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to "
|
||||||
*/
|
*/
|
||||||
@@ -267,8 +289,16 @@ $tw.utils.htmlDecode = function(s) {
|
|||||||
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
|
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
|
||||||
*/
|
*/
|
||||||
$tw.utils.getLocationHash = function() {
|
$tw.utils.getLocationHash = function() {
|
||||||
var parts = window.location.href.split('#');
|
var href = window.location.href;
|
||||||
return "#" + (parts.length > 1 ? parts[1] : "");
|
var idx = href.indexOf('#');
|
||||||
|
if(idx === -1) {
|
||||||
|
return "#";
|
||||||
|
} else if(idx < href.length-1 && href[idx+1] === '#') {
|
||||||
|
// Special case: ignore location hash if it itself starts with a #
|
||||||
|
return "#";
|
||||||
|
} else {
|
||||||
|
return href.substring(idx);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -297,13 +327,21 @@ $tw.utils.stringifyDate = function(value) {
|
|||||||
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
|
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
|
||||||
$tw.utils.parseDate = function(value) {
|
$tw.utils.parseDate = function(value) {
|
||||||
if(typeof value === "string") {
|
if(typeof value === "string") {
|
||||||
return new Date(Date.UTC(parseInt(value.substr(0,4),10),
|
var negative = 1;
|
||||||
|
if(value.charAt(0) === "-") {
|
||||||
|
negative = -1;
|
||||||
|
value = value.substr(1);
|
||||||
|
}
|
||||||
|
var year = parseInt(value.substr(0,4),10) * negative,
|
||||||
|
d = new Date(Date.UTC(year,
|
||||||
parseInt(value.substr(4,2),10)-1,
|
parseInt(value.substr(4,2),10)-1,
|
||||||
parseInt(value.substr(6,2),10),
|
parseInt(value.substr(6,2),10),
|
||||||
parseInt(value.substr(8,2)||"00",10),
|
parseInt(value.substr(8,2)||"00",10),
|
||||||
parseInt(value.substr(10,2)||"00",10),
|
parseInt(value.substr(10,2)||"00",10),
|
||||||
parseInt(value.substr(12,2)||"00",10),
|
parseInt(value.substr(12,2)||"00",10),
|
||||||
parseInt(value.substr(14,3)||"000",10)));
|
parseInt(value.substr(14,3)||"000",10)));
|
||||||
|
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
||||||
|
return d;
|
||||||
} else if($tw.utils.isDate(value)) {
|
} else if($tw.utils.isDate(value)) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
} else {
|
||||||
@@ -652,11 +690,13 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
|
|||||||
var promptInfo = {
|
var promptInfo = {
|
||||||
serviceName: options.serviceName,
|
serviceName: options.serviceName,
|
||||||
callback: options.callback,
|
callback: options.callback,
|
||||||
form: form
|
form: form,
|
||||||
|
owner: this
|
||||||
};
|
};
|
||||||
this.passwordPrompts.push(promptInfo);
|
this.passwordPrompts.push(promptInfo);
|
||||||
// Make sure the wrapper is displayed
|
// Make sure the wrapper is displayed
|
||||||
this.setWrapperDisplay();
|
this.setWrapperDisplay();
|
||||||
|
return promptInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
|
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
|
||||||
@@ -874,6 +914,19 @@ $tw.modules.applyMethods = function(moduleType,targetObject) {
|
|||||||
return targetObject;
|
return targetObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return a class created from a modules. The module should export the properties to be added to those of the optional base class
|
||||||
|
*/
|
||||||
|
$tw.modules.createClassFromModule = function(moduleExports,baseClass) {
|
||||||
|
var newClass = function() {};
|
||||||
|
if(baseClass) {
|
||||||
|
newClass.prototype = new baseClass();
|
||||||
|
newClass.prototype.constructor = baseClass;
|
||||||
|
}
|
||||||
|
$tw.utils.extend(newClass.prototype,moduleExports);
|
||||||
|
return newClass;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class
|
Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class
|
||||||
*/
|
*/
|
||||||
@@ -881,13 +934,7 @@ $tw.modules.createClassesFromModules = function(moduleType,subType,baseClass) {
|
|||||||
var classes = Object.create(null);
|
var classes = Object.create(null);
|
||||||
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
|
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
|
||||||
if(!subType || moduleExports.types[subType]) {
|
if(!subType || moduleExports.types[subType]) {
|
||||||
var newClass = function() {};
|
classes[moduleExports.name] = $tw.modules.createClassFromModule(moduleExports,baseClass);
|
||||||
if(baseClass) {
|
|
||||||
newClass.prototype = new baseClass();
|
|
||||||
newClass.prototype.constructor = baseClass;
|
|
||||||
}
|
|
||||||
$tw.utils.extend(newClass.prototype,moduleExports);
|
|
||||||
classes[moduleExports.name] = newClass;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return classes;
|
return classes;
|
||||||
@@ -1129,7 +1176,7 @@ $tw.Wiki = function(options) {
|
|||||||
var index = tiddlerTitles.indexOf(title);
|
var index = tiddlerTitles.indexOf(title);
|
||||||
if(index !== -1) {
|
if(index !== -1) {
|
||||||
tiddlerTitles.splice(index,1);
|
tiddlerTitles.splice(index,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Record the new tiddler state
|
// Record the new tiddler state
|
||||||
updateDescriptor["new"] = {
|
updateDescriptor["new"] = {
|
||||||
@@ -1187,8 +1234,12 @@ $tw.Wiki = function(options) {
|
|||||||
index,titlesLength,title;
|
index,titlesLength,title;
|
||||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||||
title = titles[index];
|
title = titles[index];
|
||||||
var shadowInfo = shadowTiddlers[title];
|
if(tiddlers[title]) {
|
||||||
callback(shadowInfo.tiddler,title);
|
callback(tiddlers[title],title);
|
||||||
|
} else {
|
||||||
|
var shadowInfo = shadowTiddlers[title];
|
||||||
|
callback(shadowInfo.tiddler,title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1270,13 +1321,13 @@ $tw.Wiki = function(options) {
|
|||||||
$tw.utils.each(titles || getTiddlerTitles(),function(title) {
|
$tw.utils.each(titles || getTiddlerTitles(),function(title) {
|
||||||
var tiddler = tiddlers[title];
|
var tiddler = tiddlers[title];
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type")) {
|
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type") && tiddler.fields.text) {
|
||||||
pluginInfo[tiddler.fields.title] = JSON.parse(tiddler.fields.text);
|
pluginInfo[tiddler.fields.title] = JSON.parse(tiddler.fields.text);
|
||||||
results.modifiedPlugins.push(tiddler.fields.title);
|
results.modifiedPlugins.push(tiddler.fields.title);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(pluginInfo[title]) {
|
if(pluginInfo[title]) {
|
||||||
delete pluginInfo[title];
|
delete pluginInfo[title];
|
||||||
results.deletedPlugins.push(title);
|
results.deletedPlugins.push(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1577,8 +1628,8 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||||||
}
|
}
|
||||||
for(var f in data) {
|
for(var f in data) {
|
||||||
if($tw.utils.hop(data,f)) {
|
if($tw.utils.hop(data,f)) {
|
||||||
// Check field name doesn't contain whitespace or control characters
|
// Check field name doesn't contain control characters
|
||||||
if(typeof(data[f]) !== "string" || /[\x00-\x1F\s]/.test(f)) {
|
if(typeof(data[f]) !== "string" || /[\x00-\x1F]/.test(f)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1593,7 +1644,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
data = JSON.parse(text);
|
data = {};
|
||||||
|
try {
|
||||||
|
data = JSON.parse(text);
|
||||||
|
} catch(e) {
|
||||||
|
// Ignore JSON parse errors
|
||||||
|
}
|
||||||
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
|
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
|
||||||
return data;
|
return data;
|
||||||
} else if(isTiddlerValid(data)) {
|
} else if(isTiddlerValid(data)) {
|
||||||
@@ -1699,13 +1755,20 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
|||||||
},
|
},
|
||||||
t,result = [];
|
t,result = [];
|
||||||
if(node) {
|
if(node) {
|
||||||
for(t = 0; t < node.childNodes.length; t++) {
|
var type = (node.getAttribute && node.getAttribute("type")) || null;
|
||||||
|
if(type) {
|
||||||
|
// A new-style container with an explicit deserialization type
|
||||||
|
result = $tw.wiki.deserializeTiddlers(type,node.textContent);
|
||||||
|
} else {
|
||||||
|
// An old-style container of classic DIV-based tiddlers
|
||||||
|
for(t = 0; t < node.childNodes.length; t++) {
|
||||||
var childNode = node.childNodes[t],
|
var childNode = node.childNodes[t],
|
||||||
tiddlers = extractTextTiddlers(childNode);
|
tiddlers = extractTextTiddlers(childNode);
|
||||||
tiddlers = tiddlers || extractModuleTiddlers(childNode);
|
tiddlers = tiddlers || extractModuleTiddlers(childNode);
|
||||||
if(tiddlers) {
|
if(tiddlers) {
|
||||||
result.push.apply(result,tiddlers);
|
result.push.apply(result,tiddlers);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1714,17 +1777,23 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
|||||||
|
|
||||||
$tw.loadTiddlersBrowser = function() {
|
$tw.loadTiddlersBrowser = function() {
|
||||||
// In the browser, we load tiddlers from certain elements
|
// In the browser, we load tiddlers from certain elements
|
||||||
var containerIds = [
|
var containerSelectors = [
|
||||||
"libraryModules",
|
// IDs for old-style v5.1.x tiddler stores
|
||||||
"modules",
|
"#libraryModules",
|
||||||
"bootKernelPrefix",
|
"#modules",
|
||||||
"bootKernel",
|
"#bootKernelPrefix",
|
||||||
"styleArea",
|
"#bootKernel",
|
||||||
"storeArea",
|
"#styleArea",
|
||||||
"systemArea"
|
"#storeArea",
|
||||||
|
"#systemArea",
|
||||||
|
// Classes for new-style v5.2.x JSON tiddler stores
|
||||||
|
"script.tiddlywiki-tiddler-store"
|
||||||
];
|
];
|
||||||
for(var t=0; t<containerIds.length; t++) {
|
for(var t=0; t<containerSelectors.length; t++) {
|
||||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t])));
|
var nodes = document.querySelectorAll(containerSelectors[t]);
|
||||||
|
for(var n=0; n<nodes.length; n++) {
|
||||||
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",nodes[n]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1822,7 +1891,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
// Read the specification
|
// Read the specification
|
||||||
var filesInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
var filesInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
||||||
// Helper to process a file
|
// Helper to process a file
|
||||||
var processFile = function(filename,isTiddlerFile,fields) {
|
var processFile = function(filename,isTiddlerFile,fields,isEditableFile) {
|
||||||
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
||||||
type = (extInfo || {}).type || fields.type || "text/plain",
|
type = (extInfo || {}).type || fields.type || "text/plain",
|
||||||
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||||
@@ -1847,13 +1916,13 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
value = path.basename(filename);
|
value = path.basename(filename);
|
||||||
break;
|
break;
|
||||||
case "filename-uri-decoded":
|
case "filename-uri-decoded":
|
||||||
value = decodeURIComponent(path.basename(filename));
|
value = $tw.utils.decodeURIComponentSafe(path.basename(filename));
|
||||||
break;
|
break;
|
||||||
case "basename":
|
case "basename":
|
||||||
value = path.basename(filename,path.extname(filename));
|
value = path.basename(filename,path.extname(filename));
|
||||||
break;
|
break;
|
||||||
case "basename-uri-decoded":
|
case "basename-uri-decoded":
|
||||||
value = decodeURIComponent(path.basename(filename,path.extname(filename)));
|
value = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));
|
||||||
break;
|
break;
|
||||||
case "extname":
|
case "extname":
|
||||||
value = path.extname(filename);
|
value = path.extname(filename);
|
||||||
@@ -1875,8 +1944,26 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
tiddlers.push({tiddlers: fileTiddlers});
|
if(isEditableFile) {
|
||||||
|
tiddlers.push({filepath: pathname, hasMetaFile: !!metadata && !isTiddlerFile, isEditableFile: true, tiddlers: fileTiddlers});
|
||||||
|
} else {
|
||||||
|
tiddlers.push({tiddlers: fileTiddlers});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
// Helper to recursively search subdirectories
|
||||||
|
var getAllFiles = function(dirPath, recurse, arrayOfFiles) {
|
||||||
|
recurse = recurse || false;
|
||||||
|
arrayOfFiles = arrayOfFiles || [];
|
||||||
|
var files = fs.readdirSync(dirPath);
|
||||||
|
files.forEach(function(file) {
|
||||||
|
if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
||||||
|
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
|
||||||
|
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
|
||||||
|
arrayOfFiles.push(path.join(dirPath, path.sep, file));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return arrayOfFiles;
|
||||||
|
}
|
||||||
// Process the listed tiddlers
|
// Process the listed tiddlers
|
||||||
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
||||||
if(tidInfo.prefix && tidInfo.suffix) {
|
if(tidInfo.prefix && tidInfo.suffix) {
|
||||||
@@ -1898,15 +1985,22 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Process directory specifier
|
// Process directory specifier
|
||||||
var dirPath = path.resolve(filepath,dirSpec.path),
|
var dirPath = path.resolve(filepath,dirSpec.path);
|
||||||
files = fs.readdirSync(dirPath),
|
if(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
||||||
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
|
||||||
metaRegExp = /^.*\.meta$/;
|
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
||||||
for(var t=0; t<files.length; t++) {
|
metaRegExp = /^.*\.meta$/;
|
||||||
var filename = files[t];
|
for(var t=0; t<files.length; t++) {
|
||||||
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
var thisPath = path.relative(filepath, files[t]),
|
||||||
processFile(dirPath + path.sep + filename,dirSpec.isTiddlerFile,dirSpec.fields);
|
filename = path.basename(thisPath);
|
||||||
|
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
||||||
|
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log("Warning: a directory in a tiddlywiki.files file does not exist.");
|
||||||
|
console.log("dirPath: " + dirPath);
|
||||||
|
console.log("tiddlywiki.files location: " + filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1950,7 +2044,7 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||||||
pluginInfo.dependents = pluginInfo.dependents || [];
|
pluginInfo.dependents = pluginInfo.dependents || [];
|
||||||
pluginInfo.type = "application/json";
|
pluginInfo.type = "application/json";
|
||||||
// Set plugin text
|
// Set plugin text
|
||||||
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4);
|
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});
|
||||||
delete pluginInfo.tiddlers;
|
delete pluginInfo.tiddlers;
|
||||||
// Deserialise array fields (currently required for the dependents field)
|
// Deserialise array fields (currently required for the dependents field)
|
||||||
for(var field in pluginInfo) {
|
for(var field in pluginInfo) {
|
||||||
@@ -2046,6 +2140,11 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// Save the path to the tiddlers folder for the filesystemadaptor
|
||||||
|
var config = wikiInfo.config || {};
|
||||||
|
if($tw.boot.wikiPath == wikiPath) {
|
||||||
|
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);
|
||||||
|
}
|
||||||
// Load any parent wikis
|
// Load any parent wikis
|
||||||
if(wikiInfo.includeWikis) {
|
if(wikiInfo.includeWikis) {
|
||||||
parentPaths = parentPaths.slice(0);
|
parentPaths = parentPaths.slice(0);
|
||||||
@@ -2079,27 +2178,31 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
$tw.boot.files[tiddler.title] = {
|
$tw.boot.files[tiddler.title] = {
|
||||||
filepath: tiddlerFile.filepath,
|
filepath: tiddlerFile.filepath,
|
||||||
type: tiddlerFile.type,
|
type: tiddlerFile.type,
|
||||||
hasMetaFile: tiddlerFile.hasMetaFile
|
hasMetaFile: tiddlerFile.hasMetaFile,
|
||||||
|
isEditableFile: config["retain-original-tiddler-path"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||||
});
|
});
|
||||||
// Save the original tiddler file locations if requested
|
if ($tw.boot.wikiPath == wikiPath) {
|
||||||
var config = wikiInfo.config || {};
|
// Save the original tiddler file locations if requested
|
||||||
if(config["retain-original-tiddler-path"]) {
|
var output = {}, relativePath, fileInfo;
|
||||||
var output = {}, relativePath;
|
|
||||||
for(var title in $tw.boot.files) {
|
for(var title in $tw.boot.files) {
|
||||||
relativePath = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
|
fileInfo = $tw.boot.files[title];
|
||||||
output[title] =
|
if(fileInfo.isEditableFile) {
|
||||||
path.sep === "/" ?
|
relativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);
|
||||||
relativePath :
|
fileInfo.originalpath = relativePath;
|
||||||
relativePath.split(path.sep).join("/");
|
output[title] =
|
||||||
|
path.sep === "/" ?
|
||||||
|
relativePath :
|
||||||
|
relativePath.split(path.sep).join("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Object.keys(output).length > 0){
|
||||||
|
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
||||||
}
|
}
|
||||||
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
|
||||||
}
|
}
|
||||||
// Save the path to the tiddlers folder for the filesystemadaptor
|
|
||||||
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);
|
|
||||||
// Load any plugins within the wiki folder
|
// Load any plugins within the wiki folder
|
||||||
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);
|
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);
|
||||||
if(fs.existsSync(wikiPluginsPath)) {
|
if(fs.existsSync(wikiPluginsPath)) {
|
||||||
@@ -2146,7 +2249,7 @@ $tw.loadTiddlersNode = function() {
|
|||||||
// Load any extra plugins
|
// Load any extra plugins
|
||||||
$tw.utils.each($tw.boot.extraPlugins,function(name) {
|
$tw.utils.each($tw.boot.extraPlugins,function(name) {
|
||||||
if(name.charAt(0) === "+") { // Relative path to plugin
|
if(name.charAt(0) === "+") { // Relative path to plugin
|
||||||
var pluginFields = $tw.loadPluginFolder(name.substring(1));;
|
var pluginFields = $tw.loadPluginFolder(name.substring(1));
|
||||||
if(pluginFields) {
|
if(pluginFields) {
|
||||||
$tw.wiki.addTiddler(pluginFields);
|
$tw.wiki.addTiddler(pluginFields);
|
||||||
}
|
}
|
||||||
@@ -2155,7 +2258,7 @@ $tw.loadTiddlersNode = function() {
|
|||||||
type = parts[0];
|
type = parts[0];
|
||||||
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
|
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
|
||||||
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
|
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Load the tiddlers from the wiki directory
|
// Load the tiddlers from the wiki directory
|
||||||
@@ -2258,12 +2361,14 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("application/zip","base64",".zip");
|
$tw.utils.registerFileType("application/zip","base64",".zip");
|
||||||
$tw.utils.registerFileType("application/x-zip-compressed","base64",".zip");
|
$tw.utils.registerFileType("application/x-zip-compressed","base64",".zip");
|
||||||
$tw.utils.registerFileType("image/jpeg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
$tw.utils.registerFileType("image/jpeg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
||||||
|
$tw.utils.registerFileType("image/jpg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/png","base64",".png",{flags:["image"]});
|
$tw.utils.registerFileType("image/png","base64",".png",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/gif","base64",".gif",{flags:["image"]});
|
$tw.utils.registerFileType("image/gif","base64",".gif",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||||
|
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||||
@@ -2421,16 +2526,29 @@ $tw.boot.executeNextStartupTask = function(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns true if we are running on one platforms specified in a task modules `platforms` array
|
Returns true if we are running on one of the platforms specified in taskModule's
|
||||||
|
`platforms` array; or if `platforms` property is not defined.
|
||||||
*/
|
*/
|
||||||
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
||||||
var platforms = taskModule.platforms;
|
var platforms = taskModule.platforms;
|
||||||
if(platforms) {
|
if(platforms) {
|
||||||
for(var t=0; t<platforms.length; t++) {
|
for(var t=0; t<platforms.length; t++) {
|
||||||
if((platforms[t] === "browser" && !$tw.browser) || (platforms[t] === "node" && !$tw.node)) {
|
switch (platforms[t]) {
|
||||||
return false;
|
case "browser":
|
||||||
|
if ($tw.browser) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "node":
|
||||||
|
if ($tw.node) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$tw.utils.error("Module " + taskModule.name + ": '" + platforms[t] + "' in export.platforms invalid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ type: text/plain
|
|||||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||||
|
|
||||||
Copyright (c) 2004-2007, Jeremy Ruston
|
Copyright (c) 2004-2007, Jeremy Ruston
|
||||||
Copyright (c) 2007-2020, UnaMesa Association
|
Copyright (c) 2007-2021, UnaMesa Association
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
4
core/images/minus-button.tid
Normal file
4
core/images/minus-button.tid
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
title: $:/core/images/minus-button
|
||||||
|
tags: $:/tags/Image
|
||||||
|
|
||||||
|
<svg width="22pt" height="22pt" class="tc-image-minus-button tc-image-button" viewBox="0 0 128 128"><path d="M64 0c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64C0 28.654 28.654 0 64 0zm.332 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"/><rect width="80" height="16" x="24" y="56" rx="8"/></svg>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
title: $:/core/images/plugin-generic-language
|
title: $:/core/images/plugin-generic-language
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M61.207 68.137c-4.324 2.795-6.999 6.656-6.999 10.921 0 7.906 9.19 14.424 21.042 15.336 2.162 3.902 8.598 6.785 16.318 7.01-5.126-1.125-9.117-3.742-10.62-7.01C92.805 93.487 102 86.967 102 79.059c0-8.53-10.699-15.445-23.896-15.445-6.599 0-12.572 1.729-16.897 4.524zm12.794-14.158c-4.324 2.795-10.298 4.524-16.897 4.524-2.619 0-5.14-.272-7.497-.775-3.312 2.25-8.383 3.69-14.067 3.69l-.255-.002c4.119-.892 7.511-2.747 9.478-5.13-6.925-2.704-11.555-7.617-11.555-13.228 0-8.53 10.699-15.445 23.896-15.445C70.301 27.613 81 34.528 81 43.058c0 4.265-2.675 8.126-6.999 10.921zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
<svg width="22pt" height="22pt" viewBox="0 0 128 128" class="tc-image-plugin-generic-language tc-image-button"><path fill-rule="evenodd" d="M61.207 68.137c-4.324 2.795-6.999 6.656-6.999 10.921 0 7.906 9.19 14.424 21.042 15.336 2.162 3.902 8.598 6.785 16.318 7.01-5.126-1.125-9.117-3.742-10.62-7.01C92.805 93.487 102 86.967 102 79.059c0-8.53-10.699-15.445-23.896-15.445-6.599 0-12.572 1.729-16.897 4.524zm12.794-14.158c-4.324 2.795-10.298 4.524-16.897 4.524-2.619 0-5.14-.272-7.497-.775-3.312 2.25-8.383 3.69-14.067 3.69l-.255-.002c4.119-.892 7.511-2.747 9.478-5.13-6.925-2.704-11.555-7.617-11.555-13.228 0-8.53 10.699-15.445 23.896-15.445C70.301 27.613 81 34.528 81 43.058c0 4.265-2.675 8.126-6.999 10.921zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
title: $:/core/images/plugin-generic-plugin
|
title: $:/core/images/plugin-generic-plugin
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M40.397 76.446V95.34h14.12l-.001-.005a6.912 6.912 0 005.364-11.593l.046-.023a6.912 6.912 0 119.979.526l.086.055a6.914 6.914 0 004.408 10.948l-.023.092h21.32V75.568l-.15.038a6.912 6.912 0 00-11.593-5.364l-.022-.046a6.912 6.912 0 11.526-9.979l.055-.086a6.914 6.914 0 0010.948-4.408c.079.018.158.038.236.059v-15.74h-21.32l.023-.094a6.914 6.914 0 01-4.408-10.947 10.23 10.23 0 00-.086-.055 6.912 6.912 0 10-9.979-.526l-.046.023a6.912 6.912 0 01-5.364 11.593l.001.005h-14.12v12.847A6.912 6.912 0 0129.5 59.843l-.054.086a6.912 6.912 0 10-.526 9.979l.023.046a6.912 6.912 0 0111.455 6.492zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
<svg width="22pt" height="22pt" viewBox="0 0 128 128" class="tc-image-plugin-generic-plugin tc-image-button"><path fill-rule="evenodd" d="M40.397 76.446V95.34h14.12l-.001-.005a6.912 6.912 0 005.364-11.593l.046-.023a6.912 6.912 0 119.979.526l.086.055a6.914 6.914 0 004.408 10.948l-.023.092h21.32V75.568l-.15.038a6.912 6.912 0 00-11.593-5.364l-.022-.046a6.912 6.912 0 11.526-9.979l.055-.086a6.914 6.914 0 0010.948-4.408c.079.018.158.038.236.059v-15.74h-21.32l.023-.094a6.914 6.914 0 01-4.408-10.947 10.23 10.23 0 00-.086-.055 6.912 6.912 0 10-9.979-.526l-.046.023a6.912 6.912 0 01-5.364 11.593l.001.005h-14.12v12.847A6.912 6.912 0 0129.5 59.843l-.054.086a6.912 6.912 0 10-.526 9.979l.023.046a6.912 6.912 0 0111.455 6.492zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
title: $:/core/images/plugin-generic-theme
|
title: $:/core/images/plugin-generic-theme
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M29.408 91.472L51.469 69.41l-.004-.005a2.22 2.22 0 01.004-3.146c.87-.87 2.281-.872 3.147-.005l9.465 9.464a2.22 2.22 0 01-.005 3.147c-.87.87-2.28.871-3.147.005l-.005-.005-22.061 22.062a6.686 6.686 0 11-9.455-9.455zM60.802 66.38c-2.436-2.704-4.465-5.091-5.817-6.869-6.855-9.014-10.313-4.268-14.226 0-3.913 4.268 1.03 7.726-2.683 10.741-3.713 3.015-3.484 4.06-9.752-1.455-6.267-5.516-6.7-7.034-3.823-10.181 2.877-3.147 5.281 1.808 11.159-3.785 5.877-5.593.94-10.55.94-10.55s12.237-25.014 28.588-23.167c16.351 1.848-6.186-2.392-11.792 17.226-2.4 8.4.447 6.42 4.998 9.968 1.394 1.086 6.03 4.401 11.794 8.685l20.677-20.676 1.615-4.766 7.84-4.689 3.151 3.152-4.688 7.84-4.766 1.615-20.224 20.223c12.663 9.547 28.312 22.146 28.312 26.709 0 7.217-3.071 11.526-9.535 9.164-4.693-1.715-18.768-15.192-28.753-25.897l-2.893 2.893-3.151-3.152 3.029-3.029zM63.953 0l54.56 32v64l-54.56 32-54.56-32V32l54.56-32z"/></svg>
|
<svg width="22pt" height="22pt" viewBox="0 0 128 128" class="tc-image-plugin-generic-theme tc-image-button"><path fill-rule="evenodd" d="M29.408 91.472L51.469 69.41l-.004-.005a2.22 2.22 0 01.004-3.146c.87-.87 2.281-.872 3.147-.005l9.465 9.464a2.22 2.22 0 01-.005 3.147c-.87.87-2.28.871-3.147.005l-.005-.005-22.061 22.062a6.686 6.686 0 11-9.455-9.455zM60.802 66.38c-2.436-2.704-4.465-5.091-5.817-6.869-6.855-9.014-10.313-4.268-14.226 0-3.913 4.268 1.03 7.726-2.683 10.741-3.713 3.015-3.484 4.06-9.752-1.455-6.267-5.516-6.7-7.034-3.823-10.181 2.877-3.147 5.281 1.808 11.159-3.785 5.877-5.593.94-10.55.94-10.55s12.237-25.014 28.588-23.167c16.351 1.848-6.186-2.392-11.792 17.226-2.4 8.4.447 6.42 4.998 9.968 1.394 1.086 6.03 4.401 11.794 8.685l20.677-20.676 1.615-4.766 7.84-4.689 3.151 3.152-4.688 7.84-4.766 1.615-20.224 20.223c12.663 9.547 28.312 22.146 28.312 26.709 0 7.217-3.071 11.526-9.535 9.164-4.693-1.715-18.768-15.192-28.753-25.897l-2.893 2.893-3.151-3.152 3.029-3.029zM63.953 0l54.56 32v64l-54.56 32-54.56-32V32l54.56-32z"/></svg>
|
||||||
4
core/images/plus-button.tid
Normal file
4
core/images/plus-button.tid
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
title: $:/core/images/plus-button
|
||||||
|
tags: $:/tags/Image
|
||||||
|
|
||||||
|
<svg width="22pt" height="22pt" class="tc-image-plus-button tc-image-button" viewBox="0 0 128 128"><path d="M64-.333c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64zM64 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"/><rect width="80" height="16" x="24" y="56" rx="8"/><rect width="16" height="80" x="56" y="24" rx="8"/></svg>
|
||||||
@@ -17,6 +17,8 @@ Basics/NewJournal/Tags/Prompt: Tags for new journal tiddlers
|
|||||||
Basics/NewTiddler/Title/Prompt: Title of new tiddlers
|
Basics/NewTiddler/Title/Prompt: Title of new tiddlers
|
||||||
Basics/NewTiddler/Tags/Prompt: Tags for new tiddlers
|
Basics/NewTiddler/Tags/Prompt: Tags for new tiddlers
|
||||||
Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers
|
Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers
|
||||||
|
Basics/RemoveTags: Update to current format
|
||||||
|
Basics/RemoveTags/Hint: Update the tags configuration to the latest format
|
||||||
Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers
|
Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers
|
||||||
Basics/Subtitle/Prompt: Subtitle
|
Basics/Subtitle/Prompt: Subtitle
|
||||||
Basics/SystemTiddlers/Prompt: Number of system tiddlers
|
Basics/SystemTiddlers/Prompt: Number of system tiddlers
|
||||||
@@ -44,6 +46,7 @@ KeyboardShortcuts/Platform/Linux: Linux platform only
|
|||||||
KeyboardShortcuts/Platform/NonLinux: Non-Linux platforms only
|
KeyboardShortcuts/Platform/NonLinux: Non-Linux platforms only
|
||||||
KeyboardShortcuts/Platform/Windows: Windows platform only
|
KeyboardShortcuts/Platform/Windows: Windows platform only
|
||||||
KeyboardShortcuts/Platform/NonWindows: Non-Windows platforms only
|
KeyboardShortcuts/Platform/NonWindows: Non-Windows platforms only
|
||||||
|
LayoutSwitcher/Caption: Layout
|
||||||
LoadedModules/Caption: Loaded Modules
|
LoadedModules/Caption: Loaded Modules
|
||||||
LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process.
|
LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process.
|
||||||
Palette/Caption: Palette
|
Palette/Caption: Palette
|
||||||
@@ -120,11 +123,12 @@ Saving/TiddlySpot/BackupDir: Backup Directory
|
|||||||
Saving/TiddlySpot/ControlPanel: ~TiddlySpot Control Panel
|
Saving/TiddlySpot/ControlPanel: ~TiddlySpot Control Panel
|
||||||
Saving/TiddlySpot/Backups: Backups
|
Saving/TiddlySpot/Backups: Backups
|
||||||
Saving/TiddlySpot/Caption: ~TiddlySpot Saver
|
Saving/TiddlySpot/Caption: ~TiddlySpot Saver
|
||||||
Saving/TiddlySpot/Description: These settings are only used when saving to http://tiddlyspot.com or a compatible remote server
|
Saving/TiddlySpot/Description: These settings are only used when saving to [[TiddlySpot|http://tiddlyspot.com]], [[TiddlyHost|https://tiddlyhost.com]], or a compatible remote server. See [[here|https://github.com/simonbaird/tiddlyhost/wiki/TiddlySpot-Saver-configuration-for-Tiddlyhost-and-Tiddlyspot]] for information on ~TiddlySpot and ~TiddlyHost saving configuration.
|
||||||
Saving/TiddlySpot/Filename: Upload Filename
|
Saving/TiddlySpot/Filename: Upload Filename
|
||||||
Saving/TiddlySpot/Heading: ~TiddlySpot
|
Saving/TiddlySpot/Heading: ~TiddlySpot
|
||||||
Saving/TiddlySpot/Hint: //The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//
|
Saving/TiddlySpot/Hint: //The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//
|
||||||
Saving/TiddlySpot/Password: Password
|
Saving/TiddlySpot/Password: Password
|
||||||
|
Saving/TiddlySpot/ReadOnly: Note that [[TiddlySpot|http://tiddlyspot.com]] no longer allows the creation of new sites. For new sites, you can use [[TiddlyHost|https://tiddlyhost.com]], a new hosting service that replaces ~TiddlySpot.
|
||||||
Saving/TiddlySpot/ServerURL: Server URL
|
Saving/TiddlySpot/ServerURL: Server URL
|
||||||
Saving/TiddlySpot/UploadDir: Upload Directory
|
Saving/TiddlySpot/UploadDir: Upload Directory
|
||||||
Saving/TiddlySpot/UserName: Wiki Name
|
Saving/TiddlySpot/UserName: Wiki Name
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ tiddlerfield: Defines the behaviour of an individual tiddler field.
|
|||||||
tiddlermethod: Adds methods to the `$tw.Tiddler` prototype.
|
tiddlermethod: Adds methods to the `$tw.Tiddler` prototype.
|
||||||
upgrader: Applies upgrade processing to tiddlers during an upgrade/import.
|
upgrader: Applies upgrade processing to tiddlers during an upgrade/import.
|
||||||
utils: Adds methods to `$tw.utils`.
|
utils: Adds methods to `$tw.utils`.
|
||||||
|
utils-browser: Adds browser-specific methods to `$tw.utils`.
|
||||||
utils-node: Adds Node.js-specific methods to `$tw.utils`.
|
utils-node: Adds Node.js-specific methods to `$tw.utils`.
|
||||||
widget: Widgets encapsulate DOM rendering and refreshing.
|
widget: Widgets encapsulate DOM rendering and refreshing.
|
||||||
wikimethod: Adds methods to `$tw.Wiki`.
|
wikimethod: Adds methods to `$tw.Wiki`.
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ title: $:/language/EditTemplate/
|
|||||||
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/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/Placeholder: Type the text for this tiddler
|
||||||
Body/Preview/Type/Output: output
|
Body/Preview/Type/Output: output
|
||||||
|
Body/Preview/Type/DiffShadow: differences from shadow (if any)
|
||||||
|
Body/Preview/Type/DiffCurrent: differences from current
|
||||||
Field/Remove/Caption: remove field
|
Field/Remove/Caption: remove field
|
||||||
Field/Remove/Hint: Remove field
|
Field/Remove/Hint: Remove field
|
||||||
Field/Dropdown/Caption: field list
|
Field/Dropdown/Caption: field list
|
||||||
@@ -19,6 +21,8 @@ Shadow/OverriddenWarning: This is a modified shadow tiddler. You can revert to t
|
|||||||
Tags/Add/Button: add
|
Tags/Add/Button: add
|
||||||
Tags/Add/Button/Hint: add tag
|
Tags/Add/Button/Hint: add tag
|
||||||
Tags/Add/Placeholder: tag name
|
Tags/Add/Placeholder: tag name
|
||||||
|
Tags/ClearInput/Caption: clear input
|
||||||
|
Tags/ClearInput/Hint: Clear tag input
|
||||||
Tags/Dropdown/Caption: tag list
|
Tags/Dropdown/Caption: tag list
|
||||||
Tags/Dropdown/Hint: Show tag list
|
Tags/Dropdown/Hint: Show tag list
|
||||||
Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
|
Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ All parameters are optional with safe defaults, and can be specified in any orde
|
|||||||
* ''username'' - optional username for basic authentication
|
* ''username'' - optional username for basic authentication
|
||||||
* ''password'' - optional password for basic authentication
|
* ''password'' - optional password for basic authentication
|
||||||
* ''authenticated-user-header'' - optional name of header to be used for trusted authentication
|
* ''authenticated-user-header'' - optional name of header to be used for trusted authentication
|
||||||
* ''readers'' - comma separated list of principals allowed to read from this wiki
|
* ''readers'' - comma-separated list of principals allowed to read from this wiki
|
||||||
* ''writers'' - comma separated list of principals allowed to write to this wiki
|
* ''writers'' - comma-separated list of principals allowed to write to this wiki
|
||||||
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
|
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
|
||||||
* ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
* ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
||||||
* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
||||||
@@ -29,6 +29,7 @@ All parameters are optional with safe defaults, and can be specified in any orde
|
|||||||
* ''tls-key'' - pathname of TLS key file (relative to wiki folder)
|
* ''tls-key'' - pathname of TLS key file (relative to wiki folder)
|
||||||
* ''debug-level'' - optional debug level; set to "debug" to view request details (defaults to "none")
|
* ''debug-level'' - optional debug level; set to "debug" to view request details (defaults to "none")
|
||||||
* ''gzip'' - set to "yes" to enable gzip compression for some http endpoints (defaults to "no")
|
* ''gzip'' - set to "yes" to enable gzip compression for some http endpoints (defaults to "no")
|
||||||
|
* ''use-browser-cache'' - set to "yes" to allow the browser to cache responses to save bandwidth (defaults to "no")
|
||||||
|
|
||||||
For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com.
|
For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com.
|
||||||
|
|
||||||
|
|||||||
13
core/language/en-GB/Help/pipe.tid
Normal file
13
core/language/en-GB/Help/pipe.tid
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
title: $:/language/Help/pipe
|
||||||
|
description: Pipe data to/from external processes
|
||||||
|
|
||||||
|
Pipe data to/from external processes.
|
||||||
|
|
||||||
|
```
|
||||||
|
--pipe <pipename> <filter> <incomingTitle> <arguments>...
|
||||||
|
```
|
||||||
|
|
||||||
|
* ''pipename'': identifies the pipe, matching the name defined in the `tiddlywiki.info` file
|
||||||
|
* ''filter'': identifies the tiddlers to be passed to the pipe
|
||||||
|
* ''incomingTitle'': provides a title to be applied to incoming tiddlers for the `raw-text` output format
|
||||||
|
* ''arguments'': passed through to external task pipes, and ignored for other types of pipe
|
||||||
@@ -8,15 +8,15 @@ Optionally, the title of a template tiddler can be specified. In this case, inst
|
|||||||
A name and value for an additional variable may optionally also be specified.
|
A name and value for an additional variable may optionally also be specified.
|
||||||
|
|
||||||
```
|
```
|
||||||
--render <tiddler-filter> [<filename-filter>] [<render-type>] [<template>] [<name>] [<value>]
|
--render <tiddler-filter> [<filename-filter>] [<render-type>] [<template>] [ [<name>] [<value>] ]*
|
||||||
```
|
```
|
||||||
|
|
||||||
* ''tiddler-filter'': A filter identifying the tiddler(s) to be rendered
|
* ''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
|
* ''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
|
||||||
* ''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)
|
* ''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)
|
||||||
* ''template'': Optional template through which each tiddler is rendered
|
* ''template'': Optional template through which each tiddler is rendered
|
||||||
* ''name'': Name of optional variable
|
* ''name'': Name of optional variables
|
||||||
* ''value'': Value of optional variable
|
* ''value'': Value of optional variables
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
@@ -24,8 +24,9 @@ Notes:
|
|||||||
|
|
||||||
* The output directory is not cleared of any existing files
|
* The output directory is not cleared of any existing files
|
||||||
* Any missing directories in the path to the filename are automatically created.
|
* 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]]"`
|
* 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 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/`
|
||||||
|
* Multiple ''name''/''value'' pairs can be used to pass more than one variable
|
||||||
* The `--render` command is a more flexible replacement for both the `--rendertiddler` and `--rendertiddlers` commands, which are deprecated
|
* The `--render` command is a more flexible replacement for both the `--rendertiddler` and `--rendertiddlers` commands, which are deprecated
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Notes:
|
|||||||
|
|
||||||
* The output directory is not cleared of any existing files
|
* The output directory is not cleared of any existing files
|
||||||
* Any missing directories in the path to the filename are automatically created.
|
* 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]]"`
|
* 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 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
|
* The `--save` command is a more flexible replacement for both the `--savetiddler` and `--savetiddlers` commands, which are deprecated
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
title: $:/language/Import/
|
title: $:/language/Import/
|
||||||
|
|
||||||
|
Editor/Import/Heading: Import images and insert them into the editor.
|
||||||
Imported/Hint: The following tiddlers were imported:
|
Imported/Hint: The following tiddlers were imported:
|
||||||
Listing/Cancel/Caption: Cancel
|
Listing/Cancel/Caption: Cancel
|
||||||
|
Listing/Cancel/Warning: Do you wish to cancel the import?
|
||||||
Listing/Hint: These tiddlers are ready to import:
|
Listing/Hint: These tiddlers are ready to import:
|
||||||
Listing/Import/Caption: Import
|
Listing/Import/Caption: Import
|
||||||
Listing/Select/Caption: Select
|
Listing/Select/Caption: Select
|
||||||
@@ -13,11 +15,20 @@ Listing/Preview/TextRaw: Text (Raw)
|
|||||||
Listing/Preview/Fields: Fields
|
Listing/Preview/Fields: Fields
|
||||||
Listing/Preview/Diff: Diff
|
Listing/Preview/Diff: Diff
|
||||||
Listing/Preview/DiffFields: Diff (Fields)
|
Listing/Preview/DiffFields: Diff (Fields)
|
||||||
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
Listing/Rename/Tooltip: Rename tiddler before importing
|
||||||
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
|
Listing/Rename/Prompt: Rename to:
|
||||||
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
|
Listing/Rename/ConfirmRename: Rename tiddler
|
||||||
Upgrader/State/Suppressed: Blocked temporary state tiddler
|
Listing/Rename/CancelRename: Cancel
|
||||||
Upgrader/System/Suppressed: Blocked system tiddler
|
Listing/Rename/OverwriteWarning: A tiddler with this title already exists.
|
||||||
Upgrader/System/Warning: Core module tiddler
|
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin.
|
||||||
Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable
|
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> not being newer than existing <<existing>>).
|
||||||
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>
|
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>.
|
||||||
|
Upgrader/State/Suppressed: Blocked temporary state tiddler.
|
||||||
|
Upgrader/System/Disabled: Disabled system tiddler.
|
||||||
|
Upgrader/System/Suppressed: Blocked system tiddler.
|
||||||
|
Upgrader/System/Warning: Core module tiddler.
|
||||||
|
Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable.
|
||||||
|
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>.
|
||||||
|
Upgrader/Tiddler/Disabled: Disabled tiddler.
|
||||||
|
Upgrader/Tiddler/Selected: Selected tiddler.
|
||||||
|
Upgrader/Tiddler/Unselected: Unselected tiddler.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text
|
|||||||
ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"?
|
ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"?
|
||||||
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"?
|
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"?
|
||||||
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>>/>"?
|
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>>/>"?
|
||||||
|
ConfirmAction: Do you wish to proceed?
|
||||||
Count: count
|
Count: count
|
||||||
DefaultNewTiddlerTitle: New Tiddler
|
DefaultNewTiddlerTitle: New Tiddler
|
||||||
Diffs/CountMessage: <<diff-count>> differences
|
Diffs/CountMessage: <<diff-count>> differences
|
||||||
@@ -23,13 +24,16 @@ Encryption/RepeatPassword: Repeat password
|
|||||||
Encryption/PasswordNoMatch: Passwords do not match
|
Encryption/PasswordNoMatch: Passwords do not match
|
||||||
Encryption/SetPassword: Set password
|
Encryption/SetPassword: Set password
|
||||||
Error/Caption: Error
|
Error/Caption: Error
|
||||||
Error/EditConflict: File changed on server
|
|
||||||
Error/Filter: Filter error
|
Error/Filter: Filter error
|
||||||
Error/FilterSyntax: Syntax error in filter expression
|
Error/FilterSyntax: Syntax error in filter expression
|
||||||
|
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
||||||
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
||||||
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
||||||
Error/LoadingPluginLibrary: Error loading plugin library
|
Error/LoadingPluginLibrary: Error loading plugin library
|
||||||
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
||||||
|
Error/PutEditConflict: File changed on server
|
||||||
|
Error/PutForbidden: Permission denied
|
||||||
|
Error/PutUnauthorized: Authentication required
|
||||||
Error/RecursiveTransclusion: Recursive transclusion error in transclude widget
|
Error/RecursiveTransclusion: Recursive transclusion error in transclude widget
|
||||||
Error/RetrievingSkinny: Error retrieving skinny tiddler list
|
Error/RetrievingSkinny: Error retrieving skinny tiddler list
|
||||||
Error/SavingToTWEdit: Error saving to TWEdit
|
Error/SavingToTWEdit: Error saving to TWEdit
|
||||||
@@ -37,7 +41,7 @@ Error/WhileSaving: Error while saving
|
|||||||
Error/XMLHttpRequest: XMLHttpRequest error code
|
Error/XMLHttpRequest: XMLHttpRequest error code
|
||||||
InternalJavaScriptError/Title: Internal JavaScript Error
|
InternalJavaScriptError/Title: Internal JavaScript Error
|
||||||
InternalJavaScriptError/Hint: Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
|
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 (`.`)
|
LayoutSwitcher/Description: Open the layout switcher
|
||||||
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>
|
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
|
LoginToTiddlySpace: Login to TiddlySpace
|
||||||
Manager/Controls/FilterByTag/None: (none)
|
Manager/Controls/FilterByTag/None: (none)
|
||||||
@@ -61,13 +65,23 @@ MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" -- click
|
|||||||
No: No
|
No: No
|
||||||
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
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.
|
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||||
|
PageTemplate/Description: the default ~TiddlyWiki layout
|
||||||
|
PageTemplate/Name: Default ~PageTemplate
|
||||||
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
||||||
RecentChanges/DateFormat: DDth MMM YYYY
|
RecentChanges/DateFormat: DDth MMM YYYY
|
||||||
|
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field
|
||||||
Shortcuts/Input/Accept/Hint: Accept the selected item
|
Shortcuts/Input/Accept/Hint: Accept the selected item
|
||||||
Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant)
|
Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant)
|
||||||
Shortcuts/Input/Cancel/Hint: Clear the input field
|
Shortcuts/Input/Cancel/Hint: Clear the input field
|
||||||
Shortcuts/Input/Down/Hint: Select the next item
|
Shortcuts/Input/Down/Hint: Select the next item
|
||||||
|
Shortcuts/Input/Tab-Left/Hint: Select the previous Tab
|
||||||
|
Shortcuts/Input/Tab-Right/Hint: Select the next Tab
|
||||||
Shortcuts/Input/Up/Hint: Select the previous item
|
Shortcuts/Input/Up/Hint: Select the previous item
|
||||||
|
Shortcuts/SidebarLayout/Hint: Change the sidebar layout
|
||||||
|
Switcher/Subtitle/theme: Switch Theme
|
||||||
|
Switcher/Subtitle/layout: Switch Layout
|
||||||
|
Switcher/Subtitle/language: Switch Language
|
||||||
|
Switcher/Subtitle/palette: Switch Palette
|
||||||
SystemTiddler/Tooltip: This is a system tiddler
|
SystemTiddler/Tooltip: This is a system tiddler
|
||||||
SystemTiddlers/Include/Prompt: Include system tiddlers
|
SystemTiddlers/Include/Prompt: Include system tiddlers
|
||||||
TagManager/Colour/Heading: Colour
|
TagManager/Colour/Heading: Colour
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ List/Caption: List
|
|||||||
List/Empty: This tiddler does not have a list
|
List/Empty: This tiddler does not have a list
|
||||||
Listed/Caption: Listed
|
Listed/Caption: Listed
|
||||||
Listed/Empty: This tiddler is not listed by any others
|
Listed/Empty: This tiddler is not listed by any others
|
||||||
References/Caption: References
|
References/Caption: Backlinks
|
||||||
References/Empty: No tiddlers link to this one
|
References/Empty: No tiddlers link to this one
|
||||||
Tagging/Caption: Tagging
|
Tagging/Caption: Tagging
|
||||||
Tagging/Empty: No tiddlers are tagged with this one
|
Tagging/Empty: No tiddlers are tagged with this one
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ Commander.prototype.extractNamedParameters = function(params,mandatoryParameters
|
|||||||
if(errors.length > 0) {
|
if(errors.length > 0) {
|
||||||
return errors.join(" and\n");
|
return errors.join(" and\n");
|
||||||
} else {
|
} else {
|
||||||
return paramsByName;
|
return paramsByName;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ Command.prototype.fetchFile = function(url,options,callback,redirectCount) {
|
|||||||
if(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
if(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
||||||
return self.fetchFile(response.headers.location,options,callback,redirectCount + 1);
|
return self.fetchFile(response.headers.location,options,callback,redirectCount + 1);
|
||||||
} else {
|
} else {
|
||||||
return callback("Error " + response.statusCode + " retrieving " + url)
|
return callback("Error " + response.statusCode + " retrieving " + url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
278
core/modules/commands/pipe.js
Normal file
278
core/modules/commands/pipe.js
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/commands/pipe.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: command
|
||||||
|
|
||||||
|
Command to execute an external task
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.info = {
|
||||||
|
name: "pipe",
|
||||||
|
synchronous: false
|
||||||
|
};
|
||||||
|
|
||||||
|
var Command = function(params,commander,callback) {
|
||||||
|
this.params = params;
|
||||||
|
this.commander = commander;
|
||||||
|
this.callback = callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
Command.prototype.execute = function() {
|
||||||
|
var self = this;
|
||||||
|
if(this.params.length < 2) {
|
||||||
|
return "Missing parameters";
|
||||||
|
}
|
||||||
|
var name = self.params[0], // External pipe name
|
||||||
|
outgoingFilter = self.params[1], // Filter of tiddlers to write to the pipe
|
||||||
|
incomingTitle = self.params[2],
|
||||||
|
args = self.params.slice(3); // Remaining arguments are passed on as tasks arguments
|
||||||
|
// Find the pipe information
|
||||||
|
var pipeInfo = ($tw.boot.wikiInfo["external-pipes"] || {})[name];
|
||||||
|
if(!pipeInfo) {
|
||||||
|
return this.callback("External pipe \"" + name + "\" not found");
|
||||||
|
}
|
||||||
|
// Create the pipe instance and process a message
|
||||||
|
var pipe = new Pipe({
|
||||||
|
name: name,
|
||||||
|
pipeInfo: pipeInfo,
|
||||||
|
outgoingFilter: outgoingFilter,
|
||||||
|
incomingTitle: incomingTitle,
|
||||||
|
args: args,
|
||||||
|
command: this
|
||||||
|
});
|
||||||
|
pipe.processMessage(this.callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
function Pipe(options) {
|
||||||
|
this.name = options.name;
|
||||||
|
this.pipeInfo = options.pipeInfo;
|
||||||
|
this.outgoingFilter = options.outgoingFilter;
|
||||||
|
this.incomingTitle = options.incomingTitle;
|
||||||
|
this.args = options.args;
|
||||||
|
this.command = options.command;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pipe.prototype.processMessage = function(callback) {
|
||||||
|
// Get the outgoing data
|
||||||
|
var data = this.composeOutgoingData(this.outgoingFilter);
|
||||||
|
// Connect to the pipe
|
||||||
|
switch(this.pipeInfo.type) {
|
||||||
|
case "task":
|
||||||
|
this.pipeExternalTask(data,callback);
|
||||||
|
break;
|
||||||
|
case "socket":
|
||||||
|
this.pipeSocket(data,callback);
|
||||||
|
break;
|
||||||
|
case "socket-erlang":
|
||||||
|
this.pipeSocketErlang(data,callback);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
callback("Invalid pipe specifier '" + this.name + "': " + this.pipeInfo.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Pipe.prototype.log = function(args) {
|
||||||
|
this.command.commander.log("Pipe: " + Array.prototype.slice.call(arguments,0).join(" "));
|
||||||
|
};
|
||||||
|
|
||||||
|
Pipe.prototype.pipeExternalTask = function(data,callback) {
|
||||||
|
var self = this,
|
||||||
|
spawn = require("child_process").spawn,
|
||||||
|
path = require("path"),
|
||||||
|
childProcess = spawn(path.resolve($tw.boot.wikiPath,this.pipeInfo.path),this.args,{
|
||||||
|
stdio: ["pipe","pipe",process.stderr],
|
||||||
|
shell: true,
|
||||||
|
env: $tw.utils.extend({},process.env,this.pipeInfo.environment)
|
||||||
|
});
|
||||||
|
// Pass the tiddlers over the outgoing stream
|
||||||
|
childProcess.stdin.on("error",function(err) {
|
||||||
|
self.log("Task stdin error",err)
|
||||||
|
});
|
||||||
|
childProcess.stdin.write(data);
|
||||||
|
childProcess.stdin.end();
|
||||||
|
// Catch the output
|
||||||
|
var chunks = [];
|
||||||
|
childProcess.stdout.on("data",function(chunk) {
|
||||||
|
chunks.push(chunk.toString());
|
||||||
|
});
|
||||||
|
childProcess.stdout.on("close",function() {
|
||||||
|
self.log("Task stdout close");
|
||||||
|
self.processIncomingData(chunks.join(""));
|
||||||
|
});
|
||||||
|
childProcess.stdout.on("error",function(err) {
|
||||||
|
self.log("Task stdout error",err)
|
||||||
|
});
|
||||||
|
// Pick up the output when the process ends
|
||||||
|
childProcess.on("error",function(err) {
|
||||||
|
self.log("Task error",err)
|
||||||
|
});
|
||||||
|
childProcess.on("exit",function(code,signal) {
|
||||||
|
self.log("Task exit",code,signal)
|
||||||
|
if(code !== 0) {
|
||||||
|
return callback("Error executing external task: " + code);
|
||||||
|
}
|
||||||
|
// Exit successfully
|
||||||
|
callback(null);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Pipe.prototype.pipeSocket = function(data,callback) {
|
||||||
|
var self = this,
|
||||||
|
net = require("net"),
|
||||||
|
socket = new net.Socket({
|
||||||
|
allowHalfOpen: true
|
||||||
|
}),
|
||||||
|
chunks = [];
|
||||||
|
socket.connect(this.pipeInfo.port,this.pipeInfo.host || 8081,function() {
|
||||||
|
self.log("Socket connection",this.pipeInfo.port,this.pipeInfo.host);
|
||||||
|
socket.write(data);
|
||||||
|
socket.end();
|
||||||
|
});
|
||||||
|
socket.on("error",function(e) {
|
||||||
|
self.log("Socket error",e)
|
||||||
|
});
|
||||||
|
socket.on("data",function(data) {
|
||||||
|
chunks.push(data.toString());
|
||||||
|
});
|
||||||
|
socket.on("end",function() {
|
||||||
|
self.processIncomingData(chunks.join(""));
|
||||||
|
self.log("Socket end");
|
||||||
|
socket.destroy();
|
||||||
|
});
|
||||||
|
// Add a "close" event handler for the client socket
|
||||||
|
socket.on("close",function() {
|
||||||
|
self.log("Socket closed");
|
||||||
|
return callback(null);
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
Pipe.prototype.pipeSocketErlang = function(data,callback) {
|
||||||
|
var self = this,
|
||||||
|
encoding = this.pipeInfo.encoding || "utf8",
|
||||||
|
net = require("net"),
|
||||||
|
socket = new net.Socket(),
|
||||||
|
accumulator = Buffer.alloc(0);
|
||||||
|
socket.connect(this.pipeInfo.port,this.pipeInfo.host || 8081,function() {
|
||||||
|
self.log("Socket connection",self.pipeInfo.port,self.pipeInfo.host);
|
||||||
|
var dataBytes = Buffer.from(data,encoding);
|
||||||
|
// Write 32-bit big endian message length
|
||||||
|
var lengthBytes = Buffer.alloc(4);
|
||||||
|
lengthBytes.writeUInt32BE(dataBytes.length + 1,0)
|
||||||
|
console.log("Writing bytes",dataBytes.length + 1);
|
||||||
|
socket.write(lengthBytes);
|
||||||
|
// Write 8-bit type
|
||||||
|
var typeByte = Buffer.alloc(1);
|
||||||
|
typeByte.writeUInt8(1,0);
|
||||||
|
socket.write(typeByte);
|
||||||
|
// Write data
|
||||||
|
socket.write(dataBytes);
|
||||||
|
});
|
||||||
|
socket.on("error",function(e) {
|
||||||
|
self.log("Socket error",e)
|
||||||
|
});
|
||||||
|
socket.on("data",function(data) {
|
||||||
|
console.log("Received data",data.length)
|
||||||
|
accumulator = Buffer.concat([accumulator,data]);
|
||||||
|
while(accumulator.length > 4) {
|
||||||
|
var length = accumulator.readInt32BE(0);
|
||||||
|
if(accumulator.length >= (length + 4)) {
|
||||||
|
if(length < 1) {
|
||||||
|
throw "ERROR: Incoming message length field is less than 1";
|
||||||
|
}
|
||||||
|
var type = accumulator.readUInt8(4),
|
||||||
|
dataLength = length - 1,
|
||||||
|
data = accumulator.toString(encoding,5,dataLength + 5);
|
||||||
|
console.log("Got message",length,type)
|
||||||
|
self.processIncomingData(data);
|
||||||
|
accumulator = accumulator.slice(length + 4);
|
||||||
|
socket.end();
|
||||||
|
return callback(null);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
socket.on("end",function() {
|
||||||
|
self.log("Socket end");
|
||||||
|
socket.destroy();
|
||||||
|
});
|
||||||
|
// Add a "close" event handler for the client socket
|
||||||
|
socket.on("close",function() {
|
||||||
|
self.log("Socket closed");
|
||||||
|
return callback(null);
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
Pipe.prototype.composeOutgoingData = function(outgoingFilter) {
|
||||||
|
var self = this,
|
||||||
|
pipeInfoInput = this.pipeInfo.input || {},
|
||||||
|
data;
|
||||||
|
switch(pipeInfoInput.format || "json-raw-tiddlers") {
|
||||||
|
case "rendered-text":
|
||||||
|
var titles = self.command.commander.wiki.filterTiddlers(outgoingFilter),
|
||||||
|
output = [];
|
||||||
|
$tw.utils.each(titles,function(title) {
|
||||||
|
output.push(self.command.commander.wiki.renderTiddler("text/plain",title));
|
||||||
|
});
|
||||||
|
data = output.join("");
|
||||||
|
break;
|
||||||
|
case "json-rendered-text-tiddlers":
|
||||||
|
var titles = self.command.commander.wiki.filterTiddlers(outgoingFilter),
|
||||||
|
tiddlers = [];
|
||||||
|
$tw.utils.each(titles,function(title) {
|
||||||
|
tiddlers.push({
|
||||||
|
title: title,
|
||||||
|
text: self.command.commander.wiki.renderTiddler("text/plain",title)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
data = JSON.stringify(tiddlers);
|
||||||
|
break;
|
||||||
|
case "json-raw-tiddlers":
|
||||||
|
// Intentional fall-through
|
||||||
|
default:
|
||||||
|
data = this.command.commander.wiki.getTiddlersAsJson(outgoingFilter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
Pipe.prototype.processIncomingData = function(data) {
|
||||||
|
var pipeInfoOutput = this.pipeInfo.output || {},
|
||||||
|
jsonData;
|
||||||
|
switch(pipeInfoOutput.format || "text") {
|
||||||
|
case "json-raw-tiddlers":
|
||||||
|
try {
|
||||||
|
jsonData = JSON.parse(data);
|
||||||
|
} catch(e) {
|
||||||
|
this.log("Error parsing returned JSON: " + e + "\n\n\n->\n" + data);
|
||||||
|
}
|
||||||
|
// Add the tiddlers
|
||||||
|
if(jsonData) {
|
||||||
|
this.command.commander.wiki.addTiddlers(jsonData);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "text":
|
||||||
|
// Intentional fall-through
|
||||||
|
default:
|
||||||
|
console.log("Writing tiddler",pipeInfoOutput.tiddler,{
|
||||||
|
text: data, title: this.incomingTitle
|
||||||
|
})
|
||||||
|
this.command.commander.wiki.addTiddler(new $tw.Tiddler(pipeInfoOutput.tiddler,{
|
||||||
|
text: data, title: this.incomingTitle || pipeInfoOutput.tiddler.title
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Command = Command;
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -8,58 +8,59 @@ Render individual tiddlers and save the results to the specified files
|
|||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
/*jslint node: true, browser: true */
|
||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var widget = require("$:/core/modules/widgets/widget.js");
|
var widget = require("$:/core/modules/widgets/widget.js");
|
||||||
|
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "render",
|
name: "render",
|
||||||
synchronous: true
|
synchronous: true
|
||||||
};
|
};
|
||||||
|
|
||||||
var Command = function(params,commander,callback) {
|
var Command = function(params,commander,callback) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.commander = commander;
|
this.commander = commander;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
if(this.params.length < 1) {
|
if(this.params.length < 1) {
|
||||||
return "Missing tiddler filter";
|
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}),
|
var self = this,
|
||||||
container = $tw.fakeDocument.createElement("div");
|
fs = require("fs"),
|
||||||
widgetNode.render(container,null);
|
path = require("path"),
|
||||||
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
wiki = this.commander.wiki,
|
||||||
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
tiddlerFilter = this.params[0],
|
||||||
if(self.commander.verbose) {
|
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
|
||||||
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
type = this.params[2] || "text/html",
|
||||||
}
|
template = this.params[3],
|
||||||
$tw.utils.createFileDirectories(filepath);
|
variableList = this.params.slice(4),
|
||||||
fs.writeFileSync(filepath,text,"utf8");
|
tiddlers = wiki.filterTiddlers(tiddlerFilter),
|
||||||
});
|
variables = Object.create(null);
|
||||||
return null;
|
while(variableList.length >= 2) {
|
||||||
};
|
variables[variableList[0]] = variableList[1];
|
||||||
|
variableList = variableList.slice(2);
|
||||||
exports.Command = Command;
|
}
|
||||||
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
})();
|
var 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 + "\"");
|
||||||
|
}
|
||||||
|
var parser = wiki.parseTiddler(template || title),
|
||||||
|
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title})}),
|
||||||
|
container = $tw.fakeDocument.createElement("div");
|
||||||
|
widgetNode.render(container,null);
|
||||||
|
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
||||||
|
$tw.utils.createFileDirectories(filepath);
|
||||||
|
fs.writeFileSync(filepath,text,"utf8");
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Command = Command;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ Command.prototype.execute = function() {
|
|||||||
filter = this.params[0],
|
filter = this.params[0],
|
||||||
template = this.params[1],
|
template = this.params[1],
|
||||||
outputPath = this.commander.outputPath,
|
outputPath = this.commander.outputPath,
|
||||||
pathname = path.resolve(outputPath,this.params[2]),
|
pathname = path.resolve(outputPath,this.params[2]),
|
||||||
type = this.params[3] || "text/html",
|
type = this.params[3] || "text/html",
|
||||||
extension = this.params[4] || ".html",
|
extension = this.params[4] || ".html",
|
||||||
deleteDirectory = (this.params[5] || "").toLowerCase() !== "noclean",
|
deleteDirectory = (this.params[5] || "").toLowerCase() !== "noclean",
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ WikiFolderMaker.prototype.save = function() {
|
|||||||
// A custom plugin
|
// A custom plugin
|
||||||
self.log("Processing custom plugin: " + title);
|
self.log("Processing custom plugin: " + title);
|
||||||
self.saveCustomPlugin(tiddler);
|
self.saveCustomPlugin(tiddler);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ordinary tiddler
|
// Ordinary tiddler
|
||||||
self.saveTiddler("tiddlers",tiddler);
|
self.saveTiddler("tiddlers",tiddler);
|
||||||
@@ -158,11 +158,25 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
WikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) {
|
WikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) {
|
||||||
|
var title = tiddler.fields.title, fileInfo, pathFilters, extFilters;
|
||||||
|
if(this.wiki.tiddlerExists("$:/config/FileSystemPaths")) {
|
||||||
|
pathFilters = this.wiki.getTiddlerText("$:/config/FileSystemPaths","").split("\n");
|
||||||
|
}
|
||||||
|
if(this.wiki.tiddlerExists("$:/config/FileSystemExtensions")) {
|
||||||
|
extFilters = this.wiki.getTiddlerText("$:/config/FileSystemExtensions","").split("\n");
|
||||||
|
}
|
||||||
var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
||||||
directory: path.resolve(this.wikiFolderPath,directory),
|
directory: path.resolve(this.wikiFolderPath,directory),
|
||||||
wiki: this.wiki
|
pathFilters: pathFilters,
|
||||||
|
extFilters: extFilters,
|
||||||
|
wiki: this.wiki,
|
||||||
|
fileInfo: {}
|
||||||
});
|
});
|
||||||
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
try {
|
||||||
|
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("SaveWikiFolder: Error saving file '" + fileInfo.filepath + "', tiddler: '" + tiddler.fields.title);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
WikiFolderMaker.prototype.saveJSONFile = function(filename,json) {
|
WikiFolderMaker.prototype.saveJSONFile = function(filename,json) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ exports.htmlEntities = {quot:34, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:
|
|||||||
|
|
||||||
exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
|
exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
|
||||||
|
|
||||||
exports.htmlBlockElements = "address,article,aside,audio,blockquote,canvas,dd,div,dl,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,noscript,ol,output,p,pre,section,table,tfoot,ul,video".split(",");
|
exports.htmlBlockElements = "address,article,aside,audio,blockquote,canvas,dd,details,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,nav,ol,p,pre,section,summary,table,tfoot,ul,video".split(",");
|
||||||
|
|
||||||
exports.htmlUnsafeElements = "script".split(",");
|
exports.htmlUnsafeElements = "script".split(",");
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,124 @@ Functions to deserialise tiddlers from a block of text
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
exports["application/x-tiddler-html-div"] = function(text,fields) {
|
||||||
|
return [deserializeTiddlerDiv(text,fields)];
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["application/json"] = function(text,fields) {
|
||||||
|
var incoming,
|
||||||
|
results = [];
|
||||||
|
try {
|
||||||
|
incoming = JSON.parse(text);
|
||||||
|
} catch(e) {
|
||||||
|
incoming = [{
|
||||||
|
title: "JSON error: " + e,
|
||||||
|
text: ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
if(!$tw.utils.isArray(incoming)) {
|
||||||
|
incoming = [incoming];
|
||||||
|
}
|
||||||
|
for(var t=0; t<incoming.length; t++) {
|
||||||
|
var incomingFields = incoming[t],
|
||||||
|
fields = {};
|
||||||
|
for(var f in incomingFields) {
|
||||||
|
if(typeof incomingFields[f] === "string") {
|
||||||
|
fields[f] = incomingFields[f];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results.push(fields);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parse an HTML file into tiddlers. There are three possibilities:
|
||||||
|
# A TiddlyWiki classic HTML file containing `text/x-tiddlywiki` tiddlers
|
||||||
|
# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers
|
||||||
|
# An ordinary HTML file
|
||||||
|
*/
|
||||||
|
exports["text/html"] = function(text,fields) {
|
||||||
|
var results = [];
|
||||||
|
// Check if we've got an old-style store area
|
||||||
|
var storeAreaMarkerRegExp = /<div id=["']?storeArea['"]?( style=["']?display:none;["']?)?>/gi,
|
||||||
|
storeAreaMatch = storeAreaMarkerRegExp.exec(text);
|
||||||
|
if(storeAreaMatch) {
|
||||||
|
// If so, we've got tiddlers in classic TiddlyWiki format or unencrypted old-style TW5 format
|
||||||
|
results.push.apply(results,deserializeStoreArea(text,storeAreaMarkerRegExp.lastIndex,!!storeAreaMatch[1],fields));
|
||||||
|
}
|
||||||
|
// Check for new-style store areas
|
||||||
|
var newStoreAreaMarkerRegExp = /<script class="tiddlywiki-tiddler-store" type="([^"]*)">/gi,
|
||||||
|
newStoreAreaMatch = newStoreAreaMarkerRegExp.exec(text),
|
||||||
|
haveHadNewStoreArea = !!newStoreAreaMatch;
|
||||||
|
while(newStoreAreaMatch) {
|
||||||
|
results.push.apply(results,deserializeNewStoreArea(text,newStoreAreaMarkerRegExp.lastIndex,newStoreAreaMatch[1],fields));
|
||||||
|
newStoreAreaMatch = newStoreAreaMarkerRegExp.exec(text);
|
||||||
|
}
|
||||||
|
// Return if we had either an old-style or a new-style store area
|
||||||
|
if(storeAreaMatch || haveHadNewStoreArea) {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
// Otherwise, check whether we've got an encrypted file
|
||||||
|
var encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);
|
||||||
|
if(encryptedStoreArea) {
|
||||||
|
// If so, attempt to decrypt it using the current password
|
||||||
|
return $tw.utils.decryptStoreArea(encryptedStoreArea);
|
||||||
|
} else {
|
||||||
|
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
|
||||||
|
return deserializeHtmlFile(text,fields);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function deserializeHtmlFile(text,fields) {
|
||||||
|
var result = {};
|
||||||
|
$tw.utils.each(fields,function(value,name) {
|
||||||
|
result[name] = value;
|
||||||
|
});
|
||||||
|
result.text = text;
|
||||||
|
result.type = "text/html";
|
||||||
|
return [result];
|
||||||
|
}
|
||||||
|
|
||||||
|
function deserializeNewStoreArea(text,storeAreaEnd,type,fields) {
|
||||||
|
var endOfScriptRegExp = /<\/script>/gi;
|
||||||
|
endOfScriptRegExp.lastIndex = storeAreaEnd;
|
||||||
|
var match = endOfScriptRegExp.exec(text);
|
||||||
|
if(match) {
|
||||||
|
var scriptContent = text.substring(storeAreaEnd,match.index);
|
||||||
|
return $tw.wiki.deserializeTiddlers(type,scriptContent);
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deserializeStoreArea(text,storeAreaEnd,isTiddlyWiki5,fields) {
|
||||||
|
var results = [],
|
||||||
|
endOfDivRegExp = /(<\/div>\s*)/gi,
|
||||||
|
startPos = storeAreaEnd,
|
||||||
|
defaultType = isTiddlyWiki5 ? undefined : "text/x-tiddlywiki";
|
||||||
|
endOfDivRegExp.lastIndex = startPos;
|
||||||
|
var match = endOfDivRegExp.exec(text);
|
||||||
|
while(match) {
|
||||||
|
var endPos = endOfDivRegExp.lastIndex,
|
||||||
|
tiddlerFields = deserializeTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});
|
||||||
|
if(!tiddlerFields) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$tw.utils.each(tiddlerFields,function(value,name) {
|
||||||
|
if(typeof value === "string") {
|
||||||
|
tiddlerFields[name] = $tw.utils.htmlDecode(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(tiddlerFields.text !== null) {
|
||||||
|
results.push(tiddlerFields);
|
||||||
|
}
|
||||||
|
startPos = endPos;
|
||||||
|
match = endOfDivRegExp.exec(text);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Utility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:
|
Utility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:
|
||||||
|
|
||||||
@@ -24,7 +142,7 @@ Note that the field attributes are HTML encoded, but that the body of the <PRE>
|
|||||||
|
|
||||||
When these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.
|
When these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.
|
||||||
*/
|
*/
|
||||||
var parseTiddlerDiv = function(text /* [,fields] */) {
|
var deserializeTiddlerDiv = function(text /* [,fields] */) {
|
||||||
// Slot together the default results
|
// Slot together the default results
|
||||||
var result = {};
|
var result = {};
|
||||||
if(arguments.length > 1) {
|
if(arguments.length > 1) {
|
||||||
@@ -67,106 +185,4 @@ var parseTiddlerDiv = function(text /* [,fields] */) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports["application/x-tiddler-html-div"] = function(text,fields) {
|
|
||||||
return [parseTiddlerDiv(text,fields)];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["application/json"] = function(text,fields) {
|
|
||||||
var incoming,
|
|
||||||
results = [];
|
|
||||||
try {
|
|
||||||
incoming = JSON.parse(text);
|
|
||||||
} catch(e) {
|
|
||||||
incoming = [{
|
|
||||||
title: "JSON error: " + e,
|
|
||||||
text: ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
if(!$tw.utils.isArray(incoming)) {
|
|
||||||
incoming = [incoming];
|
|
||||||
}
|
|
||||||
for(var t=0; t<incoming.length; t++) {
|
|
||||||
var incomingFields = incoming[t],
|
|
||||||
fields = {};
|
|
||||||
for(var f in incomingFields) {
|
|
||||||
if(typeof incomingFields[f] === "string") {
|
|
||||||
fields[f] = incomingFields[f];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
results.push(fields);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Parse an HTML file into tiddlers. There are three possibilities:
|
|
||||||
# A TiddlyWiki classic HTML file containing `text/x-tiddlywiki` tiddlers
|
|
||||||
# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers
|
|
||||||
# An ordinary HTML file
|
|
||||||
*/
|
|
||||||
exports["text/html"] = function(text,fields) {
|
|
||||||
// Check if we've got a store area
|
|
||||||
var storeAreaMarkerRegExp = /<div id=["']?storeArea['"]?( style=["']?display:none;["']?)?>/gi,
|
|
||||||
match = storeAreaMarkerRegExp.exec(text);
|
|
||||||
if(match) {
|
|
||||||
// If so, it's either a classic TiddlyWiki file or an unencrypted TW5 file
|
|
||||||
// First read the normal tiddlers
|
|
||||||
var results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);
|
|
||||||
// Then any system tiddlers
|
|
||||||
var systemAreaMarkerRegExp = /<div id=["']?systemArea['"]?( style=["']?display:none;["']?)?>/gi,
|
|
||||||
sysMatch = systemAreaMarkerRegExp.exec(text);
|
|
||||||
if(sysMatch) {
|
|
||||||
results.push.apply(results,deserializeTiddlyWikiFile(text,systemAreaMarkerRegExp.lastIndex,!!sysMatch[1],fields));
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
} else {
|
|
||||||
// Check whether we've got an encrypted file
|
|
||||||
var encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);
|
|
||||||
if(encryptedStoreArea) {
|
|
||||||
// If so, attempt to decrypt it using the current password
|
|
||||||
return $tw.utils.decryptStoreArea(encryptedStoreArea);
|
|
||||||
} else {
|
|
||||||
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
|
|
||||||
return deserializeHtmlFile(text,fields);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function deserializeHtmlFile(text,fields) {
|
|
||||||
var result = {};
|
|
||||||
$tw.utils.each(fields,function(value,name) {
|
|
||||||
result[name] = value;
|
|
||||||
});
|
|
||||||
result.text = text;
|
|
||||||
result.type = "text/html";
|
|
||||||
return [result];
|
|
||||||
}
|
|
||||||
|
|
||||||
function deserializeTiddlyWikiFile(text,storeAreaEnd,isTiddlyWiki5,fields) {
|
|
||||||
var results = [],
|
|
||||||
endOfDivRegExp = /(<\/div>\s*)/gi,
|
|
||||||
startPos = storeAreaEnd,
|
|
||||||
defaultType = isTiddlyWiki5 ? undefined : "text/x-tiddlywiki";
|
|
||||||
endOfDivRegExp.lastIndex = startPos;
|
|
||||||
var match = endOfDivRegExp.exec(text);
|
|
||||||
while(match) {
|
|
||||||
var endPos = endOfDivRegExp.lastIndex,
|
|
||||||
tiddlerFields = parseTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});
|
|
||||||
if(!tiddlerFields) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$tw.utils.each(tiddlerFields,function(value,name) {
|
|
||||||
if(typeof value === "string") {
|
|
||||||
tiddlerFields[name] = $tw.utils.htmlDecode(value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(tiddlerFields.text !== null) {
|
|
||||||
results.push(tiddlerFields);
|
|
||||||
}
|
|
||||||
startPos = endPos;
|
|
||||||
match = endOfDivRegExp.exec(text);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ function FramedEngine(options) {
|
|||||||
this.iframeNode.style.border = "none";
|
this.iframeNode.style.border = "none";
|
||||||
this.iframeNode.style.padding = "0";
|
this.iframeNode.style.padding = "0";
|
||||||
this.iframeNode.style.resize = "none";
|
this.iframeNode.style.resize = "none";
|
||||||
this.iframeNode.style["background-color"] = this.widget.wiki.extractTiddlerDataItem(this.widget.wiki.getTiddlerText("$:/palette"),"tiddler-editor-background");
|
|
||||||
this.iframeDoc.body.style.margin = "0";
|
this.iframeDoc.body.style.margin = "0";
|
||||||
this.iframeDoc.body.style.padding = "0";
|
this.iframeDoc.body.style.padding = "0";
|
||||||
this.widget.domNodes.push(this.iframeNode);
|
this.widget.domNodes.push(this.iframeNode);
|
||||||
@@ -74,6 +73,12 @@ function FramedEngine(options) {
|
|||||||
if(this.widget.editTabIndex) {
|
if(this.widget.editTabIndex) {
|
||||||
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex);
|
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||||
}
|
}
|
||||||
|
if(this.widget.editAutoComplete) {
|
||||||
|
this.domNode.setAttribute("autocomplete",this.widget.editAutoComplete);
|
||||||
|
}
|
||||||
|
if(this.widget.isDisabled === "yes") {
|
||||||
|
this.domNode.setAttribute("disabled",true);
|
||||||
|
}
|
||||||
// Copy the styles from the dummy textarea
|
// Copy the styles from the dummy textarea
|
||||||
this.copyStyles();
|
this.copyStyles();
|
||||||
// Add event listeners
|
// Add event listeners
|
||||||
@@ -83,6 +88,18 @@ function FramedEngine(options) {
|
|||||||
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"},
|
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"},
|
||||||
{name: "focus",handlerObject: this,handlerMethod: "handleFocusEvent"}
|
{name: "focus",handlerObject: this,handlerMethod: "handleFocusEvent"}
|
||||||
]);
|
]);
|
||||||
|
// Add drag and drop event listeners if fileDrop is enabled
|
||||||
|
if(this.widget.isFileDropEnabled) {
|
||||||
|
$tw.utils.addEventListeners(this.domNode,[
|
||||||
|
{name: "dragenter",handlerObject: this.widget,handlerMethod: "handleDragEnterEvent"},
|
||||||
|
{name: "dragover",handlerObject: this.widget,handlerMethod: "handleDragOverEvent"},
|
||||||
|
{name: "dragleave",handlerObject: this.widget,handlerMethod: "handleDragLeaveEvent"},
|
||||||
|
{name: "dragend",handlerObject: this.widget,handlerMethod: "handleDragEndEvent"},
|
||||||
|
{name: "drop", handlerObject: this.widget,handlerMethod: "handleDropEvent"},
|
||||||
|
{name: "paste", handlerObject: this.widget,handlerMethod: "handlePasteEvent"},
|
||||||
|
{name: "click",handlerObject: this.widget,handlerMethod: "handleClickEvent"}
|
||||||
|
]);
|
||||||
|
}
|
||||||
// Insert the element into the DOM
|
// Insert the element into the DOM
|
||||||
this.iframeDoc.body.appendChild(this.domNode);
|
this.iframeDoc.body.appendChild(this.domNode);
|
||||||
}
|
}
|
||||||
@@ -97,7 +114,6 @@ FramedEngine.prototype.copyStyles = function() {
|
|||||||
this.domNode.style.display = "block";
|
this.domNode.style.display = "block";
|
||||||
this.domNode.style.width = "100%";
|
this.domNode.style.width = "100%";
|
||||||
this.domNode.style.margin = "0";
|
this.domNode.style.margin = "0";
|
||||||
this.domNode.style["background-color"] = this.widget.wiki.extractTiddlerDataItem(this.widget.wiki.getTiddlerText("$:/palette"),"tiddler-editor-background");
|
|
||||||
// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
|
// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
|
||||||
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
||||||
};
|
};
|
||||||
@@ -119,7 +135,11 @@ FramedEngine.prototype.setText = function(text,type) {
|
|||||||
Update the DomNode with the new text
|
Update the DomNode with the new text
|
||||||
*/
|
*/
|
||||||
FramedEngine.prototype.updateDomNodeText = function(text) {
|
FramedEngine.prototype.updateDomNodeText = function(text) {
|
||||||
this.domNode.value = text;
|
try {
|
||||||
|
this.domNode.value = text;
|
||||||
|
} catch(e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -166,7 +186,7 @@ Handle a focus event
|
|||||||
*/
|
*/
|
||||||
FramedEngine.prototype.handleFocusEvent = function(event) {
|
FramedEngine.prototype.handleFocusEvent = function(event) {
|
||||||
if(this.widget.editCancelPopups) {
|
if(this.widget.editCancelPopups) {
|
||||||
$tw.popup.cancel(0);
|
$tw.popup.cancel(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ function SimpleEngine(options) {
|
|||||||
if(this.widget.editTabIndex) {
|
if(this.widget.editTabIndex) {
|
||||||
this.domNode.setAttribute("tabindex",this.widget.editTabIndex);
|
this.domNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||||
}
|
}
|
||||||
|
if(this.widget.editAutoComplete) {
|
||||||
|
this.domNode.setAttribute("autocomplete",this.widget.editAutoComplete);
|
||||||
|
}
|
||||||
|
if(this.widget.isDisabled === "yes") {
|
||||||
|
this.domNode.setAttribute("disabled",true);
|
||||||
|
}
|
||||||
// Add an input event handler
|
// Add an input event handler
|
||||||
$tw.utils.addEventListeners(this.domNode,[
|
$tw.utils.addEventListeners(this.domNode,[
|
||||||
{name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"},
|
{name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"},
|
||||||
@@ -79,7 +85,11 @@ SimpleEngine.prototype.setText = function(text,type) {
|
|||||||
Update the DomNode with the new text
|
Update the DomNode with the new text
|
||||||
*/
|
*/
|
||||||
SimpleEngine.prototype.updateDomNodeText = function(text) {
|
SimpleEngine.prototype.updateDomNodeText = function(text) {
|
||||||
this.domNode.value = text;
|
try {
|
||||||
|
this.domNode.value = text;
|
||||||
|
} catch(e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -103,7 +103,11 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
var tiddler = this.wiki.getTiddler(this.editTitle);
|
var tiddler = this.wiki.getTiddler(this.editTitle);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
// If we've got a tiddler, the value to display is the field string value
|
// If we've got a tiddler, the value to display is the field string value
|
||||||
value = tiddler.getFieldString(this.editField);
|
if(tiddler.hasField(this.editField)) {
|
||||||
|
value = tiddler.getFieldString(this.editField);
|
||||||
|
} else {
|
||||||
|
value = this.editDefault || "";
|
||||||
|
}
|
||||||
if(this.editField === "text") {
|
if(this.editField === "text") {
|
||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki";
|
type = tiddler.fields.type || "text/vnd.tiddlywiki";
|
||||||
}
|
}
|
||||||
@@ -180,6 +184,9 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
||||||
this.editInputActions = this.getAttribute("inputActions");
|
this.editInputActions = this.getAttribute("inputActions");
|
||||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||||
|
this.editAutoComplete = this.getAttribute("autocomplete");
|
||||||
|
this.isDisabled = this.getAttribute("disabled","no");
|
||||||
|
this.isFileDropEnabled = this.getAttribute("fileDrop","no") === "yes";
|
||||||
// Get the default editor element tag and type
|
// Get the default editor element tag and type
|
||||||
var tag,type;
|
var tag,type;
|
||||||
if(this.editField === "text") {
|
if(this.editField === "text") {
|
||||||
@@ -211,7 +218,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
// Completely rerender if any of our attributes have changed
|
// Completely rerender if any of our attributes have changed
|
||||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
|
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedAttributes.disabled || changedAttributes.fileDrop) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else if (changedTiddlers[this.editRefreshTitle]) {
|
} else if (changedTiddlers[this.editRefreshTitle]) {
|
||||||
@@ -291,21 +298,89 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
Propogate keydown events to our container for the keyboard widgets benefit
|
Propogate keydown events to our container for the keyboard widgets benefit
|
||||||
*/
|
*/
|
||||||
EditTextWidget.prototype.propogateKeydownEvent = function(event) {
|
EditTextWidget.prototype.propogateKeydownEvent = function(event) {
|
||||||
var newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent("Events");
|
var newEvent = this.cloneEvent(event,["keyCode","which","metaKey","ctrlKey","altKey","shiftKey"]);
|
||||||
if(newEvent.initEvent) {
|
|
||||||
newEvent.initEvent("keydown", true, true);
|
|
||||||
}
|
|
||||||
newEvent.keyCode = event.keyCode;
|
|
||||||
newEvent.which = event.which;
|
|
||||||
newEvent.metaKey = event.metaKey;
|
|
||||||
newEvent.ctrlKey = event.ctrlKey;
|
|
||||||
newEvent.altKey = event.altKey;
|
|
||||||
newEvent.shiftKey = event.shiftKey;
|
|
||||||
return !this.parentDomNode.dispatchEvent(newEvent);
|
return !this.parentDomNode.dispatchEvent(newEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
return EditTextWidget;
|
EditTextWidget.prototype.cloneEvent = function(event,propertiesToCopy) {
|
||||||
|
var propertiesToCopy = propertiesToCopy || [],
|
||||||
|
newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent("Events");
|
||||||
|
if(newEvent.initEvent) {
|
||||||
|
newEvent.initEvent(event.type, true, true);
|
||||||
|
}
|
||||||
|
$tw.utils.each(propertiesToCopy,function(prop){
|
||||||
|
newEvent[prop] = event[prop];
|
||||||
|
});
|
||||||
|
return newEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.dispatchDOMEvent = function(newEvent) {
|
||||||
|
var dispatchNode = this.engine.iframeNode || this.engine.parentNode;
|
||||||
|
return dispatchNode.dispatchEvent(newEvent);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Propogate drag and drop events with File data to our container for the dropzone widgets benefit.
|
||||||
|
If there are no Files, let the browser handle it.
|
||||||
|
*/
|
||||||
|
EditTextWidget.prototype.handleDropEvent = function(event) {
|
||||||
|
if(event.dataTransfer.files.length) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.handlePasteEvent = function(event) {
|
||||||
|
if(event.clipboardData && event.clipboardData.files && event.clipboardData.files.length) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.dispatchDOMEvent(this.cloneEvent(event,["clipboardData"]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.handleDragEnterEvent = function(event) {
|
||||||
|
if($tw.utils.dragEventContainsFiles(event)) {
|
||||||
|
// Ignore excessive events fired by FF when entering and leaving text nodes in a text area.
|
||||||
|
if( event.relatedTarget && (event.relatedTarget.nodeType === 3 || event.target === event.relatedTarget)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
return this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.handleDragOverEvent = function(event) {
|
||||||
|
if($tw.utils.dragEventContainsFiles(event)) {
|
||||||
|
// Call preventDefault() in browsers that default to not allowing drop events on textarea
|
||||||
|
if($tw.browser.isFirefox || $tw.browser.isIE) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
event.dataTransfer.dropEffect = "copy";
|
||||||
|
return this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.handleDragLeaveEvent = function(event) {
|
||||||
|
// Ignore excessive events fired by FF when entering and leaving text nodes in a text area.
|
||||||
|
if(event.relatedTarget && ((event.relatedTarget.nodeType === 3) || (event.target === event.relatedTarget))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.handleDragEndEvent = function(event) {
|
||||||
|
this.dispatchDOMEvent(this.cloneEvent(event));
|
||||||
|
};
|
||||||
|
|
||||||
|
EditTextWidget.prototype.handleClickEvent = function(event) {
|
||||||
|
return !this.dispatchDOMEvent(this.cloneEvent(event));
|
||||||
|
};
|
||||||
|
|
||||||
|
return EditTextWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.editTextWidgetFactory = editTextWidgetFactory;
|
exports.editTextWidgetFactory = editTextWidgetFactory;
|
||||||
|
|||||||
17
core/modules/editor/operations/text/focus-editor.js
Normal file
17
core/modules/editor/operations/text/focus-editor.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/editor/operations/text/focus-editor.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: texteditoroperation
|
||||||
|
Simply focus the Text editor
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports["focus-editor"] = function(event,operation) {
|
||||||
|
operation = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
23
core/modules/editor/operations/text/insert-text.js
Normal file
23
core/modules/editor/operations/text/insert-text.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/editor/operations/text/insert-text.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: texteditoroperation
|
||||||
|
|
||||||
|
Text editor operation insert text at the caret position. If there is a selection it is replaced.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports["insert-text"] = function(event,operation) {
|
||||||
|
operation.replacement = event.paramObject.text;
|
||||||
|
operation.cutStart = operation.selStart;
|
||||||
|
operation.cutEnd = operation.selEnd;
|
||||||
|
operation.newSelStart = operation.selStart + operation.replacement.length;
|
||||||
|
operation.newSelEnd = operation.newSelStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
25
core/modules/filterrunprefixes/all.js
Normal file
25
core/modules/filterrunprefixes/all.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/all.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
Union of sets without de-duplication.
|
||||||
|
Equivalent to = filter run prefix.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.all = function(operationSubFunction) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
results.push.apply(results, operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
28
core/modules/filterrunprefixes/and.js
Normal file
28
core/modules/filterrunprefixes/and.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/and.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
Intersection of sets.
|
||||||
|
Equivalent to + filter run prefix.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.and = function(operationSubFunction,options) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved
|
||||||
|
source = options.wiki.makeTiddlerIterator(results.toArray());
|
||||||
|
results.clear();
|
||||||
|
results.pushTop(operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
27
core/modules/filterrunprefixes/else.js
Normal file
27
core/modules/filterrunprefixes/else.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/else.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
Equivalent to ~ filter run prefix.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.else = function(operationSubFunction) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length === 0) {
|
||||||
|
// Main result so far is empty
|
||||||
|
results.pushTop(operationSubFunction(source,widget));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
25
core/modules/filterrunprefixes/except.js
Normal file
25
core/modules/filterrunprefixes/except.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/except.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
Difference of sets.
|
||||||
|
Equivalent to - filter run prefix.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.except = function(operationSubFunction) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
results.remove(operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
42
core/modules/filterrunprefixes/filter.js
Normal file
42
core/modules/filterrunprefixes/filter.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/filter.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.filter = function(operationSubFunction,options) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length > 0) {
|
||||||
|
var resultsToRemove = [];
|
||||||
|
results.each(function(title) {
|
||||||
|
var filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
|
||||||
|
getVariable: function(name) {
|
||||||
|
switch(name) {
|
||||||
|
case "currentTiddler":
|
||||||
|
return "" + title;
|
||||||
|
case "..currentTiddler":
|
||||||
|
return widget.getVariable("currentTiddler");
|
||||||
|
default:
|
||||||
|
return widget.getVariable(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(filtered.length === 0) {
|
||||||
|
resultsToRemove.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
results.remove(resultsToRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
31
core/modules/filterrunprefixes/intersection.js
Normal file
31
core/modules/filterrunprefixes/intersection.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/intersection.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.intersection = function(operationSubFunction) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length !== 0) {
|
||||||
|
var secondRunResults = operationSubFunction(source,widget);
|
||||||
|
var firstRunResults = results.toArray();
|
||||||
|
results.clear();
|
||||||
|
$tw.utils.each(firstRunResults,function(title) {
|
||||||
|
if(secondRunResults.indexOf(title) !== -1) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
39
core/modules/filterrunprefixes/map.js
Normal file
39
core/modules/filterrunprefixes/map.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/map.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.map = function(operationSubFunction,options) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length > 0) {
|
||||||
|
var inputTitles = results.toArray();
|
||||||
|
results.clear();
|
||||||
|
$tw.utils.each(inputTitles,function(title) {
|
||||||
|
var filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
|
||||||
|
getVariable: function(name) {
|
||||||
|
switch(name) {
|
||||||
|
case "currentTiddler":
|
||||||
|
return "" + title;
|
||||||
|
case "..currentTiddler":
|
||||||
|
return widget.getVariable("currentTiddler");
|
||||||
|
default:
|
||||||
|
return widget.getVariable(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
results.push(filtered[0] || "");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
24
core/modules/filterrunprefixes/or.js
Normal file
24
core/modules/filterrunprefixes/or.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/or.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
Equivalent to a filter run with no prefix.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.or = function(operationSubFunction) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
results.pushTop(operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
52
core/modules/filterrunprefixes/reduce.js
Normal file
52
core/modules/filterrunprefixes/reduce.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/reduce.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.reduce = function(operationSubFunction,options) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length > 0) {
|
||||||
|
var accumulator = "";
|
||||||
|
var index = 0;
|
||||||
|
results.each(function(title) {
|
||||||
|
var list = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
|
||||||
|
getVariable: function(name) {
|
||||||
|
switch(name) {
|
||||||
|
case "currentTiddler":
|
||||||
|
return "" + title;
|
||||||
|
case "..currentTiddler":
|
||||||
|
return widget.getVariable("currentTiddler");
|
||||||
|
case "accumulator":
|
||||||
|
return "" + accumulator;
|
||||||
|
case "index":
|
||||||
|
return "" + index;
|
||||||
|
case "revIndex":
|
||||||
|
return "" + (results.length - 1 - index);
|
||||||
|
case "length":
|
||||||
|
return "" + results.length;
|
||||||
|
default:
|
||||||
|
return widget.getVariable(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(list.length > 0) {
|
||||||
|
accumulator = "" + list[0];
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
});
|
||||||
|
results.clear();
|
||||||
|
results.push(accumulator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
60
core/modules/filterrunprefixes/sort.js
Normal file
60
core/modules/filterrunprefixes/sort.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/sort.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.sort = function(operationSubFunction,options) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length > 0) {
|
||||||
|
var suffixes = options.suffixes,
|
||||||
|
sortType = (suffixes[0] && suffixes[0][0]) ? suffixes[0][0] : "string",
|
||||||
|
invert = suffixes[1] ? (suffixes[1].indexOf("reverse") !== -1) : false,
|
||||||
|
isCaseSensitive = suffixes[1] ? (suffixes[1].indexOf("casesensitive") !== -1) : false,
|
||||||
|
inputTitles = results.toArray(),
|
||||||
|
sortKeys = [],
|
||||||
|
indexes = new Array(inputTitles.length),
|
||||||
|
compareFn;
|
||||||
|
results.each(function(title) {
|
||||||
|
var key = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
|
||||||
|
getVariable: function(name) {
|
||||||
|
switch(name) {
|
||||||
|
case "currentTiddler":
|
||||||
|
return "" + title;
|
||||||
|
case "..currentTiddler":
|
||||||
|
return widget.getVariable("currentTiddler");
|
||||||
|
default:
|
||||||
|
return widget.getVariable(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sortKeys.push(key[0] || "");
|
||||||
|
});
|
||||||
|
results.clear();
|
||||||
|
// Prepare an array of indexes to sort
|
||||||
|
for(var t=0; t<inputTitles.length; t++) {
|
||||||
|
indexes[t] = t;
|
||||||
|
}
|
||||||
|
// Sort the indexes
|
||||||
|
compareFn = $tw.utils.makeCompareFunction(sortType,{defaultType: "string", invert:invert, isCaseSensitive:isCaseSensitive});
|
||||||
|
indexes = indexes.sort(function(a,b) {
|
||||||
|
return compareFn(sortKeys[a],sortKeys[b]);
|
||||||
|
});
|
||||||
|
// Add to results in correct order
|
||||||
|
$tw.utils.each(indexes,function(index) {
|
||||||
|
results.push(inputTitles[index]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -62,42 +62,60 @@ function parseFilterOperation(operators,filterString,p) {
|
|||||||
else if(operator.operator === "") {
|
else if(operator.operator === "") {
|
||||||
operator.operator = "title";
|
operator.operator = "title";
|
||||||
}
|
}
|
||||||
|
operator.operands = [];
|
||||||
|
var parseOperand = function(bracketType) {
|
||||||
|
var operand = {};
|
||||||
|
switch (bracketType) {
|
||||||
|
case "{": // Curly brackets
|
||||||
|
operand.indirect = true;
|
||||||
|
nextBracketPos = filterString.indexOf("}",p);
|
||||||
|
break;
|
||||||
|
case "[": // Square brackets
|
||||||
|
nextBracketPos = filterString.indexOf("]",p);
|
||||||
|
break;
|
||||||
|
case "<": // Angle brackets
|
||||||
|
operand.variable = true;
|
||||||
|
nextBracketPos = filterString.indexOf(">",p);
|
||||||
|
break;
|
||||||
|
case "/": // regexp brackets
|
||||||
|
var rex = /^((?:[^\\\/]|\\.)*)\/(?:\(([mygi]+)\))?/g,
|
||||||
|
rexMatch = rex.exec(filterString.substring(p));
|
||||||
|
if(rexMatch) {
|
||||||
|
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
|
||||||
|
// DEPRECATION WARNING
|
||||||
|
console.log("WARNING: Filter",operator.operator,"has a deprecated regexp operand",operator.regexp);
|
||||||
|
nextBracketPos = p + rex.lastIndex - 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw "Unterminated regular expression in filter expression";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nextBracketPos === -1) {
|
||||||
|
throw "Missing closing bracket in filter expression";
|
||||||
|
}
|
||||||
|
if(!operator.regexp) {
|
||||||
|
operand.text = filterString.substring(p,nextBracketPos);
|
||||||
|
operator.operands.push(operand);
|
||||||
|
}
|
||||||
|
p = nextBracketPos + 1;
|
||||||
|
}
|
||||||
|
|
||||||
p = nextBracketPos + 1;
|
p = nextBracketPos + 1;
|
||||||
switch (bracket) {
|
parseOperand(bracket);
|
||||||
case "{": // Curly brackets
|
|
||||||
operator.indirect = true;
|
|
||||||
nextBracketPos = filterString.indexOf("}",p);
|
|
||||||
break;
|
|
||||||
case "[": // Square brackets
|
|
||||||
nextBracketPos = filterString.indexOf("]",p);
|
|
||||||
break;
|
|
||||||
case "<": // Angle brackets
|
|
||||||
operator.variable = true;
|
|
||||||
nextBracketPos = filterString.indexOf(">",p);
|
|
||||||
break;
|
|
||||||
case "/": // regexp brackets
|
|
||||||
var rex = /^((?:[^\\\/]*|\\.)*)\/(?:\(([mygi]+)\))?/g,
|
|
||||||
rexMatch = rex.exec(filterString.substring(p));
|
|
||||||
if(rexMatch) {
|
|
||||||
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
|
|
||||||
// DEPRECATION WARNING
|
|
||||||
console.log("WARNING: Filter",operator.operator,"has a deprecated regexp operand",operator.regexp);
|
|
||||||
nextBracketPos = p + rex.lastIndex - 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw "Unterminated regular expression in filter expression";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nextBracketPos === -1) {
|
// Check for multiple operands
|
||||||
throw "Missing closing bracket in filter expression";
|
while(filterString.charAt(p) === ",") {
|
||||||
|
p++;
|
||||||
|
if(/^[\[\{<\/]/.test(filterString.substring(p))) {
|
||||||
|
nextBracketPos = p;
|
||||||
|
p++;
|
||||||
|
parseOperand(filterString.charAt(nextBracketPos));
|
||||||
|
} else {
|
||||||
|
throw "Missing [ in filter expression";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!operator.regexp) {
|
|
||||||
operator.operand = filterString.substring(p,nextBracketPos);
|
|
||||||
}
|
|
||||||
p = nextBracketPos + 1;
|
|
||||||
|
|
||||||
// Push this operator
|
// Push this operator
|
||||||
operators.push(operator);
|
operators.push(operator);
|
||||||
@@ -119,7 +137,7 @@ exports.parseFilter = function(filterString) {
|
|||||||
p = 0, // Current position in the filter string
|
p = 0, // Current position in the filter string
|
||||||
match;
|
match;
|
||||||
var whitespaceRegExp = /(\s+)/mg,
|
var whitespaceRegExp = /(\s+)/mg,
|
||||||
operandRegExp = /((?:\+|\-|~|=)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg;
|
operandRegExp = /((?:\+|\-|~|=|\:(\w+)(?:\:([\w\:, ]*))?)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg;
|
||||||
while(p < filterString.length) {
|
while(p < filterString.length) {
|
||||||
// Skip any whitespace
|
// Skip any whitespace
|
||||||
whitespaceRegExp.lastIndex = p;
|
whitespaceRegExp.lastIndex = p;
|
||||||
@@ -140,16 +158,31 @@ exports.parseFilter = function(filterString) {
|
|||||||
};
|
};
|
||||||
if(match[1]) {
|
if(match[1]) {
|
||||||
operation.prefix = match[1];
|
operation.prefix = match[1];
|
||||||
p++;
|
p = p + operation.prefix.length;
|
||||||
|
if(match[2]) {
|
||||||
|
operation.namedPrefix = match[2];
|
||||||
|
}
|
||||||
|
if(match[3]) {
|
||||||
|
operation.suffixes = [];
|
||||||
|
$tw.utils.each(match[3].split(":"),function(subsuffix) {
|
||||||
|
operation.suffixes.push([]);
|
||||||
|
$tw.utils.each(subsuffix.split(","),function(entry) {
|
||||||
|
entry = $tw.utils.trim(entry);
|
||||||
|
if(entry) {
|
||||||
|
operation.suffixes[operation.suffixes.length -1].push(entry);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(match[2]) { // Opening square bracket
|
if(match[4]) { // Opening square bracket
|
||||||
p = parseFilterOperation(operation.operators,filterString,p);
|
p = parseFilterOperation(operation.operators,filterString,p);
|
||||||
} else {
|
} else {
|
||||||
p = match.index + match[0].length;
|
p = match.index + match[0].length;
|
||||||
}
|
}
|
||||||
if(match[3] || match[4] || match[5]) { // Double quoted string, single quoted string or unquoted title
|
if(match[5] || match[6] || match[7]) { // Double quoted string, single quoted string or unquoted title
|
||||||
operation.operators.push(
|
operation.operators.push(
|
||||||
{operator: "title", operand: match[3] || match[4] || match[5]}
|
{operator: "title", operands: [{text: match[5] || match[6] || match[7]}]}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
results.push(operation);
|
results.push(operation);
|
||||||
@@ -166,6 +199,14 @@ exports.getFilterOperators = function() {
|
|||||||
return this.filterOperators;
|
return this.filterOperators;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.getFilterRunPrefixes = function() {
|
||||||
|
if(!this.filterRunPrefixes) {
|
||||||
|
$tw.Wiki.prototype.filterRunPrefixes = {};
|
||||||
|
$tw.modules.applyMethods("filterrunprefix",this.filterRunPrefixes);
|
||||||
|
}
|
||||||
|
return this.filterRunPrefixes;
|
||||||
|
}
|
||||||
|
|
||||||
exports.filterTiddlers = function(filterString,widget,source) {
|
exports.filterTiddlers = function(filterString,widget,source) {
|
||||||
var fn = this.compileFilter(filterString);
|
var fn = this.compileFilter(filterString);
|
||||||
return fn.call(this,source,widget);
|
return fn.call(this,source,widget);
|
||||||
@@ -198,7 +239,7 @@ exports.compileFilter = function(filterString) {
|
|||||||
results = [],
|
results = [],
|
||||||
currTiddlerTitle = widget && widget.getVariable("currentTiddler");
|
currTiddlerTitle = widget && widget.getVariable("currentTiddler");
|
||||||
$tw.utils.each(operation.operators,function(operator) {
|
$tw.utils.each(operation.operators,function(operator) {
|
||||||
var operand = operator.operand,
|
var operands = [],
|
||||||
operatorFunction;
|
operatorFunction;
|
||||||
if(!operator.operator) {
|
if(!operator.operator) {
|
||||||
operatorFunction = filterOperators.title;
|
operatorFunction = filterOperators.title;
|
||||||
@@ -207,16 +248,24 @@ exports.compileFilter = function(filterString) {
|
|||||||
} else {
|
} else {
|
||||||
operatorFunction = filterOperators[operator.operator];
|
operatorFunction = filterOperators[operator.operator];
|
||||||
}
|
}
|
||||||
if(operator.indirect) {
|
|
||||||
operand = self.getTextReference(operator.operand,"",currTiddlerTitle);
|
$tw.utils.each(operator.operands,function(operand) {
|
||||||
}
|
if(operand.indirect) {
|
||||||
if(operator.variable) {
|
operand.value = self.getTextReference(operand.text,"",currTiddlerTitle);
|
||||||
operand = widget.getVariable(operator.operand,{defaultValue: ""});
|
} else if(operand.variable) {
|
||||||
}
|
var varTree = $tw.utils.parseFilterVariable(operand.text);
|
||||||
|
operand.value = widget.getVariable(varTree.name,{params:varTree.params,defaultValue: ""});
|
||||||
|
} else {
|
||||||
|
operand.value = operand.text;
|
||||||
|
}
|
||||||
|
operands.push(operand.value);
|
||||||
|
});
|
||||||
|
|
||||||
// Invoke the appropriate filteroperator module
|
// Invoke the appropriate filteroperator module
|
||||||
results = operatorFunction(accumulator,{
|
results = operatorFunction(accumulator,{
|
||||||
operator: operator.operator,
|
operator: operator.operator,
|
||||||
operand: operand,
|
operand: operands.length > 0 ? operands[0] : undefined,
|
||||||
|
operands: operands,
|
||||||
prefix: operator.prefix,
|
prefix: operator.prefix,
|
||||||
suffix: operator.suffix,
|
suffix: operator.suffix,
|
||||||
suffixes: operator.suffixes,
|
suffixes: operator.suffixes,
|
||||||
@@ -241,35 +290,30 @@ exports.compileFilter = function(filterString) {
|
|||||||
return resultArray;
|
return resultArray;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var filterRunPrefixes = self.getFilterRunPrefixes();
|
||||||
// Wrap the operator functions in a wrapper function that depends on the prefix
|
// Wrap the operator functions in a wrapper function that depends on the prefix
|
||||||
operationFunctions.push((function() {
|
operationFunctions.push((function() {
|
||||||
|
var options = {wiki: self, suffixes: operation.suffixes || []};
|
||||||
switch(operation.prefix || "") {
|
switch(operation.prefix || "") {
|
||||||
case "": // No prefix means that the operation is unioned into the result
|
case "": // No prefix means that the operation is unioned into the result
|
||||||
return function(results,source,widget) {
|
return filterRunPrefixes["or"](operationSubFunction, options);
|
||||||
$tw.utils.pushTop(results,operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
case "=": // The results of the operation are pushed into the result without deduplication
|
case "=": // The results of the operation are pushed into the result without deduplication
|
||||||
return function(results,source,widget) {
|
return filterRunPrefixes["all"](operationSubFunction, options);
|
||||||
Array.prototype.push.apply(results,operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
case "-": // The results of this operation are removed from the main result
|
case "-": // The results of this operation are removed from the main result
|
||||||
return function(results,source,widget) {
|
return filterRunPrefixes["except"](operationSubFunction, options);
|
||||||
$tw.utils.removeArrayEntries(results,operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
case "+": // This operation is applied to the main results so far
|
case "+": // This operation is applied to the main results so far
|
||||||
return function(results,source,widget) {
|
return filterRunPrefixes["and"](operationSubFunction, options);
|
||||||
// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved
|
|
||||||
source = self.makeTiddlerIterator(results);
|
|
||||||
results.splice(0,results.length);
|
|
||||||
$tw.utils.pushTop(results,operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
case "~": // This operation is unioned into the result only if the main result so far is empty
|
case "~": // This operation is unioned into the result only if the main result so far is empty
|
||||||
return function(results,source,widget) {
|
return filterRunPrefixes["else"](operationSubFunction, options);
|
||||||
if(results.length === 0) {
|
default:
|
||||||
// Main result so far is empty
|
if(operation.namedPrefix && filterRunPrefixes[operation.namedPrefix]) {
|
||||||
$tw.utils.pushTop(results,operationSubFunction(source,widget));
|
return filterRunPrefixes[operation.namedPrefix](operationSubFunction, options);
|
||||||
}
|
} else {
|
||||||
};
|
return function(results,source,widget) {
|
||||||
|
results.clear();
|
||||||
|
results.push($tw.language.getString("Error/FilterRunPrefix"));
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
});
|
});
|
||||||
@@ -280,11 +324,14 @@ exports.compileFilter = function(filterString) {
|
|||||||
} else if(typeof source === "object") { // Array or hashmap
|
} else if(typeof source === "object") { // Array or hashmap
|
||||||
source = self.makeTiddlerIterator(source);
|
source = self.makeTiddlerIterator(source);
|
||||||
}
|
}
|
||||||
var results = [];
|
if(!widget) {
|
||||||
|
widget = $tw.rootWidget;
|
||||||
|
}
|
||||||
|
var results = new $tw.utils.LinkedList();
|
||||||
$tw.utils.each(operationFunctions,function(operationFunction) {
|
$tw.utils.each(operationFunctions,function(operationFunction) {
|
||||||
operationFunction(results,source,widget);
|
operationFunction(results,source,widget);
|
||||||
});
|
});
|
||||||
return results;
|
return results.toArray();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ exports.all = function(source,operator,options) {
|
|||||||
// Get our suboperators
|
// Get our suboperators
|
||||||
var allFilterOperators = getAllFilterOperators();
|
var allFilterOperators = getAllFilterOperators();
|
||||||
// Cycle through the suboperators accumulating their results
|
// Cycle through the suboperators accumulating their results
|
||||||
var results = [],
|
var results = new $tw.utils.LinkedList(),
|
||||||
subops = operator.operand.split("+");
|
subops = operator.operand.split("+");
|
||||||
// Check for common optimisations
|
// Check for common optimisations
|
||||||
if(subops.length === 1 && subops[0] === "") {
|
if(subops.length === 1 && subops[0] === "") {
|
||||||
@@ -49,10 +49,10 @@ exports.all = function(source,operator,options) {
|
|||||||
for(var t=0; t<subops.length; t++) {
|
for(var t=0; t<subops.length; t++) {
|
||||||
var subop = allFilterOperators[subops[t]];
|
var subop = allFilterOperators[subops[t]];
|
||||||
if(subop) {
|
if(subop) {
|
||||||
$tw.utils.pushTop(results,subop(source,operator.prefix,options));
|
results.pushTop(subop(source,operator.prefix,options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results.makeTiddlerIterator(options.wiki);
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ Filter operator for returning all the backlinks from a tiddler
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.backlinks = function(source,operator,options) {
|
exports.backlinks = function(source,operator,options) {
|
||||||
var results = [];
|
var results = new $tw.utils.LinkedList();
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));
|
results.pushTop(options.wiki.getTiddlerBacklinks(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results.makeTiddlerIterator(options.wiki);
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.contains = function(source,operator,options) {
|
exports.contains = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
fieldname = (operator.suffix || "list").toLowerCase();
|
fieldname = operator.suffix || "list";
|
||||||
if(operator.prefix === "!") {
|
if(operator.prefix === "!") {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
|
|||||||
27
core/modules/filters/deserializers.js
Normal file
27
core/modules/filters/deserializers.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filters/deserializers.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filteroperator
|
||||||
|
|
||||||
|
Filter operator for returning the names of the deserializers in this wiki
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.deserializers = function(source,operator,options) {
|
||||||
|
var results = [];
|
||||||
|
$tw.utils.each($tw.Wiki.tiddlerDeserializerModules,function(deserializer,type) {
|
||||||
|
results.push(type);
|
||||||
|
});
|
||||||
|
results.sort();
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -16,14 +16,16 @@ Filter operator for returning the descriptions of the specified edition names
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.editiondescription = function(source,operator,options) {
|
exports.editiondescription = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [];
|
||||||
editionInfo = $tw.utils.getEditionInfo();
|
if($tw.node) {
|
||||||
if(editionInfo) {
|
var editionInfo = $tw.utils.getEditionInfo();
|
||||||
source(function(tiddler,title) {
|
if(editionInfo) {
|
||||||
if($tw.utils.hop(editionInfo,title)) {
|
source(function(tiddler,title) {
|
||||||
results.push(editionInfo[title].description || "");
|
if($tw.utils.hop(editionInfo,title)) {
|
||||||
}
|
results.push(editionInfo[title].description || "");
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,14 +16,16 @@ Filter operator for returning the names of the available editions in this wiki
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.editions = function(source,operator,options) {
|
exports.editions = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [];
|
||||||
editionInfo = $tw.utils.getEditionInfo();
|
if($tw.node) {
|
||||||
if(editionInfo) {
|
var editionInfo = $tw.utils.getEditionInfo();
|
||||||
$tw.utils.each(editionInfo,function(info,name) {
|
if(editionInfo) {
|
||||||
results.push(name);
|
$tw.utils.each(editionInfo,function(info,name) {
|
||||||
});
|
results.push(name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
results.sort();
|
||||||
}
|
}
|
||||||
results.sort();
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,7 @@ Export our filter functions
|
|||||||
exports.decodeuricomponent = function(source,operator,options) {
|
exports.decodeuricomponent = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var value = title;
|
results.push($tw.utils.decodeURIComponentSafe(title));
|
||||||
try {
|
|
||||||
value = decodeURIComponent(title);
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
results.push(value);
|
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -40,12 +35,7 @@ exports.encodeuricomponent = function(source,operator,options) {
|
|||||||
exports.decodeuri = function(source,operator,options) {
|
exports.decodeuri = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var value = title;
|
results.push($tw.utils.decodeURISafe(title));
|
||||||
try {
|
|
||||||
value = decodeURI(title);
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
results.push(value);
|
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -77,7 +67,7 @@ exports.encodehtml = function(source,operator,options) {
|
|||||||
exports.stringify = function(source,operator,options) {
|
exports.stringify = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.stringify(title));
|
results.push($tw.utils.stringify(title,(operator.suffix === "rawunicode")));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -85,7 +75,7 @@ exports.stringify = function(source,operator,options) {
|
|||||||
exports.jsonstringify = function(source,operator,options) {
|
exports.jsonstringify = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.jsonStringify(title));
|
results.push($tw.utils.jsonStringify(title,(operator.suffix === "rawunicode")));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -102,7 +92,7 @@ exports.escapecss = function(source,operator,options) {
|
|||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
// escape any character with a special meaning in CSS using CSS.escape()
|
// escape any character with a special meaning in CSS using CSS.escape()
|
||||||
results.push(CSS.escape(title));
|
results.push($tw.utils.escapeCSS(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.field = function(source,operator,options) {
|
exports.field = function(source,operator,options) {
|
||||||
var results = [],indexedResults,
|
var results = [],indexedResults,
|
||||||
fieldname = (operator.suffix || operator.operator || "title").toLowerCase();
|
fieldname = operator.suffix || operator.operator || "title";
|
||||||
if(operator.prefix === "!") {
|
if(operator.prefix === "!") {
|
||||||
if(operator.regexp) {
|
if(operator.regexp) {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ exports.fields = function(source,operator,options) {
|
|||||||
fieldName,
|
fieldName,
|
||||||
suffixes = (operator.suffixes || [])[0] || [],
|
suffixes = (operator.suffixes || [])[0] || [],
|
||||||
operand = $tw.utils.parseStringArray(operator.operand);
|
operand = $tw.utils.parseStringArray(operator.operand);
|
||||||
|
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
if(suffixes.indexOf("include") !== -1) {
|
if(suffixes.indexOf("include") !== -1) {
|
||||||
|
|||||||
@@ -20,7 +20,18 @@ exports.filter = function(source,operator,options) {
|
|||||||
results = [],
|
results = [],
|
||||||
target = operator.prefix !== "!";
|
target = operator.prefix !== "!";
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]));
|
var list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),{
|
||||||
|
getVariable: function(name) {
|
||||||
|
switch(name) {
|
||||||
|
case "currentTiddler":
|
||||||
|
return "" + title;
|
||||||
|
case "..currentTiddler":
|
||||||
|
return options.widget.getVariable("currentTiddler");
|
||||||
|
default:
|
||||||
|
return options.widget.getVariable(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
if((list.length > 0) === target) {
|
if((list.length > 0) === target) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ module-type: formatfilteroperator
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.date = function(source,operand,options) {
|
exports.date = function(source,operand,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var value = $tw.utils.parseDate(title);
|
var value = $tw.utils.parseDate(title);
|
||||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||||
results.push($tw.utils.formatDateString(value,operand || "YYYY MM DD 0hh:0mm"));
|
results.push($tw.utils.formatDateString(value,operand || "YYYY MM DD 0hh:0mm"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ module-type: formatfilteroperator
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.relativedate = function(source,operand,options) {
|
exports.relativedate = function(source,operand,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var value = $tw.utils.parseDate(title);
|
var value = $tw.utils.parseDate(title);
|
||||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||||
results.push($tw.utils.getRelativeDate((new Date()) - (new Date(value))).description);
|
results.push($tw.utils.getRelativeDate((new Date()) - (new Date(value))).description);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
25
core/modules/filters/format/titlelist.js
Normal file
25
core/modules/filters/format/titlelist.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filters/format/titlelist.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: formatfilteroperator
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.titlelist = function(source,operand,options) {
|
||||||
|
var results = [];
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(title && title.length) {
|
||||||
|
results.push($tw.utils.stringifyList([title]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -61,7 +61,7 @@ exports.has = function(source,operator,options) {
|
|||||||
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && (tiddler.fields[operator.operand].length !== 0)) {
|
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && (tiddler.fields[operator.operand].length !== 0)) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|||||||
36
core/modules/filters/is/draft.js
Normal file
36
core/modules/filters/is/draft.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filters/is/draft.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: isfilteroperator
|
||||||
|
|
||||||
|
Filter function for [is[draft]] analagous to [has[draft.of]]
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.draft = function(source,prefix,options) {
|
||||||
|
var results = [];
|
||||||
|
if(prefix === "!") {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(!tiddler || !$tw.utils.hop(tiddler.fields,"draft.of")) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(tiddler && $tw.utils.hop(tiddler.fields,"draft.of") && (tiddler.fields["draft.of"].length !== 0)) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -16,11 +16,11 @@ Filter operator for returning all the links from a tiddler
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.links = function(source,operator,options) {
|
exports.links = function(source,operator,options) {
|
||||||
var results = [];
|
var results = new $tw.utils.LinkedList();
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
$tw.utils.pushTop(results,options.wiki.getTiddlerLinks(title));
|
results.pushTop(options.wiki.getTiddlerLinks(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results.makeTiddlerIterator(options.wiki);
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Export our filter function
|
|||||||
exports.lookup = function(source,operator,options) {
|
exports.lookup = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push(options.wiki.getTiddlerText(operator.operand + title) || options.wiki.getTiddlerText(operator.operand + operator.suffix));
|
results.push(options.wiki.getTiddlerText(operator.operand + title) || operator.suffix || '');
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -91,6 +91,20 @@ exports.exponential = makeNumericBinaryOperator(
|
|||||||
function(a,b) {return Number.prototype.toExponential.call(a,Math.min(Math.max(b,0),100));}
|
function(a,b) {return Number.prototype.toExponential.call(a,Math.min(Math.max(b,0),100));}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
exports.power = makeNumericBinaryOperator(
|
||||||
|
function(a,b) {return Math.pow(a,b);}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.log = makeNumericBinaryOperator(
|
||||||
|
function(a,b) {
|
||||||
|
if(b) {
|
||||||
|
return Math.log(a)/Math.log(b);
|
||||||
|
} else {
|
||||||
|
return Math.log(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
exports.sum = makeNumericReducingOperator(
|
exports.sum = makeNumericReducingOperator(
|
||||||
function(accumulator,value) {return accumulator + value},
|
function(accumulator,value) {return accumulator + value},
|
||||||
0 // Initial value
|
0 // Initial value
|
||||||
@@ -111,6 +125,83 @@ exports.minall = makeNumericReducingOperator(
|
|||||||
Infinity // Initial value
|
Infinity // Initial value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
exports.median = makeNumericArrayOperator(
|
||||||
|
function(values) {
|
||||||
|
var len = values.length, median;
|
||||||
|
values.sort();
|
||||||
|
if(len % 2) {
|
||||||
|
// Odd, return the middle number
|
||||||
|
median = values[(len - 1) / 2];
|
||||||
|
} else {
|
||||||
|
// Even, return average of two middle numbers
|
||||||
|
median = (values[len / 2 - 1] + values[len / 2]) / 2;
|
||||||
|
}
|
||||||
|
return [median];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.average = makeNumericReducingOperator(
|
||||||
|
function(accumulator,value) {return accumulator + value},
|
||||||
|
0, // Initial value
|
||||||
|
function(finalValue,numberOfValues) {
|
||||||
|
return finalValue/numberOfValues;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.variance = makeNumericReducingOperator(
|
||||||
|
function(accumulator,value) {return accumulator + value},
|
||||||
|
0,
|
||||||
|
function(finalValue,numberOfValues,originalValues) {
|
||||||
|
return getVarianceFromArray(originalValues,finalValue/numberOfValues);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports["standard-deviation"] = makeNumericReducingOperator(
|
||||||
|
function(accumulator,value) {return accumulator + value},
|
||||||
|
0,
|
||||||
|
function(finalValue,numberOfValues,originalValues) {
|
||||||
|
var variance = getVarianceFromArray(originalValues,finalValue/numberOfValues);
|
||||||
|
return Math.sqrt(variance);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
//trigonometry
|
||||||
|
exports.cos = makeNumericBinaryOperator(
|
||||||
|
function(a) {return Math.cos(a)}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.sin = makeNumericBinaryOperator(
|
||||||
|
function(a) {return Math.sin(a)}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.tan = makeNumericBinaryOperator(
|
||||||
|
function(a) {return Math.tan(a)}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.acos = makeNumericBinaryOperator(
|
||||||
|
function(a) {return Math.acos(a)}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.asin = makeNumericBinaryOperator(
|
||||||
|
function(a) {return Math.asin(a)}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.atan = makeNumericBinaryOperator(
|
||||||
|
function(a) {return Math.atan(a)}
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.atan2 = makeNumericBinaryOperator(
|
||||||
|
function(a,b) {return Math.atan2(a,b)}
|
||||||
|
);
|
||||||
|
|
||||||
|
//Calculate the variance of a population of numbers in an array given its mean
|
||||||
|
function getVarianceFromArray(values,mean) {
|
||||||
|
var deviationTotal = values.reduce(function(accumulator,value) {
|
||||||
|
return accumulator + Math.pow(value - mean, 2);
|
||||||
|
},0);
|
||||||
|
return deviationTotal/values.length;
|
||||||
|
};
|
||||||
|
|
||||||
function makeNumericBinaryOperator(fnCalc) {
|
function makeNumericBinaryOperator(fnCalc) {
|
||||||
return function(source,operator,options) {
|
return function(source,operator,options) {
|
||||||
var result = [],
|
var result = [],
|
||||||
@@ -120,19 +211,37 @@ function makeNumericBinaryOperator(fnCalc) {
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
function makeNumericReducingOperator(fnCalc,initialValue) {
|
function makeNumericReducingOperator(fnCalc,initialValue,fnFinal) {
|
||||||
initialValue = initialValue || 0;
|
initialValue = initialValue || 0;
|
||||||
return function(source,operator,options) {
|
return function(source,operator,options) {
|
||||||
var result = [];
|
var result = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
result.push(title);
|
result.push($tw.utils.parseNumber(title));
|
||||||
});
|
});
|
||||||
return [$tw.utils.stringifyNumber(result.reduce(function(accumulator,currentValue) {
|
var value = result.reduce(function(accumulator,currentValue) {
|
||||||
return fnCalc(accumulator,$tw.utils.parseNumber(currentValue));
|
return fnCalc(accumulator,currentValue);
|
||||||
},initialValue))];
|
},initialValue);
|
||||||
|
if(fnFinal) {
|
||||||
|
value = fnFinal(value,result.length,result);
|
||||||
|
}
|
||||||
|
return [$tw.utils.stringifyNumber(value)];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
function makeNumericArrayOperator(fnCalc) {
|
||||||
|
return function(source,operator,options) {
|
||||||
|
var results = [];
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
results.push($tw.utils.parseNumber(title));
|
||||||
|
});
|
||||||
|
results = fnCalc(results);
|
||||||
|
$tw.utils.each(results,function(value,index) {
|
||||||
|
results[index] = $tw.utils.stringifyNumber(value);
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
30
core/modules/filters/moduleproperty.js
Normal file
30
core/modules/filters/moduleproperty.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filters/moduleproperty.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filteroperator
|
||||||
|
|
||||||
|
Filter [[module-name]moduleproperty[name]] retrieve a module property
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.moduleproperty = function(source,operator,options) {
|
||||||
|
var results = [];
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
var value = require(title)[operator.operand || ""];
|
||||||
|
if(value !== undefined) {
|
||||||
|
results.push(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
results.sort();
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -17,11 +17,23 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.modules = function(source,operator,options) {
|
exports.modules = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
if(operator.operands.length >= 2) {
|
||||||
$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {
|
// Return the modules that have the module property specified in the first operand with the value in the second operand
|
||||||
results.push(moduleName);
|
source(function(tiddler,title) {
|
||||||
|
$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {
|
||||||
|
if(require(moduleName)[operator.operands[0]] === operator.operands[1]) {
|
||||||
|
results.push(moduleName);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
// Return all the module names without filtering
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {
|
||||||
|
results.push(moduleName);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
results.sort();
|
results.sort();
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,9 +17,13 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.range = function(source,operator,options) {
|
exports.range = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
// Split the operand into numbers delimited by these symbols
|
// For backwards compatibility, if there is only one operand, try to split it using one of the delimiters
|
||||||
var parts = operator.operand.split(/[,:;]/g),
|
var parts = operator.operands || [];
|
||||||
beg, end, inc, i, fixed = 0;
|
if(parts.length === 1) {
|
||||||
|
parts = operator.operand.split(/[,:;]/g);
|
||||||
|
}
|
||||||
|
// Process the parts
|
||||||
|
var beg, end, inc, i, fixed = 0;
|
||||||
for (i=0; i<parts.length; i++) {
|
for (i=0; i<parts.length; i++) {
|
||||||
// Validate real number
|
// Validate real number
|
||||||
if(!/^\s*[+-]?((\d+(\.\d*)?)|(\.\d+))\s*$/.test(parts[i])) {
|
if(!/^\s*[+-]?((\d+(\.\d*)?)|(\.\d+))\s*$/.test(parts[i])) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: $:/core/modules/filters/reduce.js
|
|||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: filteroperator
|
module-type: filteroperator
|
||||||
|
|
||||||
Filter operator evaluats a subfilter for each item, making the running total available in the variable `accumulator`, and the current index available in the variable `index`
|
Filter operator evaluates a subfilter for each item, making the running total available in the variable `accumulator`, and the current index available in the variable `index`
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -23,7 +23,7 @@ exports.reduce = function(source,operator,options) {
|
|||||||
});
|
});
|
||||||
// Run the filter over each item
|
// Run the filter over each item
|
||||||
var filterFn = options.wiki.compileFilter(operator.operand),
|
var filterFn = options.wiki.compileFilter(operator.operand),
|
||||||
accumulator = operator.suffix || "";
|
accumulator = operator.operands[1] || "";
|
||||||
for(var index=0; index<results.length; index++) {
|
for(var index=0; index<results.length; index++) {
|
||||||
var title = results[index],
|
var title = results[index],
|
||||||
list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),{
|
list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),{
|
||||||
@@ -31,6 +31,8 @@ exports.reduce = function(source,operator,options) {
|
|||||||
switch(name) {
|
switch(name) {
|
||||||
case "currentTiddler":
|
case "currentTiddler":
|
||||||
return "" + title;
|
return "" + title;
|
||||||
|
case "..currentTiddler":
|
||||||
|
return options.widget.getVariable("currentTiddler");
|
||||||
case "accumulator":
|
case "accumulator":
|
||||||
return "" + accumulator;
|
return "" + accumulator;
|
||||||
case "index":
|
case "index":
|
||||||
@@ -48,7 +50,11 @@ exports.reduce = function(source,operator,options) {
|
|||||||
accumulator = "" + list[0];
|
accumulator = "" + list[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [accumulator];
|
if(results.length > 0) {
|
||||||
|
return [accumulator];
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.regexp = function(source,operator,options) {
|
exports.regexp = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
fieldname = (operator.suffix || "title").toLowerCase(),
|
fieldname = operator.suffix || "title",
|
||||||
regexpString, regexp, flags = "", match,
|
regexpString, regexp, flags = "", match,
|
||||||
getFieldString = function(tiddler,title) {
|
getFieldString = function(tiddler,title) {
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
|
|||||||
@@ -27,10 +27,13 @@ exports.sortsub = function(source,operator,options) {
|
|||||||
iterator(options.wiki.getTiddler(title),title);
|
iterator(options.wiki.getTiddler(title),title);
|
||||||
},{
|
},{
|
||||||
getVariable: function(name) {
|
getVariable: function(name) {
|
||||||
if(name === "currentTiddler") {
|
switch(name) {
|
||||||
return title;
|
case "currentTiddler":
|
||||||
} else {
|
return "" + title;
|
||||||
return options.widget.getVariable(name);
|
case "..currentTiddler":
|
||||||
|
return options.widget.getVariable("currentTiddler");
|
||||||
|
default:
|
||||||
|
return options.widget.getVariable(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,14 +56,14 @@ exports.trim = function(source,operator,options) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// makeStringBinaryOperator(
|
|
||||||
// function(a) {return [$tw.utils.trim(a)];}
|
|
||||||
// );
|
|
||||||
|
|
||||||
exports.split = makeStringBinaryOperator(
|
exports.split = makeStringBinaryOperator(
|
||||||
function(a,b) {return ("" + a).split(b);}
|
function(a,b) {return ("" + a).split(b);}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
exports["enlist-input"] = makeStringBinaryOperator(
|
||||||
|
function(a,o,s) {return $tw.utils.parseStringArray("" + a,(s === "raw"));}
|
||||||
|
);
|
||||||
|
|
||||||
exports.join = makeStringReducingOperator(
|
exports.join = makeStringReducingOperator(
|
||||||
function(accumulator,value,operand) {
|
function(accumulator,value,operand) {
|
||||||
if(accumulator === null) {
|
if(accumulator === null) {
|
||||||
@@ -78,7 +78,7 @@ function makeStringBinaryOperator(fnCalc) {
|
|||||||
return function(source,operator,options) {
|
return function(source,operator,options) {
|
||||||
var result = [];
|
var result = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
Array.prototype.push.apply(result,fnCalc(title,operator.operand || ""));
|
Array.prototype.push.apply(result,fnCalc(title,operator.operand || "",operator.suffix || ""));
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -105,14 +105,81 @@ exports.splitregexp = function(source,operator,options) {
|
|||||||
flags = (suffix.indexOf("m") !== -1 ? "m" : "") + (suffix.indexOf("i") !== -1 ? "i" : ""),
|
flags = (suffix.indexOf("m") !== -1 ? "m" : "") + (suffix.indexOf("i") !== -1 ? "i" : ""),
|
||||||
regExp;
|
regExp;
|
||||||
try {
|
try {
|
||||||
regExp = new RegExp(operator.operand || "",flags);
|
regExp = new RegExp(operator.operand || "",flags);
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
return ["RegExp error: " + ex];
|
return ["RegExp error: " + ex];
|
||||||
}
|
}
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
Array.prototype.push.apply(result,title.split(regExp));
|
Array.prototype.push.apply(result,title.split(regExp));
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports["search-replace"] = function(source,operator,options) {
|
||||||
|
var results = [],
|
||||||
|
suffixes = operator.suffixes || [],
|
||||||
|
flagSuffix = (suffixes[0] ? (suffixes[0][0] || "") : ""),
|
||||||
|
flags = (flagSuffix.indexOf("g") !== -1 ? "g" : "") + (flagSuffix.indexOf("i") !== -1 ? "i" : "") + (flagSuffix.indexOf("m") !== -1 ? "m" : ""),
|
||||||
|
isRegExp = (suffixes[1] && suffixes[1][0] === "regexp") ? true : false,
|
||||||
|
searchTerm,
|
||||||
|
regExp;
|
||||||
|
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(title && (operator.operands.length > 1)) {
|
||||||
|
//Escape regexp characters if the operand is not a regular expression
|
||||||
|
searchTerm = isRegExp ? operator.operand : $tw.utils.escapeRegExp(operator.operand);
|
||||||
|
try {
|
||||||
|
regExp = new RegExp(searchTerm,flags);
|
||||||
|
} catch(ex) {
|
||||||
|
return ["RegExp error: " + ex];
|
||||||
|
}
|
||||||
|
results.push(
|
||||||
|
title.replace(regExp,operator.operands[1])
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.pad = function(source,operator,options) {
|
||||||
|
var results = [],
|
||||||
|
targetLength = operator.operand ? parseInt(operator.operand) : 0,
|
||||||
|
fill = operator.operands[1] || "0";
|
||||||
|
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(title && title.length) {
|
||||||
|
if(title.length >= targetLength) {
|
||||||
|
results.push(title);
|
||||||
|
} else {
|
||||||
|
var padString = "",
|
||||||
|
padStringLength = targetLength - title.length;
|
||||||
|
while (padStringLength > padString.length) {
|
||||||
|
padString += fill;
|
||||||
|
}
|
||||||
|
//make sure we do not exceed the specified length
|
||||||
|
padString = padString.slice(0,padStringLength);
|
||||||
|
if(operator.suffix && (operator.suffix === "suffix")) {
|
||||||
|
title = title + padString;
|
||||||
|
} else {
|
||||||
|
title = padString + title;
|
||||||
|
}
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.charcode = function(source,operator,options) {
|
||||||
|
var chars = [];
|
||||||
|
$tw.utils.each(operator.operands,function(operand) {
|
||||||
|
if(operand !== "") {
|
||||||
|
chars.push(String.fromCharCode($tw.utils.parseInt(operand)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return [chars.join("")];
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ exports.tag = function(source,operator,options) {
|
|||||||
});
|
});
|
||||||
results = options.wiki.sortByList(results,operator.operand);
|
results = options.wiki.sortByList(results,operator.operand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,20 +16,13 @@ Filter operator returning all the selected tiddlers that are untagged
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.untagged = function(source,operator,options) {
|
exports.untagged = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [],
|
||||||
if(operator.prefix === "!") {
|
expected = (operator.prefix === "!");
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) {
|
if((tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) === expected) {
|
||||||
$tw.utils.pushTop(results,title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
if(!tiddler || !tiddler.hasField("tags") || ($tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length === 0)) {
|
|
||||||
$tw.utils.pushTop(results,title);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,183 +8,228 @@ Extended filter operators to manipulate the current list.
|
|||||||
\*/
|
\*/
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
/*jslint node: true, browser: true */
|
||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Fetch titles from the current list
|
Fetch titles from the current list
|
||||||
*/
|
*/
|
||||||
var prepare_results = function (source) {
|
var prepare_results = function (source) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function (tiddler, title) {
|
source(function (tiddler, title) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Moves a number of items from the tail of the current list before the item named in the operand
|
Moves a number of items from the tail of the current list before the item named in the operand
|
||||||
*/
|
*/
|
||||||
exports.putbefore = function (source, operator) {
|
exports.putbefore = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
index = results.indexOf(operator.operand),
|
index = results.indexOf(operator.operand),
|
||||||
count = $tw.utils.getInt(operator.suffix,1);
|
count = $tw.utils.getInt(operator.suffix,1);
|
||||||
return (index === -1) ?
|
return (index === -1) ?
|
||||||
results.slice(0, -1) :
|
results.slice(0, -1) :
|
||||||
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index, -count));
|
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index, -count));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Moves a number of items from the tail of the current list after the item named in the operand
|
Moves a number of items from the tail of the current list after the item named in the operand
|
||||||
*/
|
*/
|
||||||
exports.putafter = function (source, operator) {
|
exports.putafter = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
index = results.indexOf(operator.operand),
|
index = results.indexOf(operator.operand),
|
||||||
count = $tw.utils.getInt(operator.suffix,1);
|
count = $tw.utils.getInt(operator.suffix,1);
|
||||||
return (index === -1) ?
|
return (index === -1) ?
|
||||||
results.slice(0, -1) :
|
results.slice(0, -1) :
|
||||||
results.slice(0, index + 1).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
results.slice(0, index + 1).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Replaces the item named in the operand with a number of items from the tail of the current list
|
Replaces the item named in the operand with a number of items from the tail of the current list
|
||||||
*/
|
*/
|
||||||
exports.replace = function (source, operator) {
|
exports.replace = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
index = results.indexOf(operator.operand),
|
index = results.indexOf(operator.operand),
|
||||||
count = $tw.utils.getInt(operator.suffix,1);
|
count = $tw.utils.getInt(operator.suffix,1);
|
||||||
return (index === -1) ?
|
return (index === -1) ?
|
||||||
results.slice(0, -count) :
|
results.slice(0, -count) :
|
||||||
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Moves a number of items from the tail of the current list to the head of the list
|
Moves a number of items from the tail of the current list to the head of the list
|
||||||
*/
|
*/
|
||||||
exports.putfirst = function (source, operator) {
|
exports.putfirst = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
count = $tw.utils.getInt(operator.suffix,1);
|
count = $tw.utils.getInt(operator.suffix,1);
|
||||||
return results.slice(-count).concat(results.slice(0, -count));
|
return results.slice(-count).concat(results.slice(0, -count));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Moves a number of items from the head of the current list to the tail of the list
|
Moves a number of items from the head of the current list to the tail of the list
|
||||||
*/
|
*/
|
||||||
exports.putlast = function (source, operator) {
|
exports.putlast = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
count = $tw.utils.getInt(operator.suffix,1);
|
count = $tw.utils.getInt(operator.suffix,1);
|
||||||
return results.slice(count).concat(results.slice(0, count));
|
return results.slice(count).concat(results.slice(0, count));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Moves the item named in the operand a number of places forward or backward in the list
|
Moves the item named in the operand a number of places forward or backward in the list
|
||||||
*/
|
*/
|
||||||
exports.move = function (source, operator) {
|
exports.move = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
index = results.indexOf(operator.operand),
|
index = results.indexOf(operator.operand),
|
||||||
count = $tw.utils.getInt(operator.suffix,1),
|
count = $tw.utils.getInt(operator.suffix,1),
|
||||||
marker = results.splice(index, 1),
|
marker = results.splice(index, 1),
|
||||||
offset = (index + count) > 0 ? index + count : 0;
|
offset = (index + count) > 0 ? index + count : 0;
|
||||||
return results.slice(0, offset).concat(marker).concat(results.slice(offset));
|
return results.slice(0, offset).concat(marker).concat(results.slice(offset));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the items from the current list that are after the item named in the operand
|
Returns the items from the current list that are after the item named in the operand
|
||||||
*/
|
*/
|
||||||
exports.allafter = function (source, operator) {
|
exports.allafter = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
index = results.indexOf(operator.operand);
|
index = results.indexOf(operator.operand);
|
||||||
return (index === -1) ? [] :
|
return (index === -1) ? [] :
|
||||||
(operator.suffix) ? results.slice(index) :
|
(operator.suffix) ? results.slice(index) :
|
||||||
results.slice(index + 1);
|
results.slice(index + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the items from the current list that are before the item named in the operand
|
Returns the items from the current list that are before the item named in the operand
|
||||||
*/
|
*/
|
||||||
exports.allbefore = function (source, operator) {
|
exports.allbefore = function (source, operator) {
|
||||||
var results = prepare_results(source),
|
var results = prepare_results(source),
|
||||||
index = results.indexOf(operator.operand);
|
index = results.indexOf(operator.operand);
|
||||||
return (index === -1) ? [] :
|
return (index === -1) ? [] :
|
||||||
(operator.suffix) ? results.slice(0, index + 1) :
|
(operator.suffix) ? results.slice(0, index + 1) :
|
||||||
results.slice(0, index);
|
results.slice(0, index);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Appends the items listed in the operand array to the tail of the current list
|
Appends the items listed in the operand array to the tail of the current list
|
||||||
*/
|
*/
|
||||||
exports.append = function (source, operator) {
|
exports.append = function (source, operator) {
|
||||||
var append = $tw.utils.parseStringArray(operator.operand, "true"),
|
var append = $tw.utils.parseStringArray(operator.operand, "true"),
|
||||||
results = prepare_results(source),
|
results = prepare_results(source),
|
||||||
count = parseInt(operator.suffix) || append.length;
|
count = parseInt(operator.suffix) || append.length;
|
||||||
return (append.length === 0) ? results :
|
return (append.length === 0) ? results :
|
||||||
(operator.prefix) ? results.concat(append.slice(-count)) :
|
(operator.prefix) ? results.concat(append.slice(-count)) :
|
||||||
results.concat(append.slice(0, count));
|
results.concat(append.slice(0, count));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prepends the items listed in the operand array to the head of the current list
|
Prepends the items listed in the operand array to the head of the current list
|
||||||
*/
|
*/
|
||||||
exports.prepend = function (source, operator) {
|
exports.prepend = function (source, operator) {
|
||||||
var prepend = $tw.utils.parseStringArray(operator.operand, "true"),
|
var prepend = $tw.utils.parseStringArray(operator.operand, "true"),
|
||||||
results = prepare_results(source),
|
results = prepare_results(source),
|
||||||
count = $tw.utils.getInt(operator.suffix,prepend.length);
|
count = $tw.utils.getInt(operator.suffix,prepend.length);
|
||||||
return (prepend.length === 0) ? results :
|
return (prepend.length === 0) ? results :
|
||||||
(operator.prefix) ? prepend.slice(-count).concat(results) :
|
(operator.prefix) ? prepend.slice(-count).concat(results) :
|
||||||
prepend.slice(0, count).concat(results);
|
prepend.slice(0, count).concat(results);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns all items from the current list except the items listed in the operand array
|
Returns all items from the current list except the items listed in the operand array
|
||||||
*/
|
*/
|
||||||
exports.remove = function (source, operator) {
|
exports.remove = function (source, operator) {
|
||||||
var array = $tw.utils.parseStringArray(operator.operand, "true"),
|
var array = $tw.utils.parseStringArray(operator.operand, "true"),
|
||||||
results = prepare_results(source),
|
results = prepare_results(source),
|
||||||
count = parseInt(operator.suffix) || array.length,
|
count = parseInt(operator.suffix) || array.length,
|
||||||
p,
|
p,
|
||||||
len,
|
len,
|
||||||
index;
|
index;
|
||||||
len = array.length - 1;
|
len = array.length - 1;
|
||||||
for (p = 0; p < count; ++p) {
|
for (p = 0; p < count; ++p) {
|
||||||
if (operator.prefix) {
|
if (operator.prefix) {
|
||||||
index = results.indexOf(array[len - p]);
|
index = results.indexOf(array[len - p]);
|
||||||
} else {
|
} else {
|
||||||
index = results.indexOf(array[p]);
|
index = results.indexOf(array[p]);
|
||||||
}
|
}
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
results.splice(index, 1);
|
results.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns all items from the current list sorted in the order of the items in the operand array
|
Returns all items from the current list sorted in the order of the items in the operand array
|
||||||
*/
|
*/
|
||||||
exports.sortby = function (source, operator) {
|
exports.sortby = function (source, operator) {
|
||||||
var results = prepare_results(source);
|
var results = prepare_results(source);
|
||||||
if (!results || results.length < 2) {
|
if (!results || results.length < 2) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
var lookup = $tw.utils.parseStringArray(operator.operand, "true");
|
var lookup = $tw.utils.parseStringArray(operator.operand, "true");
|
||||||
results.sort(function (a, b) {
|
results.sort(function (a, b) {
|
||||||
return lookup.indexOf(a) - lookup.indexOf(b);
|
return lookup.indexOf(a) - lookup.indexOf(b);
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Removes all duplicate items from the current list
|
||||||
|
*/
|
||||||
|
exports.unique = function (source, operator) {
|
||||||
|
var results = prepare_results(source);
|
||||||
|
var set = results.reduce(function (a, b) {
|
||||||
|
if (a.indexOf(b) < 0) {
|
||||||
|
a.push(b);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}, []);
|
||||||
|
return set;
|
||||||
|
};
|
||||||
|
|
||||||
|
var cycleValueInArray = function(results,operands,stepSize) {
|
||||||
|
var resultsIndex,
|
||||||
|
step = stepSize || 1,
|
||||||
|
i = 0,
|
||||||
|
opLength = operands.length,
|
||||||
|
nextOperandIndex;
|
||||||
|
for(i; i < opLength; i++) {
|
||||||
|
resultsIndex = results.indexOf(operands[i]);
|
||||||
|
if(resultsIndex !== -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(resultsIndex !== -1) {
|
||||||
|
i = i + step;
|
||||||
|
nextOperandIndex = (i < opLength ? i : i - opLength);
|
||||||
|
if(operands.length > 1) {
|
||||||
|
results.splice(resultsIndex,1,operands[nextOperandIndex]);
|
||||||
|
} else {
|
||||||
|
results.splice(resultsIndex,1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
results.push(operands[0]);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Toggles an item in the current list.
|
||||||
|
*/
|
||||||
|
exports.toggle = function(source,operator) {
|
||||||
|
return cycleValueInArray(prepare_results(source),operator.operands);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.cycle = function(source,operator) {
|
||||||
|
var results = prepare_results(source),
|
||||||
|
operands = (operator.operand.length ? $tw.utils.parseStringArray(operator.operand, "true") : [""]),
|
||||||
|
step = $tw.utils.getInt(operator.operands[1]||"",1);
|
||||||
|
if(step < 0) {
|
||||||
|
operands.reverse();
|
||||||
|
step = Math.abs(step);
|
||||||
|
}
|
||||||
|
return cycleValueInArray(results,operands,step);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Removes all duplicate items from the current list
|
|
||||||
*/
|
|
||||||
exports.unique = function (source, operator) {
|
|
||||||
var results = prepare_results(source);
|
|
||||||
var set = results.reduce(function (a, b) {
|
|
||||||
if (a.indexOf(b) < 0) {
|
|
||||||
a.push(b);
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}, []);
|
|
||||||
return set;
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ FieldIndexer.prototype.update = function(updateDescriptor) {
|
|||||||
indexEntry[value].push(updateDescriptor["new"].tiddler.fields.title);
|
indexEntry[value].push(updateDescriptor["new"].tiddler.fields.title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ TagSubIndexer.prototype.rebuild = function() {
|
|||||||
} else {
|
} else {
|
||||||
self.index[tag].titles.push(title);
|
self.index[tag].titles.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ TagSubIndexer.prototype.lookup = function(tag) {
|
|||||||
if(!indexRecord.isSorted) {
|
if(!indexRecord.isSorted) {
|
||||||
if(this.indexer.wiki.sortByList) {
|
if(this.indexer.wiki.sortByList) {
|
||||||
indexRecord.titles = this.indexer.wiki.sortByList(indexRecord.titles,tag);
|
indexRecord.titles = this.indexer.wiki.sortByList(indexRecord.titles,tag);
|
||||||
}
|
}
|
||||||
indexRecord.isSorted = true;
|
indexRecord.isSorted = true;
|
||||||
}
|
}
|
||||||
return indexRecord.titles;
|
return indexRecord.titles;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Initialise basic platform $:/info/ tiddlers
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.getInfoTiddlerFields = function() {
|
exports.getInfoTiddlerFields = function(updateInfoTiddlersCallback) {
|
||||||
var mapBoolean = function(value) {return value ? "yes" : "no";},
|
var mapBoolean = function(value) {return value ? "yes" : "no";},
|
||||||
infoTiddlerFields = [];
|
infoTiddlerFields = [];
|
||||||
// Basics
|
// Basics
|
||||||
@@ -22,7 +22,7 @@ exports.getInfoTiddlerFields = function() {
|
|||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
// Document location
|
// Document location
|
||||||
var setLocationProperty = function(name,value) {
|
var setLocationProperty = function(name,value) {
|
||||||
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
||||||
},
|
},
|
||||||
location = document.location;
|
location = document.location;
|
||||||
setLocationProperty("full", (location.toString()).split("#")[0]);
|
setLocationProperty("full", (location.toString()).split("#")[0]);
|
||||||
@@ -36,6 +36,13 @@ exports.getInfoTiddlerFields = function() {
|
|||||||
// Screen size
|
// Screen size
|
||||||
infoTiddlerFields.push({title: "$:/info/browser/screen/width", text: window.screen.width.toString()});
|
infoTiddlerFields.push({title: "$:/info/browser/screen/width", text: window.screen.width.toString()});
|
||||||
infoTiddlerFields.push({title: "$:/info/browser/screen/height", text: window.screen.height.toString()});
|
infoTiddlerFields.push({title: "$:/info/browser/screen/height", text: window.screen.height.toString()});
|
||||||
|
// Dark mode through event listener on MediaQueryList
|
||||||
|
var mqList = window.matchMedia("(prefers-color-scheme: dark)"),
|
||||||
|
getDarkModeTiddler = function() {return {title: "$:/info/darkmode", text: mqList.matches ? "yes" : "no"};};
|
||||||
|
infoTiddlerFields.push(getDarkModeTiddler());
|
||||||
|
mqList.addListener(function(event) {
|
||||||
|
updateInfoTiddlersCallback([getDarkModeTiddler()]);
|
||||||
|
});
|
||||||
// Language
|
// Language
|
||||||
infoTiddlerFields.push({title: "$:/info/browser/language", text: navigator.language || ""});
|
infoTiddlerFields.push({title: "$:/info/browser/language", text: navigator.language || ""});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ Key descriptors have the following format:
|
|||||||
ctrl+enter
|
ctrl+enter
|
||||||
ctrl+shift+alt+A
|
ctrl+shift+alt+A
|
||||||
*/
|
*/
|
||||||
KeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor) {
|
KeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor,options) {
|
||||||
var components = keyDescriptor.split(/\+|\-/),
|
var components = keyDescriptor.split(/\+|\-/),
|
||||||
info = {
|
info = {
|
||||||
keyCode: 0,
|
keyCode: 0,
|
||||||
@@ -206,6 +206,9 @@ KeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor) {
|
|||||||
info.keyCode = this.namedKeys[s];
|
info.keyCode = this.namedKeys[s];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(options.keyDescriptor) {
|
||||||
|
info.keyDescriptor = options.keyDescriptor;
|
||||||
|
}
|
||||||
if(info.keyCode) {
|
if(info.keyCode) {
|
||||||
return info;
|
return info;
|
||||||
} else {
|
} else {
|
||||||
@@ -237,6 +240,7 @@ KeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options)
|
|||||||
lookupName = function(configName) {
|
lookupName = function(configName) {
|
||||||
var keyDescriptors = wiki.getTiddlerText("$:/config/" + configName + "/" + name);
|
var keyDescriptors = wiki.getTiddlerText("$:/config/" + configName + "/" + name);
|
||||||
if(keyDescriptors) {
|
if(keyDescriptors) {
|
||||||
|
options.keyDescriptor = keyDescriptor;
|
||||||
result.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options));
|
result.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -245,7 +249,7 @@ KeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.push(self.parseKeyDescriptor(keyDescriptor));
|
result.push(self.parseKeyDescriptor(keyDescriptor,options));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -276,22 +280,30 @@ KeyboardManager.prototype.checkKeyDescriptor = function(event,keyInfo) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
KeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) {
|
KeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) {
|
||||||
|
return (this.getMatchingKeyDescriptor(event,keyInfoArray) !== null);
|
||||||
|
};
|
||||||
|
|
||||||
|
KeyboardManager.prototype.getMatchingKeyDescriptor = function(event,keyInfoArray) {
|
||||||
for(var t=0; t<keyInfoArray.length; t++) {
|
for(var t=0; t<keyInfoArray.length; t++) {
|
||||||
if(this.checkKeyDescriptor(event,keyInfoArray[t])) {
|
if(this.checkKeyDescriptor(event,keyInfoArray[t])) {
|
||||||
return true;
|
return keyInfoArray[t];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyboardManager.prototype.getEventModifierKeyDescriptor = function(event) {
|
KeyboardManager.prototype.getEventModifierKeyDescriptor = function(event) {
|
||||||
return event.ctrlKey && !event.shiftKey && !event.altKey ? "ctrl" :
|
return event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey ? "ctrl" :
|
||||||
event.shiftKey && !event.ctrlKey && !event.altKey? "shift" :
|
event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey ? "shift" :
|
||||||
event.ctrlKey && event.shiftKey && !event.altKey ? "ctrl-shift" :
|
event.ctrlKey && event.shiftKey && !event.altKey && !event.metaKey ? "ctrl-shift" :
|
||||||
event.altKey && !event.shiftKey && !event.ctrlKey ? "alt" :
|
event.altKey && !event.shiftKey && !event.ctrlKey && !event.metaKey ? "alt" :
|
||||||
event.altKey && event.shiftKey && !event.ctrlKey ? "alt-shift" :
|
event.altKey && event.shiftKey && !event.ctrlKey && !event.metaKey ? "alt-shift" :
|
||||||
event.altKey && event.ctrlKey && !event.shiftKey ? "ctrl-alt" :
|
event.altKey && event.ctrlKey && !event.shiftKey && !event.metaKey ? "ctrl-alt" :
|
||||||
event.altKey && event.shiftKey && event.ctrlKey ? "ctrl-alt-shift" : "normal";
|
event.altKey && event.shiftKey && event.ctrlKey && !event.metaKey ? "ctrl-alt-shift" :
|
||||||
|
event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey ? "meta" :
|
||||||
|
event.metaKey && event.ctrlKey && !event.shiftKey && !event.altKey ? "meta-ctrl" :
|
||||||
|
event.metaKey && event.ctrlKey && event.shiftKey && !event.altKey ? "meta-ctrl-shift" :
|
||||||
|
event.metaKey && event.ctrlKey && event.shiftKey && event.altKey ? "meta-ctrl-alt-shift" : "normal";
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyboardManager.prototype.getShortcutTiddlerList = function() {
|
KeyboardManager.prototype.getShortcutTiddlerList = function() {
|
||||||
@@ -320,7 +332,7 @@ KeyboardManager.prototype.handleKeydownEvent = function(event) {
|
|||||||
if(key !== undefined) {
|
if(key !== undefined) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$tw.rootWidget.invokeActionString(action,$tw.rootWidget);
|
$tw.rootWidget.invokeActionString(action,$tw.rootWidget,event);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
title: $:/core/modules/macros/unusedtitle.js
|
title: $:/core/modules/macros/unusedtitle.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: macro
|
module-type: macro
|
||||||
|
|
||||||
Macro to return a new title that is unused in the wiki. It can be given a name as a base.
|
Macro to return a new title that is unused in the wiki. It can be given a name as a base.
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -10,25 +11,25 @@ Macro to return a new title that is unused in the wiki. It can be given a name a
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*
|
|
||||||
Information about this macro
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports.name = "unusedtitle";
|
exports.name = "unusedtitle";
|
||||||
|
|
||||||
exports.params = [
|
exports.params = [
|
||||||
{name: "baseName"},
|
{name: "baseName"},
|
||||||
{name: "options"}
|
{name: "separator"},
|
||||||
|
{name: "template"}
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Run the macro
|
Run the macro
|
||||||
*/
|
*/
|
||||||
exports.run = function(baseName, options) {
|
exports.run = function(baseName,separator,template) {
|
||||||
|
separator = separator || " ";
|
||||||
if(!baseName) {
|
if(!baseName) {
|
||||||
baseName = $tw.language.getString("DefaultNewTiddlerTitle");
|
baseName = $tw.language.getString("DefaultNewTiddlerTitle");
|
||||||
}
|
}
|
||||||
return this.wiki.generateNewTitle(baseName, options);
|
// $tw.wiki.generateNewTitle = function(baseTitle,options)
|
||||||
|
// options.prefix must be a string!
|
||||||
|
return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template});
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@@ -23,10 +23,12 @@ var HtmlParser = function(type,text,options) {
|
|||||||
type: "element",
|
type: "element",
|
||||||
tag: "iframe",
|
tag: "iframe",
|
||||||
attributes: {
|
attributes: {
|
||||||
src: {type: "string", value: src},
|
src: {type: "string", value: src}
|
||||||
sandbox: {type: "string", value: ""}
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
if($tw.wiki.getTiddlerText("$:/config/HtmlParser/DisableSandbox","no") !== "yes") {
|
||||||
|
this.tree[0].attributes.sandbox = {type: "string", value: $tw.wiki.getTiddlerText("$:/config/HtmlParser/SandboxTokens","")};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports["text/html"] = HtmlParser;
|
exports["text/html"] = HtmlParser;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ exports["image/webp"] = ImageParser;
|
|||||||
exports["image/heic"] = ImageParser;
|
exports["image/heic"] = ImageParser;
|
||||||
exports["image/heif"] = ImageParser;
|
exports["image/heif"] = ImageParser;
|
||||||
exports["image/x-icon"] = ImageParser;
|
exports["image/x-icon"] = ImageParser;
|
||||||
|
exports["image/vnd.microsoft.icon"] = ImageParser;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,19 @@ exports.parseStringLiteral = function(source,pos) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parseMacroParameters = function(node,source,pos) {
|
||||||
|
// Process parameters
|
||||||
|
var parameter = $tw.utils.parseMacroParameter(source,pos);
|
||||||
|
while(parameter) {
|
||||||
|
node.params.push(parameter);
|
||||||
|
pos = parameter.end;
|
||||||
|
// Get the next parameter
|
||||||
|
parameter = $tw.utils.parseMacroParameter(source,pos);
|
||||||
|
}
|
||||||
|
node.end = pos;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Look for a macro invocation parameter. Returns null if not found, or {type: "macro-parameter", name:, value:, start:, end:}
|
Look for a macro invocation parameter. Returns null if not found, or {type: "macro-parameter", name:, value:, start:, end:}
|
||||||
*/
|
*/
|
||||||
@@ -132,7 +145,7 @@ exports.parseMacroParameter = function(source,pos) {
|
|||||||
start: pos
|
start: pos
|
||||||
};
|
};
|
||||||
// Define our regexp
|
// Define our regexp
|
||||||
var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^\s>"'=]+)))/g;
|
var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|((?:(?:>(?!>))|[^\s>"'])+)))/g;
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||||
// Look for the parameter
|
// Look for the parameter
|
||||||
@@ -187,14 +200,8 @@ exports.parseMacroInvocation = function(source,pos) {
|
|||||||
}
|
}
|
||||||
node.name = name.match[1];
|
node.name = name.match[1];
|
||||||
pos = name.end;
|
pos = name.end;
|
||||||
// Process parameters
|
node = $tw.utils.parseMacroParameters(node,source,pos);
|
||||||
var parameter = $tw.utils.parseMacroParameter(source,pos);
|
pos = node.end;
|
||||||
while(parameter) {
|
|
||||||
node.params.push(parameter);
|
|
||||||
pos = parameter.end;
|
|
||||||
// Get the next parameter
|
|
||||||
parameter = $tw.utils.parseMacroParameter(source,pos);
|
|
||||||
}
|
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||||
// Look for a double greater than sign
|
// Look for a double greater than sign
|
||||||
@@ -208,6 +215,29 @@ exports.parseMacroInvocation = function(source,pos) {
|
|||||||
return node;
|
return node;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parseFilterVariable = function(source) {
|
||||||
|
var node = {
|
||||||
|
name: "",
|
||||||
|
params: [],
|
||||||
|
},
|
||||||
|
pos = 0,
|
||||||
|
reName = /([^\s"']+)/g;
|
||||||
|
// If there is no whitespace or it is an empty string then there are no macro parameters
|
||||||
|
if(/^\S*$/.test(source)) {
|
||||||
|
node.name = source;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
// Get the variable name
|
||||||
|
var nameMatch = $tw.utils.parseTokenRegExp(source,pos,reName);
|
||||||
|
if(nameMatch) {
|
||||||
|
node.name = nameMatch.match[1];
|
||||||
|
pos = nameMatch.end;
|
||||||
|
node = $tw.utils.parseMacroParameters(node,source,pos);
|
||||||
|
delete node.end;
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Look for an HTML attribute definition. Returns null if not found, otherwise returns {type: "attribute", name:, valueType: "string|indirect|macro", value:, start:, end:,}
|
Look for an HTML attribute definition. Returns null if not found, otherwise returns {type: "attribute", name:, valueType: "string|indirect|macro", value:, start:, end:,}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ Wiki text block rule for HTML comments. For example:
|
|||||||
|
|
||||||
```
|
```
|
||||||
<!-- This is a comment -->
|
<!-- This is a comment -->
|
||||||
|
\define macroX()
|
||||||
|
<!-- This is a comment -->
|
||||||
|
xxxx
|
||||||
|
\end
|
||||||
|
<!-- This is a comment -->
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the syntax for comments is simplified to an opening "<!--" sequence and a closing "-->" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html)
|
Note that the syntax for comments is simplified to an opening "<!--" sequence and a closing "-->" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html)
|
||||||
@@ -19,7 +25,7 @@ Note that the syntax for comments is simplified to an opening "<!--" sequence an
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.name = "commentblock";
|
exports.name = "commentblock";
|
||||||
exports.types = {block: true};
|
exports.types = {block:true, pragma:true};
|
||||||
|
|
||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
@@ -31,7 +37,7 @@ exports.findNextMatch = function(startPos) {
|
|||||||
this.matchRegExp.lastIndex = startPos;
|
this.matchRegExp.lastIndex = startPos;
|
||||||
this.match = this.matchRegExp.exec(this.parser.source);
|
this.match = this.matchRegExp.exec(this.parser.source);
|
||||||
if(this.match) {
|
if(this.match) {
|
||||||
this.endMatchRegExp.lastIndex = startPos + this.match[0].length;
|
this.endMatchRegExp.lastIndex = this.match.index + this.match[0].length;
|
||||||
this.endMatch = this.endMatchRegExp.exec(this.parser.source);
|
this.endMatch = this.endMatchRegExp.exec(this.parser.source);
|
||||||
if(this.endMatch) {
|
if(this.endMatch) {
|
||||||
return this.match.index;
|
return this.match.index;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ exports.findNextMatch = function(startPos) {
|
|||||||
this.matchRegExp.lastIndex = startPos;
|
this.matchRegExp.lastIndex = startPos;
|
||||||
this.match = this.matchRegExp.exec(this.parser.source);
|
this.match = this.matchRegExp.exec(this.parser.source);
|
||||||
if(this.match) {
|
if(this.match) {
|
||||||
this.endMatchRegExp.lastIndex = startPos + this.match[0].length;
|
this.endMatchRegExp.lastIndex = this.match.index + this.match[0].length;
|
||||||
this.endMatch = this.endMatchRegExp.exec(this.parser.source);
|
this.endMatch = this.endMatchRegExp.exec(this.parser.source);
|
||||||
if(this.endMatch) {
|
if(this.endMatch) {
|
||||||
return this.match.index;
|
return this.match.index;
|
||||||
|
|||||||
@@ -53,17 +53,12 @@ exports.parse = function() {
|
|||||||
tag.isBlock = this.is.block || hasLineBreak;
|
tag.isBlock = this.is.block || hasLineBreak;
|
||||||
// Parse the body if we need to
|
// Parse the body if we need to
|
||||||
if(!tag.isSelfClosing && $tw.config.htmlVoidElements.indexOf(tag.tag) === -1) {
|
if(!tag.isSelfClosing && $tw.config.htmlVoidElements.indexOf(tag.tag) === -1) {
|
||||||
var reEndString = "</" + $tw.utils.escapeRegExp(tag.tag) + ">",
|
var reEndString = "</" + $tw.utils.escapeRegExp(tag.tag) + ">";
|
||||||
reEnd = new RegExp("(" + reEndString + ")","mg");
|
|
||||||
if(hasLineBreak) {
|
if(hasLineBreak) {
|
||||||
tag.children = this.parser.parseBlocks(reEndString);
|
tag.children = this.parser.parseBlocks(reEndString);
|
||||||
} else {
|
} else {
|
||||||
tag.children = this.parser.parseInlineRun(reEnd);
|
var reEnd = new RegExp("(" + reEndString + ")","mg");
|
||||||
}
|
tag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true});
|
||||||
reEnd.lastIndex = this.parser.pos;
|
|
||||||
var endMatch = reEnd.exec(this.parser.source);
|
|
||||||
if(endMatch && endMatch.index === this.parser.pos) {
|
|
||||||
this.parser.pos = endMatch.index + endMatch[0].length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Return the tag
|
// Return the tag
|
||||||
@@ -71,7 +66,7 @@ exports.parse = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Look for an HTML tag. Returns null if not found, otherwise returns {type: "element", name:, attributes: [], isSelfClosing:, start:, end:,}
|
Look for an HTML tag. Returns null if not found, otherwise returns {type: "element", name:, attributes: {}, orderedAttributes: [], isSelfClosing:, start:, end:,}
|
||||||
*/
|
*/
|
||||||
exports.parseTag = function(source,pos,options) {
|
exports.parseTag = function(source,pos,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@@ -79,7 +74,8 @@ exports.parseTag = function(source,pos,options) {
|
|||||||
node = {
|
node = {
|
||||||
type: "element",
|
type: "element",
|
||||||
start: pos,
|
start: pos,
|
||||||
attributes: {}
|
attributes: {},
|
||||||
|
orderedAttributes: []
|
||||||
};
|
};
|
||||||
// Define our regexps
|
// Define our regexps
|
||||||
var reTagName = /([a-zA-Z0-9\-\$]+)/g;
|
var reTagName = /([a-zA-Z0-9\-\$]+)/g;
|
||||||
@@ -111,6 +107,7 @@ exports.parseTag = function(source,pos,options) {
|
|||||||
// Process attributes
|
// Process attributes
|
||||||
var attribute = $tw.utils.parseAttribute(source,pos);
|
var attribute = $tw.utils.parseAttribute(source,pos);
|
||||||
while(attribute) {
|
while(attribute) {
|
||||||
|
node.orderedAttributes.push(attribute);
|
||||||
node.attributes[attribute.name] = attribute;
|
node.attributes[attribute.name] = attribute;
|
||||||
pos = attribute.end;
|
pos = attribute.end;
|
||||||
// Get the next attribute
|
// Get the next attribute
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ exports.parse = function() {
|
|||||||
// Move past the pragma invocation
|
// Move past the pragma invocation
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Parse the filter terminated by a line break
|
// Parse the filter terminated by a line break
|
||||||
var reMatch = /(.*)(\r?\n)|$/mg;
|
var reMatch = /(.*)(?:$|\r?\n)/mg;
|
||||||
reMatch.lastIndex = this.parser.pos;
|
reMatch.lastIndex = this.parser.pos;
|
||||||
var match = reMatch.exec(this.parser.source);
|
var match = reMatch.exec(this.parser.source);
|
||||||
this.parser.pos = reMatch.lastIndex;
|
this.parser.pos = reMatch.lastIndex;
|
||||||
|
|||||||
@@ -21,40 +21,36 @@ exports.types = {block: true};
|
|||||||
|
|
||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
};
|
||||||
this.matchRegExp = /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*?)>>(?:\r?\n|$)/mg;
|
|
||||||
|
exports.findNextMatch = function(startPos) {
|
||||||
|
var nextStart = startPos;
|
||||||
|
// Try parsing at all possible macrocall openers until we match
|
||||||
|
while((nextStart = this.parser.source.indexOf("<<",nextStart)) >= 0) {
|
||||||
|
var nextCall = $tw.utils.parseMacroInvocation(this.parser.source,nextStart);
|
||||||
|
if(nextCall) {
|
||||||
|
var c = this.parser.source.charAt(nextCall.end);
|
||||||
|
// Ensure EOL after parsed macro
|
||||||
|
// If we didn't need to support IE, we'd just use /(?:\r?\n|$)/ym
|
||||||
|
if ((c === "") || (c === "\n") || ((c === "\r") && this.parser.source.charAt(nextCall.end+1) === "\n")) {
|
||||||
|
this.nextCall = nextCall;
|
||||||
|
return nextStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nextStart += 2;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parse the most recent match
|
Parse the most recent match
|
||||||
*/
|
*/
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
// Get all the details of the match
|
var call = this.nextCall;
|
||||||
var macroName = this.match[1],
|
call.isBlock = true;
|
||||||
paramString = this.match[2];
|
this.nextCall = null;
|
||||||
// Move past the macro call
|
this.parser.pos = call.end;
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
return [call];
|
||||||
var params = [],
|
|
||||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
|
||||||
paramMatch = reParam.exec(paramString);
|
|
||||||
while(paramMatch) {
|
|
||||||
// Process this parameter
|
|
||||||
var paramInfo = {
|
|
||||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]
|
|
||||||
};
|
|
||||||
if(paramMatch[1]) {
|
|
||||||
paramInfo.name = paramMatch[1];
|
|
||||||
}
|
|
||||||
params.push(paramInfo);
|
|
||||||
// Find the next match
|
|
||||||
paramMatch = reParam.exec(paramString);
|
|
||||||
}
|
|
||||||
return [{
|
|
||||||
type: "macrocall",
|
|
||||||
name: macroName,
|
|
||||||
params: params,
|
|
||||||
isBlock: true
|
|
||||||
}];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -21,39 +21,29 @@ exports.types = {inline: true};
|
|||||||
|
|
||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
};
|
||||||
this.matchRegExp = /<<([^\s>]+)\s*([\s\S]*?)>>/mg;
|
|
||||||
|
exports.findNextMatch = function(startPos) {
|
||||||
|
var nextStart = startPos;
|
||||||
|
// Try parsing at all possible macrocall openers until we match
|
||||||
|
while((nextStart = this.parser.source.indexOf("<<",nextStart)) >= 0) {
|
||||||
|
this.nextCall = $tw.utils.parseMacroInvocation(this.parser.source,nextStart);
|
||||||
|
if(this.nextCall) {
|
||||||
|
return nextStart;
|
||||||
|
}
|
||||||
|
nextStart += 2;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parse the most recent match
|
Parse the most recent match
|
||||||
*/
|
*/
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
// Get all the details of the match
|
var call = this.nextCall;
|
||||||
var macroName = this.match[1],
|
this.nextCall = null;
|
||||||
paramString = this.match[2];
|
this.parser.pos = call.end;
|
||||||
// Move past the macro call
|
return [call];
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
|
||||||
var params = [],
|
|
||||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
|
||||||
paramMatch = reParam.exec(paramString);
|
|
||||||
while(paramMatch) {
|
|
||||||
// Process this parameter
|
|
||||||
var paramInfo = {
|
|
||||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]|| paramMatch[6]
|
|
||||||
};
|
|
||||||
if(paramMatch[1]) {
|
|
||||||
paramInfo.name = paramMatch[1];
|
|
||||||
}
|
|
||||||
params.push(paramInfo);
|
|
||||||
// Find the next match
|
|
||||||
paramMatch = reParam.exec(paramString);
|
|
||||||
}
|
|
||||||
return [{
|
|
||||||
type: "macrocall",
|
|
||||||
name: macroName,
|
|
||||||
params: params
|
|
||||||
}];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ exports.parse = function() {
|
|||||||
// Move the caption to the first row if it isn't already
|
// Move the caption to the first row if it isn't already
|
||||||
if(table.children.length !== 1) {
|
if(table.children.length !== 1) {
|
||||||
table.children.pop(); // Take rowContainer out of the children array
|
table.children.pop(); // Take rowContainer out of the children array
|
||||||
table.children.splice(0,0,rowContainer); // Insert it at the bottom
|
table.children.splice(0,0,rowContainer); // Insert it at the bottom
|
||||||
}
|
}
|
||||||
// Set the alignment - TODO: figure out why TW did this
|
// Set the alignment - TODO: figure out why TW did this
|
||||||
// rowContainer.attributes.align = rowCount === 0 ? "top" : "bottom";
|
// rowContainer.attributes.align = rowCount === 0 ? "top" : "bottom";
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ Attributes are stored as hashmaps of the following objects:
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
type: content type of text
|
||||||
|
text: text to be parsed
|
||||||
|
options: see below:
|
||||||
|
parseAsInline: true to parse text as inline instead of block
|
||||||
|
wiki: reference to wiki to use
|
||||||
|
_canonical_uri: optional URI of content if text is missing or empty
|
||||||
|
*/
|
||||||
var WikiParser = function(type,text,options) {
|
var WikiParser = function(type,text,options) {
|
||||||
this.wiki = options.wiki;
|
this.wiki = options.wiki;
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -33,19 +41,6 @@ var WikiParser = function(type,text,options) {
|
|||||||
this.loadRemoteTiddler(options._canonical_uri);
|
this.loadRemoteTiddler(options._canonical_uri);
|
||||||
text = $tw.language.getRawString("LazyLoadingWarning");
|
text = $tw.language.getRawString("LazyLoadingWarning");
|
||||||
}
|
}
|
||||||
// Initialise the classes if we don't have them already
|
|
||||||
if(!this.pragmaRuleClasses) {
|
|
||||||
WikiParser.prototype.pragmaRuleClasses = $tw.modules.createClassesFromModules("wikirule","pragma",$tw.WikiRuleBase);
|
|
||||||
this.setupRules(WikiParser.prototype.pragmaRuleClasses,"$:/config/WikiParserRules/Pragmas/");
|
|
||||||
}
|
|
||||||
if(!this.blockRuleClasses) {
|
|
||||||
WikiParser.prototype.blockRuleClasses = $tw.modules.createClassesFromModules("wikirule","block",$tw.WikiRuleBase);
|
|
||||||
this.setupRules(WikiParser.prototype.blockRuleClasses,"$:/config/WikiParserRules/Block/");
|
|
||||||
}
|
|
||||||
if(!this.inlineRuleClasses) {
|
|
||||||
WikiParser.prototype.inlineRuleClasses = $tw.modules.createClassesFromModules("wikirule","inline",$tw.WikiRuleBase);
|
|
||||||
this.setupRules(WikiParser.prototype.inlineRuleClasses,"$:/config/WikiParserRules/Inline/");
|
|
||||||
}
|
|
||||||
// Save the parse text
|
// Save the parse text
|
||||||
this.type = type || "text/vnd.tiddlywiki";
|
this.type = type || "text/vnd.tiddlywiki";
|
||||||
this.source = text || "";
|
this.source = text || "";
|
||||||
@@ -54,13 +49,38 @@ var WikiParser = function(type,text,options) {
|
|||||||
this.configTrimWhiteSpace = false;
|
this.configTrimWhiteSpace = false;
|
||||||
// Set current parse position
|
// Set current parse position
|
||||||
this.pos = 0;
|
this.pos = 0;
|
||||||
// Instantiate the pragma parse rules
|
// Start with empty output
|
||||||
this.pragmaRules = this.instantiateRules(this.pragmaRuleClasses,"pragma",0);
|
|
||||||
// Instantiate the parser block and inline rules
|
|
||||||
this.blockRules = this.instantiateRules(this.blockRuleClasses,"block",0);
|
|
||||||
this.inlineRules = this.instantiateRules(this.inlineRuleClasses,"inline",0);
|
|
||||||
// Parse any pragmas
|
|
||||||
this.tree = [];
|
this.tree = [];
|
||||||
|
// Assemble the rule classes we're going to use
|
||||||
|
var pragmaRuleClasses, blockRuleClasses, inlineRuleClasses;
|
||||||
|
if(options.rules) {
|
||||||
|
pragmaRuleClasses = options.rules.pragma;
|
||||||
|
blockRuleClasses = options.rules.block;
|
||||||
|
inlineRuleClasses = options.rules.inline;
|
||||||
|
} else {
|
||||||
|
// Setup the rule classes if we don't have them already
|
||||||
|
if(!this.pragmaRuleClasses) {
|
||||||
|
WikiParser.prototype.pragmaRuleClasses = $tw.modules.createClassesFromModules("wikirule","pragma",$tw.WikiRuleBase);
|
||||||
|
this.setupRules(WikiParser.prototype.pragmaRuleClasses,"$:/config/WikiParserRules/Pragmas/");
|
||||||
|
}
|
||||||
|
pragmaRuleClasses = this.pragmaRuleClasses;
|
||||||
|
if(!this.blockRuleClasses) {
|
||||||
|
WikiParser.prototype.blockRuleClasses = $tw.modules.createClassesFromModules("wikirule","block",$tw.WikiRuleBase);
|
||||||
|
this.setupRules(WikiParser.prototype.blockRuleClasses,"$:/config/WikiParserRules/Block/");
|
||||||
|
}
|
||||||
|
blockRuleClasses = this.blockRuleClasses;
|
||||||
|
if(!this.inlineRuleClasses) {
|
||||||
|
WikiParser.prototype.inlineRuleClasses = $tw.modules.createClassesFromModules("wikirule","inline",$tw.WikiRuleBase);
|
||||||
|
this.setupRules(WikiParser.prototype.inlineRuleClasses,"$:/config/WikiParserRules/Inline/");
|
||||||
|
}
|
||||||
|
inlineRuleClasses = this.inlineRuleClasses;
|
||||||
|
}
|
||||||
|
// Instantiate the pragma parse rules
|
||||||
|
this.pragmaRules = this.instantiateRules(pragmaRuleClasses,"pragma",0);
|
||||||
|
// Instantiate the parser block and inline rules
|
||||||
|
this.blockRules = this.instantiateRules(blockRuleClasses,"block",0);
|
||||||
|
this.inlineRules = this.instantiateRules(inlineRuleClasses,"inline",0);
|
||||||
|
// Parse any pragmas
|
||||||
var topBranch = this.parsePragmas();
|
var topBranch = this.parsePragmas();
|
||||||
// Parse the text into inline runs or blocks
|
// Parse the text into inline runs or blocks
|
||||||
if(options.parseAsInline) {
|
if(options.parseAsInline) {
|
||||||
@@ -211,7 +231,10 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
|||||||
return nextMatch.rule.parse();
|
return nextMatch.rule.parse();
|
||||||
}
|
}
|
||||||
// Treat it as a paragraph if we didn't find a block rule
|
// Treat it as a paragraph if we didn't find a block rule
|
||||||
return [{type: "element", tag: "p", children: this.parseInlineRun(terminatorRegExp)}];
|
var start = this.pos;
|
||||||
|
var children = this.parseInlineRun(terminatorRegExp);
|
||||||
|
var end = this.pos;
|
||||||
|
return [{type: "element", tag: "p", children: children, start: start, end: end }];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -287,7 +310,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|||||||
while(this.pos < this.sourceLength && nextMatch) {
|
while(this.pos < this.sourceLength && nextMatch) {
|
||||||
// Process the text preceding the run rule
|
// Process the text preceding the run rule
|
||||||
if(nextMatch.matchIndex > this.pos) {
|
if(nextMatch.matchIndex > this.pos) {
|
||||||
this.pushTextWidget(tree,this.source.substring(this.pos,nextMatch.matchIndex));
|
this.pushTextWidget(tree,this.source.substring(this.pos,nextMatch.matchIndex),this.pos,nextMatch.matchIndex);
|
||||||
this.pos = nextMatch.matchIndex;
|
this.pos = nextMatch.matchIndex;
|
||||||
}
|
}
|
||||||
// Process the run rule
|
// Process the run rule
|
||||||
@@ -297,7 +320,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|||||||
}
|
}
|
||||||
// Process the remaining text
|
// Process the remaining text
|
||||||
if(this.pos < this.sourceLength) {
|
if(this.pos < this.sourceLength) {
|
||||||
this.pushTextWidget(tree,this.source.substr(this.pos));
|
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
||||||
}
|
}
|
||||||
this.pos = this.sourceLength;
|
this.pos = this.sourceLength;
|
||||||
return tree;
|
return tree;
|
||||||
@@ -317,7 +340,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|||||||
if(terminatorMatch) {
|
if(terminatorMatch) {
|
||||||
if(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {
|
if(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {
|
||||||
if(terminatorMatch.index > this.pos) {
|
if(terminatorMatch.index > this.pos) {
|
||||||
this.pushTextWidget(tree,this.source.substring(this.pos,terminatorMatch.index));
|
this.pushTextWidget(tree,this.source.substring(this.pos,terminatorMatch.index),this.pos,terminatorMatch.index);
|
||||||
}
|
}
|
||||||
this.pos = terminatorMatch.index;
|
this.pos = terminatorMatch.index;
|
||||||
if(options.eatTerminator) {
|
if(options.eatTerminator) {
|
||||||
@@ -330,7 +353,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|||||||
if(inlineRuleMatch) {
|
if(inlineRuleMatch) {
|
||||||
// Preceding text
|
// Preceding text
|
||||||
if(inlineRuleMatch.matchIndex > this.pos) {
|
if(inlineRuleMatch.matchIndex > this.pos) {
|
||||||
this.pushTextWidget(tree,this.source.substring(this.pos,inlineRuleMatch.matchIndex));
|
this.pushTextWidget(tree,this.source.substring(this.pos,inlineRuleMatch.matchIndex),this.pos,inlineRuleMatch.matchIndex);
|
||||||
this.pos = inlineRuleMatch.matchIndex;
|
this.pos = inlineRuleMatch.matchIndex;
|
||||||
}
|
}
|
||||||
// Process the inline rule
|
// Process the inline rule
|
||||||
@@ -344,7 +367,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|||||||
}
|
}
|
||||||
// Process the remaining text
|
// Process the remaining text
|
||||||
if(this.pos < this.sourceLength) {
|
if(this.pos < this.sourceLength) {
|
||||||
this.pushTextWidget(tree,this.source.substr(this.pos));
|
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
||||||
}
|
}
|
||||||
this.pos = this.sourceLength;
|
this.pos = this.sourceLength;
|
||||||
return tree;
|
return tree;
|
||||||
@@ -353,12 +376,12 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|||||||
/*
|
/*
|
||||||
Push a text widget onto an array, respecting the configTrimWhiteSpace setting
|
Push a text widget onto an array, respecting the configTrimWhiteSpace setting
|
||||||
*/
|
*/
|
||||||
WikiParser.prototype.pushTextWidget = function(array,text) {
|
WikiParser.prototype.pushTextWidget = function(array,text,start,end) {
|
||||||
if(this.configTrimWhiteSpace) {
|
if(this.configTrimWhiteSpace) {
|
||||||
text = $tw.utils.trim(text);
|
text = $tw.utils.trim(text);
|
||||||
}
|
}
|
||||||
if(text) {
|
if(text) {
|
||||||
array.push({type: "text", text: text});
|
array.push({type: "text", text: text, start: start, end: end});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -386,22 +409,18 @@ Amend the rules used by this instance of the parser
|
|||||||
WikiParser.prototype.amendRules = function(type,names) {
|
WikiParser.prototype.amendRules = function(type,names) {
|
||||||
names = names || [];
|
names = names || [];
|
||||||
// Define the filter function
|
// Define the filter function
|
||||||
var keepFilter;
|
var target;
|
||||||
if(type === "only") {
|
if(type === "only") {
|
||||||
keepFilter = function(name) {
|
target = true;
|
||||||
return names.indexOf(name) !== -1;
|
|
||||||
};
|
|
||||||
} else if(type === "except") {
|
} else if(type === "except") {
|
||||||
keepFilter = function(name) {
|
target = false;
|
||||||
return names.indexOf(name) === -1;
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Define a function to process each of our rule arrays
|
// Define a function to process each of our rule arrays
|
||||||
var processRuleArray = function(ruleArray) {
|
var processRuleArray = function(ruleArray) {
|
||||||
for(var t=ruleArray.length-1; t>=0; t--) {
|
for(var t=ruleArray.length-1; t>=0; t--) {
|
||||||
if(!keepFilter(ruleArray[t].rule.name)) {
|
if((names.indexOf(ruleArray[t].rule.name) === -1) === target) {
|
||||||
ruleArray.splice(t,1);
|
ruleArray.splice(t,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,11 +153,12 @@ SaverHandler.prototype.saveWiki = function(options) {
|
|||||||
var self = this,
|
var self = this,
|
||||||
method = options.method || "save";
|
method = options.method || "save";
|
||||||
// Ignore autosave if disabled
|
// Ignore autosave if disabled
|
||||||
if(method === "autosave" && this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes") {
|
if(method === "autosave" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var variables = options.variables || {},
|
var variables = options.variables || {},
|
||||||
template = options.template || "$:/core/save/all",
|
template = (options.template ||
|
||||||
|
this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
|
||||||
downloadType = options.downloadType || "text/plain",
|
downloadType = options.downloadType || "text/plain",
|
||||||
text = this.wiki.renderTiddler(downloadType,template,options),
|
text = this.wiki.renderTiddler(downloadType,template,options),
|
||||||
callback = function(err) {
|
callback = function(err) {
|
||||||
@@ -197,8 +198,12 @@ SaverHandler.prototype.isDirty = function() {
|
|||||||
Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes
|
Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes
|
||||||
*/
|
*/
|
||||||
SaverHandler.prototype.updateDirtyStatus = function() {
|
SaverHandler.prototype.updateDirtyStatus = function() {
|
||||||
|
var self = this;
|
||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
|
$tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
|
||||||
|
$tw.utils.each($tw.windows,function(win) {
|
||||||
|
$tw.utils.toggleClass(win.document.body,"tc-dirty",self.isDirty());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ AndTidWiki.prototype.save = function(text,method,callback,options) {
|
|||||||
window.twi.saveWiki(text);
|
window.twi.saveWiki(text);
|
||||||
} else {
|
} else {
|
||||||
// Get the pathname of this document
|
// Get the pathname of this document
|
||||||
var pathname = decodeURIComponent(document.location.toString().split("#")[0]);
|
var pathname = $tw.utils.decodeURIComponentSafe(document.location.toString().split("#")[0]);
|
||||||
// Strip the file://
|
// Strip the file://
|
||||||
if(pathname.indexOf("file://") === 0) {
|
if(pathname.indexOf("file://") === 0) {
|
||||||
pathname = pathname.substr(7);
|
pathname = pathname.substr(7);
|
||||||
|
|||||||
60
core/modules/savers/custom.js
Normal file
60
core/modules/savers/custom.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/savers/custom.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: saver
|
||||||
|
|
||||||
|
Looks for `window.$tw.customSaver` first on the current window, then
|
||||||
|
on the parent window (of an iframe). If present, the saver must define
|
||||||
|
save: function(text,method,callback) { ... }
|
||||||
|
and the saver may define
|
||||||
|
priority: number
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var findSaver = function(window) {
|
||||||
|
try {
|
||||||
|
return window && window.$tw && window.$tw.customSaver;
|
||||||
|
} catch (err) {
|
||||||
|
// Catching the exception is the most reliable way to detect cross-origin iframe errors.
|
||||||
|
// For example, instead of saying that `window.parent.$tw` is undefined, Firefox will throw
|
||||||
|
// Uncaught DOMException: Permission denied to access property "$tw" on cross-origin object
|
||||||
|
console.log({ msg: "custom saver is disabled", reason: err });
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var saver = findSaver(window) || findSaver(window.parent) || {};
|
||||||
|
|
||||||
|
var CustomSaver = function(wiki) {
|
||||||
|
};
|
||||||
|
|
||||||
|
CustomSaver.prototype.save = function(text,method,callback) {
|
||||||
|
return saver.save(text, method, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Information about this saver
|
||||||
|
*/
|
||||||
|
CustomSaver.prototype.info = {
|
||||||
|
name: "custom",
|
||||||
|
priority: saver.priority || 4000,
|
||||||
|
capabilities: ["save","autosave"]
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Static method that returns true if this saver is capable of working
|
||||||
|
*/
|
||||||
|
exports.canSave = function(wiki) {
|
||||||
|
return !!(saver.save);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Create an instance of this saver
|
||||||
|
*/
|
||||||
|
exports.create = function(wiki) {
|
||||||
|
return new CustomSaver(wiki);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -26,7 +26,7 @@ DownloadSaver.prototype.save = function(text,method,callback,options) {
|
|||||||
var p = document.location.pathname.lastIndexOf("/");
|
var p = document.location.pathname.lastIndexOf("/");
|
||||||
if(p !== -1) {
|
if(p !== -1) {
|
||||||
// We decode the pathname because document.location is URL encoded by the browser
|
// We decode the pathname because document.location is URL encoded by the browser
|
||||||
filename = decodeURIComponent(document.location.pathname.substr(p+1));
|
filename = $tw.utils.decodeURIComponentSafe(document.location.pathname.substr(p+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!filename) {
|
if(!filename) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ GiteaSaver.prototype.save = function(text,method,callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var data = {
|
var data = {
|
||||||
message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"),
|
message: $tw.language.getString("ControlPanel/Saving/GitService/CommitMessage"),
|
||||||
content: $tw.utils.base64Encode(text),
|
content: $tw.utils.base64Encode(text),
|
||||||
sha: sha
|
sha: sha
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
|||||||
repo = this.wiki.getTiddlerText("$:/GitHub/Repo"),
|
repo = this.wiki.getTiddlerText("$:/GitHub/Repo"),
|
||||||
path = this.wiki.getTiddlerText("$:/GitHub/Path",""),
|
path = this.wiki.getTiddlerText("$:/GitHub/Path",""),
|
||||||
filename = this.wiki.getTiddlerText("$:/GitHub/Filename"),
|
filename = this.wiki.getTiddlerText("$:/GitHub/Filename"),
|
||||||
branch = this.wiki.getTiddlerText("$:/GitHub/Branch") || "master",
|
branch = this.wiki.getTiddlerText("$:/GitHub/Branch") || "main",
|
||||||
endpoint = this.wiki.getTiddlerText("$:/GitHub/ServerURL") || "https://api.github.com",
|
endpoint = this.wiki.getTiddlerText("$:/GitHub/ServerURL") || "https://api.github.com",
|
||||||
headers = {
|
headers = {
|
||||||
"Accept": "application/vnd.github.v3+json",
|
"Accept": "application/vnd.github.v3+json",
|
||||||
"Content-Type": "application/json;charset=UTF-8",
|
"Content-Type": "application/json;charset=UTF-8",
|
||||||
"Authorization": "Basic " + window.btoa(username + ":" + password)
|
"Authorization": "Basic " + window.btoa(username + ":" + password),
|
||||||
|
"If-None-Match": ""
|
||||||
};
|
};
|
||||||
// Bail if we don't have everything we need
|
// Bail if we don't have everything we need
|
||||||
if(!username || !password || !repo || !filename) {
|
if(!username || !password || !repo || !filename) {
|
||||||
@@ -68,7 +69,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
var data = {
|
var data = {
|
||||||
message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"),
|
message: $tw.language.getString("ControlPanel/Saving/GitService/CommitMessage"),
|
||||||
content: $tw.utils.base64Encode(text),
|
content: $tw.utils.base64Encode(text),
|
||||||
branch: branch,
|
branch: branch,
|
||||||
sha: sha
|
sha: sha
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ GitLabSaver.prototype.save = function(text,method,callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
var data = {
|
var data = {
|
||||||
commit_message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"),
|
commit_message: $tw.language.getString("ControlPanel/Saving/GitService/CommitMessage"),
|
||||||
content: text,
|
content: text,
|
||||||
branch: branch,
|
branch: branch,
|
||||||
sha: sha
|
sha: sha
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user