Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 484353

Summary: Non HTML tags rendering
Product: [ECD] Orion Reporter: Alain COUTHURES <alain.couthures>
Component: EditorAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: curtis.windatt.public, grant_gayed
Version: 10.0   
Target Milestone: 11.0   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Alain COUTHURES CLA 2015-12-14 13:42:42 EST
Non HTML tags are not fully colored in HTML and XML editors. The built-in editor might have the same issue (not tested) because it is using this regular expression to match the beginning of tags: "</?[A-Za-z0-9]+".
SVG tags might be embedded within an HTML page and they require a richer regular expression because of elements being named, for example, "svg:font-face".
More generally, XML 1.0 tags support also characters such as ".", "_".
A perfect regular expression for XML is quite huge because of Unicode but a commonly used regular expression is "[A-Za-z._:][A-Za-z0-9._:]*" even if ":" should just occur once...
So, you could upgrade your own regular expression to "</?[A-Za-z._:][A-Za-z0-9._:]*".
What do you think?
Thanks!
Comment 1 Curtis Windatt CLA 2015-12-17 16:10:04 EST
Can you provide some examples of HTML that isn't displayed correctly?  I grabbed some SVG examples and none used non-alphanumeric characters in element tags.  If I put in . or : into tags, the tooling still works and while the coloring changes before and after the period, it looks good, quite readable.

Your change makes sense, I just want some real world examples to test on.
Comment 2 Alain COUTHURES CLA 2015-12-21 16:00:34 EST
Are Mozilla MDN docs valid examples for you? Please have a look at https://developer.mozilla.org/en/docs/Web/SVG/Tutorial/SVG_fonts

BTW, the commonly used regexp does not support '-' in names even if it's valid. So, the regexp should better be "</?[A-Za-z._:][A-Za-z0-9\-._:]*".

Thanks!
Comment 3 Curtis Windatt CLA 2016-01-13 14:30:39 EST
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=2e3425240b91933d077996aa511c2dfe39fb7743
Fixed the XML styles, added xml style test, improve styler tests

HTML tag names are not spec'd to use the other characters, so I did not modify the styles.
https://www.w3.org/TR/html-markup/syntax.html#tag-name

XML does support the other characters so I modified the style
https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn

I created a test for xml syntax checking.  To make it easier to create tests for the styler in the future I improved the output, cleaned up warnings, etc.