Plugin development in my favourite editor

14 views
Skip to first unread message

Tobias Beer

unread,
Oct 3, 2010, 6:22:32 PM10/3/10
to TiddlyWikiDev
ADDENDUM: I have figured out while writing this that 4) works, but if
you have other / better ideas, please do tell.

Here's what I am looking for...

* I want to edit and save my TiddlyWiki plugin in my preferred editor
* then I go to my browser hit reload and - bang - my plugin is loaded

What is needed for that to happen? Please note that I do NOT want
anything but the plugin code in my editor, especially not a tiddlywiki-
file around it, not even pure-store ...there already is enough code so
I don't need anymore HTML distraction possibly messing with my editors
highlighter.

Any ideas?

Here's what I have considered so far...


1) I have tried Erics LoadRemotePlugin [1] but failed ...not even an
error messages appeared. The plugin loads fine if I do the usual
cookie&pasta ;o)

2) LoadRemoteTiddlers [2] seems to require a TiddlyWiki around the
contents

3) IncludePlugin [3] at least requires PureStoreFormat as well.

4) MasterIncludesPlugin [4] ...it took me a while but then I figured
out where to look in order to understand how it works. As I've found
this process a bit exhausting I've put MasterIncludesPlugin along with
the basic documentation up on its own TiddlySpace [5] ...of course,
including FND as a member. Essentially what I need is provided via
TiddlerFilesModule.js ...so it seems there is a working solution for
me on a plugin per plugin basis. On the other hand, from what I
understand from the documentation that won't be very efficient when
using lots of external files.

5) Using a code highlighter in a tiddlywiki is only an option if it
allowed me to immediately run the code. But switching from Edit- to
ViewMode alone makes inline editing by multitudes less efficient as
compared to using a full fledged editor, not to mention the limited
realestate for editing ...unless, of course, I created a dedicated
coding envoronment in TiddlyWiki with FullScreenMode et al ...yet
still very likely missing even the most basic functions of a good
editor, e.g. using TAB or SHIFT+TAB on multiple lines.

6) TiddlyWeb might be an option (I am running on XP) but only if it
wont take too much of a learning curve (and thus time) to get the
basics running. On the other hand, do I really want to manage
(starting/stopping) (local) servers if what I really want is a
"simple" TiddlyWiki (inclusion mechanism) and a TextEditor?

Cheers, Tobias.

[1] http://www.tiddlytools.com/#LoadRemotePlugin
[2] http://www.tiddlytools.com/#LoadTiddlersPlugin
[3] http://tiddlywiki.abego-software.de/#IncludePlugin
[4] http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/MasterIncludesPlugin/MasterIncludesPlugin.js
[5] http://masterincludes.tiddlyspace.com

Paul Downey

unread,
Oct 4, 2010, 3:23:43 AM10/4/10
to tiddly...@googlegroups.com
> * I want to edit and save my TiddlyWiki plugin in my preferred editor
> * then I go to my browser hit reload and - bang - my plugin is loaded

I seems you'd like the TiddlyWiki to load the plugin on demand during
startup? That sounds like an interesting idea.

An alternative is to use small bash script to cook the HTML file and
reload the page, which on the Mac is "open index.html" for the default
browser.

So for vi that's :w^M:!!^M then ALT-TAB to the browser where the page is ready.

This has the advantage that the development index.html is the same
single file released with bundled the released plugin, demo data and
tests.

--
Paul (psd)
http://blog.whatfettle.com

FND

unread,
Oct 4, 2010, 4:15:17 AM10/4/10
to tiddly...@googlegroups.com
> * I want to edit and save my TiddlyWiki plugin in my preferred editor
> * then I go to my browser hit reload and - bang - my plugin is loaded

As you probably know, the standard method is to use Cook (which
basically just concatenates a bunch of files, both HTML and JavaScript,
to create a TiddlyWiki document) - however, that compilation constitues
an intermediate (if quick and painless) step, so you can't just reload
the page in the browser.

The alternative of including external content via a plugin is worth
exploring - I haven't played with any of the options in quite a while,
but this might be worth reviewing:
http://tiddlywiki.org/wiki/Including_External_Content
http://groups.google.com/group/TiddlyWiki/t/b602aa688c9fc2fa/

If you're using TiddlyWeb, you can use the devstore or a curl script - I
sometimes use a script that periodically PUTs a given JavaScript file to
the server as a systemConfig tiddler:
http://gist.github.com/494323


-- F.

PMario

unread,
Oct 4, 2010, 9:11:45 AM10/4/10
to TiddlyWikiDev
Hi Tobias,

I'm using the "The Comprehensive Method" described at tiddlywiki.org
[1]. Needs to read the whole text.
Have a look at SyntaxHighlighterPlugin at github. This is the
configuration I used to create the plugin. Using Aptana as an editor.

