[TW5] converting standard Tiddlywiki to Node.js Tiddlywiki (and back)

2,592 views
Skip to first unread message

Bob Flandard

unread,
Jun 17, 2016, 11:23:47 AM6/17/16
to TiddlyWiki
Hello,

Sorry if this question is naive. I followed the instructions to install a Node.js version of TW (Windows) and all went smoothly. How do I convert my existing standard single file TW into a Node.js version, and then convert it back if I need to? My standard TW has some non-standard templates and possibly other non-core "system" tiddlers.

Thanks, Bob

Jeremy Ruston

unread,
Jun 17, 2016, 11:46:11 AM6/17/16
to tiddl...@googlegroups.com
Hi Bob

Sorry if this question is naive. I followed the instructions to install a Node.js version of TW (Windows) and all went smoothly. How do I convert my existing standard single file TW into a Node.js version, and then convert it back if I need to? My standard TW has some non-standard templates and possibly other non-core "system" tiddlers.

The easiest way to convert a TiddlyWIki standalone HTML file into the Node.js layout is to run the Node.js wiki in client-server mode, and then import the HTML file by drag and drop in the browser. (You can also use the --load command; see /bin/ginsu.sh in the TW5 repo).

To convert the other way, either click the “save changes” button in the browser to save a snapshot of the wiki as a standalone HTML file, or use the --rendertiddler command:

--rendertiddler $:/plugins/tiddlywiki/tiddlyweb/save/offline index.html text/plain

Best wishes

Jeremy.



Thanks, Bob

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/aefe42de-b556-4767-b37d-26581dc6feda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bob Flandard

unread,
Jun 17, 2016, 1:08:01 PM6/17/16
to TiddlyWiki
Cor! that was quick,

Thanks Jeremy! I just woke from an afternoon nap and there's the answer. And it looks pretty straightforward.

Have a good weekend, Bob

Bob Flandard

unread,
Jun 17, 2016, 2:04:00 PM6/17/16
to TiddlyWiki
Hi Jeremy (or anyone),

The standalone to Node.js drag and drop method worked well (very slick interface for selecting tiddlers to import), but whereas a link to a video clip would play the clip in a new browser tab, the link is now inactive. Sample link = file:///C:/Users/Bob/Videos/Advanced%20Surface%20Repair%20Techniques.mp4#t=0:01:01,0:01:23.

Any thoughts on how to fix the links?

Another small issue is that the original dates displayed on the tiddler, all get replaced with today's date.

Extra info. the links are created by the following macros in a tiddler tagged $:/tags/Macro:

\define vid(start, end , path, file)
<a href="$path$$file$#t=$start$,$end$" class="tc-tiddlylink-external" target="_blank">$start$ ˃ $end$</a>
\end

\define videolink(start:'0:00:00', end:"Finish")
<$macrocall $name="vid" start="$start$" end="$end$" path={{!!path}} file={{!!file}} />
\end

<!--
Macro to define a link to a specific section of a video file such as an mp4 file
The link will open the video file in a new browser tab
If used, the start and end arguments must be in the format h:mm:ss e.g. 0:02:16
-->

Thanks and regards, Bob

RichardWilliamSmith

unread,
Jun 17, 2016, 7:02:00 PM6/17/16
to TiddlyWiki
Hi Bob,

When you run the node version, you are accessing your wiki over http, which means that it cant access regular files on your filing system unless they're also being served over http - it's a security feature - you can run a separate server for them if that's the solution you're looking for, but it might be easier to incorporate them directly into the wiki.

What is your use-case for trying out the node version? I have some work to post soon which makes it easier to maintain a stand-alone wiki alongside a pair of folders containing it's images and pdfs - this allows one to keep the html file small and fast. If you can explain your preferred workflow or what you're trying to achieve, we should be able to figure out the best way to do it.



Regards,
Richard

Bob Flandard

unread,
Jun 18, 2016, 2:36:16 AM6/18/16
to TiddlyWiki
Hi Richard,

Thank you for the tip. My reason for tinkering with the Node version was to reduce the risk of losing all my data in an accident. This nearly happened a couple of days ago, after installing a plugin my TW file was empty (size 0 KB). Luckily I had backed-up immediately before the install, but I don't trust myself to always remember to do that. Something like a button in TW in the tools tab, that saves a copy of the TW with the file name appended by the date and a counter integer, would be a good option for me.

