Open stellamazeika opened 9 years ago
The example at the top of the README now works:
{
"name": ["Arjun","Yuuma","Darcy","Mia","Chiaki","Izzi","Azra","Lina"],
"animal": ["unicorn","raven","sparrow","scorpion","coyote","eagle","owl","lizard","zebra","duck","kitten"],
"mood": ["vexed","indignant","impassioned","wistful","astute","courteous"],
"story": ["#hero# traveled with her pet #heroPet#. #hero# was never #mood#, for the #heroPet# was always too #mood#."],
"origin": ["#[hero:#name#][heroPet:#animal#]story#"]
}
I've created PR https://github.com/galaxykate/tracery/pull/27 to add quotes around the symbols in the examples at the end of the README.
There are two major problems with the code as written:
First, there is no "animal" symbol in the grammar. Second, tracery errors out if one leaves a symbol unpopped at the end of its expansion.
(ie, instead of the current Origin symbol:
"origin" : ["[mainCharacter:#name# the #animal.capitalize#][destination:#place#]#story#[mainCharacter:pop]"
we need to have:
"origin" : ["[mainCharacter:#name# the #animal.capitalize#][destination:#place#]#story#[mainCharacter:pop][destination:pop]"
The other solution would be allow the current format to exist without erroring out - or a way of just saying "pop all of the things that have been pushed")