Hi Vincent, I guess I'll answer on the issue about fET here to have the context nearby (and will put new notes in the new thread).
среда, 20 февраля 2013 г., 10:40:28 UTC+4 пользователь Vincent Yeh написал: > > Yakov, > > Sorry for leaving your suggestions and questions for so long. As I > mentioned before we had a big event at the end of Jan so I didn't spend > much time here in Jan. After that we had a long Chinese New Year's break so > I didn't spend much time here in most of Feb, either. :-) > > On Thursday, January 31, 2013 2:43:40 AM UTC+8, Yakov wrote: >> >> Hi Vincent, >> >> I've got couple more ideas which rised because of using TW on a mobile >> device. >> >> The first one is connected with a question which I'd like ask first: how >> easily transclusions are handled using current code? The idea is that >> inline editing of the <<tabs>> macro would be very useful (currently, >> there's PasteUpPlugin from TiddlyTools which can be used for tabs >> transcluding some text (usually a section) with tiddler macro which is >> somewhat bulky and doesn't work as expected in touch screen. The question >> rises because if this can be done relatively easily then it can be applied >> to <<slider>> and <<tiddler>> macro.. which would be consistent but >> somewhat "conflicting" with PasteUpPlugin. Anyway, inline editing of tabs >> would be very useful. >> > > This can be easily done with the current codes, just need a bit > modifications. But this can easily cause problems with the editor and > previewer (in size or positions), as you mentioned in the previous post, > especially when the transcluded content is large. I am thinking of a better > way to edit and preview large content. Your suggestions in the previous > post would be certainly taken into consideration. > > >> >> Another idea/question is this: is there some kind of API to add inline >> editing? The use-case is the following: as you probably know, there's >> ForEachTiddlerPlugin [1] which is one of the most powerful tools for >> creating auto-aggregated content (list, table etc). What I'm looking for is >> an ability to create auto-agregated tables wich will be editable. Although >> GridPlugin [2] does this partially, it is somewhat limited, and with >> ForEachTiddlerPlugin possibilities are virtually unlimited. What I mean by >> API is a method to create an element which will be editable and editing >> will affect its source (meaning if a table cell contains a slice of some >> tiddler, inline editing of the cell will affect the slice). >> > > I just checked with the ForEachTiddlerExamples and saw only some language > that I do not understand! I have no clue what to do with that. Will need > help on this from some one who is familiar with ForEachTiddlerPlugin. > Well, there's actually no "language" there, just an undordinary way to handle parameters. Let's take this simple example [1]: <<forEachTiddler where 'tiddler.title.startsWith("Site")' >> Here are two parameters of the macro (one would expect something like where:'tiddler.title.startsWith("Site")' which would be one param, but here are two separated params in terms of TW macros). Most of the params of forEachTiddler macro are lines of JavaScript which are evaluated in some part of the macro handling. For instance, the "where" part is executed when iterating tiddlers, for each tiddler tiddler.title.startsWith("Site") is calced and if that's true, some stuff is done for it, and if not, that tiddler is just skipped. One should know, though, that the variable containing an iterated tiddler is "tiddler". Next important thing is the "action" part. There are 2 actions supported by default: addToList and write; the latter is of interest for us. Let's first consider another example [2]: <<forEachTiddler where 'tiddler.tags.contains("glossar")' sortBy 'tiddler.title.toUpperCase()' write '" [["+tiddler.title+" ]] \"view ["+tiddler.title+"]\" [["+tiddler.title+"]] "' begin '"<<tabs txtMyAutoTab "' end '">"+">"' none '"//No tiddler tagged with \"glossar\"//"' >> The main "write" thing is " [["+tiddler.title+" ]] \"view ["+tiddler.title+"]\" [["+tiddler.title+"]] " which is a line that's written for each tiddler (tagged with "glossar") and then wikified. For the tiddler "Tab 1" it writes " [[Tab 1]] \"view [Tab 1]\" [[Tab 1]]". But to get a tab macro. one has to write something with "<<tabs" in the beginning and ">>" in the end, so "begin" and "end" parts are introduced which actually write "<<tabs txtMyAutoTab " and ">>" And in the end, we get <<tabs txtMyAutoTab [[Tab 1]] "view [Tab 1]" [[Tab 1]] [[Tab 2]] "view [Tab 2]" [[Tab 2]] [[Tab 3]] "view [Tab 3]" [[Tab 3]] >> (I added linebreaks for readability) which is wikified and we get tabs macro. So what is needed, is some wikitext which will create things after wikification. One can easily create a table with this, but the trick is to get smth editable which gets the source of tiddler/its sections/slices and changes it on edit. How this can be achieved? Well, if TWtid supports editing of content transcluded with tiddler macro, then nothing extra is needed: one can just put a script to the "write" part which would generate something like | <<tiddler [[iteratedTiddler::slice1]]>> | <<tiddler [[iteratedTiddler##section 1]]>> | <<tiddler [[iteratedTiddler::slice2]]>> | for each tiddler, and each thing will be editable. (sorry, I haven't tried the latest TWtid yet, so I write "if") > > > Besides, I do not know how to provide API's in a plugin yet so currently > that is not possible. It will be highly appreciated if someone would tell > me how to do that. > > I'm not quite sure I use "API" in a correct way, but what I mean by it is a number of functions/methods which can be used in a user's script. For instance, in SharedTiddlersPlugin [3], I put all such methods into one "namespace" "window.sharedTiddlersAPI" ("window" can be omitted): window.sharedTiddlersAPI.getIncludes() window.sharedTiddlersAPI.getStore(tiddyWikiURL) window.sharedTiddlersAPI.getState(tiddyWikiURL) window.sharedTiddlersAPI.orig_fetchTiddler(tName) window.sharedTiddlersAPI.forReallyEachTiddler(callback) window.sharedTiddlersAPI.importAndLog(tiddler) and documented them somehow (not very well, as I can see now). Also, it is implied that they will be supproted in future versions. So, that's what API is about: documented reliable functions added by a plugin. Also, changing the API functions by user doesn't cause any changes in the plugin's behaviour. What I meant here about API is that the lines like "<<tiddler [[iteratedTiddler::slice1]]>>" can be returned by a function like window.TWtidAPI.writeTranscludedWikitext("iteratedTiddler::slice1") so one doesn't need to care whether you implement editable transclusions via <<tiddler>> macros or some other mechanism. Best regards, Yakov. [1] http://tiddlywiki.abego-software.de/#[[List%20all%20Tiddlers%20that%20start%20with%20%27Site%27]] [2] http://tiddlywiki.abego-software.de/#[[Automatically%20create%20tabs%20from%20a%20set%20of%20Tiddlers]] [3] https://groups.google.com/forum/?fromgroups=#!topic/tiddlywiki/rQz8aDt76vQ , there's an attached copy of the repository, if you still have problems with opening the site Vincent > > >> >> Best regards, >> Yakov. >> >> [1] http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin >> [2] http://www.tiddlytools.com/#GridPluginInfo >> > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki?hl=en. For more options, visit https://groups.google.com/groups/opt_out.