Преглед изворни кода

support equal sign in unquoted props string (fixes #3193)

Falko Schindler пре 11 месеци
родитељ
комит
be3803bd12
2 измењених фајлова са 2 додато и 1 уклоњено
  1. 1 1
      nicegui/element.py
  2. 1 0
      tests/test_element.py

+ 1 - 1
nicegui/element.py

@@ -42,7 +42,7 @@ PROPS_PATTERN = re.compile(r'''
             '       # Match the closing quote
         )
         |           # Or
-        ([\w\-.,%:\/]+)  # Capture group 4: Value without quotes
+        ([\w\-.,%:\/=]+)  # Capture group 4: Value without quotes
     )
 )?                  # End of optional non-capturing group for value
 (?:$|\s)            # Match end of string or whitespace

+ 1 - 0
tests/test_element.py

@@ -64,6 +64,7 @@ def test_props_parsing():
     assert ui.element._parse_props("""foo="single '" bar='double \\"'""") == {'foo': "single '", 'bar': 'double "'}
     assert ui.element._parse_props("input-style='{ color: #ff0000 }'") == {'input-style': '{ color: #ff0000 }'}
     assert ui.element._parse_props("""input-style='{ myquote: "quote" }'""") == {'input-style': '{ myquote: "quote" }'}
+    assert ui.element._parse_props('filename=foo=bar.txt') == {'filename': 'foo=bar.txt'}
 
 
 def test_style(screen: Screen):