Some very good points... and through my own hackery over the last couple 
days it has lead me to believe that there isn't really any good/simple way 
to go about it in this manner, it seems to either cause unstably in 
Tw or violate browser security rules. 

However it dose seem like the radically simpler approach proposed by Tobias 
ie:"simply substitution of the normal title when the label == undefined" 
seems to be a safe bet as then only light modification of any 
needed plugins is needed to use the label over titles when available.

I would like to give you a personal Thank you! though for all the work you 
put into looking into this. looking through your example and ref I do feel 
like I know a bit more about the inner workings of TiddyWiki now, which 
should help me in the future figure out how hair brained an idea is before 
I bother the community. XD

On Monday, March 25, 2013 5:33:03 AM UTC-7, PMario wrote:
>
> Hi, 
> I wanted to see if a plugin will fit your needs, or if you really need 
> to change the core. Hacking the core may have some unwanted side 
> effects, that may "bite" you in the future, if not done right. eg: 
> create incompatibility with 3rd party plugins. 
>
> I also wasn't sure about your workflow. 
>
> There are 3 possibilities which come to my mind at the moment. 
>
> 1) create a new ToolbarCommand eg:"mySave" 
> 2) hijack story.saveTiddler 
> 3) hijack store.saveTiddler 
>
> ad 1) 
> create a new command, similar to config.commands.saveTiddler [1]. As 
> you found out allready, it will be needed to prepare the "edit DOM" so 
> story.saveTiddler can handle it. 
>
> pro: 
> * It's a stand alone plugin. 
> * There should be no compatibility issues. 
>
> cons: 
> * To get your "readabletitle" field, tiddlers have to be created using 
> the "edit mode" 
> * you'll need to find out, what DOM structure story.saveTiddler needs 
> to work as desired. 
>
> * I did test this possibility at the weekend. I turns out, to be 
> pretty unstable, since story.saveTiddler does the "overwrite existing 
> tiddlers" handling. To get it going in a user/dev friendly way, some 
> core changes would be needed, which imo won't happen. 
>
> ------------- 
>
> ad 2) 
> modify story.saveTiddler() [2]. 
> IMO there is no simple way to hijack this function. It'll probably end 
> up in a rewrite, which is errorprone. As you can see story.saveTiddler 
> calls "store.saveTiddler" [3] which has the needed parameters. 
>
> pros: 
> * none 
> cons: 
> * see ad 2) 
>
> ------------- 
>
> ad 3) 
> modify store.saveTiddler() [4] 
> This function expects several params. (title, newTitle, .... 
> fields ... ). So it should be relatively easy to hijack it, modify the 
> fields object an call the original function, with all params. IMO the 
> code involved will be just a view lines. 
>
> pro: 
> * easy to hijack 
> * every tiddler will have the "readabletitle" field 
>
> cons: 
> * extensive testing needed, to ensure there are no incompatibilities 
> * every tiddler will have the "readabletitle" field 
>
> -------- 
>
> A test snippet (If you copy the following 3 lines into FireBug or 
> DevTools console, a new tiddler will be created and saved. 
>
> var tid = new Tiddler("testxxx"); 
> store.saveTiddler(tid); 
> saveChanges() 
>
> So if you want, that something like this creates a "readabletitle" 
> field, option 3) is needed. 
>
> -------------- 
>
> you wrote: 
> >Outside of my own writing work however a Machine/Display title pair would 
> >also be of benefit to anyone who wants to use Tw as a CMS just as you use 
> >the same system in nearly any other CMS. 
>
> If the usecase should be more generic, I'd use a different, more 
> generic name instead of "readabletitle". For me it is similar to an 
> "alias". The problem is, there are some "aliasPlugins" out in the 
> wild. So it would be confusing to name it "alias". The second best fit 
> for me would be "label" or "tlable" for tiddler label. 
>
> I did an example extension [5] that should do, what you want. But I 
> used the name "label" for the custom field, since label can be 
> anything. It can be human readable, or a machine readable hash if 
> needed. IMO the usecase can be more generic this way. 
>
> __Be aware__ 
> Using this verison will create a label field for every tiddler that 
> will be saved. 
>
> have fun! 
> mario 
> ================= 
> If my answers and contributions are valuable, consider to help me, to 
> improve them. http://pmario.tiddlyspace.com/#Motivation 
> ================= 
>
> [1] 
> https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Commands.js#L35 
> [2] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Story.js#L590 
> [3] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Story.js#L629 
> [4] 
> https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/TiddlyWiki.js#L340 
> [5] 
> http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#hijack-core-save-tiddler
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to