[TW5] Import Tiddles automatically in Tiddlywiki

439 views
Skip to first unread message

Stéphane Delaye

unread,
Dec 28, 2016, 3:29:46 PM12/28/16
to TiddlyWiki
Hello Guys,

Thanks to previous posts, I generated json file representing new tiddlers I want to include in my tiddlywiki.
I use version 5.1.13 with node.js
Importing the tiddles by drag/drop in the broswer is straight forward and works pretty well.

Is there any solution to import the file with a shell script or API to automate this ?

Best regards,
Stephane

Tobias Beer

unread,
Dec 29, 2016, 2:07:56 AM12/29/16
to TiddlyWiki
Hi Stephane,

What you would do instead is create a wiki folder and then use includeWikis in the tiddlywiki.info of another wiki folder where you want it loaded, see:

PMario

unread,
Dec 29, 2016, 6:01:06 AM12/29/16
to TiddlyWiki
Hi Stephane,

You can create single tiddler files in the tiddlers directory from any script. ... After creating the files, you'll need to restart the nodejs server, so the file list is updated. ... and .. reload the browser.

The .tid file format looks like this:

title: any name for the tiddler
tags: tag1 tag2 [[tag with spaces]]

content, content

------

The first 2 lines are interpreted as tiddler fields. The "new line" separates the fields section from the content.

You can use any "key: value" pair, that you want. There are some more system fields.
see: http://tiddlywiki.com/#TiddlerFields

hope that helps.
-mario

Danielo Rodríguez

unread,
Dec 29, 2016, 9:46:49 AM12/29/16
to TiddlyWiki
You can use nodemon to watch the tiddlers directory and restart the server automatically

Stéphane Delaye

unread,
Dec 29, 2016, 12:17:52 PM12/29/16
to TiddlyWiki
Hi,
Thank you for all your responses.
I tested your solutions and I could make it work.
However, I understand that I always have to restart the server (and the browser). Otherwide the new tiddlers are not seen.
Is there any solution without restarting the server ? Without restarting the browser ?
Thanks,
Stephane

Danielo Rodríguez

unread,
Dec 29, 2016, 1:30:51 PM12/29/16
to TiddlyWiki
Ad I said, you can use nodemon (instead of just node) to execute tiddlywiky and it will automatically restart your server. It takes less than a couple of seconds.

If you are will to use a database you can use Noteself + couchdb that synchronizes without restarting anything.

Regards

Stéphane Delaye

unread,
Dec 30, 2016, 3:08:30 PM12/30/16
to TiddlyWiki
Hi, I will try Noteself and make a feedback. It looks very interesting.

Stéphane Delaye

unread,
Jan 3, 2017, 4:16:04 AM1/3/17
to TiddlyWiki
Hello.
I installed a pouchdb server and tried noteself... without success at the moment (https://github.com/NoteSelf/NoteSelf.github.io/issues/5 ).
I left the couchdb server online, if someone want to try.
Hope tu succeed in the coming days...
@+

Danielo Rodríguez

unread,
Jan 3, 2017, 2:07:30 PM1/3/17
to TiddlyWiki
Hello @sdelaye, thank you for trying Noteself.

I didn't make any investigation yet, but I guess that several things are happening:

you're trying to access an http server from an https origin. Browsers prevent this kind of things. Both the server and the client should speak http or https, never mix.
if you are using a standard version of couchdb then CORS is not activated by default. You have to activate it for being able to access your database server from online version of Noteself. Let me look for instructions about how to setup CORS.
In any case, you can create a free account on cloudant which makes all this things easier.

Stéphane Delaye

unread,
Jan 4, 2017, 6:42:50 AM1/4/17
to TiddlyWiki
Hello guys !

Thanks to Mario guidelines, it works !
My problem was CORS. It was enabled on my couchDB server but not with the right permissions.
 

https://pouchdb.com/getting-started.html#enabling_cors
Basically this part:
  npm install -g add-cors-to-couchdb
  add-cors-to-couchdb
Or if your database is not at 127.0.0.1:5984:
$ add-cors-to-couchdb http://me.example.com -u myusername -p mypassword

I worked on ubuntu server 14.04. The script add-cors-to-couchdb doesn't work but we can change the options in /etc/couchdb/default.ini

[httpd]
enable_cors = true

[cors]
credentials = true
; List of origins separated by a comma, * means accept all
; Origins must include the scheme: http://example.com
; You can’t set origins: * and credentials = true at the same time.
origins = *
; List of accepted headers separated by a comma
headers = accept, authorization, content-type, origin, referer, x-csrf-token
; List of accepted methods
methods = GET, PUT, POST, HEAD, DELETE

I just have to play with it now!!!

 
Best regards,
Stephane

Danielo Rodríguez

unread,
Jan 4, 2017, 2:22:08 PM1/4/17
to TiddlyWiki


El miércoles, 4 de enero de 2017, 12:42:50 (UTC+1), Stéphane Delaye escribió:
Hello guys !

Thanks to Mario guidelines, it works !

That instructions looks very similar to the ones that I provided to you on github. Did mario Helped you too or do you think that danielo515@github is Mario?

In any case, I'm glad it is working. Please don't hesitate to provide your feedback.
Reply all
Reply to author
Forward
0 new messages