diff --git a/flight/template/View.php b/flight/template/View.php index e3f8993..10a55b2 100644 --- a/flight/template/View.php +++ b/flight/template/View.php @@ -173,7 +173,7 @@ class View } preg_match_all( - "/<$this->componentPrefix-(?[a-z-]+)\s*(?([a-z]+=\"[a-zA-Z]+\"\s*)*)?\s*\/>/", + "/<$this->componentPrefix-(?[a-z-]+)\s*(?([a-z]+=\"[^\"]+\"\s*)*)?\s*\/>/", $view, $tagsMatches, ); @@ -186,7 +186,7 @@ class View $props = $tagsMatches['props'][$tagIndex] ?? ''; preg_match_all( - '/(?[a-z]+)="(?[a-zA-Z]+)"/', + '/(?[a-z]+)="(?[^"]+)"/', $props, $propsMatches, ); diff --git a/tests/ViewTest.php b/tests/ViewTest.php index 34ee4d1..39c4a6f 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -377,6 +377,13 @@ class ViewTest extends TestCase my-class-component html, ], + [ + 'page-with-component-with-prop-which-value-contains-spaces-and-numbers', + <<<'html' +

Hello, Constantine 1st the Great

+ html, + ['name' => 'Constantine 1st the Great'], + ], ]; } diff --git a/tests/views/pages/page-with-component-with-prop-which-value-contains-spaces-and-numbers.php b/tests/views/pages/page-with-component-with-prop-which-value-contains-spaces-and-numbers.php new file mode 100644 index 0000000..622b833 --- /dev/null +++ b/tests/views/pages/page-with-component-with-prop-which-value-contains-spaces-and-numbers.php @@ -0,0 +1 @@ + \ No newline at end of file