Inserting tiddlers with python script

35 views
Skip to first unread message

okido

unread,
Jun 18, 2010, 1:34:47 PM6/18/10
to TiddlyWiki
I use a python script to create tiddlers and insert them in to a TW by
str = str.replace(old, new) function.
I use <div id="storeArea"> as the old variable.
The new variable is old + newTiddler.

Is this the way to do it or is there a better way?

In the newTiddler I only create a title and the <pre> text </pre>, is
this safe or should I also create other fields.

Have a nice day, Okido

FND

unread,
Jun 18, 2010, 1:49:29 PM6/18/10
to tiddl...@googlegroups.com
> I use a python script to create tiddlers and insert them in to a TW by
> str = str.replace(old, new) function.

While practical for the most part, that might be dangerous in a number
of ways (e.g. escaping).

A while back I wrote this:
http://svn.tiddlywiki.org/Trunk/tools/TiddlyPy/
However, I haven't touched it in a while, and don't remember how
complete it is - though IIRC, it has been tested rather extensively for
_reading_ TiddlyWiki documents.

TiddlyWebWiki is also worth a look, as it's comprehensively tested and
actively maintained:
http://github.com/tiddlyweb/tiddlywebwiki/blob/master/tiddlywebwiki/serialization.py


-- F.

okido

unread,
Jun 18, 2010, 4:13:50 PM6/18/10
to TiddlyWiki
HI FND,

The files in TiddlyPY gave me some ID's how to move forward, thanks a
lot.

Okido
> actively maintained:http://github.com/tiddlyweb/tiddlywebwiki/blob/master/tiddlywebwiki/s...
>
> -- F.

marcel

unread,
Jun 19, 2010, 2:59:04 PM6/19/10
to TiddlyWiki
Hi Okido,

I insert tiddlers using C#/.NET, and do it much the same way. It works
for me. So I would guess you are on the safe side doing like you
describe.

br, Marcel

FND

unread,
Jun 22, 2010, 1:59:12 AM6/22/10
to tiddl...@googlegroups.com
> The files in TiddlyPY gave me some ID's how to move forward

Looking forward to hear more about what you come up with.

> I insert tiddlers using C#/.NET, and do it much the same way

Interesting - it'd be great if you could share you script as well.

I'd also be curious to know what both of your use cases are.


-- F.

okido

unread,
Jun 22, 2010, 12:13:35 PM6/22/10
to TiddlyWiki
I did some import from csv into tiddlers that used datatiddler plugin.
In Python this is easier to do I think, changing code and data is
rather easy although hardcore JS users might think different.
Further more I was making tiddlers based on file names in a folder.
I use it as a catalog for files, comments, tagging and expiration date
calculation make it easy to find and control a bunch of docs.
Specially scanned pdf's.
The problem of not being able to read file names in a folder is now
solved thanks to Eric's code in ShowLocalDirectory that I used.
I now run the code and a file name that is not already a tiddler will
automatically added and tagged as being new.

Still an idea is to rework this into a plugin that can read 5 to 10
photo's into TW, add some comments and buttons to navigate through the
pictures, remove edit capabilities and send it out to customers as a
help or explanation tool.
The advantage is that almost every step can be carried out script wise
and you end up with a uniform output time after time.

Remember to share good fortune with your friends, Okido

marcel

unread,
Jun 23, 2010, 3:33:58 PM6/23/10
to TiddlyWiki
Well, since C# is object oriented, there is no simple script but a set
of classes. I will not share these here for now. I intend to release
it as an open source project on codeplex, once the source code is more
mature.
In short, I simply add the required html nodes to the storearea.

I will announce this on this on the dev group, once it becomes public.

The use case is a html version of a media player for cue points. see
http://replayer.codeministry.ch for more info. TiddlyWiki is a nice
way to present a multipage "website".

br, Marcel
Reply all
Reply to author
Forward
0 new messages