TiddlyWiki Command Syntax: TiddlyWiki.Info and Shell Script

In tiddlywiki.info I see commands like this:

        "static": [
            "--render",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",
            "--render",
            "$:/core/templates/alltiddlers.template.html",
            "alltiddlers.html",
            "text/plain",
            "--render",
            "[!is[system]]",
            "[encodeuricomponent[]addprefix[static/]addsuffix[.html]]",
            "text/plain",
            "$:/core/templates/static.tiddler.html",
            "--render",
            "$:/core/templates/static.template.css",
            "static/static.css",
            "text/plain"
        ]

Does it mean that, a command starts with command name like --render and followed by arguments list separated by comma , and then a new command will start if a command name is appeared in the list like --render or --output?

When one calls TiddlyWiki from shell then there is no need for the separator , e.g

tiddlywiki --load my-standalone-wiki.html --output 'where/youwant --render '.' tiddlers.json text/plain '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]''

Is this correct?

Hi @atronoush the shell command line processor parses the command line into individual tokens. The rules for doing so are quite complex, and often shell-specific, but the important thing is that the command line is parsed into a list of tokens. In JavaScript terms, Node.js gives us an array of the tokens that were provided at startup. That’s why commands sequences are represented in tiddlywiki.info as arrays of individual tokens.

Thank you @jeremyruston
Is the order of arguments is important here? For example: Can I write below command

            "--render",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",

also like below

            "--render",
            "static.html",            
            "text/plain",
            "$:/core/templates/static.template.html",
            

My confusion is how to write a command and several commands with together.

I would write a command line like this:

tiddlywiki path/to/wiki/source/folder --output path/to/public/wiki --render $:/plugins/tiddlywiki/tiddlyweb/save/offline index.html text/plain

Note that I’m not using quotation marks anywhere in there. I would if there were embedded spaces in any of the arguments. And they shouldn’t hurt if you do use them.

This is a sequence of two commands, each starting with a ---prefixed command name, and followed by some number of arguments.

So it breaks down into these two commands:

--output path/to/public/wiki
--render $:/plugins/tiddlywiki/tiddlyweb/save/offline index.html text/plain

The output command is passed a single argument, the string path/to/public/wiki, then the render command is passed the three string arguments $:/plugins/tiddlywiki/tiddlyweb/save/offline, index.html, and text/plain.

Note that these are stored in a JSON format inside tiddlywiki.info. That is where the commas and quotation marks come from. Tiddlywiki will use the JS data extracted from that JSON to build a shell command.

1 Like