Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
56 changes: 56 additions & 0 deletions Itemizers/HTML5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<itemizer>

<recipe name="ie-conditional.comment">
<class>ESCommentItem</class>
<selector>html.comment.conditional:has-child(conditional.start:has-child(condition:capture(name)))</selector>
<subrecipes>
<include-root-recipes/>
</subrecipes>
</recipe>

<recipe name="built-in.comment">
<class>ESCommentItem</class>
<selector>html.comment</selector>
</recipe>

<!--recipe name="built-in.group.collection">
<start-selector>itemize.group-start:has-child(name:capture(name)), itemize.group-start</start-selector>
<end-selector>itemize.group-end</end-selector>
<subrecipes>
<include-root-recipes/>
</subrecipes>
</recipe-->

<!-- Special case, because the option element can be self-closing when nested in the datalist element -->
<recipe name="built-in.html.tag.collection.datalist">
<start-selector>html.tag.open:has-child(name[text='datalist']:capture(name))</start-selector>
<end-selector>html.tag.close:has-child(name[text == $name.text])</end-selector>
<subrecipes>
<recipe name="built-in.self-closing-tag.option">
<selector>html.tag.open:has-child(name[text='option']:capture(name))</selector>
<class>ESXHTMLItem</class>
</recipe>
<include-root-recipes/>
</subrecipes>
<class>ESXHTMLItem</class>
</recipe>

<recipe name="built-in.html.tag.collection">
<start-selector>html.tag.open:has-child(name:capture(name))</start-selector>
<end-selector>html.tag.close:has-child(name[text == $name.text])</end-selector>
<subrecipes>
<include-root-recipes/>
</subrecipes>
<class>ESXHTMLItem</class>
</recipe>

<recipe name="built-in.self-closing-tag">
<selector>html.tag.open:has-child(name:capture(name), empty-element-marker), html.tag.self-closing:has-child(name:capture(name)), html.tag.open:has-child(name:capture(name), self-closing)</selector>
<class>ESXHTMLItem</class>
</recipe>

<library>
</library>

</itemizer>
11 changes: 11 additions & 0 deletions Languages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@
<version status="release">0.1</version>
<download format="git">git://github.com/minimalweb/HTML5.sugar.git</download>
</meta>
<language id="chh.html5.HTML">
<root-zone>language-root.html</root-zone>
<name>HTML5</name>
<detectors>
<extension>html</extension>
<extension>htm</extension>
<extension>shtml</extension>
<extension>shtm</extension>
<extension>xhtml</extension>
</detectors>
</language>
</settings>
317 changes: 317 additions & 0 deletions Syntaxes/HTML5Syntax.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
<?xml version="1.0"?>
<syntax name="language-root.html">
<zones>
<zone name="comment.block.html">
<starts-with>
<expression>&lt;!--</expression>
<capture number="0" name="punctuation.definition.begin"/>
</starts-with>
<ends-with>
<expression>--></expression>
<capture number="0" name="punctuation.definition.end"/>
</ends-with>
</zone>
<zone name="tag.doctype.html">
<starts-with>
<expression>(&lt;!)(?i:DOCTYPE)</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>></expression>
<capture number="0" name="punctuation.definition.end"/>
</ends-with>
</zone>
<zone name="embedded-style.html">
<starts-with>
<expression>(?=&lt;(?i:style))</expression>
</starts-with>
<ends-with>
<expression>(&lt;/)((?i:style))(>)</expression>
<capture number="0" name="tag.close.style.html"/>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
<capture number="3" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<zone name="tag.open.style.html">
<starts-with>
<expression>(&lt;)((?i:style))</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(/?)(>)</expression>
<capture number="1" name="punctuation.definition.self-closing"/>
<capture number="2" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<include collection="tag-attributes"/>
</subzones>
</zone>
<zone name="embedded.language-root.css">
<starts-with>
<expression>(?&lt;=>)\s*(&lt;!--)?</expression>
<capture number="1" name="comment.embedded"/>
</starts-with>
<ends-with>
<expression>(-->\s*)?(?=&lt;/(?i:style)>)</expression>
<capture number="1" name="comment.embedded"/>
</ends-with>
<subzones>
<include syntax="language-root.css"/>
</subzones>
</zone>
</subzones>
</zone>
<zone name="embedded-javascript.html">
<starts-with>
<expression>(?=&lt;(?i:script))</expression>
</starts-with>
<ends-with>
<expression>(&lt;/)((?i:script))(>)</expression>
<capture number="0" name="tag.close.script.html"/>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
<capture number="3" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<zone name="tag.open.script.html">
<starts-with>
<expression>(&lt;)((?i:script))</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(/?)(>)</expression>
<capture number="1" name="punctuation.definition.self-closing"/>
<capture number="2" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<include collection="tag-attributes"/>
</subzones>
</zone>
<zone name="embedded.language-root.js">
<starts-with>
<expression>(?&lt;=>)\s*(&lt;!--)?</expression>
<capture number="1" name="comment.embedded"/>
</starts-with>
<ends-with>
<expression>((?://)?\s*(?:-->|]]&gt;)\s*)?(?=&lt;/(?i:script)>)</expression>
<capture number="1" name="comment.embedded"/>
</ends-with>
<subzones>
<include syntax="language-root.js"/>
</subzones>
</zone>
<!--<include syntax="language-root.js"/>-->
</subzones>
</zone>
<include collection="tags" />
<include collection="entities"/>
</zones>
<library>
<collection name="tags">
<zone name="tag.open.block.html">
<starts-with>
<expression>(&lt;)(address|article|aside|audio|blockquote|body|canvas|caption|center|colgroup|dd|details|dir|div|dl|dt|embed|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hgroup|html|iframe|li|map|menu|noframes|noscript|object|ol|output|p|pre|progress|samp|section|table|tbody|td|textarea|tfoot|th|thead|title|tr|ul|video)\b</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(/?)(>)</expression>
<capture number="1" name="punctuation.definition.end.self-closing"/>
<capture number="2" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<include collection="tag-attributes"/>
</subzones>
</zone>
<zone name="tag.close.block.html">
<starts-with>
<expression>(&lt;/)(address|article|aside|audio|blockquote|body|canvas|caption|center|colgroup|dd|details|dir|div|dl|dt|embed|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hgroup|html|iframe|li|map|menu|noframes|noscript|object|ol|output|p|pre|progress|samp|section|table|tbody|td|textarea|tfoot|th|thead|title|tr|ul|video)\b</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(>)</expression>
<capture number="1" name="punctuation.definition.end"/>
</ends-with>
</zone>
<zone name="tag.open.inline.html">
<starts-with>
<expression>(&lt;)(a|abbr|acronym|big|cite|code|dfn|command|em|font|i|kbd|mark|meter|nav|q|s|small|span|strike|strong|sub|summary|sup|time|tt|u|var)\b</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(/?)(>)</expression>
<capture number="1" name="punctuation.definition.end.self-closing"/>
<capture number="2" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<include collection="tag-attributes"/>
</subzones>
</zone>
<zone name="tag.close.inline.html">
<starts-with>
<expression>(&lt;/)(a|abbr|acronym|big|cite|code|dfn|command|em|font|i|kbd|mark|meter|nav|q|s|small|span|strike|strong|sub|summary|sup|time|tt|u|var)\b</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(>)</expression>
<capture number="1" name="punctuation.definition.end"/>
</ends-with>
</zone>
<zone name="tag.open.self-closing.html">
<starts-with>
<expression>(&lt;)(base|img|br|link|meta|hr|input|command|col|wbr|source|track)</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(/?)(>)</expression>
<capture number="1" name="punctuation.definition.end.self-closing"/>
<capture number="2" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<include collection="tag-attributes"/>
</subzones>
</zone>
<zone name="tag.open.other.html">
<starts-with>
<expression>(&lt;)([a-zA-Z:_]+[a-zA-Z:_0-9.-]*)</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(/?)(>)</expression>
<capture number="1" name="punctuation.definition.end.self-closing"/>
<capture number="2" name="punctuation.definition.end"/>
</ends-with>
<subzones>
<include collection="tag-attributes"/>
</subzones>
</zone>
<zone name="tag.close.other.html">
<starts-with>
<expression>(&lt;/)([a-zA-Z:_]+[a-zA-Z:_0-9.-]*)</expression>
<capture number="1" name="punctuation.definition.begin"/>
<capture number="2" name="entity.name"/>
</starts-with>
<ends-with>
<expression>(>)</expression>
<capture number="1" name="punctuation.definition.end"/>
</ends-with>
</zone>
</collection>
<collection name="entities">
<zone>
<expression>((&amp;)(?:[a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;))|(&amp;)</expression>
<!-- &entity; -->
<capture number="1" name="constant.character.entity.html"/>
<capture number="2" name="punctuation.definition.entity.html"/>
<capture number="3" name="punctuation.definition.entity.html"/>
<!-- & -->
<capture number="4" name="invalid.illegal.bad-ampersand.html"/>
</zone>
</collection>
<collection name="tag-attributes">
<zone>
<!-- My own additions (C.H. Harvey 7/23/2013T03:30) -->
<expression>\s+(id)(=)((")([^"]*)(")|(')([^']*)('))|\s+(class)(=)((")([^"]*)(")|(')([^']*)('))</expression>
<!-- id attribute -->
<capture number="1" name="attribute-name.id"/>
<capture number="2" name="punctuation.separator.attribute"/>
<capture number="3" name="string.quoted"/>
<capture number="4" name="punctuation.definition.begin"/>
<capture number="5" name="attribute-value.id"/>
<capture number="6" name="punctuation.definition.end"/>
<!-- Single-quoted strings -->
<capture number="7" name="punctuation.definition.begin"/>
<capture number="8" name="attribute-value.id"/>
<capture number="9" name="punctuation.definition.end"/>
<!-- class attribute -->
<capture number="10" name="attribute-name.class"/>
<capture number="11" name="punctuation.separator.attribute"/>
<capture number="12" name="string.quoted"/>
<capture number="13" name="punctuation.definition.begin"/>
<capture number="14" name="attribute-value.class"/>
<capture number="15" name="punctuation.definition.end"/>
<!-- Single-quoted strings -->
<capture number="16" name="punctuation.definition.begin"/>
<capture number="17" name="attribute-value.class"/>
<capture number="18" name="punctuation.definition.end"/>
</zone>
<zone>
<expression>\s+(style)(=)((")([^"]*)(")|(')([^']*)('))|\s+(on[a-zA-Z]+)(=)((")(.*?)((?&lt;!\\)")|(')(.*?)((?&lt;!\\)'))|\s+([-_a-zA-Z0-9:]+)(=)</expression>
<!-- Embedded CSS -->
<capture number="1" name="attribute-name.style"/>
<capture number="2" name="punctuation.separator.attribute"/>
<capture number="3" name="string.quoted"/>
<capture number="4" name="punctuation.definition.begin"/>
<capture number="5" name="embedded.property-list.css">
<subzones>
<include syntax="language-root.css" collection="properties"/>
</subzones>
</capture>
<capture number="6" name="punctuation.definition.end"/>
<!-- Single-quoted strings -->
<capture number="7" name="punctuation.definition.begin"/>
<capture number="8" name="embedded.property-list.css">
<subzones>
<include syntax="language-root.css" collection="properties"/>
</subzones>
</capture>
<capture number="9" name="punctuation.definition.end"/>
<!-- Embedded JS -->
<capture number="10" name="attribute-name.js"/>
<capture number="11" name="punctuation.separator.attribute"/>
<capture number="12" name="string.quoted"/>
<capture number="13" name="punctuation.definition.begin"/>
<capture number="14" name="embedded.sourcecode.js">
<subzones>
<include syntax="language-root.js"/>
</subzones>
</capture>
<capture number="15" name="punctuation.definition.end"/>
<!-- Single-quoted strings -->
<capture number="16" name="punctuation.definition.begin"/>
<capture number="17" name="embedded.sourcecode.js">
<subzones>
<include syntax="language-root.js"/>
</subzones>
</capture>
<capture number="18" name="punctuation.definition.end"/>
<!-- Generic attributes -->
<capture number="19" name="attribute-name">
<subzones>
<zone>
<expression>([^:]+)(:)(.*)</expression>
<capture number="1" name="namespace"/>
<capture number="2" name="punctuation.separator"/>
<capture number="3" name="localname"/>
</zone>
</subzones>
</capture>
<capture number="20" name="punctuation.separator.attribute"/>
<capture number="21" name="punctuation.separator.namespace"/>
</zone>
<include collection="strings"/>
</collection>
<collection name="strings">
<zone name="attribute-value.string.quoted">
<starts-with>
<expression>("|')</expression>
<capture number="0" name="punctuation.definition.begin"/>
</starts-with>
<ends-with>
<expression>\1</expression>
<capture number="0" name="punctuation.definition.end"/>
</ends-with>
<subzones name="attribute-value.value" />
</zone>
</collection>
</library>
</syntax>