Allow multi-character keys for EvForm cells and tables. This was due to a too restrictive regex. Resolves #1014.

This commit is contained in:
Griatch 2016-08-20 11:41:53 +02:00
parent 1da9217a18
commit 49087b50d1
3 changed files with 4 additions and 5 deletions

View file

@ -1145,7 +1145,6 @@ class ContribRPObject(DefaultObject):
if searchdata.lower() in ("me", "self",): if searchdata.lower() in ("me", "self",):
return [self] if quiet else self return [self] if quiet else self
if use_nicks: if use_nicks:
# do nick-replacement on search # do nick-replacement on search
searchdata = self.nicks.nickreplace(searchdata, categories=("object", "player"), include_player=True) searchdata = self.nicks.nickreplace(searchdata, categories=("object", "player"), include_player=True)

View file

@ -232,8 +232,8 @@ class EvForm(object):
table_coords = {} table_coords = {}
# Locate the identifier tags and the horizontal end coords for all forms # Locate the identifier tags and the horizontal end coords for all forms
re_cellchar = re.compile(r"%s+([^%s%s])%s+" % (cellchar, INVALID_FORMCHARS, cellchar, cellchar)) re_cellchar = re.compile(r"%s+([^%s%s]+)%s+" % (cellchar, INVALID_FORMCHARS, cellchar, cellchar))
re_tablechar = re.compile(r"%s+([^%s%s|])%s+" % (tablechar, INVALID_FORMCHARS, tablechar, tablechar)) re_tablechar = re.compile(r"%s+([^%s%s|+])%s+" % (tablechar, INVALID_FORMCHARS, tablechar, tablechar))
for iy, line in enumerate(_to_ansi(form, regexable=True)): for iy, line in enumerate(_to_ansi(form, regexable=True)):
# find cells # find cells
ix0 = 0 ix0 = 0
@ -429,7 +429,7 @@ def _test():
form = EvForm("evennia.utils.evform_test") form = EvForm("evennia.utils.evform_test")
# add data to each tagged form cell # add data to each tagged form cell
form.map(cells={1: "|gTom the Bouncer", form.map(cells={"AA": "|gTom the Bouncer",
2: "|yGriatch", 2: "|yGriatch",
3: "A sturdy fellow", 3: "A sturdy fellow",
4: 12, 4: 12,

View file

@ -9,7 +9,7 @@ TABLECHAR = "c"
FORM = """ FORM = """
.------------------------------------------------. .------------------------------------------------.
| | | |
| Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx | | Name: xxxxxAAxxxx Player: xxxxxxx2xxxxxxx |
| xxxxxxxxxxx | | xxxxxxxxxxx |
| | | |
>----------------------------------------------< >----------------------------------------------<