[1] http://tiddlywiki.org/wiki/Dev:Developing_and_Testing_a_Plugin
[2] http://github.com/pmario/SyntaxHighlighterPlugin
> [4]http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/MasterInclud...
> [5]http://masterincludes.tiddlyspace.com

Jeremy Ruston

unread,
Oct 4, 2010, 11:49:00 AM10/4/10
to tiddly...@googlegroups.com
Another approach that might suit some people is to use a browser
extension that lets you edit a <textarea> in an external editor. I
don't use them myself, but I found these ones for Firefox and Chrome
in a quick search:

https://addons.mozilla.org/en-US/firefox/addon/4125/
https://chrome.google.com/extensions/detail/ljobjlafonikaiipfkggjbhkghgicgoh?hl=en

Best wishes

Jeremy

> --
> You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
> To post to this group, send email to tiddly...@googlegroups.com.
> To unsubscribe from this group, send email to tiddlywikide...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
>
>

--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com

FND

unread,
Oct 4, 2010, 11:56:13 AM10/4/10
to tiddly...@googlegroups.com
> Another approach that might suit some people is to use a browser
> extension that lets you edit a <textarea> in an external editor.

Indeed, I frequently use Vimperator's built-in functionality for this to
shove tiddler contents into Vim and back - works quite well, and better
still if you have some simple scripts to mirror the contents in a .js
file on your HDD.


-- F.

Tobias Beer

unread,
Oct 4, 2010, 4:52:08 PM10/4/10
to TiddlyWikiDev
@Paul

Would there be a comprehensive documentation for cook somewhere? Does
cook work under XP? I do like linux, but for now xp runs just fine. On
the other hand, I have no inclinations to install cygwin. ;o)

Or is cook that "straight forward" that it might be rewritten as a bat
or powershell file?


@FND

Thanks for MasterIncludesPlugin ...I have got it working fine right
now. At times I need to reload twice, but I can live with that. I
guess for my needs a much simplified version would do the job as well,
but that's not very important right now.

@PMario

"The Comprehensive Method" from TiddlyWiki.org looked good to begin
with but then I realized that it does not create the plugin as a
tiddler, which is unfortunate as it contains gui-templates to be used
by it.

@Jeremy

Would be interesting to see how those browser plugins work... whether
or not the file is reopened every time I want to edit it and thus have
to look for the last changed bits, having lost all undo history, etc.

@All

I guess, for now, I am happy with MasterIncludesPlugin. It seems to
provide what I wanted, especially considering that I wont be having a
multitude of plugins in development at the same time. I could even
have a "current.js" and always save the plugin into it that I am
working on for the next few hours / days. The idea never was to use
any of that for version mgt, anyways.

Cheers, Tobias.

Jeremy Ruston

unread,
Oct 4, 2010, 5:27:00 PM10/4/10
to tiddly...@googlegroups.com, TiddlyWikiDev
Yet another idea that might work for intensive development is to have your plugin on your local drive, but include it via a file:// uri from a <script> tag in your MarkupPreHead. That way, you could edit-save-refresh in the usual way.

Cheers

Jeremy


--
http://jermolene.com
http://tiddlywiki.com
http://osmosoft.com

Paul Downey

unread,
Oct 4, 2010, 5:25:31 PM10/4/10
to tiddly...@googlegroups.com
On Mon, Oct 4, 2010 at 9:52 PM, Tobias Beer <beert...@googlemail.com> wrote:
> @Paul
>
> Would there be a comprehensive documentation for cook somewhere?

There's not a lot to it. There's a wiki page:

http://trac.tiddlywiki.org/wiki/Cook

but I've learnt by example from recipes in the svn repo:

http://svn.tiddlywiki.org/Trunk/core/tiddlywiki.html.recipe
http://svn.tiddlywiki.org/Trunk/verticals/TiddlySlidy/index.html.recipe

> Does cook work under XP?

I believe so. It's written in Ruby which is pretty platform independent:

http://svn.tiddlywiki.org/Trunk/tools/cooker/cook.rb

> I do like linux, but for now xp runs just fine. On
> the other hand, I have no inclinations to install cygwin. ;o)

heh.

> Or is cook that "straight forward" that it might be rewritten as a bat
> or powershell file?

The bit of cook I use is pretty small, though most recipes use the
core recipe which uses templates, copyright and most every feature.
Might be an interesting academic exercise to refactor it into
JavaScript.

Tobias Beer

unread,
Oct 4, 2010, 7:15:40 PM10/4/10
to TiddlyWikiDev
Hi Jeremy,

> Yet another idea that might work for intensive development is to have your plugin on your local drive, but include it via a file:// uri from a <script> tag in your MarkupPreHead. That way, you could edit-save-refresh in the usual way.