I shall desist from any further Node version tinkering with no delay - node elay, I'll get my coat.

Regards, Bob

Jeremy Ruston

unread,
Jun 18, 2016, 5:23:22 AM6/18/16
to tiddl...@googlegroups.com
Hi Bob

On 18 Jun 2016, at 07:36, Bob Flandard <bfla...@gmail.com> wrote:

Something like a button in TW in the tools tab, that saves a copy of the TW with the file name appended by the date and a counter integer, would be a good option for me. 

You can set things up to work this way.

First, use a browser that doesn’t have TiddlyFox (I tested this approach in Chrome). Second, ensure your browser is *not* set to prompt for a filename when you download a file. Third, open your TiddlyWiki file in the browser, and start to work on it. Each time you click the “save changes” button in the sidebar a fresh copy of the file will be downloaded with the latest changes, named “filename (2).html”, “filename (3).html” etc.

There is one quite significant “gotcha” with this approach, though. If you click the browsers refresh button (or restart your browser) then you’ll revert to the unmodified file, losing your most recent changes. To recover those changes, you need to load the latest version of the file that was saved (ie the one with the highest number).

Best wishes

Jeremy.


Bob Flandard

unread,
Jun 18, 2016, 5:51:15 AM6/18/16
to TiddlyWiki
Hi Jeremy,

Thank you for the saving suggestion. I think overall for my taste the benefits of that option wouldn't outweigh the effort of switching browser and having to clear-out the multiple back-ups it would dump on the hard-drive.

I think I need make a Windows batch file to do the back-up. Is it possible to execute a Windows batch file from a button in TW5? It does sound like a dangerous thing to do, so I'm guessing not.

Regards, Bob

Jeremy Ruston

unread,
Jun 18, 2016, 6:03:39 AM6/18/16
to tiddl...@googlegroups.com
Hi Bob

On 18 Jun 2016, at 10:51, Bob Flandard <bfla...@gmail.com> wrote:

I think I need make a Windows batch file to do the back-up. Is it possible to execute a Windows batch file from a button in TW5? It does sound like a dangerous thing to do, so I'm guessing not.

No, sadly, it’s not possible.

Best wishes

Jeremy

Bob Flandard

unread,
Jun 18, 2016, 8:20:48 AM6/18/16
to TiddlyWiki
Thanks Jeremy,

That seems perfectly reasonable and sensible.

All the best, Bob

LinOnetwo

unread,
Apr 8, 2020, 11:46:29 PM4/8/20
to TiddlyWiki
Hi, Bob

I think you can write a script to monitor local port, for example, a zazuapp.org/ plugin, then you can write a JS widget that fetch( local port )

在 2016年6月18日星期六 UTC+8下午5:51:15,Bob Flandard写道:

LinOnetwo

unread,
Apr 8, 2020, 11:52:02 PM4/8/20
to TiddlyWiki
I come here from Google search, I'd like to find a way to convert HTML to nodejs wiki programmitcally, so I can do it using a JS script.

When I modified a wiki that is hosted in github pages ( via Github SyncAdaptor, which only support HTML wiki)

, I want a Github Action to unpack HTML file and update the nodejs wiki in the matster branch, so I need a way to do so in JS instead of do it by hand.

Is that possible?

在 2016年6月17日星期五 UTC+8下午11:46:11,Jeremy Ruston写道:
Hi Bob

Sorry if this question is naive. I followed the instructions to install a Node.js version of TW (Windows) and all went smoothly. How do I convert my existing standard single file TW into a Node.js version, and then convert it back if I need to? My standard TW has some non-standard templates and possibly other non-core "system" tiddlers.

The easiest way to convert a TiddlyWIki standalone HTML file into the Node.js layout is to run the Node.js wiki in client-server mode, and then import the HTML file by drag and drop in the browser. (You can also use the --load command; see /bin/ginsu.sh in the TW5 repo).

To convert the other way, either click the “save changes” button in the browser to save a snapshot of the wiki as a standalone HTML file, or use the --rendertiddler command:

--rendertiddler $:/plugins/tiddlywiki/tiddlyweb/save/offline index.html text/plain

Best wishes

Jeremy.



Thanks, Bob

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages