]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/haml.js
Initial commit.
[flow-web.git] / static / highlight / languages / haml.js
1 /*! `haml` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: HAML
8 Requires: ruby.js
9 Author: Dan Allen <dan.j.allen@gmail.com>
10 Website: http://haml.info
11 Category: template
12 */
13
14 // TODO support filter tags like :javascript, support inline HTML
15 function haml(hljs) {
16 return {
17 name: 'HAML',
18 case_insensitive: true,
19 contains: [
20 {
21 className: 'meta',
22 begin: '^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$',
23 relevance: 10
24 },
25 // FIXME these comments should be allowed to span indented lines
26 hljs.COMMENT(
27 '^\\s*(!=#|=#|-#|/).*$',
28 null,
29 { relevance: 0 }
30 ),
31 {
32 begin: '^\\s*(-|=|!=)(?!#)',
33 end: /$/,
34 subLanguage: 'ruby',
35 excludeBegin: true,
36 excludeEnd: true
37 },
38 {
39 className: 'tag',
40 begin: '^\\s*%',
41 contains: [
42 {
43 className: 'selector-tag',
44 begin: '\\w+'
45 },
46 {
47 className: 'selector-id',
48 begin: '#[\\w-]+'
49 },
50 {
51 className: 'selector-class',
52 begin: '\\.[\\w-]+'
53 },
54 {
55 begin: /\{\s*/,
56 end: /\s*\}/,
57 contains: [
58 {
59 begin: ':\\w+\\s*=>',
60 end: ',\\s+',
61 returnBegin: true,
62 endsWithParent: true,
63 contains: [
64 {
65 className: 'attr',
66 begin: ':\\w+'
67 },
68 hljs.APOS_STRING_MODE,
69 hljs.QUOTE_STRING_MODE,
70 {
71 begin: '\\w+',
72 relevance: 0
73 }
74 ]
75 }
76 ]
77 },
78 {
79 begin: '\\(\\s*',
80 end: '\\s*\\)',
81 excludeEnd: true,
82 contains: [
83 {
84 begin: '\\w+\\s*=',
85 end: '\\s+',
86 returnBegin: true,
87 endsWithParent: true,
88 contains: [
89 {
90 className: 'attr',
91 begin: '\\w+',
92 relevance: 0
93 },
94 hljs.APOS_STRING_MODE,
95 hljs.QUOTE_STRING_MODE,
96 {
97 begin: '\\w+',
98 relevance: 0
99 }
100 ]
101 }
102 ]
103 }
104 ]
105 },
106 { begin: '^\\s*[=~]\\s*' },
107 {
108 begin: /#\{/,
109 end: /\}/,
110 subLanguage: 'ruby',
111 excludeBegin: true,
112 excludeEnd: true
113 }
114 ]
115 };
116 }
117
118 return haml;
119
120 })();
121
122 hljs.registerLanguage('haml', hljsGrammar);
123 })();