WsInject

Injects a Whitespace program into some other file, replacing its white space with Whitespace code.

The output can (in some cases) fulfill the job of both the original file and the Whitespace program.

Usage

java WsInject myprog.ws mydoc.html >myprogdoc.html

...or, if you use the scripts in the bin directory...

wsi myprog.ws mydoc.html >myprogdoc.html

This will replace the white space in mydoc.html with the Whitespace from myprog.ws, redirecting the output to myprogdoc.html which will then be a copy of the original program, and also identical to the original HTML document.

The original files are unchanged. The injection result is written to stdout.

Works best for files where white space is not significant, for example, some HTML files, or code in curly bracket languages. However, it's still likely to fail in many cases. HTML <pre> blocks will get messed up. Code that relies on line breaks (e.g. // comments) will get messed up. Python code stands no chance.

Reprocessing

If you have injected Whitespace into, say, an HTML file, and you need to update that file's content, don't worry about breaking the Whitespace code. You can alway re-inject it after editing the HTML.

Purposes

Example

This page, if executed as Whitespace, should output a short series of Fibonacci numbers.

It's the same code example given elsewhere as Whitespace and assembler.