diff --git a/src/language/html.js b/src/language/html.js index 8aba431c..e3600408 100644 --- a/src/language/html.js +++ b/src/language/html.js @@ -7,11 +7,13 @@ Rainbow.extend('html', [ { name: 'source.php.embedded', matches: { + 1: 'variable.language.php-tag', 2: { language: 'php' - } + }, + 3: 'variable.language.php-tag' }, - pattern: /<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/gm + pattern: /(<\?php|<\?=?(?!xml))([\s\S]*?)(\?>)/gm }, { name: 'source.css.embedded', diff --git a/test/language/html-test.js b/test/language/html-test.js index 692af34f..748108bc 100644 --- a/test/language/html-test.js +++ b/test/language/html-test.js @@ -58,9 +58,9 @@ describe(language, () => { `, `<ul class="articles"> - <?php foreach ($articles as $article): ?> - <li><?php echo $article->title; ?></li> - <?php endforeach; ?> + <?php foreach ($articles as $article): ?> + <li><?php echo $article->title; ?></li> + <?php endforeach; ?> </ul>` ); @@ -73,9 +73,9 @@ describe(language, () => {

<?= $user->getBio() ?>

<? endforeach ?>`, - `<? foreach ($users as $key => $user): ?> - <p><?= $user->getBio() ?></p> - <? endforeach ?>` + `<? foreach ($users as $key => $user): ?> + <p><?= $user->getBio() ?></p> + <? endforeach ?>` ); run(