Je ne vais clairement pas beaucoup poster dans cette catégorie, alors je pose ce lien que j’avais mis de côté en 2015 d’une discussion initiée par Mat sur la liste anglophone, et notamment la réponse détaillée de PMario, que je me permets de recopier ci-dessous.
[2019-02-17: Note @prolegomenes] Visible également sur Mail Archive à l’adresse https://email@example.com/msg51295.html
I’m not exactly sure, what you need, because it depends on your existing JS skills. So I’d like to point out some resources, that may be useful and I’ll start at the beginning:
- IMO Marijn Haverbeke wrote a “interactive” js book.
- It explains the basics.
- It talks about JS in the browser
- and it talks about JS for nodejs.
So it basically discusses all elements we use in TW. … We use all of them. So reading and understanding (examples) the stuff there will help a lot.
Has anyone attempted to make an automatic convertor for this?
Code found on the internet is mainly written for HTML pages, where one library opens one instance of a function. With TW most of the time we need to be able to initialize many instances of a desired function, so the mechanism is slightly different than shown in most of the examples found in the web.
This makes using libraries a little bit different. … but the mechanism, that is used is always the same. (see chapter 10 Modules in the book) … Warning: Don’t start reading there, if you are new to JS. (It will be frustrating) Start at the beginning!
TiddlyWiki has a philosophy how external libraries are included. … The main difference here is, that libraries in TW are not hardcoded, like for all other HTML pages. Users are able to dynamically import plugins. Save the TW. Reload and the plugins have to work. So TW uses a very opinionated mechanism, that is not trivial. … BUT it is always the same. So if you understand it once, you should be fine.
See TW developer doc and I’m sorry … The TW source code itself
imo 3 reasons:
Second: dynamically installable plugins.
Trust me. You don’t want to enable script tags in tiddlers. … You really don’t.
Is it just to introduce a threshold so it won’t be too easy for someone malicious to pop by with a script saying “here, run this on your TW, it’s great”?
No, it’s not just security.
TW needs to be able to initialize many instances of the same code in a defined way: aka Widgets. Otherwise we break the automatic refresh mechanism.
You should be able to build your own TW with nodejs if you want to play with it. You can do almost everything within js macro code, except the widget stuff.
Developer tools: https://developer.mozilla.org/en/docs/Tools … Have a closer look at: Exploring and debugging tools. They are very similar in Chrome and even IE. So use the browser of your choice. …
console.log() is your friend for debugging your own stuff.
The developer doc is at: http://tiddlywiki.com/dev/ … It should give you some more info about the core internals.
While I’m sure, I’m opening more questions than I answered, I still hope this helps.
Et je rajoute la réponse de Jeremy Ruston
I think there are two questions here: