File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,22 @@ def generate_string(self, template=None):
2222 else :
2323 text = random .choice (self .templates )
2424
25- # replace static variables in the template with provided values
25+ # replace static tags in the template with provided values
26+
27+ # eg: if the template contains the tag {age} and you provide the variable age when creating the textgen,
28+ # instances of {age} will be replaced with the variable provided before the random stage
2629 if self .variables :
2730 for key , value in self .variables .items ():
2831 text = text .replace ("{%s}" % key , value )
2932
3033 # get a list of all text parts we need
3134 required_parts = TEMPLATE_RE .findall (text )
35+
36+ # TODO: replace the simple logic here with a system that can allow multiple instances of the
37+ # same tag to be handled
38+
39+ # eg: if there are two instances of the tag {example} in the template, each one should be
40+ # replaced with a random part instead of both getting the same part
3241
3342 for required_part in required_parts :
3443 ppart = self .parts [required_part ]
You can’t perform that action at this time.
0 commit comments