Menu

#1320 LexHTML: Only color unknown tag name with SCE_H_TAGUNKNOWN style

Committed
closed
5
2019-12-07
2019-10-28
Zufu Liu
No

Current code try to color entire tag and attributes with SCE_H_TAGUNKNOWN, which will fails with some characters in attribute value.
See the screenshots, I think current behavior it's ugly, characters after space is not part of tag name.

<html>
<baz src="images/test-1.png" id="foo">
</baz>
<baz src="images/test.png" id="bar">
</baz>
</html>
2 Attachments

Related

Feature Requests: #1299

Discussion

  • Neil Hodgson

    Neil Hodgson - 2019-10-29

    This should be fixed to, at least, ignore the '/' if not followed by '>'.

    Styling the entire tag as bad is fine as it makes mistakes more obvious although some users may have a different preference.

     
  • Neil Hodgson

    Neil Hodgson - 2019-10-30

    Using the above example text, the first baz line doesn't look like the image in SciTE. The entire tag is red just like the second baz. The ending code is triggered by the sequence '/>', not '/' by itself.

     
    • Zufu Liu

      Zufu Liu - 2019-10-30

      I will check it again, the top image is made by Version 4.2.1 Oct 25 2019 14:26:14. It indeed not occurs in Version 4.2.1 Oct 28 2019 18:58:55.

       
  • Zufu Liu

    Zufu Liu - 2019-10-30

    It still has bug for !:

    <html>
    <baz src="images/!test-1.png" id="foo">
    </baz>
    <baz src="images/test.png" id="bar">
    </baz>
    </html>
    
     
  • Neil Hodgson

    Neil Hodgson - 2019-11-01
    • labels: lexer --> lexer, html
    • Group: Completed --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2019-11-01

    Fixed with [5f4c6b] by not moving on start of tag when state not changing from SCE_H_TAGUNKNOWN.

     

    Related

    Commit: [5f4c6b]

  • Zufu Liu

    Zufu Liu - 2019-11-02

    Add option to only color tag name as unknown still helps, especially when viewing embedded SVG or MathML in HTML.
    It's rare for application to bundle these elements/attributes with HTML lexer.

     
  • Zufu Liu

    Zufu Liu - 2019-11-02

    A property "html.unknown.tag.only.name" is added, the last change is added after if (eClass != SCE_H_TAGUNKNOWN) {. The property name and description need improved in some way.

    There seems have two bugs in lexicalClassesHTML and lexicalClassesXML, SCE_H_ERRORTAGUNKNOWN and SCE_H_ERRORATTRIBUTEUNKNOWN are not defined in Scintilla.iface, instead SCE_H_TAGUNKNOWN and SCE_H_ATTRIBUTEUNKNOWN are defined.
    Possible a script need added to check these inconsistents.

     
  • Zufu Liu

    Zufu Liu - 2019-11-15

    Seems [5f4c6b] is conflict with [feature-requests:#1299]: the whole string before id attribute been treated as tag, so first and second been colored as custom tag.

     

    Related

    Feature Requests: #1299
    Commit: [5f4c6b]

    • Neil Hodgson

      Neil Hodgson - 2019-11-15

      Probably safest to revert [feature-requests:#1299] as it hasn't yet been included in a release.

       

      Related

      Feature Requests: #1299

  • Zufu Liu

    Zufu Liu - 2019-11-16

    Updated classifyTagHTML() to ignore characters after space.

     
  • Neil Hodgson

    Neil Hodgson - 2019-11-16

    Committed as [6e109a].

     

    Related

    Commit: [6e109a]

  • Neil Hodgson

    Neil Hodgson - 2019-12-07
    • status: open --> closed
     

Log in to post a comment.