Skip to content

Commit

Permalink
Fix mismatched PHP close tag inside string in XML source (#1656)
Browse files Browse the repository at this point in the history
* Fix mismatched PHP close tag inside string in XML

* Fix dropping out of PHP sublanguage inside XML

* Fix ghost XML strings for each string in PHP block

* Simplify PHP string skipping for XML source

* Fix PHP strings backslash escape inside XML
  • Loading branch information
brunophilipe authored and marcoscaceres committed Sep 2, 2018
1 parent 0f6f3df commit 59f4a85
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/languages/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ function(hljs) {
{
begin: /<\?(php)?/, end: /\?>/,
subLanguage: 'php',
contains: [{begin: '/\\*', end: '\\*/', skip: true}]
contains: [
// We don't want the php closing tag ?> to close the PHP block when
// inside any of the following blocks:
{begin: '/\\*', end: '\\*/', skip: true},
{begin: 'b"', end: '"', skip: true},
{begin: 'b\'', end: '\'', skip: true},
hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null, className: null, contains: null, skip: true}),
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null, className: null, contains: null, skip: true})
]
},
{
className: 'tag',
Expand Down

0 comments on commit 59f4a85

Please sign in to comment.