Re: [code] [textadept] HTML lexer

From: Robert Gieseke <rob.g.att.web.de>
Date: Mon, 23 Dec 2013 17:20:50 +0100

Hi Mitchell,

Am 12/23/13, 3:15 AM, schrieb Mitchell:
>> Am 12/18/13, 6:48 AM, schrieb Mitchell:
>> There are some HTML5 tags that are currently missing, so I wondered
>> what the 'policy' is with deprecated tags and attributes. Should all
>> be supported/lexed? I'm happy to provide a patch …
>
> They should have their own "deprecated" token that perhaps could at
> least have its own style. Patches are good, thanks.
>

I don't know if it's worth the effort, I experimented with a
deprecated_elements list, but with attributes it gets quite complicated.
Deprecated in HTML4, removed in HTML5 …
Maybe it would be okay to just cover the current ones and let the user
decide if an unknown element/attribute is a typo or legacy code,
assuming new HTML file get written as HTML5?

My updated test file is at: https://gist.github.com/rgieseke/8088593

My changes to the lexer are at: https://gist.github.com/rgieseke/8099447
A diff can be seen at:
https://gist.github.com/rgieseke/8099447/revisions (Last update is just
fixing quotes…)

Changes:
- update element list from Mozilla Developer Network [1]
- update attribute list from MDN [2]
- removed X/HTML4 elements and attributes
- add support for data attributes with multiple hyphens
- add support for accessibility attributes (role, aria-)
- change attribute style to match the unknown attribute style (makes
attributes stand out more, matter of taste probably)
- fix embedding style/script tags (as discussed before)
- fix JavaScript spelling

Known issues/questions:
- I don't know if ':-' is still necessary in the attributes list if the
approach to only handle 'modern' items is chosen, this is probably for
xml stuff?
- boolean minimized attributes are currently not covered, due to
checking for an equal sign, for example <button disabled>.

Let me know if you prefer some other way.

Happy holidays!
Robert

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element
[2] https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 23 Dec 2013 - 11:20:50 EST

This archive was generated by hypermail 2.2.0 : Tue 24 Dec 2013 - 06:29:34 EST