I've considered that and it is fine up until the point where the
plugin itself contains template that need to be accessed as tiddler
text. I could work around that by having the plugin create that stuff
as shadow tiddlers. Yet, in my current case that's really not what I
want as these templates are not intended for others to be edited.

On the other hand, as a general question, at the time of loading those
plugins via MarkupPreHead, would the core be ready to register
shadows, etc?

Cheers, Tobias.

Jeremy Ruston

unread,
Oct 5, 2010, 2:30:04 AM10/5/10
to tiddly...@googlegroups.com

I've considered that and it is fine up until the point where the
plugin itself contains template that need to be accessed as tiddler
text. I could work around that by having the plugin create that stuff
as shadow tiddlers. Yet, in my current case that's really not what I
want as these templates are not intended for others to be edited.

On the other hand, as a general question, at the time of loading those
plugins via MarkupPreHead, would the core be ready to register
shadows, etc?

Good point. You'd want to use MarkupPostBody to get around that

Best wishes

Jeremy

Tobias Beer

unread,
Oct 5, 2010, 7:34:02 AM10/5/10
to TiddlyWikiDev
Hi Jeremy,

It would sound like the most simple solution and it would sure be
great to get that working.

On the other hand, the "The Comprehensive Method" [1] as suggested by
PMario did not work ...as those templates were not accessible by the
plugin.

Just tested... and it happened as I thought:

Error while executing macro <<MyMacro>>:
TypeError: store.getTiddlerText("MyPlugin##TEMPLATE") is null

Now, would there be a few lines of code (maybe in another wrapper.js)
required to finish the actual loading? The missing part really seems
to be that no tiddler by the name of "MyPlugin" has been loaded. I
would imagine that to be rather straight forward...

1) load a wrapper.js via MarkupPostBody containing references to
plugins
2) load those plugins
3) create those tiddlers as shadows

What I believe to be missing in [1] is merely step 3)


ADDENDUM: I have modified LoadExternal.js and published it here [2]
and it now does all I really need! What was required was to modify
getTiddlerText in order to fetch sections of shadow
tiddlers ...something that is more of a bug (or missing feature) in
the core.

While at it, I have created a bugreport in trac [3].

Cheers, Tobias.


[1] http://tiddlywiki.org/wiki/Dev:Developing_and_Testing_a_Plugin#The_Comprehensive_Method
[2] http://tobibeer.tiddlyspace.com/#LoadExternal
[3] http://trac.tiddlywiki.org/ticket/1259

Eric Shulman

unread,
Oct 5, 2010, 11:37:07 AM10/5/10
to TiddlyWikiDev
> ADDENDUM: I have modified LoadExternal.js and published it here [2]
> and it now does all I really need! What was required was to modify
> getTiddlerText in order to fetch sections of shadow
> tiddlers ...something that is more of a bug (or missing feature) in
> the core.
>
> While at it, I have created a bugreport in trac [3].

This problem was already reported quite a while ago:
http://trac.tiddlywiki.org/ticket/1134

and refers to this TiddlyTools CoreTweak:
http://www.TiddlyTools.com/#CoreTweaks##1134

This change was *supposed* to be in TW260...

Unfortunately, due to a one-time technical 'burp' in the Trac system,
most of the discussion about this ticket was lost, making it appear
that the only code change to be done was to adjust the regexp for
sections to handle leading/trailing whitespace. However, the
CoreTweak code actually provides a re-write of the whole
store.getTiddlerText() function in order to support use of sections
from shadows (and also clean up the code a little).

Hopefully, this long-overdue fix will find its way into the next
release.... and won't continue to languish in 'ticket limbo'.

-e

tiddlygrp

unread,
Oct 6, 2010, 9:03:13 AM10/6/10
to TiddlyWikiDev
It would be great to replace cook by something js only, this removes a
dependency on ruby.

But more important is that instead of using a recipe file, one can use
a single index.html file to specify a (vertical) TW. During
development files and tiddlers referenced in the index html will be
loaded piece by piece, and for deployment the same js tool can "cook"
the referenced file into a single file TW.

Here are some references:

- http://github.com/jupiterjs/steal
http://jupiterjs.com/news/stealjs-script-manager

- http://berklee.github.com/nbl/index.html

- http://requirejs.org/

- http://www.andresvidal.com/jsl

- http://labjs.com/

The most interesting one in terms of philosophy is steal.js, but
requirejs is also very nice. nbl is minimal and could be used quite
simply, but does not support "cooking".

tiddlygrp

Tobias Beer

unread,
Oct 7, 2010, 9:48:58 AM10/7/10
to TiddlyWikiDev
Wow, this steal thing is quite something. Would be great to see it @
work with a TiddlyWiki based version of cook to compile required bits
and pieces into verticals "on the fly".

Cheers, Tobias.
Reply all
Reply to author
Forward
0 new messages