From 252308c3a8c6be7354f2e38126bcbb3d02a9bb26 Mon Sep 17 00:00:00 2001 From: Nick Bensema Date: Fri, 29 Jan 2016 14:08:10 -0700 Subject: [PATCH 1/2] changeMessage() is now a context-free grammar This allows other string patterns to be added easily, for example replacing "the" with a choice of other modifiers. Also, the random percentage case is calculated each time it is needed, instead of once when the page loads. New tags should be added to the grammar object. The key should be a word, and the value should be a list of strings, some of which may contain other keys in the grammar. Be careful; there is no check for infinite recursion. Also, if the same tag appears twice at any stage of processing, both tags will be replaced with the same choice. --- index.html | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 014d4a4..bf61333 100644 --- a/index.html +++ b/index.html @@ -5,15 +5,28 @@