[tw5] A viable alternative for TiddlyWiki content export

I just released a new version of BASIC Anywhere Machine (aka BAM) which has an implementation of the LPRINT statement.

The statement takes a string expression and provides it for download to a file via the web browser’s standard “Save File As” dialog.

It is a way of getting text output out of a BASIC program.

Which got me thinking…

It is easy to have a BASIC program include, at runtime, any content from TiddlyWiki. The “preprocessor” in BAM views TiddlyWiki syntax as “meta commands” that should render as something that BASIC recognizes as valid BASIC syntax. Like “DATA” statements used by “READ” statements, or values assigned to BASIC variables, or values returned by BASIC functions.

Although it is easy to create a TiddlyWiki export option (once one has figured out, short of documentation, how out-of-the-box TW exports work), I think a BASIC program in TiddlyWiki makes for a viable alternative.

Something I’ll be chewing on and maybe proving with code in a future video.

For now, you might be able to imagine the potential via this introduction to LPRINT in BASIC Anywhere Machine:

1 Like

Well, that was ridiculously easy.

Download the attached and drag into TiddlyWiki.com to import tiddlers

Two screenshots below:

Imported tiddlers:

The “BASIC Program for TW Export” (find it and click on RUN):
(a blend of TiddlyWiki and BASIC; TiddlyWiki scripting to dynamically generate the BASIC program)
(strings in BASIC are enclosed in double-quotes; if a tiddler title happens to have a double-quote, it gets replaced by that chr$(34) stuff.)

BASIC Program for TW Export.prod.bas.json (131 KB)

1 Like

And follow-up show’n tell video:

Thought: using this is a way to create a file for a set of tiddlers, one file per tiddler, based on a template for output.

Say a form letter that needs to be generated for a bunch of individuals in a group.

It would mean having to deal with File Save As for each file. But not horrible if it is a reasonably small number of files.

I am thinking of an enhancement in which file names are automatically generated, so then it would just be a matter of clicking a button for each file without needing to enter a file name.