-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemmetLite.min.js
163 lines (163 loc) · 7.77 KB
/
emmetLite.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* emmetLite v0.1 - emmet2html & html2emmet https://github.com/0-v-0/emmetLite */
var itags={
audio:"source",
colgroup:"col",
datalist:"option",
details:"summary",
dl:"dt",
em:"span",
fieldset:"legend",
figure:"figcaption",
frameset:"frame",
html:"body",
input:"input",
label:"input",
map:"area",
menu:"menuitem",
menuitem:"menuitem",
ul:"li",
ol:"li",
picture:"img",
object:"param",
optgroup:"option",
select:"option",
table:"tr",
tbody:"tr",
thead:"tr",
tfoot:"tr",
tr:"td",
video:"source",
Values:"Value"
},tabbr={
fd:"Folder",
pt:"ProjectTemplate",
mst:"MemberSubsystemTemplate",
st:"SubsystemTemplate",
et:"EntityTemplate",
ct:"ComponentTemplate",
mct:"MemberComponentTemplate",
ps:"ParameterSet",
pa:"Parameter",
pj:"Project",
ss:"Subsystems",
e:"Entity",
es:"Entities",
vs:"Values",
v:"Value",
"!":"!DOCTYPE html",
ab:"abbr",
acronym:"acr",
adr:"address",
ar:"area",
arti:"article",
asd:"aside",
bq:"blockquote",
btn:"button",
colg:"colgroup",
cap:"caption",
cmd:"command",
cv:"canvas",
dat:"data",
datg:"datagrid", datag:"datagrid",
datl:"datalist", datal:"datalist",
det:"details",
dlg:"dlg",
emb:"embed",
fg:"figure", fig:"figure",
fgc:"figcaption", figc:"figcaption",
fm:"form",
fst:"fieldset", fset:"fieldset",
frs:"frameset",
ftr:"footer",
hd:"head",
hdr:"header",
hg:"hgroup",
htm:"html",
ifr:"iframe",
inp:"input",
kg:"keygen",
lab:"label",
leg:"legend",
mi:"menuitem",
mk:"mark",
mn:"main",
nos:"noscript",
obj:"object",
opt:"option",
optg:"optgroup",
out:"output",
pic:"picture",
pr:"pre",
prog:"progress",
scr:"script",
sect:"section",
sel:"select",
sm:"samp",
summ:"summary",
sp:"span",
src:"source",
str:"strong",
sty:"style",
tab:"table",
tbd:"tbody",
tem:"template",
tft:"tfoot",
thd:"thead",
tpl:"template",
tra:"track", trk:"track",
txa:"textarea",
vid:"video",
wb:"wbr"
},aabbr={
n:"Name",
g:"Guid",
d:"Description",
i:"InheritanceParent",
v:"Value",
t:"Type"
},eabbr={
"css":' rel="stylesheet"',
"print":' rel="stylesheet" media="print"',
"favicon":' rel="shortcut icon" type="image/x-icon" href="favicon.ico"',
"touch":' rel="apple-touch-icon"',
"rss":' rel="alternate" type="application/rss+xml" title="RSS"',
"atom":' rel="alternate" type="application/atom+xml" title="Atom"',
"import":' rel="import"',
"im":' rel="import"',
"utf":' http-equiv="Content-Type" content="text/html;charset=UTF-8"',
"win":' http-equiv="Content-Type" content="text/html;charset=windows-1251"',
"vp":' name="viewport"',
"d":' disabled="disabled"',
"hidden":' type="hidden"',
"h":' type="hidden"',
"text":' type="text"',
"t":' type="text"',
"search":' type="search"',
"email":' type="email"',
"url":' type="url"',
"password, input:p":' type="password"',
"datetime":' type="datetime"',
"date":' type="date"',
"datetime-local":' type="datetime-local"',
"month":' type="month"',
"week":' type="week"',
"time":' type="time"',
"tel":' type="tel"',
"number":' type="number"',
"color":' type="color"',
"checkbox":' type="checkbox"',
"c":' type="checkbox"',
"radio":' type="radio"',
"r":' type="radio"',
"range":' type="range"',
"file":' type="file"',
"f:":' type="file"',
"submit":' type="submit"',
"s":' type="submit"',
"image, input:i":' type="image"',
"button":' type="button"',
"b":' type="button"',
"reset":' type="reset"',
};
!function(e,t,r,a,n){"use strict";function i(e,t){return function(e,t){for(var r=0,a=e.length,n=0;n<a;n++)e[n]==t&&r++;return r}((""+e).replace(/[^\\]?".+?[^\\]"/g,"").replace(/[^\\]?'.+?[^\\]'/g,"").replace(/[^\\]?\{.+?[^\\]\}/g,""),t)}function s(e,t){function r(e,r){try{return e.replace(new RegExp(t,"g"),"\t").match(/^\t+/)[0].length}catch(e){return 0}}function a(e,t){for(var r="";t>0;t--)r+=e;return r}var n=null;return e.split("\n").map(function(e,t){var s=r(e),o=e=e.trim();return null!=n&&e&&(e=s>n||"*"==e[0]?">"+e:s==n?"+"+e:s<n&&a("^",n-s)+e),""!=e&&(n=s+i(o,">")-i(o,"^")),e}).join("")}function o(e,t,r,n){return t&&(e=s(e,t)),p(e,r||l,n||a)}function p(e,t,r){function a(e){var t=o.pop();return t&&!/!|(area|base|br|col|embed|frame|hr|img|input|link|meta|param|source|wbr)\b/i.test(t)?(t="</"+t+">",e?t:c.push(t)):""}e=e.replace(/<!--[\S\s]*?-->/g,"");for(var n,i=[],s="",o=[],p=[],l=[],c=[],u=0,d=0,m=e.length;d<m;d++){switch(n=e[d]){case"{":u>=0&&u++;break;case"[":u<1&&u--;break;case"+":case">":case"^":case"(":case")":u||(s&&(i.push(s),s=""),i.push(n),n="");break;case"*":s&&!u&&(i.push(s),s="");break;case"}":u>0&&u--,u||(i.push(s+n),n=s="");break;case"]":u<0&&u++}u||"*"==n||"}"!=e[d-1]||i.push("+"),s+=n}for(s&&i.push(s),d=0,m=i.length;d<m;d++){var h,g,f,b,y=i[d],k="",v="",w=[],x=[""],j=[];switch(y){case"^":h=c[c.length-1],h&&"</"!=h.substring(0,2)&&a(),a();case">":break;case"+":(h=c[c.length-1])&&"</"!=h.substring(0,2)&&a();break;case"(":p.push([c.length,o.length]);break;case")":for(b=p[p.length-1],u=b[1],f=o.length;f-- >u;)a();l=c.slice(b[0]);break;default:if("*"==y[g=0])for(f=0|parseInt(y.substring(1)),l.length?(j=l,c.length=p.pop()[0]):c.length&&j.push(c.pop(),a(!0));g<f;g++)for(var C=0,u=j.length;C<u;C++)c.push(j[C].replace(/(\$+)(?:@(-?)(\d*))?/g,function(e,t,r,a){for(var n=("-"==r?-g:g)+(0|a||("-"==r?f-1:0))+"",i=0,s=t.length-n.length;i<s;i++)n="0"+n;return n}));else{for(l.length=0,j=y.match(/(\{.+\})|(\[.+\])|([\.#]?[\w:=!\$\@\-]+)/g)||[],u=j.length;g<u;g++)switch(s=j[g],s[0]){case".":w.push(s.substring(1));break;case"#":x.push('id="'+s.substring(1)+'"');break;case"[":x.push(s.slice(1,-1).replace(/([^=\s]+)=([^"'\s]*)(\s|$)/g,function(e,t,a,n){return(r[t]||t)+(a.indexOf('"')>=0?"='"+a+"'":'="'+a+'"')+n}));break;case"{":v=s.slice(1,-1);break;default:k=s}w[0]&&(x[0]=' class="'+w.join(" ")+'"'),!v||k||x[1]||w[0]?(k=t(k,o,c),c.push("<"+k+x.join(" ")+">"+(v||"")),o.push(k.replace(/(!|\s)[\S\s]*/g,""))):c.push(v)}}}for(d=o.length;d--;)a();return c.join("")}function l(e,a,i){var s,o=e.split(":");if(e=o[0])for(s=e.toLowerCase();r[s]&&(s=e.replace(s,r[s]))!=e;)e=s;return(e||(s=a[a.length-1])&&t[s.toLowerCase()]||(s=i[i.length-1])&&t[s.slice(1).replace(/[\s>][\S\s]*/,"").toLowerCase()]||"div")+(n[o[1]]||"")}"f"===(typeof define)[0]?define(function(){return o}):"object"==typeof exports?module.exports=o:e.Emmet=o}(this,itags,tabbr,aabbr,eabbr);
!function(t,e,a,r){"use strict";function i(t,e){t=t.replace(/[\+>\^\(\)]/g,"(>_<)$&").split("(>_<)");for(var a,r,i,o=["\n"],n=t.length,s=0,l=0,d="",c=[];s<200;s++)o.push(o[s]+e);for(s=0;s<n;s++)a=t[s].slice(1),r=t[s][0],d+="("==r?(c.push(l),a?o[l]+a:""):")"==r?(l=c.pop(),a?o[l]+a:""):">"==r?i?(i=!1,t[s]):(l++,a?o[l]+a:""):"+"==r?a?o[l]+a:"":"^"==r?(l--,a?o[l]+a:""):(i="<"==r,t[s]);return"\n"==d[0]?d.slice(1):d}function o(t,e){var a,i,n,d,c,p="",m=t.tagName;if(m){if(m=m.toLowerCase(),n=t.hasAttributes(),m==(r[e]||"div")&&n||(p+=s[c=t.tagName]||c),t.id&&(p+="#"+t.id),c=t.className.trim(),c.length&&(p+="."+t.className.replace(/\s+/,".")),n){var u,g=t.attributes;for(a=0,i=g.length;a<i;a++)u=g[a],/\b(class|id)\b/.test(u.name)||(n?(p+="[",n=!1):p+=" ",p+=l[c=u.name]||c,(c=u.value)&&(p+=c.search(/\s/)>=0?'="'+c+'"':"="+c));n||(p+="]")}d=t.childNodes,i=d.length;var f,h,b=[];if(i>0)for(a=0;a<i;a++){if(f=d[a],1!=(h=f.nodeType)){if(c=f.nodeValue.trim(),3!=h&&8!=h||!c.length)continue;var v,y=f=0;for(n="script"==m,c=c.replace(/\r?\n/g,n?"":"<br>"),v=0;v<c.length;v++){if("{"==c[v])f++;else{if("}"!=c[v])continue;f--}f<y&&(y=f),f>max&&(max=f)}c=(8==h?"*{":"{").repeat(1-y)+c,f&&(c+=(n?"//":"\x3c!--")+"}".repeat(f)+"--\x3e"),b.push(c+"}")}(f=o(f,m))&&b.push(f)}else t.content&&(f=o(t.content,m))&&b.push(f);i=b.length,i&&("{"!=b[0][0]&&(p+=">"),p+=b.join("+")+"^")}return p}var n,s={},l={};for(n in e)s[e[n]]=n;for(n in a)l[a[n]]=n;t.html2emmet=function(t,e){var a=t;return a.split&&(a=(new DOMParser).parseFromString(t,"text/xml").childNodes[0]),a=o(a).replace(/\n/g,"").replace(/\}\^/g,"}").replace(/\^\+|\+\^|>\^/g,"^").replace(/\^+$/,""),e?i(a,e):a}}(this,tabbr,aabbr,itags);