mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Make rpsystem contrib not detect /sdesc in urls. Resolves #3070
This commit is contained in:
parent
0e71e00fae
commit
e47c69dc24
2 changed files with 12 additions and 11 deletions
|
|
@ -154,18 +154,12 @@ from string import punctuation
|
|||
|
||||
import inflect
|
||||
from django.conf import settings
|
||||
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.command import Command
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.objects.objects import DefaultCharacter, DefaultObject
|
||||
from evennia.utils import ansi, logger
|
||||
from evennia.utils.utils import (
|
||||
iter_to_str,
|
||||
lazy_property,
|
||||
make_iter,
|
||||
variable_from_module,
|
||||
)
|
||||
from evennia.utils.utils import iter_to_str, lazy_property, make_iter, variable_from_module
|
||||
|
||||
_INFLECT = inflect.engine()
|
||||
|
||||
|
|
@ -203,7 +197,8 @@ _RE_PREFIX = re.compile(rf"^{_PREFIX}", re.UNICODE)
|
|||
# separate multimatches from one another and word is the first word in the
|
||||
# marker. So entering "/tall man" will return groups ("", "tall")
|
||||
# and "/2-tall man" will return groups ("2", "tall").
|
||||
_RE_OBJ_REF_START = re.compile(rf"{_PREFIX}(?:([0-9]+){_NUM_SEP})*(\w+)", _RE_FLAGS)
|
||||
# the negative lookbehind for [:/] is to avoid http:// urls being detected as a /sdesc
|
||||
_RE_OBJ_REF_START = re.compile(rf"(?<![:/]){_PREFIX}(?:([0-9]+){_NUM_SEP})*(\w+)", _RE_FLAGS)
|
||||
|
||||
_RE_LEFT_BRACKETS = re.compile(r"\{+", _RE_FLAGS)
|
||||
_RE_RIGHT_BRACKETS = re.compile(r"\}+", _RE_FLAGS)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ Tests for RP system
|
|||
import time
|
||||
|
||||
from anything import Anything
|
||||
|
||||
from evennia import create_object
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
|
|
@ -79,7 +78,8 @@ class TestLanguage(BaseEvenniaTest):
|
|||
def test_obfuscate_whisper(self):
|
||||
self.assertEqual(rplanguage.obfuscate_whisper(text, level=0.0), text)
|
||||
assert rplanguage.obfuscate_whisper(text, level=0.1).startswith(
|
||||
"-utom-t-d t-sting is -dv-nt-g-ous for - numb-r of r--sons: t-sts m-y b- -x-cut-d Continuously"
|
||||
"-utom-t-d t-sting is -dv-nt-g-ous for - numb-r of r--sons: t-sts m-y b- -x-cut-d"
|
||||
" Continuously"
|
||||
)
|
||||
assert rplanguage.obfuscate_whisper(text, level=0.5).startswith(
|
||||
"--------- --s---- -s -----------s f-- - ------ -f ---s--s: --s-s "
|
||||
|
|
@ -277,7 +277,8 @@ class TestRPSystem(BaseEvenniaTest):
|
|||
)
|
||||
self.assertEqual(
|
||||
self.out2[0],
|
||||
"|bA nice sender of emotes|n is distracted from |bthe first receiver of emotes.|n by something.",
|
||||
"|bA nice sender of emotes|n is distracted from |bthe first receiver of emotes.|n by"
|
||||
" something.",
|
||||
)
|
||||
|
||||
def test_send_case_sensitive_emote(self):
|
||||
|
|
@ -340,6 +341,11 @@ class TestRPSystemCommands(BaseEvenniaCommandTest):
|
|||
)
|
||||
self.call(rpsystem.CmdSay(), "Hello!", 'Char says, "Hello!"')
|
||||
self.call(rpsystem.CmdEmote(), "/me smiles to /BarFoo.", "Char smiles to BarFoo Character")
|
||||
|
||||
# escape urls in say
|
||||
self.call(rpsystem.CmdSay(), "https://evennia.com", 'Char says, "https://evennia.com"')
|
||||
self.call(rpsystem.CmdSay(), "http://evennia.com", 'Char says, "http://evennia.com"')
|
||||
|
||||
self.call(
|
||||
rpsystem.CmdPose(),
|
||||
"stands by the bar",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue