My example in this thread hints packaging into plugins can be done in single file wikis very simply. I have already made alternate plugin type simply by giving a json tiddler a new plugin-type field value. How do I get a json tiddler? Just drop some tiddlers on a wiki and rename $:/import and change its fields.
If you look at my example you can import a tiddler that imports tiddlers.
Regards
Tony
My example was more showing untapped hacks of imports plugins and packaging. We can design a template to generate libraries and export them and possibly import the link to the library.
Tony
\define oneTiddler() <$list filter='[<theTiddler>fields[]] -text +[bl[]]' > <br> "<$view field='title' jsencoded/>": "<$view tiddler=<<theTiddler>> field=<<currentTiddler>> format=jsencoded/>", </$list> <$list filter='[<theTiddler>fields[]] -text +[bl[]]' > <br> "<$view field='title' jsencoded/>": "<$view tiddler=<<theTiddler>> field=<<currentTiddler>> format=jsencoded/>" </$list>\end
\define jsonListing()[<br><$list filter='[subfilter{$:/state/PluginLibrary!!filter}] +[bl[]]' variable=theTiddler> { <<oneTiddler>> <br> }, <br></$list><$list filter='[subfilter{$:/state/PluginLibrary!!filter}] +[last[]]' variable=theTiddler> { <<oneTiddler>> <br> } <br></$list>]\end
This packages the plugins returned by this filter into the format needed by a plugin library.
The file structure needs to be:
*Library Folder** recipes*** library**** tiddlers***** //individual tiddler json files//**** tiddlers.json** index.html
filter: <$edit-text tiddler='$:/state/PluginLibrary' field=filter/>
!! tiddlers.json
''filename:'' tiddlers.json
''contents:''
<<jsonListing>>
!! Tiddler JSON files:
<$list filter={{$:/state/PluginLibrary!!filter}}>
---''filename:'' <$view field='title' format='urlencoded'/>.json
''contents:''
<$text text=<<jsontiddler>>/></$list>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/03b4a9ae-9cf3-4bfd-9ee4-608fee605bb8%40googlegroups.com.
Making a plugin in a single file wiki is simple, put this in a tiddler then fill out the form, the filter is the filter for what you want to package in the plugin:
```
\define plugintext()
{
"tiddlers": {<$list filter='[subfilter{$:/state/MakePlugin!!filter}]+[bl[]]'>
"<$view field=title format=jsencoded/>": <$text text=<<jsontiddler "jsontiddlers Macro">>/>,
"<$view field=title format=jsencoded/>": <$text text=<<jsontiddler>>/>,
\define plugintext(){"tiddlers": {<$list filter="[subfilter{$:/state/MakePlugin!!filter}]+[bl[]]">
"{{{ [<currentTiddler>] +[jsonstringify[]] }}}": <$text text=<<jsontiddler>>/>,</$list><$list filter="[subfilter{$:/state/MakePlugin!!filter}]+[last[]]">"{{{ [<currentTiddler>] +[jsonstringify[]] }}}": <$text text=<<jsontiddler>>/></$list>
\define makeHTML(json)`<!doctype html><html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><meta name="application-name" content="TiddlyWiki Plugin Library" /><meta name="application-version" content="v0.0.0" /><meta name="copyright" content="Copyright 2015 Jeremy Ruston" /><link id="faviconLink" rel="shortcut icon" href="favicon.ico"><title>Plugin Library</title><script>var assetList = $(JSONLISTING)$
/*\title: $:/plugins/tiddlywiki/pluginlibrary/libraryserver.jstype: application/javascriptmodule-type: library
A simple HTTP-over-window.postMessage implementation of a standard TiddlyWeb-compatible server. It uses real HTTP to load the individual tiddler JSON files.
\*/(function(){
/*jslint node: true, browser: true *//*global $tw: false */"use strict";
// Listen for window messageswindow.addEventListener("message",function listener(event){ console.log("plugin library: Received message from",event.origin); console.log("plugin library: Message content",event.data); switch(event.data.verb) { case "GET": if(event.data.url === "recipes/library/tiddlers.json") { // Route for recipes/library/tiddlers.json event.source.postMessage({ verb: "GET-RESPONSE", status: "200", cookies: event.data.cookies, url: event.data.url, type: "application/json", body: JSON.stringify(assetList,null,4) },"*"); } else if(event.data.url.indexOf("recipes/library/tiddlers/") === 0) { var url = "recipes/library/tiddlers/" + encodeURIComponent(removePrefix(event.data.url,"recipes/library/tiddlers/")); // Route for recipes/library/tiddlers/<uri-encoded-tiddler-title>.json httpGet(url,function(err,responseText) { if(err) { event.source.postMessage({ verb: "GET-RESPONSE", status: "404", cookies: event.data.cookies, url: event.data.url, type: "text/plain", body: "Not found" },"*"); } else { event.source.postMessage({ verb: "GET-RESPONSE", status: "200", cookies: event.data.cookies, url: event.data.url, type: "application/json", body: responseText },"*"); } }); } else { event.source.postMessage({ verb: "GET-RESPONSE", status: "404", cookies: event.data.cookies, url: event.data.url, type: "text/plain", body: "Not found" },"*"); } break; }},false);
// Helper to remove string prefixesfunction removePrefix(string,prefix) { if(string.indexOf(prefix) === 0) { return string.substr(prefix.length); } else { return string; }}
// Helper for HTTP GETfunction httpGet(url,callback) { var http = new XMLHttpRequest(); http.open("GET",url,true); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { callback(null,http.responseText); } }; http.send();}
})();
</script></head><body>
<h1>HelloThere</h1>
<p>This is the TiddlyWiki plugin library. It is not intended to be opened directly in the browser.</p>
<p>See <a href="https://tiddlywiki.com/" target="_blank">https://tiddlywiki.com/</a> for details of how to install plugins.</p>
</body></html>`\end
---''filename:'' index.html
''contents:''
<$wikify name=JSONLISTING text=<<jsonListing>>><pre><<makeHTML>></pre></$wikify>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/648ee829-7bf8-49b0-abcc-fa3d0214b637%40googlegroups.com.
Oh, sorry about that. I had another tiddler generate the html file. Here is everything in one file, I am also adding it to the plugin development repo. The formatting for the html file output isn't great, but it should work:
\define makeHTML(json)`<!doctype html><html><head>
<meta http-equiv="Content-Type" content="text/html; />
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a46199ec-b02a-433b-9a53-f2b6a0cd037b%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/05a22ed6-9f3d-4323-b043-cf7716dffd58%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1d53506d-a13f-45a0-91b0-06a9320215a7%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1d53506d-a13f-45a0-91b0-06a9320215a7%40googlegroups.com.
Jan,I am not sure the reason the folder is called recipes, I believe it has something to do with how some system was set up while this was being developed. I think you would have to ask Jeremy why.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4556a7cb-1490-4d70-a695-622787414b41%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
I am not sure the reason the folder is called recipes, I believe it has something to do with how some system was set up while this was being developed. I think you would have to ask Jeremy why.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5ceff8ad-2473-4929-ae2f-f14e7aabba6c%40googlegroups.com.