robbestad / Rantjs

Procedurally generate text with JavaScript
220 stars 10 forks source link

Incorrect block behavior #4

Closed TheBerkin closed 3 years ago

TheBerkin commented 9 years ago

I started playing around with your online demo and wanted to point out a few important block features that I noticed were missing.

Plain text in blocks does not work.

First, I tried creating a block with some normal text in it. screenshot It doesn't appear to print anything. According to the original specification, it should print the same text as if it weren't in the block:

Example text

Repeaters don't work with plain text.

Calling rep followed by a block containing a raw string prints nothing, no matter how many repetitions are specified. It seems to only work with a single query. If rep is not called, a block is ignored. screenshot

If a block has no repetitions specified, it should always be assumed that the block will be read one time.

Blocks do not appear to support multiple elements.

Since blocks currently only support lone queries, I decided to test multiple item selection. This doesn't appear to be supported yet, either. screenshot Each repetition should randomly select a noun, adjective, or verb.


I understand that Rantjs is still in early development, and perhaps you were already planning to fix these things, but I thought I'd write this up just in case you missed any of them by mistake.

A friend of mine recently rewrote all of the Rant documentation. You can find it here. If your aim is to go with the original language spec, you might find it useful as a reference.

robbestad commented 9 years ago

Thanks for taking the time to look into this and report it with very clear examples. Blocks are only partly implemented, so I'll focus on implementing it fully moving on. I really like the new concise documentation (thumbs up to your friend), so I'll pin this and use it for reference!