Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 240205 Details for
Bug 428700
html content in .php files is not styled properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch #2
phpFix.patch (text/plain), 7.32 KB, created by
Grant Gayed
on 2014-02-21 10:41:48 EST
(
hide
)
Description:
patch #2
Filename:
MIME Type:
Creator:
Grant Gayed
Created:
2014-02-21 10:41:48 EST
Size:
7.32 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_html/syntax.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_html/syntax.js >index 811d132..9292050 100644 >--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_html/syntax.js >+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_html/syntax.js >@@ -46,42 +46,6 @@ > include: "orion.js" > } > ] >- }, { >- begin: "(?i)<script\\s.*?(?:language\\s*=\\s*(['\"])php\\1|type\\s*=\\s*(['\"])text/x-php\\2).*?>", >- end: "(?i)</script>", >- captures: { >- 0: {name: "entity.name.tag.html"} >- }, >- contentName: "source.php.embedded.html", >- patterns: [ >- { >- include: "orion.php" >- } >- ] >- }, { >- begin: "(?i)<\\?(?:=|php)?(?:\\s|$)", >- end: "\\?>", >- captures: { >- 0: {name: "entity.name.declaration.php"} >- }, >- contentName: "source.php.embedded.html", >- patterns: [ >- { >- include: "orion.php" >- } >- ] >- }, { >- begin: "<%=?(?:\\s|$)", >- end: "%>", >- captures: { >- 0: {name: "entity.name.declaration.php"} >- }, >- contentName: "source.php.embedded.html", >- patterns: [ >- { >- include: "orion.php" >- } >- ] > } > ], > repository: { >diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_x-php/syntax.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_x-php/syntax.js >index 46f15d1..450be7d 100644 >--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_x-php/syntax.js >+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_x-php/syntax.js >@@ -44,37 +44,43 @@ > contentTypes: ["text/x-php"], > patterns: [ > { >- include: "orion.lib#doc_block" >+ include: "orion.html" > }, { >- include: "orion.c-like" >- }, { >- match: "(?i)<\\?(?:=|php)?(?:\\s|$)", >- name: "entity.name.declaration.php", >- }, { >- match: "<%=?(?:\\s|$)", >- name: "entity.name.declaration.php", >- }, { >- match: "#.*", >- name: "comment.line.number-sign.php", >+ begin: "(?i)<(\\?|%(?!php))(?:=|php)?(?:\\s|$)", >+ end: "[\\1]>", >+ captures: { >+ 0: {name: "entity.name.declaration.php"} >+ }, >+ contentName: "source.php.embedded", > patterns: [ > { >- include: "orion.lib#todo_comment_singleLine" >+ include: "orion.lib#doc_block" >+ }, { >+ include: "orion.c-like" >+ }, { >+ match: "\\b0[bB][01]+\\b", >+ name: "constant.numeric.binary.php" >+ }, { >+ match: "#.*", >+ name: "comment.line.number-sign.php", >+ patterns: [ >+ { >+ include: "orion.lib#todo_comment_singleLine" >+ } >+ ] >+ }, { >+ begin: "<<<(\\w+)$", >+ end: "^\\1;$", >+ name: "string.unquoted.heredoc.php" >+ }, { >+ begin: "<<<'(\\w+)'$", >+ end: "^\\1;$", >+ name: "string.unquoted.heredoc.nowdoc.php" >+ }, { >+ match: "\\b(?:" + keywords.join("|") + ")\\b", >+ name: "keyword.control.php" > } > ] >- }, { >- begin: "<<<(\\w+)$", >- end: "^\\1;$", >- name: "string.unquoted.heredoc.php" >- }, { >- begin: "<<<'(\\w+)'$", >- end: "^\\1;$", >- name: "string.unquoted.heredoc.nowdoc.php" >- }, { >- match: "\\b0[bB][01]+\\b", >- name: "constant.numeric.binary.php" >- }, { >- match: "\\b(?:" + keywords.join("|") + ")\\b", >- name: "keyword.control.php" > } > ] > }); >diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textStyler.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textStyler.js >index 1f8a433..48e2f4d 100644 >--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textStyler.js >+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textStyler.js >@@ -33,8 +33,9 @@ > > var eolRegex = /$/; > var captureReferenceRegex = /\\(\d)/g; >+ var ignoreCaseRegex = /^\(\?i\)\s*/; > var linebreakRegex = /(.*)(?:[\r\n]|$)/g; >- var spacePattern = {regex: / /g, style: {styleClass: "punctuation separator space", unmergeable: true}}; //$NON-NLS-0$ >+ var spacePattern = {regex: /[ ]/g, style: {styleClass: "punctuation separator space", unmergeable: true}}; //$NON-NLS-0$ > var tabPattern = {regex: /\t/g, style: {styleClass: "punctuation separator tab", unmergeable: true}}; //$NON-NLS-0$ > > var _findMatch = function(regex, text, startIndex, testBeforeMatch) { >@@ -297,10 +298,6 @@ > var contentStart = current.result.index; > var resultEnd = null; > >- /* >- * If the end match contains a capture reference (eg.- "\1") then update >- * its regex with the resolved capture values from the begin match. >- */ > var endRegex = current.pattern.regexEnd; > if (!endRegex) { > resultEnd = new Block( >@@ -316,7 +313,26 @@ > block); > } else { > contentStart += current.result[0].length; >- endRegex = substituteCaptureValues(endRegex, current.result); >+ var testPattern = current.pattern; >+ /* >+ * If the end regex contains a capture reference (eg.- "\1") then substitute >+ * the resolved capture values from the begin match. >+ */ >+ var resolvedEndRegex = substituteCaptureValues(endRegex, current.result); >+ if (resolvedEndRegex !== endRegex) { >+ /* >+ * A substitution was made, so make a copy of the test pattern and set its >+ * end regex to the resolved one. This will cause end-match detection to be >+ * performed with this concrete end regex value, but the original pattern >+ * definition containing the capture reference will not be affected. >+ */ >+ testPattern = { >+ pattern: testPattern.pattern, >+ regexBegin: testPattern.regexBegin, >+ regexEnd: resolvedEndRegex >+ }; >+ endRegex = resolvedEndRegex; >+ } > > var lastIndex = contentStart; > while (!resultEnd) { >@@ -333,7 +349,7 @@ > contentStart: offset + contentStart, > contentEnd: offset + result.index > }, >- current.pattern, >+ testPattern, > block.getStyler(), > model, > block); >@@ -390,18 +406,19 @@ > getPatterns: function(pattern) { > var parentId; > if (!pattern) { >- parentId = this._rootId; >+ parentId = this._rootId + "#" + this._NO_ID; > } else { > if (typeof(pattern) === "string") { //$NON-NLS-0$ > parentId = pattern; > } else { > parentId = pattern.qualifiedId; > } >+ parentId += "#"; > } > /* indexes on patterns are used to break ties when multiple patterns match the same start text */ > var indexCounter = [0]; > var resultObject = {}; >- var regEx = new RegExp("^" + parentId + "#[^#]+$"); //$NON-NLS-0$ >+ var regEx = new RegExp("^" + parentId + "[^#]+$"); //$NON-NLS-0$ > var includes = []; > this._patterns.forEach(function(current) { > if (regEx.test(current.qualifiedId)) { >@@ -598,7 +615,7 @@ > _initPatterns: function() { > var patterns = this.getPatternManager().getPatterns(this.pattern ? this.pattern.pattern : null); > var processIgnore = function(matchString) { >- var result = /^\(\?i\)\s*/.exec(matchString); >+ var result = ignoreCaseRegex.exec(matchString); > if (result) { > matchString = matchString.substring(result[0].length); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 428700
:
240178
| 240205