mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 07:27:17 +02:00
Fix profunc parse and html tabs. Resolve #2246
This commit is contained in:
parent
dfbdd3544f
commit
6d73605813
3 changed files with 12 additions and 9 deletions
|
|
@ -929,7 +929,10 @@ def init_spawn_value(value, validator=None):
|
|||
value = validator(value[0](*make_iter(args)))
|
||||
else:
|
||||
value = validator(value)
|
||||
return protfunc_parser(value)
|
||||
result = protfunc_parser(value)
|
||||
if result != value:
|
||||
return validator(result)
|
||||
return result
|
||||
|
||||
|
||||
def value_to_obj_or_any(value):
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class TestText2Html(TestCase):
|
|||
"tab": "\t",
|
||||
"space": "",
|
||||
}
|
||||
self.assertEqual(" ", parser.sub_text(mocked_match))
|
||||
self.assertEqual(" ", parser.sub_text(mocked_match))
|
||||
|
||||
mocked_match.groupdict.return_value = {
|
||||
"htmlchars": "",
|
||||
|
|
@ -165,7 +165,7 @@ class TestText2Html(TestCase):
|
|||
"space": " ",
|
||||
"spacestart": " ",
|
||||
}
|
||||
self.assertEqual(" ",
|
||||
self.assertEqual(" ",
|
||||
parser.sub_text(mocked_match))
|
||||
|
||||
mocked_match.groupdict.return_value = {
|
||||
|
|
@ -182,16 +182,16 @@ class TestText2Html(TestCase):
|
|||
parser = text2html.HTML_PARSER
|
||||
parser.tabstop = 4
|
||||
# single tab
|
||||
self.assertEqual(parser.parse("foo|-foo"),
|
||||
"foo foo")
|
||||
self.assertEqual(parser.parse("foo|>foo"),
|
||||
"foo foo")
|
||||
|
||||
# space and tab
|
||||
self.assertEqual(parser.parse("foo |-foo"),
|
||||
self.assertEqual(parser.parse("foo |>foo"),
|
||||
"foo foo")
|
||||
|
||||
# space, tab, space
|
||||
self.assertEqual(parser.parse("foo |- foo"),
|
||||
"foo foo")
|
||||
self.assertEqual(parser.parse("foo |> foo"),
|
||||
"foo foo")
|
||||
|
||||
def test_parse_space_to_html(self):
|
||||
"""test space parsing - a single space should be kept, two or more
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ class TextToHTMLparser(object):
|
|||
elif cdict["lineend"]:
|
||||
return "<br>"
|
||||
elif cdict["tab"]:
|
||||
text = cdict["tab"].replace("\t", "<span class=\"tabspace\">	</span>")
|
||||
text = cdict["tab"].replace("\t", " " + " " * (self.tabstop - 1))
|
||||
return text
|
||||
elif cdict["space"] or cdict["spacestart"]:
|
||||
text = cdict["space"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue