mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Stop using an import tiddler for text slicer
Instead we directly output the tiddlers (we keep the old code around; later we’ll make the output mode switchable). Also improve the icon
This commit is contained in:
parent
dd1f82c1aa
commit
535d8d6fa0
@ -15,8 +15,7 @@ The source document must first be marked up as an ordinary wikitext tiddler. Cur
|
||||
To try it out:
|
||||
|
||||
# Click the "text slicer" icon on the [[Sample Text]] tiddler below
|
||||
# Click the ''import'' button in the resulting import listing
|
||||
# Open the tiddler [[Sliced up Sample Text]]
|
||||
# View the tiddler [[Sliced up Sample Text]]
|
||||
#* It should match the content of [[Sample Text]]
|
||||
#* The table of contents at the top allows the structure to be explored
|
||||
|
||||
|
@ -24,7 +24,7 @@ var SLICER_OUTPUT_TITLE = "$:/TextSlicer";
|
||||
exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tm-slice-tiddler",function(event) {
|
||||
// Slice up and output the tiddler
|
||||
outputTiddlers(sliceTiddler(event.param),event.param);
|
||||
outputTiddlers(sliceTiddler(event.param),event.param,event.param);
|
||||
});
|
||||
};
|
||||
|
||||
@ -129,8 +129,21 @@ function sliceTiddler(title) {
|
||||
return tiddlers;
|
||||
}
|
||||
|
||||
// Output to the output tiddler
|
||||
function outputTiddlers(tiddlers,navigateFromTitle) {
|
||||
// Output directly to the output tiddlers
|
||||
function outputTiddlers(tiddlers,title,navigateFromTitle) {
|
||||
$tw.utils.each(tiddlers,function(tiddlerFields) {
|
||||
var title = tiddlerFields.title;
|
||||
if(title) {
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),tiddlerFields,$tw.wiki.getModificationFields()));
|
||||
}
|
||||
});
|
||||
// Navigate to output
|
||||
var story = new $tw.Story({wiki: $tw.wiki});
|
||||
story.navigateTiddler("Sliced up " + title,navigateFromTitle);
|
||||
}
|
||||
|
||||
// Output via an import tiddler
|
||||
function outputTiddlers_viaImportTiddler(tiddlers,navigateFromTitle) {
|
||||
// Get the current slicer output tiddler
|
||||
var slicerOutputTiddler = $tw.wiki.getTiddler(SLICER_OUTPUT_TITLE),
|
||||
slicerOutputData = $tw.wiki.getTiddlerData(SLICER_OUTPUT_TITLE,{}),
|
||||
|
@ -3,22 +3,20 @@ tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-text-slicer tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||
<g fill-rule="evenodd">
|
||||
<g transform="translate(-14.000000, -7.000000)">
|
||||
<g transform="translate(72.584657, 72.467249) rotate(-315.000000) translate(-72.584657, -72.467249) translate(21.197294, 21.478238)">
|
||||
<path d="M38.2417582,61.693607 L54.4992571,51.1358638 L1.67477118,16.8312416 C-0.0239526134,15.7280774 -0.514751641,13.4426154 0.593419494,11.7361815 C1.69933572,10.0332198 3.98242867,9.54420766 5.68781385,10.6516977 L61.26361,46.7430417 L80.5851735,34.1954717 L80.5851772,34.1954697 C79.5387267,33.6602668 78.5396616,32.9905201 77.6124931,32.1845448 C71.4704623,26.8453589 70.8094077,17.5497509 76.1359863,11.4222231 C81.4625649,5.29469534 90.7597098,4.65561799 96.9017406,9.9948039 C103.043771,15.3339898 103.704826,24.6295979 98.3782473,30.7571256 C97.32681,31.966666 96.1206611,32.9623511 94.8146072,33.7404136 L68.0279628,51.1358638 L68.0279628,51.1358638 L95.1717053,68.7632163 C95.4106056,68.91836 95.6256152,69.0968874 95.8156465,69.2938995 C96.1871521,69.560781 96.549631,69.8472178 96.9017406,70.153302 C103.043771,75.4924879 103.704826,84.7880959 98.3782473,90.9156237 C93.0516687,97.0431515 83.7545238,97.6822288 77.6124931,92.3430429 C71.4704623,87.003857 70.8094077,77.7082489 76.1359863,71.5807212 C77.4290023,70.0932764 78.9559902,68.9292471 80.615022,68.0956398 L61.26361,55.5286859 L38.2417582,70.4792512 L38.2417582,61.693607 L38.2417582,61.693607 Z M91.6170208,75.1964141 C91.7989942,75.3276374 91.9766156,75.4682625 92.149252,75.6183331 C95.2204507,78.2880854 95.5509978,82.936167 92.8875494,86.0001139 C90.2241011,89.0640607 85.575251,89.3836185 82.5040522,86.7138661 C79.4328535,84.0441137 79.1023064,79.3960321 81.7657548,76.3320853 C84.012963,73.7469679 87.6735107,73.115487 90.60737,74.5847463 L91.1586626,74.9427601 C91.3074402,75.0393774 91.4606147,75.1238441 91.6170208,75.1964141 L91.6170208,75.1964141 L91.6170208,75.1964141 Z M92.8875494,25.8416158 C95.5509978,22.7776689 95.2204507,18.1295874 92.149252,15.459835 C89.0780532,12.7900826 84.4292031,13.1096404 81.7657548,16.1735872 C79.1023064,19.237534 79.4328535,23.8856156 82.5040522,26.555368 C85.575251,29.2251204 90.2241011,28.9055626 92.8875494,25.8416158 L92.8875494,25.8416158 Z"></path>
|
||||
<g transform="translate(31.868132, 50.989011) rotate(-180.000000) translate(-31.868132, -50.989011) translate(28.681319, -0.000000)">
|
||||
<path d="M6.37362637,41.4285714 C6.37362637,39.6685431 4.94684151,38.2417582 3.18681319,38.2417582 C1.42678486,38.2417582 -1.35783528e-13,39.6685431 -1.35891298e-13,41.4285714 C-1.35999069e-13,43.1885998 1.42678486,44.6153846 3.18681319,44.6153846 C4.94684151,44.6153846 6.37362637,43.1885998 6.37362637,41.4285714 L6.37362637,41.4285714 Z"></path>
|
||||
<path d="M6.37362637,89.2307692 C6.37362637,87.4707409 4.94684151,86.043956 3.18681319,86.043956 C1.42678486,86.043956 -1.97956017e-13,87.4707409 -1.98063788e-13,89.2307692 C-1.98171558e-13,90.9907976 1.42678486,92.4175824 3.18681319,92.4175824 C4.94684151,92.4175824 6.37362637,90.9907976 6.37362637,89.2307692 L6.37362637,89.2307692 Z"></path>
|
||||
<path d="M6.37362637,98.7912088 C6.37362637,97.0311805 4.94684151,95.6043956 3.18681319,95.6043956 C1.42678486,95.6043956 -1.30010368e-13,97.0311805 -1.30118138e-13,98.7912088 C-1.30225909e-13,100.551237 1.42678486,101.978022 3.18681319,101.978022 C4.94684151,101.978022 6.37362637,100.551237 6.37362637,98.7912088 L6.37362637,98.7912088 Z"></path>
|
||||
<path d="M6.37362637,31.8681319 C6.37362637,30.1081035 4.94684151,28.6813187 3.18681319,28.6813187 C1.42678486,28.6813187 -2.06393712e-13,30.1081035 -2.06501483e-13,31.8681319 C-2.06609253e-13,33.6281602 1.42678486,35.0549451 3.18681319,35.0549451 C4.94684151,35.0549451 6.37362637,33.6281602 6.37362637,31.8681319 L6.37362637,31.8681319 Z"></path>
|
||||
<path d="M6.37362637,79.9228745 C6.37362637,78.1628462 4.94684151,76.7360613 3.18681319,76.7360613 C1.42678486,76.7360613 -8.32992433e-15,78.1628462 -8.43769499e-15,79.9228745 C-8.54546564e-15,81.6829028 1.42678486,83.1096877 3.18681319,83.1096877 C4.94684151,83.1096877 6.37362637,81.6829028 6.37362637,79.9228745 L6.37362637,79.9228745 Z"></path>
|
||||
<path d="M6.37362637,22.3076923 C6.37362637,20.547664 4.94684151,19.1208791 3.18681319,19.1208791 C1.42678486,19.1208791 4.27403348e-14,20.547664 4.26325641e-14,22.3076923 C4.25247935e-14,24.0677206 1.42678486,25.4945055 3.18681319,25.4945055 C4.94684151,25.4945055 6.37362637,24.0677206 6.37362637,22.3076923 L6.37362637,22.3076923 Z"></path>
|
||||
<path d="M6.37362637,70.3624349 C6.37362637,68.6024066 4.94684151,67.1756217 3.18681319,67.1756217 C1.42678486,67.1756217 -8.32992433e-15,68.6024066 -8.43769499e-15,70.3624349 C-8.54546564e-15,72.1224633 1.42678486,73.5492481 3.18681319,73.5492481 C4.94684151,73.5492481 6.37362637,72.1224633 6.37362637,70.3624349 L6.37362637,70.3624349 Z"></path>
|
||||
<path d="M6.37362637,12.7472527 C6.37362637,10.9872244 4.94684151,9.56043956 3.18681319,9.56043956 C1.42678486,9.56043956 -2.83139388e-14,10.9872244 -2.84217094e-14,12.7472527 C-2.85294801e-14,14.5072811 1.42678486,15.9340659 3.18681319,15.9340659 C4.94684151,15.9340659 6.37362637,14.5072811 6.37362637,12.7472527 L6.37362637,12.7472527 Z"></path>
|
||||
<path d="M6.37362637,60.8019954 C6.37362637,59.0419671 4.94684151,57.6151822 3.18681319,57.6151822 C1.42678486,57.6151822 -7.89401087e-14,59.0419671 -7.90478794e-14,60.8019954 C-7.915565e-14,62.5620237 1.42678486,63.9888086 3.18681319,63.9888086 C4.94684151,63.9888086 6.37362637,62.5620237 6.37362637,60.8019954 L6.37362637,60.8019954 Z"></path>
|
||||
<path d="M6.37362637,3.18681319 C6.37362637,1.42678486 4.94684151,3.37507799e-14 3.18681319,3.37507799e-14 C1.42678486,3.37507799e-14 -2.83139388e-14,1.42678486 -2.84217094e-14,3.18681319 C-2.85294801e-14,4.94684151 1.42678486,6.37362637 3.18681319,6.37362637 C4.94684151,6.37362637 6.37362637,4.94684151 6.37362637,3.18681319 L6.37362637,3.18681319 Z"></path>
|
||||
<path d="M6.37362637,51.2415558 C6.37362637,49.4815275 4.94684151,48.0547426 3.18681319,48.0547426 C1.42678486,48.0547426 -7.89401087e-14,49.4815275 -7.90478794e-14,51.2415558 C-7.915565e-14,53.0015841 1.42678486,54.428369 3.18681319,54.428369 C4.94684151,54.428369 6.37362637,53.0015841 6.37362637,51.2415558 L6.37362637,51.2415558 Z"></path>
|
||||
</g>
|
||||
<g transform="translate(4.000000, 0.000000)">
|
||||
<path d="M38.3411765,60.8692043 L37.0438554,60.5934502 L36.1060169,61.5312888 L30.0358967,67.6014089 L26.8546358,70.7826698 L31.2553046,71.7180609 L57.49096,77.2946216 L55.6094677,75.4131293 L60.2969414,97.4659591 L62.6863095,96.9580832 L63.4542053,94.6391709 C61.3968756,93.9578968 59.2178345,93.6803997 57.0133961,93.834549 C47.752502,94.4821338 40.7734518,102.529805 41.4221661,111.806851 C42.0708803,121.083897 50.1020302,128.081953 59.3629243,127.434368 C68.6238185,126.786783 75.6028686,118.739112 74.9541544,109.462066 C74.9172571,108.93441 74.8561906,108.411074 74.7713217,107.893227 L72.3607324,108.288294 L74.8030833,108.332344 C74.8113029,107.876617 74.7676676,107.419644 74.6718491,106.968854 L68.0968468,76.0359001 L65.1996027,78.9331442 L95.7256082,85.4216469 C97.3484677,85.8346681 99.1301315,85.9957158 100.927243,85.8700496 C110.188137,85.2224648 117.167187,77.1747935 116.518473,67.8977477 C115.869758,58.6207018 107.838608,51.622646 98.5777143,52.2702308 C89.3168202,52.9178156 82.3377701,60.9654868 82.9864843,70.2425327 C83.0829952,71.6227022 83.3447327,72.9713395 83.7634295,74.2666802 L86.0877705,73.5153767 L86.5956464,71.1260085 L64.5768319,66.445765 L66.4583242,68.3272573 L52.9962533,4.9931931 C52.3027992,1.7307483 49.0908655,-0.351931923 45.8299389,0.34119942 C42.5678304,1.03458199 40.4828911,4.24818153 41.1753213,7.50580974 L53.9709451,67.7044865 L56.8681892,64.8072424 L38.3411765,60.8692043 L38.3411765,60.8692043 Z M62.9704214,109.856258 C62.9938415,110.000792 63.0107875,110.147165 63.0211368,110.295166 C63.2044836,112.917148 61.2347613,115.188472 58.6247241,115.370983 C56.014687,115.553495 53.7480268,113.578408 53.5646799,110.956426 C53.3813331,108.334444 55.3510554,106.063121 57.9610925,105.880609 C60.1295425,105.728976 62.1103551,107.076498 62.7888621,109.116336 L65.1067464,108.345342 L62.7173781,108.853218 L62.850917,109.48147 C62.9106646,109.76256 62.989888,110.03773 63.0878857,110.305385 L65.3817182,109.465533 L62.9704214,109.856258 L62.9704214,109.856258 Z M100.189042,73.8066649 C97.5790052,73.9891764 95.312345,72.0140901 95.1289982,69.3921077 C94.9456513,66.7701254 96.9153736,64.4988023 99.5254108,64.3162907 C102.135448,64.1337792 104.402108,66.1088655 104.585455,68.7308479 C104.768802,71.3528302 102.79908,73.6241533 100.189042,73.8066649 L100.189042,73.8066649 L100.189042,73.8066649 Z"></path>
|
||||
<g transform="translate(37.805833, 47.877863) rotate(-135.000000) translate(-37.805833, -47.877863) translate(34.692000, -1.943461)">
|
||||
<path d="M6.22766546,40.4798255 C6.22766546,38.7601032 4.83355506,37.3659928 3.11383273,37.3659928 C1.3941104,37.3659928 -1.32677371e-13,38.7601032 -1.32782674e-13,40.4798255 C-1.32887976e-13,42.1995478 1.3941104,43.5936583 3.11383273,43.5936583 C4.83355506,43.5936583 6.22766546,42.1995478 6.22766546,40.4798255 L6.22766546,40.4798255 Z" id="Oval-251"></path>
|
||||
<path d="M6.22766546,87.1873165 C6.22766546,85.4675942 4.83355506,84.0734838 3.11383273,84.0734838 C1.3941104,84.0734838 -1.93517593e-13,85.4675942 -1.93622895e-13,87.1873165 C-1.93728198e-13,88.9070388 1.3941104,90.3011492 3.11383273,90.3011492 C4.83355506,90.3011492 6.22766546,88.9070388 6.22766546,87.1873165 L6.22766546,87.1873165 Z"></path>
|
||||
<path d="M6.22766546,96.5288147 C6.22766546,94.8090924 4.83355506,93.414982 3.11383273,93.414982 C1.3941104,93.414982 -1.26904211e-13,94.8090924 -1.27009514e-13,96.5288147 C-1.27114817e-13,98.248537 1.3941104,99.6426474 3.11383273,99.6426474 C4.83355506,99.6426474 6.22766546,98.248537 6.22766546,96.5288147 L6.22766546,96.5288147 Z"></path>
|
||||
<path d="M6.22766546,31.1383273 C6.22766546,29.418605 4.83355506,28.0244946 3.11383273,28.0244946 C1.3941104,28.0244946 -2.01955288e-13,29.418605 -2.0206059e-13,31.1383273 C-2.02165893e-13,32.8580497 1.3941104,34.2521601 3.11383273,34.2521601 C4.83355506,34.2521601 6.22766546,32.8580497 6.22766546,31.1383273 L6.22766546,31.1383273 Z"></path>
|
||||
<path d="M6.22766546,78.0925797 C6.22766546,76.3728573 4.83355506,74.9787469 3.11383273,74.9787469 C1.3941104,74.9787469 -8.33239236e-15,76.3728573 -8.43769499e-15,78.0925797 C-8.54299761e-15,79.812302 1.3941104,81.2064124 3.11383273,81.2064124 C4.83355506,81.2064124 6.22766546,79.812302 6.22766546,78.0925797 L6.22766546,78.0925797 Z"></path>
|
||||
<path d="M6.22766546,21.7968291 C6.22766546,20.0771068 4.83355506,18.6829964 3.11383273,18.6829964 C1.3941104,18.6829964 4.14055991e-14,20.0771068 4.13002965e-14,21.7968291 C4.11949939e-14,23.5165515 1.3941104,24.9106619 3.11383273,24.9106619 C4.83355506,24.9106619 6.22766546,23.5165515 6.22766546,21.7968291 L6.22766546,21.7968291 Z"></path>
|
||||
<path d="M6.22766546,68.7510815 C6.22766546,67.0313591 4.83355506,65.6372487 3.11383273,65.6372487 C1.3941104,65.6372487 -8.33239236e-15,67.0313591 -8.43769499e-15,68.7510815 C-8.54299761e-15,70.4708038 1.3941104,71.8649142 3.11383273,71.8649142 C4.83355506,71.8649142 6.22766546,70.4708038 6.22766546,68.7510815 L6.22766546,68.7510815 Z"></path>
|
||||
<path d="M6.22766546,12.4553309 C6.22766546,10.7356086 4.83355506,9.3414982 3.11383273,9.3414982 C1.3941104,9.3414982 -2.74282284e-14,10.7356086 -2.7533531e-14,12.4553309 C-2.76388336e-14,14.1750533 1.3941104,15.5691637 3.11383273,15.5691637 C4.83355506,15.5691637 6.22766546,14.1750533 6.22766546,12.4553309 L6.22766546,12.4553309 Z"></path>
|
||||
<path d="M6.22766546,59.4095833 C6.22766546,57.6898609 4.83355506,56.2957505 3.11383273,56.2957505 C1.3941104,56.2957505 -7.71662199e-14,57.6898609 -7.72715225e-14,59.4095833 C-7.73768251e-14,61.1293056 1.3941104,62.523416 3.11383273,62.523416 C4.83355506,62.523416 6.22766546,61.1293056 6.22766546,59.4095833 L6.22766546,59.4095833 Z"></path>
|
||||
<path d="M6.22766546,3.11383273 C6.22766546,1.3941104 4.83355506,3.33066907e-14 3.11383273,3.33066907e-14 C1.3941104,3.33066907e-14 -2.74282284e-14,1.3941104 -2.7533531e-14,3.11383273 C-2.76388336e-14,4.83355506 1.3941104,6.22766546 3.11383273,6.22766546 C4.83355506,6.22766546 6.22766546,4.83355506 6.22766546,3.11383273 L6.22766546,3.11383273 Z"></path>
|
||||
<path d="M6.22766546,50.0680851 C6.22766546,48.3483627 4.83355506,46.9542523 3.11383273,46.9542523 C1.3941104,46.9542523 -7.71662199e-14,48.3483627 -7.72715225e-14,50.0680851 C-7.73768251e-14,51.7878074 1.3941104,53.1819178 3.11383273,53.1819178 C4.83355506,53.1819178 6.22766546,51.7878074 6.22766546,50.0680851 L6.22766546,50.0680851 Z"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
|
Loading…
Reference in New Issue
Block a user