This is a json mangler plugin for TiddlyWiki (http://tiddlywiki.com) by Joshua Fontany.
It contains a widget module $jsonmangler, which catches the following messages sent by the ActionSendMessage widget (within Button widgets, etc).
tm-json-refresh - Refreshes the json tiddler's formatting.
tm-json-flatten - Flattens the json's keys (flattens nested objects, etc) to one layer deep. Values are assigned to an index that is the dot-notation version of the path to the original value.
tm-json-unflatten - Unflattens the json's keys (re-nesting objects, etc) from a flat tiddler. Path Keys are read and objects are re-created.
tm-json-restore - Restores data from the json's archive. The Refresh, Flatten, and Unflatten operations store a copy of the old text field in an archive tiddler: $:/archive/json/jsonTiddlerTitle
tm-json-push / tm-json-pull - Flat jsons with titles that end in ".json" only. Pushes or pulls the json's keys (& optionally values) to or from the json's "parent". The parent is a tiddler with the exact same title without the ".json" extension.
This functionality is currently implemented in an Edit Template shown for all tildders of type 'application/json'. When creating new Json Tiddlers, set a 'flat' field to either "true" or "false" (depending on how the tiddler is created) and save the tiddler, then re-open the tiddler in edit mode to ensure all mangler functions are performed correctly.
See the example wiki for more information: https://joshuafontany.github.io/TW5-JsonManglerPlugin/
<$list filter="[is[current]type[application/json]]"><div class="json-tools"><$jsonmangler title=<<currentTiddler>> ><!-- /* Refresh Json */ --><$button tooltip="Refresh Json Formatting" class="nottc-btn-invisible tc-tiddlylink" style="float: left; margin-right: 1em; padding: 4px;"><$action-sendmessage $message="tm-json-refresh" /><<fa-icon "retweet" "fa-lg fa-fw">> ''Refresh''</$button><!-- /* Flatten/Unflatten */ --><$reveal type="nomatch" state="!!flat" text="true"><$button tooltip="Flatten This Json" class="nottc-btn-invisible tc-tiddlylink" style="float: left; margin-right: 1em; padding: 4px;"><$action-sendmessage $message="tm-json-flatten" /><<fa-icon "list-ul" "fa-lg fa-fw">> ''Flatten''</$button></$reveal><$reveal type="match" state="!!flat" text="true"><$button tooltip="Unflatten This Json" class="nottc-btn-invisible tc-tiddlylink" style="float: left; margin-right: 1em; padding: 4px;"><$action-sendmessage $message="tm-json-unflatten"/><<fa-icon "share-alt" "fa-lg fa-fw">> ''Unflatten''</$button></$reveal></$jsonmangler></div><div class="clear" style="clear: both;"></div></$list>
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/OMaRZ1mOZ2w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4ffda938-b9bf-4139-ac64-6f7578ecde70%40googlegroups.com.
Hi, thanks for the tip on "Issues", I've activated that for my repo.
The widget is fully implemented in the Edit template of any tiddler with "type" = "application/json" once the plugin is installed.
Oh, did you mean examples of how I send the messages? Right now they are setup to be used in an EditTemplate (as mentioned).
That can be found in the Plugin's shadow tiddler:$:/plugins/telarus/jsonmangler/editTemplate/Json
Here is an example of some of the buttons from there (cut out a few buttons for the sake of the example).The <<fa-icon>> macro is just an easy way of transcluding FontAwesome icons (code also included with the plugin).