Compare commits
521 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2e44f96d6 | ||
|
|
2ccc707059 | ||
|
|
30490a0c5c | ||
|
|
4c1102026d | ||
|
|
63b589170c | ||
|
|
2b0d098027 | ||
|
|
fcfaa63f33 | ||
|
|
f497aa7fcf | ||
|
|
d91f7381e1 | ||
|
|
bad0af15f6 | ||
|
|
d7cc15c85d | ||
|
|
1f1e65dcb5 | ||
|
|
930d4dcdd0 | ||
|
|
b640820052 | ||
|
|
be0003927a | ||
|
|
0015a265a9 | ||
|
|
12ff451f4b | ||
|
|
63cefe0862 | ||
|
|
bf3a24e515 | ||
|
|
4378a8a792 | ||
|
|
1532cecb25 | ||
|
|
22af4db51d | ||
|
|
523cb34119 | ||
|
|
24b037c307 | ||
|
|
bd933ca43d | ||
|
|
676b2ef54b | ||
|
|
353a66f44c | ||
|
|
689dfcd83e | ||
|
|
8f7b82fdb3 | ||
|
|
c574a97cad | ||
|
|
5e7de996e0 | ||
|
|
52ba4bb0ea | ||
|
|
c43aa3545f | ||
|
|
8e48a816f8 | ||
|
|
afef829571 | ||
|
|
f4e5de995c | ||
|
|
70a4e06f18 | ||
|
|
f241c008d4 | ||
|
|
9920b7592d | ||
|
|
fee2c667b3 | ||
|
|
ebc9d98a87 | ||
|
|
06f5a32c48 | ||
|
|
35cb9ee529 | ||
|
|
f0e59ca617 | ||
|
|
1bbfd80c24 | ||
|
|
a9600faa9f | ||
|
|
6f39f96799 | ||
|
|
b06df4740b | ||
|
|
d354e4f767 | ||
|
|
caef44d4f9 | ||
|
|
f9eb2c5a0a | ||
|
|
3a05be49f6 | ||
|
|
b92e169b69 | ||
|
|
882f42de8f | ||
|
|
c8e64ac4f7 | ||
|
|
da1751dc1b | ||
|
|
304ae277fe | ||
|
|
0e93162080 | ||
|
|
6ced9dd235 | ||
|
|
e2da57f448 | ||
|
|
d0047e6e5b | ||
|
|
90955bdcab | ||
|
|
d2b4099cdb | ||
|
|
1e7315d4a8 | ||
|
|
d7ace92c04 | ||
|
|
568c33d7d6 | ||
|
|
ef8f10c42d | ||
|
|
fc7c4432e9 | ||
|
|
04a7d9a92d | ||
|
|
b83673f1c8 | ||
|
|
ba21ce887a | ||
|
|
5764482acd | ||
|
|
1b0e08cfa0 | ||
|
|
e59cb43b0b | ||
|
|
2cbca7a43d | ||
|
|
d2dd3d0ac6 | ||
|
|
6324ed7a9c | ||
|
|
23595c0608 | ||
|
|
eebc3418f9 | ||
|
|
867caae3da | ||
|
|
d0098a878a | ||
|
|
ee7db631ee | ||
|
|
b388f41f80 | ||
|
|
9f5391bbc0 | ||
|
|
22ca52a1cb | ||
|
|
b56cfb372d | ||
|
|
c8367e257f | ||
|
|
62d37702a9 | ||
|
|
74fc2a2d85 | ||
|
|
0ac1298501 | ||
|
|
faf76ac715 | ||
|
|
3ece96ae08 | ||
|
|
e91cf7f6ac | ||
|
|
019d3e07b5 | ||
|
|
e3046845bf | ||
|
|
b8f52ed76a | ||
|
|
662abd29cb | ||
|
|
3560337b40 | ||
|
|
c7985e8881 | ||
|
|
a69bc44314 | ||
|
|
651c92c175 | ||
|
|
7319574f30 | ||
|
|
b9821f1c21 | ||
|
|
52ca6af024 | ||
|
|
cc4d27c6d2 | ||
|
|
b687977663 | ||
|
|
3e85f5bf39 | ||
|
|
23165d9382 | ||
|
|
1abc31895e | ||
|
|
6fc70fbc55 | ||
|
|
bf86becc5e | ||
|
|
510142ad2d | ||
|
|
6eb361d8f7 | ||
|
|
e56f588dea | ||
|
|
0ee551de71 | ||
|
|
7dc40f68db | ||
|
|
adb0c08933 | ||
|
|
2fea9495b3 | ||
|
|
1f767c3497 | ||
|
|
09bae08dfa | ||
|
|
8a137691ff | ||
|
|
7de90f18cc | ||
|
|
859636e6e0 | ||
|
|
a511682ce1 | ||
|
|
6a81420fc0 | ||
|
|
fa019e8960 | ||
|
|
b17358e761 | ||
|
|
c9b41a4343 | ||
|
|
8affdbdc86 | ||
|
|
a61e388498 | ||
|
|
d72752f453 | ||
|
|
d67af48f29 | ||
|
|
b18a2a7aa3 | ||
|
|
693dce0e6c | ||
|
|
e1cd36771e | ||
|
|
12107da9bd | ||
|
|
96eee74f56 | ||
|
|
2f881085ef | ||
|
|
7b2afa109e | ||
|
|
8dae3f832d | ||
|
|
c61e0e11bb | ||
|
|
04caa5f4e4 | ||
|
|
6a13c33c70 | ||
|
|
4357edb1d4 | ||
|
|
9d7e009c0f | ||
|
|
7549f77edc | ||
|
|
5ee2ab9b6b | ||
|
|
54b98b4e05 | ||
|
|
6e0e48e150 | ||
|
|
fe5a1c6a8d | ||
|
|
8332106754 | ||
|
|
aa149d2e7b | ||
|
|
a5f883c2f0 | ||
|
|
5953377060 | ||
|
|
5a478302f4 | ||
|
|
1621825166 | ||
|
|
6af2e859ac | ||
|
|
fb22a8843e | ||
|
|
529dda0e6d | ||
|
|
35c893d47a | ||
|
|
99e2397981 | ||
|
|
b6d68f97d6 | ||
|
|
74024301a5 | ||
|
|
1f100bbe88 | ||
|
|
c94c192e17 | ||
|
|
0d9e5985e4 | ||
|
|
b31bfdaaf5 | ||
|
|
5f67edbf87 | ||
|
|
093e8b356e | ||
|
|
43d4c2831d | ||
|
|
55a0dbeb86 | ||
|
|
2f1f2dccc1 | ||
|
|
a4cef60c49 | ||
|
|
96ee377279 | ||
|
|
4152c72de5 | ||
|
|
ab066397b2 | ||
|
|
8c514df120 | ||
|
|
0eab35842d | ||
|
|
752bb7e048 | ||
|
|
9e897dcc46 | ||
|
|
2bb3485827 | ||
|
|
0be4abe9c2 | ||
|
|
37bc09169f | ||
|
|
1cc2decfdd | ||
|
|
e9eb1689e2 | ||
|
|
0f446833c0 | ||
|
|
cb9c2a8ef9 | ||
|
|
b37ed1c1e0 | ||
|
|
b484955005 | ||
|
|
654626d519 | ||
|
|
ca0313c514 | ||
|
|
fb357eb241 | ||
|
|
1a83487221 | ||
|
|
6cda7a29fc | ||
|
|
17f495e9c5 | ||
|
|
dd32a90844 | ||
|
|
4b2ba185ae | ||
|
|
b716df1a05 | ||
|
|
d552eb2eeb | ||
|
|
de2337dfe3 | ||
|
|
e707cfc67c | ||
|
|
c3c5df6394 | ||
|
|
72739ebb97 | ||
|
|
39c94b8dcf | ||
|
|
5af380223a | ||
|
|
1ea379180a | ||
|
|
ca3d050a0b | ||
|
|
161b2271b3 | ||
|
|
013c94cdf6 | ||
|
|
addbb78151 | ||
|
|
f6789eaf39 | ||
|
|
c13b4f18f7 | ||
|
|
67840e9481 | ||
|
|
41c40974a3 | ||
|
|
9a6ce11f09 | ||
|
|
d404e40508 | ||
|
|
b6a496aae5 | ||
|
|
ecaed07a3d | ||
|
|
30ec8e645b | ||
|
|
3a1ba53a4b | ||
|
|
ab95dfa7cd | ||
|
|
6b9ebb6dc5 | ||
|
|
e2e843d2ed | ||
|
|
d5381d7b36 | ||
|
|
f7c0f0341b | ||
|
|
9f7fd68728 | ||
|
|
c2b6c645ef | ||
|
|
36810aaccc | ||
|
|
8e14d1c92e | ||
|
|
9b7e944dea | ||
|
|
b6429ca5fd | ||
|
|
8607b09e64 | ||
|
|
64151a2c3e | ||
|
|
d5749db0cd | ||
|
|
df7d6847e6 | ||
|
|
c6b5ad8179 | ||
|
|
71ec500fde | ||
|
|
6cf05edf63 | ||
|
|
39c5341dbc | ||
|
|
e2234a8771 | ||
|
|
cac9741cb7 | ||
|
|
648cb296e6 | ||
|
|
5a0ebb7d8c | ||
|
|
b7b534ccf2 | ||
|
|
fab23d210b | ||
|
|
6a18539f7e | ||
|
|
4d87a90c10 | ||
|
|
2c9767e500 | ||
|
|
2b1d9acba5 | ||
|
|
8a2d18b63b | ||
|
|
b59f9f896c | ||
|
|
496e6663fd | ||
|
|
a4fbf9b6b4 | ||
|
|
b8afce746b | ||
|
|
4c239eaf79 | ||
|
|
1d03233c83 | ||
|
|
5358ad271e | ||
|
|
2fa7d72b01 | ||
|
|
f034d83c81 | ||
|
|
b3afa2ab57 | ||
|
|
36fc758690 | ||
|
|
f764eb2653 | ||
|
|
63f56ddecc | ||
|
|
0b2bab3f3d | ||
|
|
66de02929b | ||
|
|
3c4a142f9a | ||
|
|
bf6f090428 | ||
|
|
59ab818f5b | ||
|
|
77847daa77 | ||
|
|
690d2df774 | ||
|
|
643cc9c141 | ||
|
|
562cb58342 | ||
|
|
1c8ef29413 | ||
|
|
8e67c551de | ||
|
|
03e3324a12 | ||
|
|
a3ba3f662a | ||
|
|
2b21678d48 | ||
|
|
09f29257d2 | ||
|
|
62be48decf | ||
|
|
952a29d5da | ||
|
|
db9151b993 | ||
|
|
e1bb2b4556 | ||
|
|
668658b7c9 | ||
|
|
231a3e1278 | ||
|
|
41d234bf48 | ||
|
|
f16c3a394f | ||
|
|
570538042e | ||
|
|
6a97bfe517 | ||
|
|
7b6e5c5270 | ||
|
|
20deb56e33 | ||
|
|
a23a2c52c2 | ||
|
|
3f6fa941cb | ||
|
|
28f914463b | ||
|
|
f0c84b5230 | ||
|
|
dc51abe54c | ||
|
|
f501da74b7 | ||
|
|
c1d14a35ee | ||
|
|
4f4a0318aa | ||
|
|
54a1005af3 | ||
|
|
7b4fac7a7f | ||
|
|
c80a6db604 | ||
|
|
96247eda51 | ||
|
|
433a02537c | ||
|
|
bacff3453b | ||
|
|
b20e74c899 | ||
|
|
efa5ceb6de | ||
|
|
f79660dd2a | ||
|
|
606daabdd3 | ||
|
|
fc1e4ad620 | ||
|
|
54dcf2ead9 | ||
|
|
69cea23cd4 | ||
|
|
083b598c93 | ||
|
|
94f11501ed | ||
|
|
9ac4a11db1 | ||
|
|
a56cf59136 | ||
|
|
12cc81147c | ||
|
|
f70737ddc2 | ||
|
|
1a22497b64 | ||
|
|
6da330a001 | ||
|
|
f6652e7530 | ||
|
|
5148c6ec3a | ||
|
|
954c79abcb | ||
|
|
7ec3fe3bfe | ||
|
|
9ce1cde6ca | ||
|
|
672af73e96 | ||
|
|
67022578e3 | ||
|
|
65fe4c16fc | ||
|
|
b6f9cd1863 | ||
|
|
4908a5e7be | ||
|
|
853c0b1a3a | ||
|
|
d0d8a4827e | ||
|
|
4745ce42f9 | ||
|
|
bba13becd0 | ||
|
|
7712e005c4 | ||
|
|
07c667f469 | ||
|
|
57ad1ec1cf | ||
|
|
60a043479c | ||
|
|
1a43e1671f | ||
|
|
cd955d3603 | ||
|
|
492a0c51d1 | ||
|
|
dd4a4c281f | ||
|
|
41ec6da72c | ||
|
|
e18f38d4da | ||
|
|
bd27df8fa5 | ||
|
|
2f44c2de9b | ||
|
|
ccf154a807 | ||
|
|
837453dd6e | ||
|
|
64bc60cdf0 | ||
|
|
af258c334e | ||
|
|
627fff624a | ||
|
|
bc8127f6de | ||
|
|
19bf43815d | ||
|
|
7709074d7c | ||
|
|
4b73f249dd | ||
|
|
ae9e2c2be0 | ||
|
|
fd8edb5aa2 | ||
|
|
82ab59c46a | ||
|
|
74a63e98b5 | ||
|
|
9e23b3dac5 | ||
|
|
077ce011e2 | ||
|
|
1430bc824f | ||
|
|
722b16e620 | ||
|
|
30727ef9e4 | ||
|
|
0f322f8a69 | ||
|
|
ec5b4dde6f | ||
|
|
630dcb799e | ||
|
|
c6d1e47226 | ||
|
|
aa8315a7c9 | ||
|
|
80040bf8e5 | ||
|
|
8f382f322e | ||
|
|
9ccc7dc59a | ||
|
|
70f6f86827 | ||
|
|
3055c87567 | ||
|
|
473955611a | ||
|
|
21a7ded8e0 | ||
|
|
23347995e2 | ||
|
|
4027a3cda3 | ||
|
|
a9b6c4f1a3 | ||
|
|
c1330662aa | ||
|
|
3e38f8017f | ||
|
|
41bc1cb1e9 | ||
|
|
9fb94008ea | ||
|
|
5f647a46b8 | ||
|
|
69a2e76c3c | ||
|
|
4d6598c645 | ||
|
|
56acb685e9 | ||
|
|
f0be4416b3 | ||
|
|
93ce59f65b | ||
|
|
28b94eceb2 | ||
|
|
e4c63769f2 | ||
|
|
e0fc61932d | ||
|
|
3de3046260 | ||
|
|
b6a96301cd | ||
|
|
480dea23ad | ||
|
|
457ef24c04 | ||
|
|
dbf6ce6d6c | ||
|
|
7686a6fc93 | ||
|
|
afde6efafa | ||
|
|
af53f17f5a | ||
|
|
8f9cf4034d | ||
|
|
31a6c5df9b | ||
|
|
08d1b26738 | ||
|
|
abd739123c | ||
|
|
da8570b560 | ||
|
|
8d238890a2 | ||
|
|
ca29f262e5 | ||
|
|
cffefbeb2e | ||
|
|
52528f9311 | ||
|
|
8b75256281 | ||
|
|
2385ed22b1 | ||
|
|
7a0cf446ba | ||
|
|
586d85cf08 | ||
|
|
f371e72e07 | ||
|
|
8d9bc1cb53 | ||
|
|
29edf94498 | ||
|
|
d7a108ff06 | ||
|
|
5ed41285c0 | ||
|
|
b16d79e654 | ||
|
|
90e5d06d3d | ||
|
|
a1156cae6c | ||
|
|
037a200357 | ||
|
|
e282454bfe | ||
|
|
e499c1d5a4 | ||
|
|
8540b1b113 | ||
|
|
6b5e3f2abf | ||
|
|
f8be550e6a | ||
|
|
6a7b04199f | ||
|
|
2847e0f4df | ||
|
|
eec7f7c687 | ||
|
|
a4253deda3 | ||
|
|
372d639601 | ||
|
|
06e5c6869d | ||
|
|
933189c216 | ||
|
|
c942881f36 | ||
|
|
99e491ca0f | ||
|
|
ea539d50e2 | ||
|
|
497bbf002c | ||
|
|
2629fac624 | ||
|
|
30af5901eb | ||
|
|
42b60d3291 | ||
|
|
9b53fd2302 | ||
|
|
972f64b6f9 | ||
|
|
3eb4627ccf | ||
|
|
2ba88b8951 | ||
|
|
117b04169c | ||
|
|
c56d5bd066 | ||
|
|
00bfde9ce9 | ||
|
|
5f503d0427 | ||
|
|
47bcab6b26 | ||
|
|
ecca0439f1 | ||
|
|
e896be4037 | ||
|
|
b0e4284130 | ||
|
|
3e69889cca | ||
|
|
dfb2e62c6c | ||
|
|
73f3e74300 | ||
|
|
d66377c716 | ||
|
|
6083e4cd97 | ||
|
|
1fb927978b | ||
|
|
bb3414f78e | ||
|
|
35edb3587b | ||
|
|
509f53a902 | ||
|
|
3dad0a8b8a | ||
|
|
d242f56398 | ||
|
|
a63e24cd9d | ||
|
|
0827815b8d | ||
|
|
fa73d46e82 | ||
|
|
a84b9b6bf1 | ||
|
|
0d2414d7ec | ||
|
|
54e67932a0 | ||
|
|
7898055f0c | ||
|
|
19e19f4ec5 | ||
|
|
0f546e7062 | ||
|
|
2f6fbb689b | ||
|
|
7e61e576cd | ||
|
|
39f8a18c34 | ||
|
|
4b334c5117 | ||
|
|
91c0b6c76a | ||
|
|
6a170f3b7b | ||
|
|
8f7bafb963 | ||
|
|
2c509a7bc4 | ||
|
|
cc3a8fc3a2 | ||
|
|
130a843605 | ||
|
|
9466389cd6 | ||
|
|
2fb6138ed2 | ||
|
|
95a4f8e4d5 | ||
|
|
7ae1147df8 | ||
|
|
e5652e36d5 | ||
|
|
f8fab83761 | ||
|
|
2d669d1376 | ||
|
|
821184b45a | ||
|
|
bf42dfbb5c | ||
|
|
a5807be01e | ||
|
|
642ae77f73 | ||
|
|
7d06e2977c | ||
|
|
fb6811fc0d | ||
|
|
d10cdbb44f | ||
|
|
385e5c0693 | ||
|
|
359d6c9579 | ||
|
|
1d825fda76 | ||
|
|
87a127c42b | ||
|
|
7220877f5e | ||
|
|
2e64465d6b | ||
|
|
4f3c364b79 | ||
|
|
ee92d918a5 | ||
|
|
fcd2d8724a | ||
|
|
8d9da30c46 | ||
|
|
a6035a98e8 | ||
|
|
960bff0808 | ||
|
|
a489d6b23d | ||
|
|
d82f91c0ec | ||
|
|
c42ebc92fe | ||
|
|
22fbf70aae | ||
|
|
bbaee04f28 | ||
|
|
7fe1b4321a | ||
|
|
329689de7b | ||
|
|
c7b2fb2b11 | ||
|
|
d2aa73570d | ||
|
|
da4b90b3b0 | ||
|
|
5448dcb5a5 | ||
|
|
00a6b6a779 | ||
|
|
bf1961598a |
72
CHANGELOG
72
CHANGELOG
@@ -1,4 +1,74 @@
|
||||
## 2.00.1
|
||||
## 2.3.1
|
||||
|
||||
- new virtual fields syntax:
|
||||
``db.define_table('person',Field('name'),Field.Virtual('namey',lambda row: row.person.name+'y'))``
|
||||
- db.thing(name='Cohen',_orderby=db.thing.name), thanks Yair
|
||||
- made many modules Python 3.3 friendly (compile but not tested)
|
||||
- better welcome css, thanks Paolo
|
||||
- jQuery 1.8.3
|
||||
- Bootstrap 2.2.2
|
||||
- Modernizr 2.6.2 (custom full options)
|
||||
- integration with analyitics.js (0.2.0)
|
||||
- better scheduler, thanks Niphlod
|
||||
- page and media preview in wiki, thanks Niphlod
|
||||
- create new auth.wiki page from slug model, thanks Nico
|
||||
- conditional menus with auth.wiki(menugroups=['wiki_editor'])
|
||||
- better security in grid/smartgrid
|
||||
- allow LOADing multiple grids, thanks Niphlod
|
||||
- auth.settings.login_onfail, thanks Yair
|
||||
- better handling of session files for speed
|
||||
- added heroku support (experimental)
|
||||
- added rocket support for IPV6, thanks Chirs Winebrinner
|
||||
- more customizable menus with MENU(li_first, li_last..)
|
||||
- added support for paymentech (gluon/contrib/paymentech.py)
|
||||
- fixed broken cron
|
||||
- fixed possible xss with share.js
|
||||
- many bug fixes. Closed more than 50 tickets since 2.2.1
|
||||
|
||||
## 2.2.1
|
||||
|
||||
- session.connect(cookie_key='secret', compression_level=9) stores sessions in cookies
|
||||
- T.is_writable = False prevents T from dynamically updating langauge files
|
||||
- all code is more PEP8 compliant
|
||||
- better custom_importer behaviour (now works per app, is smalled and faster)
|
||||
- fixed some bugs
|
||||
- upgraded feedparser.py and rss2.py
|
||||
- codemirror has autoresize
|
||||
|
||||
## 2.1.0
|
||||
|
||||
- overall faster web2py
|
||||
- when apps are deleted, a w2p copy left in deposit folder
|
||||
- change in cron (it is now disabled by default). removed -N option and introduced -Y.
|
||||
- faster web2py_uuid() and request initialization logic, thanks Michele
|
||||
- static asset management, thanks Niphlod
|
||||
- improved mobile admin
|
||||
- request.requires_https and Auth(secure=True), thanks Yarin and Niphlod
|
||||
- better custom_import (works per app and is faster), thanks Michele
|
||||
- redis_sesssion.py, thanks Niphlod
|
||||
- allow entropy computation in IS_STRONG and web2py.js, thanks Jonathan and Niphlod
|
||||
- fixed many aith.wiki problems
|
||||
- support for auth.wiki(render='html')
|
||||
- better welcome layout, thanks Paolo
|
||||
- db.define_table(...,redefine=True)
|
||||
- DAL, Row, and Rows object can now be pickled/unpickled, thanks to zombie DAL.
|
||||
- admin uses codemirror
|
||||
- allow syntax auth = Auth(db).define_tables()
|
||||
- better auth.wiki with preview, thanks Alan
|
||||
- better auth.impersonate, thanks Alan
|
||||
- upgraded jQuery 1.8
|
||||
- upgraded Bootstrap 2.1
|
||||
- fixed problem with dropbox_account.py
|
||||
- many fixes to cache.ram, cache.disk, memcache and gae_memcache
|
||||
- cache.with_prefix(cache.ram,'prefix')
|
||||
- db.table.field.epoch() counts seconds from epoch
|
||||
- DAL support for SQL CASE, example: db().select(...query.case('true','false))
|
||||
- DAL(...,do_connect=False) allows faking connections
|
||||
- DAL(...,auto_import=True) now retieves some fiel attributes
|
||||
- mail can specify a sender: mail.send(...,sender='Mr X <%(sender)s>')
|
||||
- renamed gluon/contrib/comet_messaging.py -> gluon/contrib/websocket_messaging.py
|
||||
|
||||
## 2.0.1-11
|
||||
|
||||
### DAL Improvements
|
||||
|
||||
|
||||
18
Makefile
18
Makefile
@@ -29,7 +29,7 @@ update:
|
||||
wget -O gluon/contrib/simplejsonrpc.py http://rad2py.googlecode.com/hg/ide2py/simplejsonrpc.py
|
||||
echo "remember that pymysql was tweaked"
|
||||
src:
|
||||
echo 'Version 2.0.8 ('`date +%Y-%m-%d\ %H:%M:%S`') stable' > VERSION
|
||||
echo 'Version 2.3.1 ('`date +%Y-%m-%d\ %H:%M:%S`') stable' > VERSION
|
||||
### rm -f all junk files
|
||||
make clean
|
||||
### clean up baisc apps
|
||||
@@ -42,7 +42,9 @@ src:
|
||||
rm -f applications/examples/databases/*
|
||||
rm -f applications/admin/uploads/*
|
||||
rm -f applications/welcome/uploads/*
|
||||
rm -f applications/examples/uploads/*
|
||||
rm -f applications/examples/uploads/*
|
||||
### make epydoc
|
||||
make epydoc
|
||||
### make welcome layout and appadmin the default
|
||||
cp applications/welcome/views/appadmin.html applications/admin/views
|
||||
cp applications/welcome/views/appadmin.html applications/examples/views
|
||||
@@ -54,7 +56,6 @@ src:
|
||||
cd ..; zip -r web2py/web2py_src.zip web2py/gluon/*.py web2py/gluon/contrib/* web2py/splashlogo.gif web2py/*.py web2py/README.markdown web2py/LICENSE web2py/CHANGELOG web2py/NEWINSTALL web2py/VERSION web2py/Makefile web2py/epydoc.css web2py/epydoc.conf web2py/app.example.yaml web2py/logging.example.conf web2py_exe.conf web2py/queue.example.yaml MANIFEST.in w2p_apps w2p_clone w2p_run startweb2py web2py/scripts/*.sh web2py/scripts/*.py web2py/applications/admin web2py/applications/examples/ web2py/applications/welcome web2py/applications/__init__.py web2py/site-packages/__init__.py web2py/gluon/tests/*.sh web2py/gluon/tests/*.py
|
||||
|
||||
mdp:
|
||||
make epydoc
|
||||
make src
|
||||
make app
|
||||
make win
|
||||
@@ -107,10 +108,6 @@ win:
|
||||
cp applications/__init__.py ../web2py_win/web2py/applications
|
||||
cd ../web2py_win; zip -r web2py_win.zip web2py
|
||||
mv ../web2py_win/web2py_win.zip .
|
||||
pip:
|
||||
# create Web2py distribution for upload to Pypi
|
||||
# after upload clean Web2py sources with rm -R ./dist
|
||||
python setup.py sdist
|
||||
run:
|
||||
python2.5 web2py.py -a hello
|
||||
commit:
|
||||
@@ -129,3 +126,10 @@ tag:
|
||||
hg tag -l '$(S)'
|
||||
make commit S='$(S)'
|
||||
make push
|
||||
pip:
|
||||
# create Web2py distribution for upload to Pypi
|
||||
# after upload clean Web2py sources with rm -R ./dist
|
||||
# http://guide.python-distribute.org/creation.html
|
||||
python setup.py sdist
|
||||
sudo python setup.py register
|
||||
sudo python setup.py sdist upload
|
||||
|
||||
1
NEWINSTALL
Normal file
1
NEWINSTALL
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.0.8 (2012-09-06 21:32:40) stable
|
||||
Version 2.3.1 (2012-12-14 09:21:31) stable
|
||||
|
||||
10
__init__.py
10
__init__.py
@@ -1,10 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
125
anyserver.py
125
anyserver.py
@@ -9,47 +9,54 @@ License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
This file is based, although a rewrite, on MIT-licensed code from the Bottle web framework.
|
||||
"""
|
||||
|
||||
import os, sys, optparse, urllib
|
||||
import os
|
||||
import sys
|
||||
import optparse
|
||||
import urllib
|
||||
|
||||
path = os.path.dirname(os.path.abspath(__file__))
|
||||
os.chdir(path)
|
||||
sys.path = [path]+[p for p in sys.path if not p==path]
|
||||
sys.path = [path] + [p for p in sys.path if not p == path]
|
||||
import gluon.main
|
||||
from gluon.fileutils import read_file, write_file
|
||||
|
||||
|
||||
class Servers:
|
||||
@staticmethod
|
||||
def cgi(app, address=None, **options):
|
||||
from wsgiref.handlers import CGIHandler
|
||||
CGIHandler().run(app) # Just ignore host and port here
|
||||
CGIHandler().run(app) # Just ignore host and port here
|
||||
|
||||
@staticmethod
|
||||
def flup(app,address, **options):
|
||||
def flup(app, address, **options):
|
||||
import flup.server.fcgi
|
||||
flup.server.fcgi.WSGIServer(app, bindAddress=address).run()
|
||||
|
||||
@staticmethod
|
||||
def wsgiref(app,address,**options): # pragma: no cover
|
||||
def wsgiref(app, address, **options): # pragma: no cover
|
||||
from wsgiref.simple_server import make_server, WSGIRequestHandler
|
||||
|
||||
class QuietHandler(WSGIRequestHandler):
|
||||
def log_request(*args, **kw): pass
|
||||
def log_request(*args, **kw):
|
||||
pass
|
||||
options['handler_class'] = QuietHandler
|
||||
srv = make_server(address[0],address[1],app,**options)
|
||||
srv = make_server(address[0], address[1], app, **options)
|
||||
srv.serve_forever()
|
||||
|
||||
@staticmethod
|
||||
def cherrypy(app,address, **options):
|
||||
def cherrypy(app, address, **options):
|
||||
from cherrypy import wsgiserver
|
||||
server = wsgiserver.CherryPyWSGIServer(address, app)
|
||||
server.start()
|
||||
|
||||
@staticmethod
|
||||
def rocket(app,address, **options):
|
||||
def rocket(app, address, **options):
|
||||
from gluon.rocket import CherryPyWSGIServer
|
||||
server = CherryPyWSGIServer(address, app)
|
||||
server.start()
|
||||
|
||||
@staticmethod
|
||||
def rocket_with_repoze_profiler(app,address, **options):
|
||||
def rocket_with_repoze_profiler(app, address, **options):
|
||||
from gluon.rocket import CherryPyWSGIServer
|
||||
from repoze.profile.profiler import AccumulatingProfileMiddleware
|
||||
from gluon.settings import global_settings
|
||||
@@ -59,44 +66,46 @@ class Servers:
|
||||
log_filename='wsgi.prof',
|
||||
discard_first_request=True,
|
||||
flush_at_shutdown=True,
|
||||
path = '/__profile__'
|
||||
)
|
||||
path='/__profile__'
|
||||
)
|
||||
server = CherryPyWSGIServer(address, wrapped)
|
||||
server.start()
|
||||
|
||||
@staticmethod
|
||||
def paste(app,address,**options):
|
||||
def paste(app, address, **options):
|
||||
from paste import httpserver
|
||||
from paste.translogger import TransLogger
|
||||
httpserver.serve(app, host=address[0], port=address[1], **options)
|
||||
|
||||
@staticmethod
|
||||
def fapws(app,address, **options):
|
||||
def fapws(app, address, **options):
|
||||
import fapws._evwsgi as evwsgi
|
||||
from fapws import base
|
||||
evwsgi.start(address[0],str(address[1]))
|
||||
evwsgi.start(address[0], str(address[1]))
|
||||
evwsgi.set_base_module(base)
|
||||
|
||||
def app(environ, start_response):
|
||||
environ['wsgi.multiprocess'] = False
|
||||
return app(environ, start_response)
|
||||
evwsgi.wsgi_cb(('',app))
|
||||
evwsgi.wsgi_cb(('', app))
|
||||
evwsgi.run()
|
||||
|
||||
|
||||
@staticmethod
|
||||
def gevent(app,address, **options):
|
||||
from gevent import monkey; monkey.patch_all()
|
||||
def gevent(app, address, **options):
|
||||
from gevent import monkey
|
||||
monkey.patch_all()
|
||||
from gevent import pywsgi
|
||||
from gevent.pool import Pool
|
||||
pywsgi.WSGIServer(address, app, spawn = 'workers' in options and Pool(int(options.workers)) or 'default').serve_forever()
|
||||
pywsgi.WSGIServer(address, app, spawn='workers' in options and Pool(
|
||||
int(options.workers)) or 'default').serve_forever()
|
||||
|
||||
@staticmethod
|
||||
def bjoern(app,address, **options):
|
||||
def bjoern(app, address, **options):
|
||||
import bjoern
|
||||
bjoern.run(app, *address)
|
||||
|
||||
@staticmethod
|
||||
def tornado(app,address, **options):
|
||||
def tornado(app, address, **options):
|
||||
import tornado.wsgi
|
||||
import tornado.httpserver
|
||||
import tornado.ioloop
|
||||
@@ -106,7 +115,7 @@ class Servers:
|
||||
tornado.ioloop.IOLoop.instance().start()
|
||||
|
||||
@staticmethod
|
||||
def twisted(app,address, **options):
|
||||
def twisted(app, address, **options):
|
||||
from twisted.web import server, wsgi
|
||||
from twisted.python.threadpool import ThreadPool
|
||||
from twisted.internet import reactor
|
||||
@@ -118,42 +127,44 @@ class Servers:
|
||||
reactor.run()
|
||||
|
||||
@staticmethod
|
||||
def diesel(app,address, **options):
|
||||
def diesel(app, address, **options):
|
||||
from diesel.protocols.wsgi import WSGIApplication
|
||||
app = WSGIApplication(app, port=address[1])
|
||||
app.run()
|
||||
|
||||
@staticmethod
|
||||
def gunicorn(app,address, **options):
|
||||
def gunicorn(app, address, **options):
|
||||
from gunicorn.app.base import Application
|
||||
config = {'bind': "%s:%d" % address}
|
||||
config.update(options)
|
||||
sys.argv = ['anyserver.py']
|
||||
|
||||
class GunicornApplication(Application):
|
||||
def init(self, parser, opts, args):
|
||||
return config
|
||||
|
||||
def load(self):
|
||||
return app
|
||||
g = GunicornApplication()
|
||||
g.run()
|
||||
|
||||
@staticmethod
|
||||
def eventlet(app,address, **options):
|
||||
def eventlet(app, address, **options):
|
||||
from eventlet import wsgi, listen
|
||||
wsgi.server(listen(address), app)
|
||||
|
||||
@staticmethod
|
||||
def mongrel2(app,address,**options):
|
||||
def mongrel2(app, address, **options):
|
||||
import uuid
|
||||
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
||||
from mongrel2 import handler
|
||||
conn = handler.Connection(str(uuid.uuid4()),
|
||||
"tcp://127.0.0.1:9997",
|
||||
"tcp://127.0.0.1:9996")
|
||||
mongrel2_handler(app,conn,debug=False)
|
||||
mongrel2_handler(app, conn, debug=False)
|
||||
|
||||
|
||||
def run(servername,ip,port,softcron=True,logging=False,profiler=None):
|
||||
def run(servername, ip, port, softcron=True, logging=False, profiler=None):
|
||||
if logging:
|
||||
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
|
||||
logfilename='httpserver.log',
|
||||
@@ -163,9 +174,10 @@ def run(servername,ip,port,softcron=True,logging=False,profiler=None):
|
||||
if softcron:
|
||||
from gluon.settings import global_settings
|
||||
global_settings.web2py_crontype = 'soft'
|
||||
getattr(Servers,servername)(application,(ip,int(port)))
|
||||
getattr(Servers, servername)(application, (ip, int(port)))
|
||||
|
||||
def mongrel2_handler(application,conn,debug=False):
|
||||
|
||||
def mongrel2_handler(application, conn, debug=False):
|
||||
"""
|
||||
Based on :
|
||||
https://github.com/berry/Mongrel2-WSGI-Handler/blob/master/wsgi-handler.py
|
||||
@@ -190,20 +202,23 @@ def mongrel2_handler(application,conn,debug=False):
|
||||
# and responses. Unless I have missed something.
|
||||
|
||||
while True:
|
||||
if debug: print "WAITING FOR REQUEST"
|
||||
if debug:
|
||||
print "WAITING FOR REQUEST"
|
||||
|
||||
# receive a request
|
||||
req = conn.recv()
|
||||
if debug: print "REQUEST BODY: %r\n" % req.body
|
||||
if debug:
|
||||
print "REQUEST BODY: %r\n" % req.body
|
||||
|
||||
if req.is_disconnect():
|
||||
if debug: print "DISCONNECT"
|
||||
continue #effectively ignore the disconnect from the client
|
||||
if debug:
|
||||
print "DISCONNECT"
|
||||
continue # effectively ignore the disconnect from the client
|
||||
|
||||
# Set a couple of environment attributes a.k.a. header attributes
|
||||
# that are a must according to PEP 333
|
||||
environ = req.headers
|
||||
environ['SERVER_PROTOCOL'] = 'HTTP/1.1' # SimpleHandler expects a server_protocol, lets assume it is HTTP 1.1
|
||||
environ['SERVER_PROTOCOL'] = 'HTTP/1.1' # SimpleHandler expects a server_protocol, lets assume it is HTTP 1.1
|
||||
environ['REQUEST_METHOD'] = environ['METHOD']
|
||||
if ':' in environ['Host']:
|
||||
environ['SERVER_NAME'] = environ['Host'].split(':')[0]
|
||||
@@ -211,17 +226,19 @@ def mongrel2_handler(application,conn,debug=False):
|
||||
else:
|
||||
environ['SERVER_NAME'] = environ['Host']
|
||||
environ['SERVER_PORT'] = ''
|
||||
environ['SCRIPT_NAME'] = '' # empty for now
|
||||
environ['SCRIPT_NAME'] = '' # empty for now
|
||||
environ['PATH_INFO'] = urllib.unquote(environ['PATH'])
|
||||
if '?' in environ['URI']:
|
||||
environ['QUERY_STRING'] = environ['URI'].split('?')[1]
|
||||
else:
|
||||
environ['QUERY_STRING'] = ''
|
||||
if environ.has_key('Content-Length'):
|
||||
environ['CONTENT_LENGTH'] = environ['Content-Length'] # necessary for POST to work with Django
|
||||
if 'Content-Length' in environ:
|
||||
environ['CONTENT_LENGTH'] = environ[
|
||||
'Content-Length'] # necessary for POST to work with Django
|
||||
environ['wsgi.input'] = req.body
|
||||
|
||||
if debug: print "ENVIRON: %r\n" % environ
|
||||
if debug:
|
||||
print "ENVIRON: %r\n" % environ
|
||||
|
||||
# SimpleHandler needs file-like stream objects for
|
||||
# requests, errors and responses
|
||||
@@ -230,7 +247,8 @@ def mongrel2_handler(application,conn,debug=False):
|
||||
respIO = StringIO.StringIO()
|
||||
|
||||
# execute the application
|
||||
handler = SimpleHandler(reqIO, respIO, errIO, environ, multithread = False, multiprocess = False)
|
||||
handler = SimpleHandler(reqIO, respIO, errIO, environ,
|
||||
multithread=False, multiprocess=False)
|
||||
handler.run(application)
|
||||
|
||||
# Get the response and filter out the response (=data) itself,
|
||||
@@ -254,11 +272,15 @@ def mongrel2_handler(application,conn,debug=False):
|
||||
errors = errIO.getvalue()
|
||||
|
||||
# return the response
|
||||
if debug: print "RESPONSE: %r\n" % response
|
||||
if debug:
|
||||
print "RESPONSE: %r\n" % response
|
||||
if errors:
|
||||
if debug: print "ERRORS: %r" % errors
|
||||
if debug:
|
||||
print "ERRORS: %r" % errors
|
||||
data = "%s\r\n\r\n%s" % (data, errors)
|
||||
conn.reply_http(req, data, code = code, status = status, headers = headers)
|
||||
conn.reply_http(
|
||||
req, data, code=code, status=status, headers=headers)
|
||||
|
||||
|
||||
def main():
|
||||
usage = "python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P"
|
||||
@@ -278,7 +300,7 @@ def main():
|
||||
default=False,
|
||||
dest='profiler',
|
||||
help='profiler filename')
|
||||
servers = ', '.join(x for x in dir(Servers) if not x[0]=='_')
|
||||
servers = ', '.join(x for x in dir(Servers) if not x[0] == '_')
|
||||
parser.add_option('-s',
|
||||
'--server',
|
||||
default='rocket',
|
||||
@@ -300,13 +322,10 @@ def main():
|
||||
dest='workers',
|
||||
help='number of workers number')
|
||||
(options, args) = parser.parse_args()
|
||||
print 'starting %s on %s:%s...' % (options.server,options.ip,options.port)
|
||||
run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
|
||||
print 'starting %s on %s:%s...' % (
|
||||
options.server, options.ip, options.port)
|
||||
run(options.server, options.ip, options.port,
|
||||
logging=options.logging, profiler=options.profiler)
|
||||
|
||||
if __name__=='__main__':
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ skip_files: |
|
||||
|
||||
builtins:
|
||||
- remote_api: on
|
||||
- datastore_admin: on
|
||||
- appstats: on
|
||||
- admin_redirect: on
|
||||
- deferred: on
|
||||
|
||||
@@ -2,8 +2,3 @@ def webapp_add_wsgi_middleware(app):
|
||||
from google.appengine.ext.appstats import recording
|
||||
app = recording.appstats_wsgi_middleware(app)
|
||||
return app
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ remote_addr = request.env.remote_addr
|
||||
try:
|
||||
hosts = (http_host, socket.gethostname(),
|
||||
socket.gethostbyname(http_host),
|
||||
'::1','127.0.0.1','::ffff:127.0.0.1')
|
||||
'::1', '127.0.0.1', '::ffff:127.0.0.1')
|
||||
except:
|
||||
hosts = (http_host, )
|
||||
|
||||
@@ -32,10 +32,10 @@ if request.env.http_x_forwarded_for or request.is_https:
|
||||
elif (remote_addr not in hosts) and (remote_addr != "127.0.0.1"):
|
||||
raise HTTP(200, T('appadmin is disabled because insecure channel'))
|
||||
|
||||
if (request.application=='admin' and not session.authorized) or \
|
||||
(request.application!='admin' and not gluon.fileutils.check_credentials(request)):
|
||||
if (request.application == 'admin' and not session.authorized) or \
|
||||
(request.application != 'admin' and not gluon.fileutils.check_credentials(request)):
|
||||
redirect(URL('admin', 'default', 'index',
|
||||
vars=dict(send=URL(args=request.args,vars=request.vars))))
|
||||
vars=dict(send=URL(args=request.args, vars=request.vars))))
|
||||
|
||||
ignore_rw = True
|
||||
response.view = 'appadmin.html'
|
||||
@@ -95,25 +95,23 @@ def get_query(request):
|
||||
return None
|
||||
|
||||
|
||||
def query_by_table_type(tablename,db,request=request):
|
||||
keyed = hasattr(db[tablename],'_primarykey')
|
||||
def query_by_table_type(tablename, db, request=request):
|
||||
keyed = hasattr(db[tablename], '_primarykey')
|
||||
if keyed:
|
||||
firstkey = db[tablename][db[tablename]._primarykey[0]]
|
||||
cond = '>0'
|
||||
if firstkey.type in ['string', 'text']:
|
||||
cond = '!=""'
|
||||
qry = '%s.%s.%s%s' % (request.args[0], request.args[1], firstkey.name, cond)
|
||||
qry = '%s.%s.%s%s' % (
|
||||
request.args[0], request.args[1], firstkey.name, cond)
|
||||
else:
|
||||
qry = '%s.%s.id>0' % tuple(request.args[:2])
|
||||
return qry
|
||||
|
||||
|
||||
|
||||
# ##########################################################
|
||||
# ## list all databases and tables
|
||||
# ###########################################################
|
||||
|
||||
|
||||
def index():
|
||||
return dict(databases=databases)
|
||||
|
||||
@@ -128,7 +126,7 @@ def insert():
|
||||
form = SQLFORM(db[table], ignore_rw=ignore_rw)
|
||||
if form.accepts(request.vars, session):
|
||||
response.flash = T('new record inserted')
|
||||
return dict(form=form,table=db[table])
|
||||
return dict(form=form, table=db[table])
|
||||
|
||||
|
||||
# ##########################################################
|
||||
@@ -139,7 +137,8 @@ def insert():
|
||||
def download():
|
||||
import os
|
||||
db = get_database(request)
|
||||
return response.download(request,db)
|
||||
return response.download(request, db)
|
||||
|
||||
|
||||
def csv():
|
||||
import gluon.contenttype
|
||||
@@ -150,26 +149,27 @@ def csv():
|
||||
if not query:
|
||||
return None
|
||||
response.headers['Content-disposition'] = 'attachment; filename=%s_%s.csv'\
|
||||
% tuple(request.vars.query.split('.')[:2])
|
||||
return str(db(query,ignore_common_filters=True).select())
|
||||
% tuple(request.vars.query.split('.')[:2])
|
||||
return str(db(query, ignore_common_filters=True).select())
|
||||
|
||||
|
||||
def import_csv(table, file):
|
||||
table.import_from_csv_file(file)
|
||||
|
||||
|
||||
def select():
|
||||
import re
|
||||
db = get_database(request)
|
||||
dbname = request.args[0]
|
||||
regex = re.compile('(?P<table>\w+)\.(?P<field>\w+)=(?P<value>\d+)')
|
||||
if len(request.args)>1 and hasattr(db[request.args[1]],'_primarykey'):
|
||||
if len(request.args) > 1 and hasattr(db[request.args[1]], '_primarykey'):
|
||||
regex = re.compile('(?P<table>\w+)\.(?P<field>\w+)=(?P<value>.+)')
|
||||
if request.vars.query:
|
||||
match = regex.match(request.vars.query)
|
||||
if match:
|
||||
request.vars.query = '%s.%s.%s==%s' % (request.args[0],
|
||||
match.group('table'), match.group('field'),
|
||||
match.group('value'))
|
||||
match.group('table'), match.group('field'),
|
||||
match.group('value'))
|
||||
else:
|
||||
request.vars.query = session.last_query
|
||||
query = get_query(request)
|
||||
@@ -193,14 +193,17 @@ def select():
|
||||
session.last_query = request.vars.query
|
||||
form = FORM(TABLE(TR(T('Query:'), '', INPUT(_style='width:400px',
|
||||
_name='query', _value=request.vars.query or '',
|
||||
requires=IS_NOT_EMPTY(error_message=T("Cannot be empty")))), TR(T('Update:'),
|
||||
requires=IS_NOT_EMPTY(
|
||||
error_message=T("Cannot be empty")))), TR(T('Update:'),
|
||||
INPUT(_name='update_check', _type='checkbox',
|
||||
value=False), INPUT(_style='width:400px',
|
||||
_name='update_fields', _value=request.vars.update_fields
|
||||
or '')), TR(T('Delete:'), INPUT(_name='delete_check',
|
||||
or '')), TR(T('Delete:'), INPUT(_name='delete_check',
|
||||
_class='delete', _type='checkbox', value=False), ''),
|
||||
TR('', '', INPUT(_type='submit', _value=T('submit')))),
|
||||
_action=URL(r=request,args=request.args))
|
||||
_action=URL(r=request, args=request.args))
|
||||
|
||||
tb = None
|
||||
if form.accepts(request.vars, formname=None):
|
||||
regex = re.compile(request.args[0] + '\.(?P<table>\w+)\..+')
|
||||
match = regex.match(form.vars.query.strip())
|
||||
@@ -210,26 +213,30 @@ def select():
|
||||
nrows = db(query).count()
|
||||
if form.vars.update_check and form.vars.update_fields:
|
||||
db(query).update(**eval_in_global_env('dict(%s)'
|
||||
% form.vars.update_fields))
|
||||
% form.vars.update_fields))
|
||||
response.flash = T('%s %%{row} updated', nrows)
|
||||
elif form.vars.delete_check:
|
||||
db(query).delete()
|
||||
response.flash = T('%s %%{row} deleted', nrows)
|
||||
nrows = db(query).count()
|
||||
if orderby:
|
||||
rows = db(query,ignore_common_filters=True).select(limitby=(start, stop), orderby=eval_in_global_env(orderby))
|
||||
rows = db(query, ignore_common_filters=True).select(limitby=(
|
||||
start, stop), orderby=eval_in_global_env(orderby))
|
||||
else:
|
||||
rows = db(query,ignore_common_filters=True).select(limitby=(start, stop))
|
||||
rows = db(query, ignore_common_filters=True).select(
|
||||
limitby=(start, stop))
|
||||
except Exception, e:
|
||||
import traceback
|
||||
tb = traceback.format_exc()
|
||||
(rows, nrows) = ([], 0)
|
||||
response.flash = DIV(T('Invalid Query'),PRE(str(e)))
|
||||
response.flash = DIV(T('Invalid Query'), PRE(str(e)))
|
||||
# begin handle upload csv
|
||||
csv_table = table or request.vars.table
|
||||
if csv_table:
|
||||
formcsv = FORM(str(T('or import from csv file'))+" ",
|
||||
INPUT(_type='file',_name='csvfile'),
|
||||
INPUT(_type='hidden',_value=csv_table,_name='table'),
|
||||
INPUT(_type='submit',_value=T('import')))
|
||||
formcsv = FORM(str(T('or import from csv file')) + " ",
|
||||
INPUT(_type='file', _name='csvfile'),
|
||||
INPUT(_type='hidden', _value=csv_table, _name='table'),
|
||||
INPUT(_type='submit', _value=T('import')))
|
||||
else:
|
||||
formcsv = None
|
||||
if formcsv and formcsv.process().accepted:
|
||||
@@ -238,7 +245,7 @@ def select():
|
||||
request.vars.csvfile.file)
|
||||
response.flash = T('data uploaded')
|
||||
except Exception, e:
|
||||
response.flash = DIV(T('unable to parse csv file'),PRE(str(e)))
|
||||
response.flash = DIV(T('unable to parse csv file'), PRE(str(e)))
|
||||
# end handle upload csv
|
||||
|
||||
return dict(
|
||||
@@ -249,8 +256,9 @@ def select():
|
||||
nrows=nrows,
|
||||
rows=rows,
|
||||
query=request.vars.query,
|
||||
formcsv = formcsv,
|
||||
)
|
||||
formcsv=formcsv,
|
||||
tb=tb,
|
||||
)
|
||||
|
||||
|
||||
# ##########################################################
|
||||
@@ -260,14 +268,16 @@ def select():
|
||||
|
||||
def update():
|
||||
(db, table) = get_table(request)
|
||||
keyed = hasattr(db[table],'_primarykey')
|
||||
keyed = hasattr(db[table], '_primarykey')
|
||||
record = None
|
||||
if keyed:
|
||||
key = [f for f in request.vars if f in db[table]._primarykey]
|
||||
if key:
|
||||
record = db(db[table][key[0]] == request.vars[key[0]], ignore_common_filters=True).select().first()
|
||||
record = db(db[table][key[0]] == request.vars[key[
|
||||
0]], ignore_common_filters=True).select().first()
|
||||
else:
|
||||
record = db(db[table].id == request.args(2),ignore_common_filters=True).select().first()
|
||||
record = db(db[table].id == request.args(
|
||||
2), ignore_common_filters=True).select().first()
|
||||
|
||||
if not record:
|
||||
qry = query_by_table_type(table, db)
|
||||
@@ -277,20 +287,21 @@ def update():
|
||||
|
||||
if keyed:
|
||||
for k in db[table]._primarykey:
|
||||
db[table][k].writable=False
|
||||
db[table][k].writable = False
|
||||
|
||||
form = SQLFORM(db[table], record, deletable=True, delete_label=T('Check to delete'),
|
||||
ignore_rw=ignore_rw and not keyed,
|
||||
linkto=URL('select',
|
||||
form = SQLFORM(
|
||||
db[table], record, deletable=True, delete_label=T('Check to delete'),
|
||||
ignore_rw=ignore_rw and not keyed,
|
||||
linkto=URL('select',
|
||||
args=request.args[:1]), upload=URL(r=request,
|
||||
f='download', args=request.args[:1]))
|
||||
f='download', args=request.args[:1]))
|
||||
|
||||
if form.accepts(request.vars, session):
|
||||
session.flash = T('done!')
|
||||
qry = query_by_table_type(table, db)
|
||||
redirect(URL('select', args=request.args[:1],
|
||||
vars=dict(query=qry)))
|
||||
return dict(form=form,table=db[table])
|
||||
return dict(form=form, table=db[table])
|
||||
|
||||
|
||||
# ##########################################################
|
||||
@@ -301,11 +312,15 @@ def update():
|
||||
def state():
|
||||
return dict()
|
||||
|
||||
|
||||
def ccache():
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
|
||||
if form.accepts(request.vars, session):
|
||||
@@ -329,11 +344,16 @@ def ccache():
|
||||
redirect(URL(r=request))
|
||||
|
||||
try:
|
||||
from guppy import hpy; hp=hpy()
|
||||
from guppy import hpy
|
||||
hp = hpy()
|
||||
except ImportError:
|
||||
hp = False
|
||||
|
||||
import shelve, os, copy, time, math
|
||||
import shelve
|
||||
import os
|
||||
import copy
|
||||
import time
|
||||
import math
|
||||
from gluon import portalocker
|
||||
|
||||
ram = {
|
||||
@@ -376,11 +396,13 @@ def ccache():
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
|
||||
locker = open(os.path.join(request.folder,
|
||||
'cache/cache.lock'), 'a')
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(os.path.join(request.folder, 'cache/cache.shelve'))
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if isinstance(value, dict):
|
||||
@@ -411,7 +433,8 @@ def ccache():
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] + total['misses'])
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['misses'])
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
|
||||
@@ -437,6 +460,3 @@ def ccache():
|
||||
|
||||
return dict(form=form, total=total,
|
||||
ram=ram, disk=disk, object_stats=hp != False)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,35 +5,39 @@ import gluon.contrib.shell
|
||||
import gluon.dal
|
||||
import gluon.html
|
||||
import gluon.validators
|
||||
import code, thread
|
||||
import code
|
||||
import thread
|
||||
from gluon.debug import communicate, web_debugger, qdb_debugger
|
||||
import pydoc
|
||||
|
||||
|
||||
if DEMO_MODE or MULTI_USER_MODE:
|
||||
session.flash = T('disabled in demo mode')
|
||||
redirect(URL('default','site'))
|
||||
redirect(URL('default', 'site'))
|
||||
|
||||
FE = 10 ** 9
|
||||
|
||||
FE=10**9
|
||||
|
||||
def index():
|
||||
app = request.args(0) or 'admin'
|
||||
reset()
|
||||
# read buffer
|
||||
data = communicate()
|
||||
return dict(app=app,data=data)
|
||||
return dict(app=app, data=data)
|
||||
|
||||
|
||||
def callback():
|
||||
app = request.args[0]
|
||||
command = request.vars.statement
|
||||
session['debug_commands:'+app].append(command)
|
||||
session['debug_commands:' + app].append(command)
|
||||
output = communicate(command)
|
||||
k = len(session['debug_commands:'+app]) - 1
|
||||
k = len(session['debug_commands:' + app]) - 1
|
||||
return '[%i] %s%s\n' % (k + 1, command, output)
|
||||
|
||||
|
||||
def reset():
|
||||
app = request.args(0) or 'admin'
|
||||
session['debug_commands:'+app] = []
|
||||
session['debug_commands:' + app] = []
|
||||
return 'done'
|
||||
|
||||
|
||||
@@ -50,9 +54,9 @@ def interact():
|
||||
filename = web_debugger.filename
|
||||
lineno = web_debugger.lineno
|
||||
if filename:
|
||||
lines = dict([(i+1, l) for (i, l) in enumerate(
|
||||
[l.strip("\n").strip("\r") for l
|
||||
in open(filename).readlines()])])
|
||||
lines = dict([(i + 1, l) for (i, l) in enumerate(
|
||||
[l.strip("\n").strip("\r") for l
|
||||
in open(filename).readlines()])])
|
||||
filename = os.path.basename(filename)
|
||||
else:
|
||||
lines = {}
|
||||
@@ -64,8 +68,8 @@ def interact():
|
||||
f_globals = {}
|
||||
for name, value in env['globals'].items():
|
||||
if name not in gluon.html.__all__ and \
|
||||
name not in gluon.validators.__all__ and \
|
||||
name not in gluon.dal.__all__:
|
||||
name not in gluon.validators.__all__ and \
|
||||
name not in gluon.dal.__all__:
|
||||
f_globals[name] = pydoc.text.repr(value)
|
||||
else:
|
||||
f_locals = {}
|
||||
@@ -76,42 +80,48 @@ def interact():
|
||||
response.flash = T('"User Exception" debug mode. '
|
||||
'An error ticket could be issued!')
|
||||
|
||||
return dict(app=app, data="",
|
||||
filename=web_debugger.filename, lines=lines, lineno=lineno,
|
||||
f_globals=f_globals, f_locals=f_locals,
|
||||
return dict(app=app, data="",
|
||||
filename=web_debugger.filename, lines=lines, lineno=lineno,
|
||||
f_globals=f_globals, f_locals=f_locals,
|
||||
exception=web_debugger.exception_info)
|
||||
|
||||
|
||||
def step():
|
||||
web_debugger.do_step()
|
||||
redirect(URL("interact"))
|
||||
|
||||
|
||||
def next():
|
||||
web_debugger.do_next()
|
||||
redirect(URL("interact"))
|
||||
|
||||
|
||||
def cont():
|
||||
web_debugger.do_continue()
|
||||
redirect(URL("interact"))
|
||||
|
||||
|
||||
def ret():
|
||||
web_debugger.do_return()
|
||||
redirect(URL("interact"))
|
||||
|
||||
|
||||
def stop():
|
||||
web_debugger.do_quit()
|
||||
redirect(URL("interact"))
|
||||
|
||||
|
||||
def execute():
|
||||
app = request.args[0]
|
||||
command = request.vars.statement
|
||||
session['debug_commands:'+app].append(command)
|
||||
session['debug_commands:' + app].append(command)
|
||||
try:
|
||||
output = web_debugger.do_exec(command)
|
||||
if output is None:
|
||||
output = ""
|
||||
except Exception, e:
|
||||
output = T("Exception %s") % str(e)
|
||||
k = len(session['debug_commands:'+app]) - 1
|
||||
output = T("Exception %s") % str(e)
|
||||
k = len(session['debug_commands:' + app]) - 1
|
||||
return '[%i] %s%s\n' % (k + 1, command, output)
|
||||
|
||||
|
||||
@@ -120,52 +130,54 @@ def breakpoints():
|
||||
|
||||
# Get all .py files
|
||||
files = listdir(apath('', r=request), '.*\.py$')
|
||||
files = [filename for filename in files
|
||||
if filename and 'languages' not in filename
|
||||
and not filename.startswith("admin")
|
||||
and not filename.startswith("examples")]
|
||||
files = [filename for filename in files
|
||||
if filename and 'languages' not in filename
|
||||
and not filename.startswith("admin")
|
||||
and not filename.startswith("examples")]
|
||||
|
||||
form = SQLFORM.factory(
|
||||
Field('filename', requires=IS_IN_SET(files), label=T("Filename")),
|
||||
Field('lineno', 'integer', label=T("Line number"),
|
||||
requires=IS_NOT_EMPTY()),
|
||||
Field('temporary', 'boolean', label=T("Temporary"),
|
||||
Field('temporary', 'boolean', label=T("Temporary"),
|
||||
comment=T("deleted after first hit")),
|
||||
Field('condition', 'string', label=T("Condition"),
|
||||
comment=T("honored only if the expression evaluates to true")),
|
||||
)
|
||||
)
|
||||
|
||||
if form.accepts(request.vars, session):
|
||||
filename = os.path.join(request.env['applications_parent'],
|
||||
filename = os.path.join(request.env['applications_parent'],
|
||||
'applications', form.vars.filename)
|
||||
err = qdb_debugger.do_set_breakpoint(filename,
|
||||
form.vars.lineno,
|
||||
form.vars.temporary,
|
||||
form.vars.condition)
|
||||
err = qdb_debugger.do_set_breakpoint(filename,
|
||||
form.vars.lineno,
|
||||
form.vars.temporary,
|
||||
form.vars.condition)
|
||||
response.flash = T("Set Breakpoint on %s at line %s: %s") % (
|
||||
filename, form.vars.lineno, err or T('successful'))
|
||||
filename, form.vars.lineno, err or T('successful'))
|
||||
|
||||
for item in request.vars:
|
||||
if item[:7] == 'delete_':
|
||||
qdb_debugger.do_clear(item[7:])
|
||||
|
||||
breakpoints = [{'number': bp[0], 'filename': os.path.basename(bp[1]),
|
||||
'path': bp[1], 'lineno': bp[2],
|
||||
'temporary': bp[3], 'enabled': bp[4], 'hits': bp[5],
|
||||
'condition': bp[6]}
|
||||
for bp in qdb_debugger.do_list_breakpoint()]
|
||||
'path': bp[1], 'lineno': bp[2],
|
||||
'temporary': bp[3], 'enabled': bp[4], 'hits': bp[5],
|
||||
'condition': bp[6]}
|
||||
for bp in qdb_debugger.do_list_breakpoint()]
|
||||
|
||||
return dict(breakpoints=breakpoints, form=form)
|
||||
|
||||
|
||||
def toggle_breakpoint():
|
||||
"Set or clear a breakpoint"
|
||||
|
||||
|
||||
lineno = None
|
||||
ok = None
|
||||
try:
|
||||
filename = os.path.join(request.env['applications_parent'],
|
||||
filename = os.path.join(request.env['applications_parent'],
|
||||
'applications', request.vars.filename)
|
||||
# normalize path name: replace slashes, references, etc...
|
||||
filename = os.path.normpath(os.path.normcase(filename))
|
||||
if not request.vars.data:
|
||||
# ace send us the line number!
|
||||
lineno = int(request.vars.sel_start) + 1
|
||||
@@ -182,20 +194,21 @@ def toggle_breakpoint():
|
||||
if lineno is not None:
|
||||
for bp in qdb_debugger.do_list_breakpoint():
|
||||
no, bp_filename, bp_lineno, temporary, enabled, hits, cond = bp
|
||||
# normalize path name: replace slashes, references, etc...
|
||||
bp_filename = os.path.normpath(os.path.normcase(bp_filename))
|
||||
if filename == bp_filename and lineno == bp_lineno:
|
||||
err = qdb_debugger.do_clear_breakpoint(filename, lineno)
|
||||
response.flash = T("Removed Breakpoint on %s at line %s", (
|
||||
filename, lineno))
|
||||
response.flash = T("Removed Breakpoint on %s at line %s", (
|
||||
filename, lineno))
|
||||
ok = False
|
||||
break
|
||||
else:
|
||||
err = qdb_debugger.do_set_breakpoint(filename, lineno)
|
||||
response.flash = T("Set Breakpoint on %s at line %s: %s") % (
|
||||
filename, lineno, err or T('successful'))
|
||||
filename, lineno, err or T('successful'))
|
||||
ok = True
|
||||
else:
|
||||
response.flash = T("Unable to determine the line number!")
|
||||
except Exception, e:
|
||||
session.flash = str(e)
|
||||
return response.json({'ok': ok, 'lineno': lineno})
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,85 +9,92 @@ try:
|
||||
import shutil
|
||||
from gluon.fileutils import read_file, write_file
|
||||
except:
|
||||
session.flash='sorry, only on Unix systems'
|
||||
redirect(URL(request.application,'default','site'))
|
||||
session.flash = 'sorry, only on Unix systems'
|
||||
redirect(URL(request.application, 'default', 'site'))
|
||||
|
||||
if MULTI_USER_MODE and not is_manager():
|
||||
session.flash = 'Not Authorized'
|
||||
redirect(URL('default','site'))
|
||||
redirect(URL('default', 'site'))
|
||||
|
||||
forever = 10 ** 8
|
||||
|
||||
forever=10**8
|
||||
|
||||
def kill():
|
||||
p = cache.ram('gae_upload',lambda:None,forever)
|
||||
if not p or p.poll()!=None:
|
||||
p = cache.ram('gae_upload', lambda: None, forever)
|
||||
if not p or p.poll() is not None:
|
||||
return 'oops'
|
||||
os.kill(p.pid, signal.SIGKILL)
|
||||
cache.ram('gae_upload',lambda:None,-1)
|
||||
cache.ram('gae_upload', lambda: None, -1)
|
||||
|
||||
|
||||
class EXISTS(object):
|
||||
def __init__(self, error_message='file not found'):
|
||||
self.error_message = error_message
|
||||
|
||||
def __call__(self, value):
|
||||
if os.path.exists(value):
|
||||
return (value,None)
|
||||
return (value,self.error_message)
|
||||
return (value, None)
|
||||
return (value, self.error_message)
|
||||
|
||||
|
||||
def deploy():
|
||||
regex = re.compile('^\w+$')
|
||||
apps = sorted(file for file in os.listdir(apath(r=request)) if regex.match(file))
|
||||
apps = sorted(
|
||||
file for file in os.listdir(apath(r=request)) if regex.match(file))
|
||||
form = SQLFORM.factory(
|
||||
Field('appcfg',default=GAE_APPCFG,label=T('Path to appcfg.py'),
|
||||
Field('appcfg', default=GAE_APPCFG, label=T('Path to appcfg.py'),
|
||||
requires=EXISTS(error_message=T('file not found'))),
|
||||
Field('google_application_id',requires=IS_ALPHANUMERIC(),label=T('Google Application Id')),
|
||||
Field('applications','list:string',
|
||||
requires=IS_IN_SET(apps,multiple=True),
|
||||
Field('google_application_id', requires=IS_MATCH(
|
||||
'[\w\-]+'), label=T('Google Application Id')),
|
||||
Field('applications', 'list:string',
|
||||
requires=IS_IN_SET(apps, multiple=True),
|
||||
label=T('web2py apps to deploy')),
|
||||
Field('email',requires=IS_EMAIL(),label=T('GAE Email')),
|
||||
Field('password','password',requires=IS_NOT_EMPTY(),label=T('GAE Password')))
|
||||
cmd = output = errors= ""
|
||||
if form.accepts(request,session):
|
||||
Field('email', requires=IS_EMAIL(), label=T('GAE Email')),
|
||||
Field('password', 'password', requires=IS_NOT_EMPTY(), label=T('GAE Password')))
|
||||
cmd = output = errors = ""
|
||||
if form.accepts(request, session):
|
||||
try:
|
||||
kill()
|
||||
except:
|
||||
pass
|
||||
ignore_apps = [item for item in apps \
|
||||
if not item in form.vars.applications]
|
||||
ignore_apps = [item for item in apps
|
||||
if not item in form.vars.applications]
|
||||
regex = re.compile('\(applications/\(.*')
|
||||
yaml = apath('../app.yaml', r=request)
|
||||
if not os.path.exists(yaml):
|
||||
example = apath('../app.example.yaml', r=request)
|
||||
shutil.copyfile(example,yaml)
|
||||
shutil.copyfile(example, yaml)
|
||||
data = read_file(yaml)
|
||||
data = re.sub('application:.*','application: %s' % form.vars.google_application_id,data)
|
||||
data = regex.sub('(applications/(%s)/.*)|' % '|'.join(ignore_apps),data)
|
||||
data = re.sub('application:.*', 'application: %s' %
|
||||
form.vars.google_application_id, data)
|
||||
data = regex.sub(
|
||||
'(applications/(%s)/.*)|' % '|'.join(ignore_apps), data)
|
||||
write_file(yaml, data)
|
||||
|
||||
path = request.env.applications_parent
|
||||
cmd = '%s --email=%s --passin update %s' % \
|
||||
(form.vars.appcfg, form.vars.email, path)
|
||||
p = cache.ram('gae_upload',
|
||||
lambda s=subprocess,c=cmd:s.Popen(c, shell=True,
|
||||
stdin=s.PIPE,
|
||||
stdout=s.PIPE,
|
||||
stderr=s.PIPE, close_fds=True),-1)
|
||||
p.stdin.write(form.vars.password+'\n')
|
||||
lambda s=subprocess, c=cmd: s.Popen(c, shell=True,
|
||||
stdin=s.PIPE,
|
||||
stdout=s.PIPE,
|
||||
stderr=s.PIPE, close_fds=True), -1)
|
||||
p.stdin.write(form.vars.password + '\n')
|
||||
fcntl.fcntl(p.stdout.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
|
||||
fcntl.fcntl(p.stderr.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
|
||||
return dict(form=form,command=cmd)
|
||||
return dict(form=form, command=cmd)
|
||||
|
||||
|
||||
def callback():
|
||||
p = cache.ram('gae_upload',lambda:None,forever)
|
||||
if not p or p.poll()!=None:
|
||||
p = cache.ram('gae_upload', lambda: None, forever)
|
||||
if not p or p.poll() is not None:
|
||||
return '<done/>'
|
||||
try:
|
||||
output = p.stdout.read()
|
||||
except:
|
||||
output=''
|
||||
output = ''
|
||||
try:
|
||||
errors = p.stderr.read()
|
||||
except:
|
||||
errors=''
|
||||
return (output+errors).replace('\n','<br/>')
|
||||
|
||||
|
||||
errors = ''
|
||||
return (output + errors).replace('\n', '<br/>')
|
||||
|
||||
@@ -2,10 +2,10 @@ from gluon.fileutils import read_file, write_file
|
||||
|
||||
if DEMO_MODE or MULTI_USER_MODE:
|
||||
session.flash = T('disabled in demo mode')
|
||||
redirect(URL('default','site'))
|
||||
redirect(URL('default', 'site'))
|
||||
if not have_mercurial:
|
||||
session.flash=T("Sorry, could not find mercurial installed")
|
||||
redirect(URL('default','design',args=request.args(0)))
|
||||
session.flash = T("Sorry, could not find mercurial installed")
|
||||
redirect(URL('default', 'design', args=request.args(0)))
|
||||
|
||||
_hgignore_content = """\
|
||||
syntax: glob
|
||||
@@ -22,6 +22,7 @@ sessions/*
|
||||
errors/*
|
||||
"""
|
||||
|
||||
|
||||
def hg_repo(path):
|
||||
import os
|
||||
uio = ui.ui()
|
||||
@@ -37,13 +38,14 @@ def hg_repo(path):
|
||||
write_file(hgignore, _hgignore_content)
|
||||
return repo
|
||||
|
||||
|
||||
def commit():
|
||||
app = request.args(0)
|
||||
path = apath(app, r=request)
|
||||
repo = hg_repo(path)
|
||||
form = FORM('Comment:',INPUT(_name='comment',requires=IS_NOT_EMPTY()),
|
||||
INPUT(_type='submit',_value=T('Commit')))
|
||||
if form.accepts(request.vars,session):
|
||||
form = FORM('Comment:', INPUT(_name='comment', requires=IS_NOT_EMPTY()),
|
||||
INPUT(_type='submit', _value=T('Commit')))
|
||||
if form.accepts(request.vars, session):
|
||||
oldid = repo[repo.lookup('.')]
|
||||
addremove(repo)
|
||||
repo.commit(text=form.vars.comment)
|
||||
@@ -51,34 +53,33 @@ def commit():
|
||||
response.flash = 'no changes'
|
||||
try:
|
||||
files = TABLE(*[TR(file) for file in repo[repo.lookup('.')].files()])
|
||||
changes = TABLE(TR(TH('revision'),TH('description')))
|
||||
changes = TABLE(TR(TH('revision'), TH('description')))
|
||||
for change in repo.changelog:
|
||||
ctx=repo.changectx(change)
|
||||
ctx = repo.changectx(change)
|
||||
revision, description = ctx.rev(), ctx.description()
|
||||
changes.append(TR(A(revision,_href=URL('revision',
|
||||
args=(app,revision))),
|
||||
changes.append(TR(A(revision, _href=URL('revision',
|
||||
args=(app, revision))),
|
||||
description))
|
||||
except:
|
||||
files = []
|
||||
changes = []
|
||||
return dict(form=form,files=files,changes=changes,repo=repo)
|
||||
return dict(form=form, files=files, changes=changes, repo=repo)
|
||||
|
||||
|
||||
def revision():
|
||||
app = request.args(0)
|
||||
path = apath(app, r=request)
|
||||
repo = hg_repo(path)
|
||||
revision = request.args(1)
|
||||
ctx=repo.changectx(revision)
|
||||
form=FORM(INPUT(_type='submit',_value=T('Revert')))
|
||||
ctx = repo.changectx(revision)
|
||||
form = FORM(INPUT(_type='submit', _value=T('Revert')))
|
||||
if form.accepts(request.vars):
|
||||
hg.update(repo, revision)
|
||||
session.flash = "reverted to revision %s" % ctx.rev()
|
||||
redirect(URL('default','design',args=app))
|
||||
redirect(URL('default', 'design', args=app))
|
||||
return dict(
|
||||
files=ctx.files(),
|
||||
rev=str(ctx.rev()),
|
||||
desc=ctx.description(),
|
||||
form=form
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
import os
|
||||
from distutils import dir_util
|
||||
try:
|
||||
from distutils import dir_util
|
||||
except ImportError:
|
||||
session.flash = T('requires distutils, but not installed')
|
||||
redirect(URL('default', 'site'))
|
||||
try:
|
||||
from git import *
|
||||
except ImportError:
|
||||
session.flash = T('requires python-git, but not installed')
|
||||
redirect(URL('default','site'))
|
||||
redirect(URL('default', 'site'))
|
||||
|
||||
|
||||
def deploy():
|
||||
apps = sorted(file for file in os.listdir(apath(r=request)))
|
||||
form = SQLFORM.factory(
|
||||
Field('osrepo',default='/tmp',label=T('Path to local openshift repo root.'),
|
||||
requires=EXISTS(error_message=T('directory not found'))),
|
||||
Field('osname',default='web2py',label=T('WSGI reference name')),
|
||||
Field('applications','list:string',
|
||||
requires=IS_IN_SET(apps,multiple=True),
|
||||
Field(
|
||||
'osrepo', default='/tmp', label=T('Path to local openshift repo root.'),
|
||||
requires=EXISTS(error_message=T('directory not found'))),
|
||||
Field('osname', default='web2py', label=T('WSGI reference name')),
|
||||
Field('applications', 'list:string',
|
||||
requires=IS_IN_SET(apps, multiple=True),
|
||||
label=T('web2py apps to deploy')))
|
||||
|
||||
cmd = output = errors= ""
|
||||
if form.accepts(request,session):
|
||||
cmd = output = errors = ""
|
||||
if form.accepts(request, session):
|
||||
try:
|
||||
kill()
|
||||
except:
|
||||
pass
|
||||
|
||||
ignore_apps = [item for item in apps if not item in form.vars.applications]
|
||||
|
||||
ignore_apps = [
|
||||
item for item in apps if not item in form.vars.applications]
|
||||
regex = re.compile('\(applications/\(.*')
|
||||
w2p_origin = os.getcwd()
|
||||
osrepo = form.vars.osrepo
|
||||
@@ -34,23 +41,25 @@ def deploy():
|
||||
assert repo.bare == False
|
||||
|
||||
for i in form.vars.applications:
|
||||
appsrc = os.path.join(apath(r=request),i)
|
||||
appdest = os.path.join(osrepo,'wsgi',osname,'applications',i)
|
||||
dir_util.copy_tree(appsrc,appdest)
|
||||
appsrc = os.path.join(apath(r=request), i)
|
||||
appdest = os.path.join(osrepo, 'wsgi', osname, 'applications', i)
|
||||
dir_util.copy_tree(appsrc, appdest)
|
||||
#shutil.copytree(appsrc,appdest)
|
||||
index.add(['wsgi/'+osname+'/applications/'+i])
|
||||
index.add(['wsgi/' + osname + '/applications/' + i])
|
||||
new_commit = index.commit("Deploy from Web2py IDE")
|
||||
|
||||
|
||||
origin = repo.remotes.origin
|
||||
origin.push
|
||||
origin.push()
|
||||
#Git code ends here
|
||||
return dict(form=form,command=cmd)
|
||||
|
||||
return dict(form=form, command=cmd)
|
||||
|
||||
|
||||
class EXISTS(object):
|
||||
def __init__(self, error_message='file not found'):
|
||||
self.error_message = error_message
|
||||
|
||||
def __call__(self, value):
|
||||
if os.path.exists(value):
|
||||
return (value,None)
|
||||
return (value,self.error_message)
|
||||
return (value, None)
|
||||
return (value, self.error_message)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
response.files=response.files[:3]
|
||||
response.menu=[]
|
||||
response.files = response.files[:3]
|
||||
response.menu = []
|
||||
|
||||
|
||||
def index():
|
||||
return locals()
|
||||
|
||||
|
||||
def about():
|
||||
return locals()
|
||||
|
||||
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
import sys
|
||||
import cStringIO
|
||||
import gluon.contrib.shell
|
||||
import code, thread
|
||||
import code
|
||||
import thread
|
||||
from gluon.shell import env
|
||||
|
||||
if DEMO_MODE or MULTI_USER_MODE:
|
||||
session.flash = T('disabled in demo mode')
|
||||
redirect(URL('default','site'))
|
||||
redirect(URL('default', 'site'))
|
||||
|
||||
FE = 10 ** 9
|
||||
|
||||
FE=10**9
|
||||
|
||||
def index():
|
||||
app = request.args(0) or 'admin'
|
||||
reset()
|
||||
return dict(app=app)
|
||||
|
||||
|
||||
def callback():
|
||||
app = request.args[0]
|
||||
command = request.vars.statement
|
||||
escape = command[:1]!='!'
|
||||
history = session['history:'+app] = session.get('history:'+app,gluon.contrib.shell.History())
|
||||
escape = command[:1] != '!'
|
||||
history = session['history:' + app] = session.get(
|
||||
'history:' + app, gluon.contrib.shell.History())
|
||||
if not escape:
|
||||
command = command[1:]
|
||||
if command == '%reset':
|
||||
@@ -27,21 +31,20 @@ def callback():
|
||||
return '*** reset ***'
|
||||
elif command[0] == '%':
|
||||
try:
|
||||
command=session['commands:'+app][int(command[1:])]
|
||||
command = session['commands:' + app][int(command[1:])]
|
||||
except ValueError:
|
||||
return ''
|
||||
session['commands:'+app].append(command)
|
||||
environ=env(app,True)
|
||||
output = gluon.contrib.shell.run(history,command,environ)
|
||||
k = len(session['commands:'+app]) - 1
|
||||
session['commands:' + app].append(command)
|
||||
environ = env(app, True, extra_request=dict(is_https=request.is_https))
|
||||
output = gluon.contrib.shell.run(history, command, environ)
|
||||
k = len(session['commands:' + app]) - 1
|
||||
#output = PRE(output)
|
||||
#return TABLE(TR('In[%i]:'%k,PRE(command)),TR('Out[%i]:'%k,output))
|
||||
return 'In [%i] : %s%s\n' % (k + 1, command, output)
|
||||
|
||||
|
||||
def reset():
|
||||
app = request.args(0) or 'admin'
|
||||
session['commands:'+app] = []
|
||||
session['history:'+app] = gluon.contrib.shell.History()
|
||||
session['commands:' + app] = []
|
||||
session['history:' + app] = gluon.contrib.shell.History()
|
||||
return 'done'
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@ import os
|
||||
from gluon.settings import global_settings, read_file
|
||||
#
|
||||
|
||||
|
||||
def index():
|
||||
app = request.args(0)
|
||||
return dict(app=app)
|
||||
|
||||
|
||||
def profiler():
|
||||
"""
|
||||
to use the profiler start web2py with -F profiler.log
|
||||
@@ -19,13 +21,11 @@ def profiler():
|
||||
else:
|
||||
size = 0
|
||||
if os.path.exists(filename):
|
||||
data = read_file('profiler.log','rb')
|
||||
if size<len(data):
|
||||
data = read_file('profiler.log', 'rb')
|
||||
if size < len(data):
|
||||
data = data[size:]
|
||||
else:
|
||||
size=0
|
||||
size = 0
|
||||
size += len(data)
|
||||
response.cookies[KEY] = size
|
||||
return data
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ def list_apps():
|
||||
@service.jsonrpc
|
||||
def list_files(app, pattern='.*\.py$'):
|
||||
files = listdir(apath('%s/' % app, r=request), pattern)
|
||||
return [x.replace('\\','/') for x in files]
|
||||
return [x.replace('\\', '/') for x in files]
|
||||
|
||||
|
||||
@service.jsonrpc
|
||||
@@ -43,7 +43,7 @@ def read_file(filename, b64=False):
|
||||
try:
|
||||
data = f.read()
|
||||
if not b64:
|
||||
data = data.replace('\r','')
|
||||
data = data.replace('\r', '')
|
||||
else:
|
||||
data = base64.b64encode(data)
|
||||
finally:
|
||||
@@ -82,6 +82,7 @@ def install(app_name, filename, data, overwrite=True):
|
||||
|
||||
return installed
|
||||
|
||||
|
||||
@service.jsonrpc
|
||||
def attach_debugger(host='localhost', port=6000, authkey='secret password'):
|
||||
import gluon.contrib.qdb as qdb
|
||||
@@ -90,7 +91,7 @@ def attach_debugger(host='localhost', port=6000, authkey='secret password'):
|
||||
|
||||
if isinstance(authkey, unicode):
|
||||
authkey = authkey.encode('utf8')
|
||||
|
||||
|
||||
if not hasattr(gluon.debug, 'qdb_listener'):
|
||||
# create a remote debugger server and wait for connection
|
||||
address = (host, port) # family is deduced to be 'AF_INET'
|
||||
@@ -124,7 +125,7 @@ def detach_debugger():
|
||||
gluon.debug.qdb_debugger = None
|
||||
return True
|
||||
|
||||
|
||||
def call():
|
||||
session.forget()
|
||||
return service()
|
||||
|
||||
|
||||
@@ -1,64 +1,73 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, uuid, re, pickle, urllib, glob
|
||||
import os
|
||||
import uuid
|
||||
import re
|
||||
import pickle
|
||||
import urllib
|
||||
import glob
|
||||
from gluon.admin import app_create, plugin_install
|
||||
from gluon.fileutils import abspath, read_file, write_file
|
||||
|
||||
def reset(session):
|
||||
session.app={
|
||||
'name':'',
|
||||
'params':[('title','My New App'),
|
||||
('subtitle','powered by web2py'),
|
||||
('author','you'),
|
||||
('author_email','you@example.com'),
|
||||
('keywords',''),
|
||||
('description',''),
|
||||
('layout_theme','Default'),
|
||||
('database_uri','sqlite://storage.sqlite'),
|
||||
('security_key',str(uuid.uuid4())),
|
||||
('email_server','localhost'),
|
||||
('email_sender','you@example.com'),
|
||||
('email_login',''),
|
||||
('login_method','local'),
|
||||
('login_config',''),
|
||||
('plugins',[])],
|
||||
'tables':['auth_user'],
|
||||
'table_auth_user':['username','first_name',
|
||||
'last_name','email','password'],
|
||||
'pages':['index','error'],
|
||||
'page_index':'# Welcome to my new app',
|
||||
'page_error':'# Error: the document does not exist',
|
||||
}
|
||||
|
||||
if not session.app: reset(session)
|
||||
def reset(session):
|
||||
session.app = {
|
||||
'name': '',
|
||||
'params': [('title', 'My New App'),
|
||||
('subtitle', 'powered by web2py'),
|
||||
('author', 'you'),
|
||||
('author_email', 'you@example.com'),
|
||||
('keywords', ''),
|
||||
('description', ''),
|
||||
('layout_theme', 'Default'),
|
||||
('database_uri', 'sqlite://storage.sqlite'),
|
||||
('security_key', str(uuid.uuid4())),
|
||||
('email_server', 'localhost'),
|
||||
('email_sender', 'you@example.com'),
|
||||
('email_login', ''),
|
||||
('login_method', 'local'),
|
||||
('login_config', ''),
|
||||
('plugins', [])],
|
||||
'tables': ['auth_user'],
|
||||
'table_auth_user': ['username', 'first_name',
|
||||
'last_name', 'email', 'password'],
|
||||
'pages': ['index', 'error'],
|
||||
'page_index': '# Welcome to my new app',
|
||||
'page_error': '# Error: the document does not exist',
|
||||
}
|
||||
|
||||
if not session.app:
|
||||
reset(session)
|
||||
|
||||
|
||||
def listify(x):
|
||||
if not isinstance(x,(list,tuple)):
|
||||
if not isinstance(x, (list, tuple)):
|
||||
return x and [x] or []
|
||||
return x
|
||||
|
||||
|
||||
def clean(name):
|
||||
return re.sub('\W+','_',name.strip().lower())
|
||||
return re.sub('\W+', '_', name.strip().lower())
|
||||
|
||||
|
||||
def index():
|
||||
response.view='wizard/step.html'
|
||||
response.view = 'wizard/step.html'
|
||||
reset(session)
|
||||
apps=os.listdir(os.path.join(request.folder,'..'))
|
||||
form=SQLFORM.factory(Field('name',requires=[IS_NOT_EMPTY(),
|
||||
IS_ALPHANUMERIC()]))
|
||||
apps = os.listdir(os.path.join(request.folder, '..'))
|
||||
form = SQLFORM.factory(Field('name', requires=[IS_NOT_EMPTY(),
|
||||
IS_ALPHANUMERIC()]))
|
||||
if form.accepts(request.vars):
|
||||
app = form.vars.name
|
||||
session.app['name'] = app
|
||||
if MULTI_USER_MODE and db(db.app.name==app)\
|
||||
(db.app.owner!=auth.user.id).count():
|
||||
if MULTI_USER_MODE and db(db.app.name == app)(db.app.owner != auth.user.id).count():
|
||||
session.flash = 'App belongs already to other user'
|
||||
elif app in apps:
|
||||
meta = os.path.normpath(\
|
||||
meta = os.path.normpath(
|
||||
os.path.join(os.path.normpath(request.folder),
|
||||
'..',app,'wizard.metadata'))
|
||||
'..', app, 'wizard.metadata'))
|
||||
if os.path.exists(meta):
|
||||
try:
|
||||
metafile = open(meta,'rb')
|
||||
metafile = open(meta, 'rb')
|
||||
try:
|
||||
session.app = pickle.load(metafile)
|
||||
finally:
|
||||
@@ -67,14 +76,14 @@ def index():
|
||||
except:
|
||||
session.flash = T("The app exists, was NOT created by wizard, continue to overwrite!")
|
||||
redirect(URL('step1'))
|
||||
return dict(step='Start',form=form)
|
||||
return dict(step='Start', form=form)
|
||||
|
||||
|
||||
def step1():
|
||||
from gluon.contrib.simplejson import loads
|
||||
import urllib
|
||||
if not session.themes:
|
||||
url=LAYOUTS_APP+'/default/layouts.json'
|
||||
url = LAYOUTS_APP + '/default/layouts.json'
|
||||
try:
|
||||
data = urllib.urlopen(url).read()
|
||||
session.themes = ['Default'] + loads(data)['layouts']
|
||||
@@ -82,145 +91,158 @@ def step1():
|
||||
session.themes = ['Default']
|
||||
themes = session.themes
|
||||
if not session.plugins:
|
||||
url = PLUGINS_APP+'/default/plugins.json'
|
||||
url = PLUGINS_APP + '/default/plugins.json'
|
||||
try:
|
||||
data = urllib.urlopen(url).read()
|
||||
session.plugins = loads(data)['plugins']
|
||||
except:
|
||||
session.plugins = []
|
||||
plugins = [x.split('.')[2] for x in session.plugins]
|
||||
response.view='wizard/step.html'
|
||||
response.view = 'wizard/step.html'
|
||||
params = dict(session.app['params'])
|
||||
form=SQLFORM.factory(
|
||||
Field('title',default=params.get('title',None),
|
||||
requires=IS_NOT_EMPTY()),
|
||||
Field('subtitle',default=params.get('subtitle',None)),
|
||||
Field('author',default=params.get('author',None)),
|
||||
Field('author_email',default=params.get('author_email',None)),
|
||||
Field('keywords',default=params.get('keywords',None)),
|
||||
Field('description','text',
|
||||
default=params.get('description',None)),
|
||||
Field('layout_theme',requires=IS_IN_SET(themes),
|
||||
default=params.get('layout_theme',themes[0])),
|
||||
Field('database_uri',default=params.get('database_uri',None)),
|
||||
Field('security_key',default=params.get('security_key',None)),
|
||||
Field('email_server',default=params.get('email_server',None)),
|
||||
Field('email_sender',default=params.get('email_sender',None)),
|
||||
Field('email_login',default=params.get('email_login',None)),
|
||||
Field('login_method',requires=IS_IN_SET(('local','janrain')),
|
||||
default=params.get('login_method','local')),
|
||||
Field('login_config',default=params.get('login_config',None)),
|
||||
Field('plugins','list:string',requires=IS_IN_SET(plugins,multiple=True)))
|
||||
form = SQLFORM.factory(
|
||||
Field('title', default=params.get('title', None),
|
||||
requires=IS_NOT_EMPTY()),
|
||||
Field('subtitle', default=params.get('subtitle', None)),
|
||||
Field('author', default=params.get('author', None)),
|
||||
Field(
|
||||
'author_email', default=params.get('author_email', None)),
|
||||
Field('keywords', default=params.get('keywords', None)),
|
||||
Field('description', 'text',
|
||||
default=params.get('description', None)),
|
||||
Field('layout_theme', requires=IS_IN_SET(themes),
|
||||
default=params.get('layout_theme', themes[0])),
|
||||
Field(
|
||||
'database_uri', default=params.get('database_uri', None)),
|
||||
Field(
|
||||
'security_key', default=params.get('security_key', None)),
|
||||
Field(
|
||||
'email_server', default=params.get('email_server', None)),
|
||||
Field(
|
||||
'email_sender', default=params.get('email_sender', None)),
|
||||
Field('email_login', default=params.get('email_login', None)),
|
||||
Field('login_method', requires=IS_IN_SET(('local', 'janrain')),
|
||||
default=params.get('login_method', 'local')),
|
||||
Field(
|
||||
'login_config', default=params.get('login_config', None)),
|
||||
Field('plugins', 'list:string', requires=IS_IN_SET(plugins, multiple=True)))
|
||||
|
||||
if form.accepts(request.vars):
|
||||
session.app['params']=[(key,form.vars.get(key,None))
|
||||
for key,value in session.app['params']]
|
||||
session.app['params'] = [(key, form.vars.get(key, None))
|
||||
for key, value in session.app['params']]
|
||||
redirect(URL('step2'))
|
||||
return dict(step='1: Setting Parameters',form=form)
|
||||
return dict(step='1: Setting Parameters', form=form)
|
||||
|
||||
|
||||
def step2():
|
||||
response.view='wizard/step.html'
|
||||
form=SQLFORM.factory(Field('table_names','list:string',
|
||||
default=session.app['tables']))
|
||||
response.view = 'wizard/step.html'
|
||||
form = SQLFORM.factory(Field('table_names', 'list:string',
|
||||
default=session.app['tables']))
|
||||
if form.accepts(request.vars):
|
||||
table_names = [clean(t) for t in listify(form.vars.table_names) \
|
||||
if t.strip()]
|
||||
if [t for t in table_names if t.startswith('auth_') and \
|
||||
not t=='auth_user']:
|
||||
table_names = [clean(t) for t in listify(form.vars.table_names)
|
||||
if t.strip()]
|
||||
if [t for t in table_names if t.startswith('auth_') and
|
||||
not t == 'auth_user']:
|
||||
form.error.table_names = \
|
||||
T('invalid table names (auth_* tables already defined)')
|
||||
else:
|
||||
session.app['tables']=table_names
|
||||
session.app['tables'] = table_names
|
||||
for table in session.app['tables']:
|
||||
if not 'table_'+table in session.app:
|
||||
session.app['table_'+table]=['name']
|
||||
if not table=='auth_user':
|
||||
name = table+'_manage'
|
||||
if not 'table_' + table in session.app:
|
||||
session.app['table_' + table] = ['name']
|
||||
if not table == 'auth_user':
|
||||
name = table + '_manage'
|
||||
if not name in session.app['pages']:
|
||||
session.app['pages'].append(name)
|
||||
session.app['page_'+name] = \
|
||||
session.app['page_' + name] = \
|
||||
'## Manage %s\n\n{{=form}}' % (table)
|
||||
if session.app['tables']:
|
||||
redirect(URL('step3',args=0))
|
||||
redirect(URL('step3', args=0))
|
||||
else:
|
||||
redirect(URL('step4'))
|
||||
return dict(step='2: Tables',form=form)
|
||||
return dict(step='2: Tables', form=form)
|
||||
|
||||
|
||||
def step3():
|
||||
response.view='wizard/step.html'
|
||||
n=int(request.args(0) or 0)
|
||||
m=len(session.app['tables'])
|
||||
if n>=m: redirect(URL('step2'))
|
||||
table=session.app['tables'][n]
|
||||
form=SQLFORM.factory(Field('field_names','list:string',
|
||||
default=session.app.get('table_'+table,[])))
|
||||
response.view = 'wizard/step.html'
|
||||
n = int(request.args(0) or 0)
|
||||
m = len(session.app['tables'])
|
||||
if n >= m:
|
||||
redirect(URL('step2'))
|
||||
table = session.app['tables'][n]
|
||||
form = SQLFORM.factory(Field('field_names', 'list:string',
|
||||
default=session.app.get('table_' + table, [])))
|
||||
if form.accepts(request.vars) and form.vars.field_names:
|
||||
fields=listify(form.vars.field_names)
|
||||
if table=='auth_user':
|
||||
for field in ['first_name','last_name','username','email','password']:
|
||||
fields = listify(form.vars.field_names)
|
||||
if table == 'auth_user':
|
||||
for field in ['first_name', 'last_name', 'username', 'email', 'password']:
|
||||
if not field in fields:
|
||||
fields.append(field)
|
||||
session.app['table_'+table]=[t.strip().lower()
|
||||
for t in listify(form.vars.field_names)
|
||||
if t.strip()]
|
||||
session.app['table_' + table] = [t.strip().lower()
|
||||
for t in listify(form.vars.field_names)
|
||||
if t.strip()]
|
||||
try:
|
||||
tables=sort_tables(session.app['tables'])
|
||||
tables = sort_tables(session.app['tables'])
|
||||
except RuntimeError:
|
||||
response.flash=T('invalid circular reference')
|
||||
response.flash = T('invalid circular reference')
|
||||
else:
|
||||
if n<m-1:
|
||||
redirect(URL('step3',args=n+1))
|
||||
if n < m - 1:
|
||||
redirect(URL('step3', args=n + 1))
|
||||
else:
|
||||
redirect(URL('step4'))
|
||||
return dict(step='3: Fields for table "%s" (%s of %s)' \
|
||||
% (table,n+1,m),table=table,form=form)
|
||||
return dict(step='3: Fields for table "%s" (%s of %s)'
|
||||
% (table, n + 1, m), table=table, form=form)
|
||||
|
||||
|
||||
def step4():
|
||||
response.view='wizard/step.html'
|
||||
form=SQLFORM.factory(Field('pages','list:string',
|
||||
default=session.app['pages']))
|
||||
response.view = 'wizard/step.html'
|
||||
form = SQLFORM.factory(Field('pages', 'list:string',
|
||||
default=session.app['pages']))
|
||||
if form.accepts(request.vars):
|
||||
session.app['pages']=[clean(t)
|
||||
for t in listify(form.vars.pages)
|
||||
if t.strip()]
|
||||
session.app['pages'] = [clean(t)
|
||||
for t in listify(form.vars.pages)
|
||||
if t.strip()]
|
||||
if session.app['pages']:
|
||||
redirect(URL('step5',args=0))
|
||||
redirect(URL('step5', args=0))
|
||||
else:
|
||||
redirect(URL('step6'))
|
||||
return dict(step='4: Pages',form=form)
|
||||
return dict(step='4: Pages', form=form)
|
||||
|
||||
|
||||
def step5():
|
||||
response.view='wizard/step.html'
|
||||
n=int(request.args(0) or 0)
|
||||
m=len(session.app['pages'])
|
||||
if n>=m: redirect(URL('step4'))
|
||||
page=session.app['pages'][n]
|
||||
markmin_url='http://web2py.com/examples/static/markmin.html'
|
||||
form=SQLFORM.factory(Field('content','text',
|
||||
default=session.app.get('page_'+page,[]),
|
||||
comment=A('use markmin',
|
||||
_href=markmin_url,_target='_blank')),
|
||||
formstyle='table2cols')
|
||||
response.view = 'wizard/step.html'
|
||||
n = int(request.args(0) or 0)
|
||||
m = len(session.app['pages'])
|
||||
if n >= m:
|
||||
redirect(URL('step4'))
|
||||
page = session.app['pages'][n]
|
||||
markmin_url = 'http://web2py.com/examples/static/markmin.html'
|
||||
form = SQLFORM.factory(Field('content', 'text',
|
||||
default=session.app.get('page_' + page, []),
|
||||
comment=A('use markmin',
|
||||
_href=markmin_url, _target='_blank')),
|
||||
formstyle='table2cols')
|
||||
if form.accepts(request.vars):
|
||||
session.app['page_'+page]=form.vars.content
|
||||
if n<m-1:
|
||||
redirect(URL('step5',args=n+1))
|
||||
session.app['page_' + page] = form.vars.content
|
||||
if n < m - 1:
|
||||
redirect(URL('step5', args=n + 1))
|
||||
else:
|
||||
redirect(URL('step6'))
|
||||
return dict(step='5: View for page "%s" (%s of %s)' % (page,n+1,m),form=form)
|
||||
return dict(step='5: View for page "%s" (%s of %s)' % (page, n + 1, m), form=form)
|
||||
|
||||
|
||||
def step6():
|
||||
response.view='wizard/step.html'
|
||||
response.view = 'wizard/step.html'
|
||||
params = dict(session.app['params'])
|
||||
app = session.app['name']
|
||||
form=SQLFORM.factory(
|
||||
Field('generate_model','boolean',default=True),
|
||||
Field('generate_controller','boolean',default=True),
|
||||
Field('generate_views','boolean',default=True),
|
||||
Field('generate_menu','boolean',default=True),
|
||||
Field('apply_layout','boolean',default=True),
|
||||
Field('erase_database','boolean',default=True),
|
||||
Field('populate_database','boolean',default=True))
|
||||
form = SQLFORM.factory(
|
||||
Field('generate_model', 'boolean', default=True),
|
||||
Field('generate_controller', 'boolean', default=True),
|
||||
Field('generate_views', 'boolean', default=True),
|
||||
Field('generate_menu', 'boolean', default=True),
|
||||
Field('apply_layout', 'boolean', default=True),
|
||||
Field('erase_database', 'boolean', default=True),
|
||||
Field('populate_database', 'boolean', default=True))
|
||||
if form.accepts(request.vars):
|
||||
if DEMO_MODE:
|
||||
session.flash = T('Application cannot be generated in demo mode')
|
||||
@@ -228,159 +250,173 @@ def step6():
|
||||
create(form.vars)
|
||||
session.flash = 'Application %s created' % app
|
||||
redirect(URL('generated'))
|
||||
return dict(step='6: Generate app "%s"' % app,form=form)
|
||||
return dict(step='6: Generate app "%s"' % app, form=form)
|
||||
|
||||
|
||||
def generated():
|
||||
return dict(app=session.app['name'])
|
||||
|
||||
|
||||
def sort_tables(tables):
|
||||
import re
|
||||
regex = re.compile('(%s)' % '|'.join(tables))
|
||||
is_auth_user = 'auth_user' in tables
|
||||
d={}
|
||||
d = {}
|
||||
for table in tables:
|
||||
d[table]=[]
|
||||
d[table] = []
|
||||
for field in session.app['table_%s' % table]:
|
||||
d[table]+=regex.findall(field)
|
||||
tables=[]
|
||||
d[table] += regex.findall(field)
|
||||
tables = []
|
||||
if is_auth_user:
|
||||
tables.append('auth_user')
|
||||
def append(table,trail=[]):
|
||||
|
||||
def append(table, trail=[]):
|
||||
if table in trail:
|
||||
raise RuntimeError
|
||||
for t in d[table]:
|
||||
# if not t==table: (problem, no dropdown for self references)
|
||||
append(t,trail=trail+[table])
|
||||
append(t, trail=trail + [table])
|
||||
if not table in tables:
|
||||
tables.append(table)
|
||||
for table in d: append(table)
|
||||
for table in d:
|
||||
append(table)
|
||||
return tables
|
||||
|
||||
def make_table(table,fields):
|
||||
rawtable=table
|
||||
if table!='auth_user': table='t_'+table
|
||||
s=''
|
||||
s+='\n'+'#'*40+'\n'
|
||||
s+="db.define_table('%s',\n" % table
|
||||
first_field='id'
|
||||
|
||||
def make_table(table, fields):
|
||||
rawtable = table
|
||||
if table != 'auth_user':
|
||||
table = 't_' + table
|
||||
s = ''
|
||||
s += '\n' + '#' * 40 + '\n'
|
||||
s += "db.define_table('%s',\n" % table
|
||||
first_field = 'id'
|
||||
for field in fields:
|
||||
items=[x.lower() for x in field.split()]
|
||||
items = [x.lower() for x in field.split()]
|
||||
has = {}
|
||||
keys = []
|
||||
for key in ['notnull','unique','integer','double','boolean','float',
|
||||
'boolean', 'date','time','datetime','text','wiki',
|
||||
'html','file','upload','image','true',
|
||||
'hidden','readonly','writeonly','multiple',
|
||||
'notempty','required']:
|
||||
for key in ['notnull', 'unique', 'integer', 'double', 'boolean', 'float',
|
||||
'boolean', 'date', 'time', 'datetime', 'text', 'wiki',
|
||||
'html', 'file', 'upload', 'image', 'true',
|
||||
'hidden', 'readonly', 'writeonly', 'multiple',
|
||||
'notempty', 'required']:
|
||||
if key in items[1:]:
|
||||
keys.append(key)
|
||||
has[key] = True
|
||||
tables = session.app['tables']
|
||||
refs = [t for t in tables if t in items]
|
||||
items = items[:1] + [x for x in items[1:] \
|
||||
if not x in keys and not x in tables]
|
||||
items = items[:1] + [x for x in items[1:]
|
||||
if not x in keys and not x in tables]
|
||||
barename = name = '_'.join(items)
|
||||
if table[:2]=='t_': name='f_'+name
|
||||
if first_field=='id': first_field=name
|
||||
if table[:2] == 't_': name = 'f_' + name
|
||||
if first_field == 'id':
|
||||
first_field = name
|
||||
|
||||
### determine field type
|
||||
ftype='string'
|
||||
deftypes={'integer':'integer','double':'double','boolean':'boolean',
|
||||
'float':'double','bool':'boolean',
|
||||
'date':'date','time':'time','datetime':'datetime',
|
||||
'text':'text','file':'upload','image':'upload',
|
||||
'upload':'upload','wiki':'text', 'html':'text'}
|
||||
for key,t in deftypes.items():
|
||||
ftype = 'string'
|
||||
deftypes = {'integer': 'integer', 'double': 'double', 'boolean': 'boolean',
|
||||
'float': 'double', 'bool': 'boolean',
|
||||
'date': 'date', 'time': 'time', 'datetime': 'datetime',
|
||||
'text': 'text', 'file': 'upload', 'image': 'upload',
|
||||
'upload': 'upload', 'wiki': 'text', 'html': 'text'}
|
||||
for key, t in deftypes.items():
|
||||
if key in has:
|
||||
ftype = t
|
||||
if refs:
|
||||
key = refs[0]
|
||||
if not key=='auth_user': key='t_'+key
|
||||
if not key == 'auth_user':
|
||||
key = 't_' + key
|
||||
if 'multiple' in has:
|
||||
ftype='list:reference %s' % key
|
||||
ftype = 'list:reference %s' % key
|
||||
else:
|
||||
ftype='reference %s' % key
|
||||
if ftype=='string' and 'multiple' in has:
|
||||
ftype='list:string'
|
||||
elif ftype=='integer' and 'multiple' in has:
|
||||
ftype='list:integer'
|
||||
elif name=='password':
|
||||
ftype='password'
|
||||
s+=" Field('%s', type='%s'" % (name, ftype)
|
||||
ftype = 'reference %s' % key
|
||||
if ftype == 'string' and 'multiple' in has:
|
||||
ftype = 'list:string'
|
||||
elif ftype == 'integer' and 'multiple' in has:
|
||||
ftype = 'list:integer'
|
||||
elif name == 'password':
|
||||
ftype = 'password'
|
||||
s += " Field('%s', type='%s'" % (name, ftype)
|
||||
|
||||
### determine field attributes
|
||||
if 'notnull' in has or 'notempty' in has or 'required' in has:
|
||||
s+=', notnull=True'
|
||||
s += ', notnull=True'
|
||||
if 'unique' in has:
|
||||
s+=', unique=True'
|
||||
if ftype=='boolean' and 'true' in has:
|
||||
s+=",\n default=True"
|
||||
s += ', unique=True'
|
||||
if ftype == 'boolean' and 'true' in has:
|
||||
s += ",\n default=True"
|
||||
|
||||
### determine field representation
|
||||
elif 'wiki' in has:
|
||||
s+=",\n represent=lambda x, row: MARKMIN(x)"
|
||||
s+=",\n comment='WIKI (markmin)'"
|
||||
s += ",\n represent=lambda x, row: MARKMIN(x)"
|
||||
s += ",\n comment='WIKI (markmin)'"
|
||||
elif 'html' in has:
|
||||
s+=",\n represent=lambda x, row: XML(x,sanitize=True)"
|
||||
s+=",\n comment='HTML (sanitized)'"
|
||||
s += ",\n represent=lambda x, row: XML(x,sanitize=True)"
|
||||
s += ",\n comment='HTML (sanitized)'"
|
||||
### determine field access
|
||||
if name=='password' or 'writeonly' in has:
|
||||
s+=",\n readable=False"
|
||||
if name == 'password' or 'writeonly' in has:
|
||||
s += ",\n readable=False"
|
||||
elif 'hidden' in has:
|
||||
s+=",\n writable=False, readable=False"
|
||||
s += ",\n writable=False, readable=False"
|
||||
elif 'readonly' in has:
|
||||
s+=",\n writable=False"
|
||||
s += ",\n writable=False"
|
||||
|
||||
### make up a label
|
||||
s+=",\n label=T('%s')),\n" % \
|
||||
s += ",\n label=T('%s')),\n" % \
|
||||
' '.join(x.capitalize() for x in barename.split('_'))
|
||||
if table=='auth_user':
|
||||
s+=" Field('created_on','datetime',default=request.now,\n"
|
||||
s+=" label=T('Created On'),writable=False,readable=False),\n"
|
||||
s+=" Field('modified_on','datetime',default=request.now,\n"
|
||||
s+=" label=T('Modified On'),writable=False,readable=False,\n"
|
||||
s+=" update=request.now),\n"
|
||||
s+=" Field('registration_key',default='',\n"
|
||||
s+=" writable=False,readable=False),\n"
|
||||
s+=" Field('reset_password_key',default='',\n"
|
||||
s+=" writable=False,readable=False),\n"
|
||||
s+=" Field('registration_id',default='',\n"
|
||||
s+=" writable=False,readable=False),\n"
|
||||
if table == 'auth_user':
|
||||
s += " Field('created_on','datetime',default=request.now,\n"
|
||||
s += " label=T('Created On'),writable=False,readable=False),\n"
|
||||
s += " Field('modified_on','datetime',default=request.now,\n"
|
||||
s += " label=T('Modified On'),writable=False,readable=False,\n"
|
||||
s += " update=request.now),\n"
|
||||
s += " Field('registration_key',default='',\n"
|
||||
s += " writable=False,readable=False),\n"
|
||||
s += " Field('reset_password_key',default='',\n"
|
||||
s += " writable=False,readable=False),\n"
|
||||
s += " Field('registration_id',default='',\n"
|
||||
s += " writable=False,readable=False),\n"
|
||||
elif 'auth_user' in session.app['tables']:
|
||||
s+=" auth.signature,\n"
|
||||
s+=" format='%("+first_field+")s',\n"
|
||||
s+=" migrate=settings.migrate)\n\n"
|
||||
if table=='auth_user':
|
||||
s+="""
|
||||
db.auth_user.first_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty)
|
||||
db.auth_user.last_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty)
|
||||
db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key, min_length=4)
|
||||
s += " auth.signature,\n"
|
||||
s += " format='%(" + first_field + ")s',\n"
|
||||
s += " migrate=settings.migrate)\n\n"
|
||||
if table == 'auth_user':
|
||||
s += """
|
||||
db.auth_user.first_name.requires = IS_NOT_EMPTY(
|
||||
error_message=auth.messages.is_empty)
|
||||
db.auth_user.last_name.requires = IS_NOT_EMPTY(
|
||||
error_message=auth.messages.is_empty)
|
||||
db.auth_user.password.requires = CRYPT(
|
||||
key=auth.settings.hmac_key, min_length=4)
|
||||
db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username)
|
||||
db.auth_user.email.requires = (IS_EMAIL(error_message=auth.messages.invalid_email),
|
||||
db.auth_user.email.requires = (
|
||||
IS_EMAIL(error_message=auth.messages.invalid_email),
|
||||
IS_NOT_IN_DB(db, db.auth_user.email))
|
||||
"""
|
||||
else:
|
||||
s+="db.define_table('%s_archive',db.%s,Field('current_record','reference %s',readable=False,writable=False))\n" % (table,table,table)
|
||||
s += "db.define_table('%s_archive',db.%s,Field('current_record','reference %s',readable=False,writable=False))\n" % (table, table, table)
|
||||
return s
|
||||
|
||||
|
||||
def fix_db(filename):
|
||||
params = dict(session.app['params'])
|
||||
content = read_file(filename,'rb')
|
||||
content = read_file(filename, 'rb')
|
||||
if 'auth_user' in session.app['tables']:
|
||||
auth_user = make_table('auth_user',session.app['table_auth_user'])
|
||||
auth_user = make_table('auth_user', session.app['table_auth_user'])
|
||||
content = content.replace('sqlite://storage.sqlite',
|
||||
params['database_uri'])
|
||||
content = content.replace('auth.define_tables()',\
|
||||
auth_user+'auth.define_tables(migrate = settings.migrate)')
|
||||
params['database_uri'])
|
||||
content = content.replace('auth.define_tables()',
|
||||
auth_user + 'auth.define_tables(migrate = settings.migrate)')
|
||||
content += """
|
||||
mail.settings.server = settings.email_server
|
||||
mail.settings.sender = settings.email_sender
|
||||
mail.settings.login = settings.email_login
|
||||
"""
|
||||
if params['login_method']=='janrain':
|
||||
content+="""
|
||||
if params['login_method'] == 'janrain':
|
||||
content += """
|
||||
from gluon.contrib.login_methods.rpx_account import RPXAccount
|
||||
auth.settings.actions_disabled=['register','change_password','request_reset_password']
|
||||
auth.settings.actions_disabled=['register','change_password',
|
||||
'request_reset_password']
|
||||
auth.settings.login_form = RPXAccount(request,
|
||||
api_key = settings.login_config.split(':')[-1],
|
||||
domain = settings.login_config.split(':')[0],
|
||||
@@ -388,14 +424,15 @@ auth.settings.login_form = RPXAccount(request,
|
||||
"""
|
||||
write_file(filename, content, 'wb')
|
||||
|
||||
|
||||
def make_menu(pages):
|
||||
s=''
|
||||
s+='response.title = settings.title\n'
|
||||
s+='response.subtitle = settings.subtitle\n'
|
||||
s+="response.meta.author = '%(author)s <%(author_email)s>' % settings\n"
|
||||
s+='response.meta.keywords = settings.keywords\n'
|
||||
s+='response.meta.description = settings.description\n'
|
||||
s+='response.menu = [\n'
|
||||
s = ''
|
||||
s += 'response.title = settings.title\n'
|
||||
s += 'response.subtitle = settings.subtitle\n'
|
||||
s += "response.meta.author = '%(author)s <%(author_email)s>' % settings\n"
|
||||
s += 'response.meta.keywords = settings.keywords\n'
|
||||
s += 'response.meta.description = settings.description\n'
|
||||
s += 'response.menu = [\n'
|
||||
for page in pages:
|
||||
if not page.startswith('error'):
|
||||
if page.endswith('_manage'):
|
||||
@@ -403,65 +440,70 @@ def make_menu(pages):
|
||||
else:
|
||||
page_name = page
|
||||
page_name = ' '.join(x.capitalize() for x in page_name.split('_'))
|
||||
s+="(T('%s'),URL('default','%s')==URL(),URL('default','%s'),[]),\n" \
|
||||
% (page_name,page,page)
|
||||
s+=']'
|
||||
s += "(T('%s'),URL('default','%s')==URL(),URL('default','%s'),[]),\n" \
|
||||
% (page_name, page, page)
|
||||
s += ']'
|
||||
return s
|
||||
|
||||
def make_page(page,contents):
|
||||
if 'auth_user' in session.app['tables'] and not page in ('index','error'):
|
||||
s="@auth.requires_login()\ndef %s():\n" % page
|
||||
|
||||
def make_page(page, contents):
|
||||
if 'auth_user' in session.app['tables'] and not page in ('index', 'error'):
|
||||
s = "@auth.requires_login()\ndef %s():\n" % page
|
||||
else:
|
||||
s="def %s():\n" % page
|
||||
items = page.rsplit('_',1)
|
||||
if items[0] in session.app['tables'] and len(items)==2 and items[1]=='manage':
|
||||
s+=" form = SQLFORM.smartgrid(db.t_%s,onupdate=auth.archive)\n" % items[0]
|
||||
s+=" return locals()\n\n"
|
||||
s = "def %s():\n" % page
|
||||
items = page.rsplit('_', 1)
|
||||
if items[0] in session.app['tables'] and len(items) == 2 and items[1] == 'manage':
|
||||
s += " form = SQLFORM.smartgrid(db.t_%s,onupdate=auth.archive)\n" % items[0]
|
||||
s += " return locals()\n\n"
|
||||
else:
|
||||
s+=" return dict()\n\n"
|
||||
s += " return dict()\n\n"
|
||||
return s
|
||||
|
||||
def make_view(page,contents):
|
||||
s="{{extend 'layout.html'}}\n\n"
|
||||
s+=str(MARKMIN(contents))
|
||||
|
||||
def make_view(page, contents):
|
||||
s = "{{extend 'layout.html'}}\n\n"
|
||||
s += str(MARKMIN(contents))
|
||||
return s
|
||||
|
||||
|
||||
def populate(tables):
|
||||
s = 'from gluon.contrib.populate import populate\n'
|
||||
s+= 'if db(db.auth_user).isempty():\n'
|
||||
s += 'if db(db.auth_user).isempty():\n'
|
||||
for table in sort_tables(tables):
|
||||
t=table=='auth_user' and 'auth_user' or 't_'+table
|
||||
s+=" populate(db.%s,10)\n" % t
|
||||
t = table == 'auth_user' and 'auth_user' or 't_' + table
|
||||
s += " populate(db.%s,10)\n" % t
|
||||
return s
|
||||
|
||||
|
||||
def create(options):
|
||||
if DEMO_MODE:
|
||||
session.flash = T('disabled in demo mode')
|
||||
redirect(URL('step6'))
|
||||
params = dict(session.app['params'])
|
||||
app = session.app['name']
|
||||
if app_create(app,request,force=True,key=params['security_key']):
|
||||
if app_create(app, request, force=True, key=params['security_key']):
|
||||
if MULTI_USER_MODE:
|
||||
db.app.insert(name=app,owner=auth.user.id)
|
||||
db.app.insert(name=app, owner=auth.user.id)
|
||||
else:
|
||||
session.flash = 'Failure to create application'
|
||||
redirect(URL('step6'))
|
||||
|
||||
### save metadata in newapp/wizard.metadata
|
||||
try:
|
||||
meta = os.path.join(request.folder,'..',app,'wizard.metadata')
|
||||
file=open(meta,'wb')
|
||||
pickle.dump(session.app,file)
|
||||
meta = os.path.join(request.folder, '..', app, 'wizard.metadata')
|
||||
file = open(meta, 'wb')
|
||||
pickle.dump(session.app, file)
|
||||
file.close()
|
||||
except IOError:
|
||||
session.flash = 'Failure to write wizard metadata'
|
||||
redirect(URL('step6'))
|
||||
|
||||
### apply theme
|
||||
if options.apply_layout and params['layout_theme']!='Default':
|
||||
if options.apply_layout and params['layout_theme'] != 'Default':
|
||||
try:
|
||||
fn = 'web2py.plugin.layout_%s.w2p' % params['layout_theme']
|
||||
theme = urllib.urlopen(LAYOUTS_APP+'/static/plugin_layouts/plugins/'+fn)
|
||||
theme = urllib.urlopen(
|
||||
LAYOUTS_APP + '/static/plugin_layouts/plugins/' + fn)
|
||||
plugin_install(app, theme, request, fn)
|
||||
except:
|
||||
session.flash = T("unable to download layout")
|
||||
@@ -469,55 +511,58 @@ def create(options):
|
||||
### apply plugins
|
||||
for plugin in params['plugins']:
|
||||
try:
|
||||
plugin_name = 'web2py.plugin.'+plugin+'.w2p'
|
||||
stream = urllib.urlopen(PLUGINS_APP+'/static/'+plugin_name)
|
||||
plugin_name = 'web2py.plugin.' + plugin + '.w2p'
|
||||
stream = urllib.urlopen(PLUGINS_APP + '/static/' + plugin_name)
|
||||
plugin_install(app, stream, request, plugin_name)
|
||||
except Exception, e:
|
||||
session.flash = T("unable to download plugin: %s" % plugin)
|
||||
|
||||
### write configuration file into newapp/models/0.py
|
||||
model = os.path.join(request.folder,'..',app,'models','0.py')
|
||||
model = os.path.join(request.folder, '..', app, 'models', '0.py')
|
||||
file = open(model, 'wb')
|
||||
try:
|
||||
file.write("from gluon.storage import Storage\n")
|
||||
file.write("settings = Storage()\n\n")
|
||||
file.write("settings.migrate = True\n")
|
||||
for key,value in session.app['params']:
|
||||
file.write("settings.%s = %s\n" % (key,repr(value)))
|
||||
for key, value in session.app['params']:
|
||||
file.write("settings.%s = %s\n" % (key, repr(value)))
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
### write configuration file into newapp/models/menu.py
|
||||
if options.generate_menu:
|
||||
model = os.path.join(request.folder,'..',app,'models','menu.py')
|
||||
file = open(model,'wb')
|
||||
model = os.path.join(request.folder, '..', app, 'models', 'menu.py')
|
||||
file = open(model, 'wb')
|
||||
try:
|
||||
file.write(make_menu(session.app['pages']))
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
### customize the auth_user table
|
||||
model = os.path.join(request.folder,'..',app,'models','db.py')
|
||||
model = os.path.join(request.folder, '..', app, 'models', 'db.py')
|
||||
fix_db(model)
|
||||
|
||||
### create newapp/models/db_wizard.py
|
||||
if options.generate_model:
|
||||
model = os.path.join(request.folder,'..',app,'models','db_wizard.py')
|
||||
file = open(model,'wb')
|
||||
model = os.path.join(
|
||||
request.folder, '..', app, 'models', 'db_wizard.py')
|
||||
file = open(model, 'wb')
|
||||
try:
|
||||
file.write('### we prepend t_ to tablenames and f_ to fieldnames for disambiguity\n\n')
|
||||
tables = sort_tables(session.app['tables'])
|
||||
for table in tables:
|
||||
if table=='auth_user': continue
|
||||
file.write(make_table(table,session.app['table_'+table]))
|
||||
if table == 'auth_user':
|
||||
continue
|
||||
file.write(make_table(table, session.app['table_' + table]))
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
model = os.path.join(request.folder,'..',app,
|
||||
'models','db_wizard_populate.py')
|
||||
if os.path.exists(model): os.unlink(model)
|
||||
model = os.path.join(request.folder, '..', app,
|
||||
'models', 'db_wizard_populate.py')
|
||||
if os.path.exists(model):
|
||||
os.unlink(model)
|
||||
if options.populate_database and session.app['tables']:
|
||||
file = open(model,'wb')
|
||||
file = open(model, 'wb')
|
||||
try:
|
||||
file.write(populate(session.app['tables']))
|
||||
finally:
|
||||
@@ -525,8 +570,9 @@ def create(options):
|
||||
|
||||
### create newapp/controllers/default.py
|
||||
if options.generate_controller:
|
||||
controller = os.path.join(request.folder,'..',app,'controllers','default.py')
|
||||
file = open(controller,'wb')
|
||||
controller = os.path.join(
|
||||
request.folder, '..', app, 'controllers', 'default.py')
|
||||
file = open(controller, 'wb')
|
||||
try:
|
||||
file.write("""# -*- coding: utf-8 -*-
|
||||
### required - do no delete
|
||||
@@ -536,23 +582,24 @@ def call(): return service()
|
||||
### end requires
|
||||
""")
|
||||
for page in session.app['pages']:
|
||||
file.write(make_page(page,session.app.get('page_'+page,'')))
|
||||
file.write(
|
||||
make_page(page, session.app.get('page_' + page, '')))
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
### create newapp/views/default/*.html
|
||||
if options.generate_views:
|
||||
for page in session.app['pages']:
|
||||
view = os.path.join(request.folder,'..',app,'views','default',page+'.html')
|
||||
file = open(view,'wb')
|
||||
view = os.path.join(
|
||||
request.folder, '..', app, 'views', 'default', page + '.html')
|
||||
file = open(view, 'wb')
|
||||
try:
|
||||
file.write(make_view(page,session.app.get('page_'+page,'')))
|
||||
file.write(
|
||||
make_view(page, session.app.get('page_' + page, '')))
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
if options.erase_database:
|
||||
path = os.path.join(request.folder,'..',app,'databases','*')
|
||||
path = os.path.join(request.folder, '..', app, 'databases', '*')
|
||||
for file in glob.glob(path):
|
||||
os.unlink(file)
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
EXPIRATION_MINUTES=60
|
||||
DIGITS=('0','1','2','3','4','5','6','7','8','9')
|
||||
import os, time, stat, cPickle, logging
|
||||
path=os.path.join(request.folder,'sessions')
|
||||
path = os.path.join(request.folder,'sessions')
|
||||
if not os.path.exists(path):
|
||||
os.mkdir(path)
|
||||
now=time.time()
|
||||
now = time.time()
|
||||
for filename in os.listdir(path):
|
||||
fullpath=os.path.join(path,filename)
|
||||
if os.path.isfile(fullpath) and filename.startswith(DIGITS):
|
||||
@@ -18,6 +18,4 @@ for filename in os.listdir(path):
|
||||
if (now - filetime) > expiration:
|
||||
os.unlink(fullpath)
|
||||
except:
|
||||
logging.exception('failure to check %s'%fullpath)
|
||||
|
||||
|
||||
logging.exception('failure to check %s' % fullpath)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
'(something like "it-it")': '(something like "it-it")',
|
||||
'About': 'About',
|
||||
'Additional code for your application': 'Additional code for your application',
|
||||
'admin disabled because unable to access password file': 'admin disabled because unable to access password file',
|
||||
'Admin language': 'Admin language',
|
||||
'administrative interface': 'administrative interface',
|
||||
'Administrator Password:': 'Administrator Password:',
|
||||
@@ -19,6 +20,8 @@
|
||||
'at char %s': 'at char %s',
|
||||
'at line %s': 'at line %s',
|
||||
'back': '<<back',
|
||||
'Basics': 'Basics',
|
||||
'Begin': 'Begin',
|
||||
'can be a git repo': 'can be a git repo',
|
||||
'Change admin password': 'Change admin password',
|
||||
'Check for upgrades': 'Check for upgrades',
|
||||
@@ -39,6 +42,7 @@
|
||||
'database administration': 'database administration',
|
||||
'Debug': 'Debug',
|
||||
'defines tables': 'defines tables',
|
||||
'delete': 'delete',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Delete this file (you will be asked to confirm deletion)',
|
||||
'Deploy': 'Deploy',
|
||||
'Deploy on Google App Engine': 'Deploy on Google App Engine',
|
||||
@@ -50,13 +54,17 @@
|
||||
'download layouts': 'download layouts',
|
||||
'download plugins': 'download plugins',
|
||||
'Edit': 'Edit',
|
||||
'edit all': 'edit all',
|
||||
'Edit application': 'Edit application',
|
||||
'edit controller': 'edit controller',
|
||||
'edit views:': 'edit views:',
|
||||
'Editing file "%s"': 'Editing file "%s"',
|
||||
'Editing Language file': 'Editing Language file',
|
||||
'Error snapshot': 'Error snapshot',
|
||||
'Error ticket': 'Error ticket',
|
||||
'Errors': 'Errors',
|
||||
'Exception instance attributes': 'Exception instance attributes',
|
||||
'Expand Abbreviation': 'Expand Abbreviation',
|
||||
'exposes': 'exposes',
|
||||
'exposes:': 'exposes:',
|
||||
'extends': 'extends',
|
||||
@@ -65,16 +73,21 @@
|
||||
'file saved on %s': 'file saved on %s',
|
||||
'filter': 'filter',
|
||||
'Frames': 'Frames',
|
||||
'Generate': 'Generate',
|
||||
'Get from URL:': 'Get from URL:',
|
||||
'Git Pull': 'Git Pull',
|
||||
'Git Push': 'Git Push',
|
||||
'Go to Matching Pair': 'Go to Matching Pair',
|
||||
'go!': 'go!',
|
||||
'Help': 'Help',
|
||||
'Hide/Show Translated strings': 'Hide/Show Translated strings',
|
||||
'includes': 'includes',
|
||||
'inspect attributes': 'inspect attributes',
|
||||
'Install': 'Install',
|
||||
'Installed applications': 'Installed applications',
|
||||
'invalid password.': 'invalid password.',
|
||||
'Key bindings': 'Key bindings',
|
||||
'Key bindings for ZenCoding Plugin': 'Key bindings for ZenCoding Plugin',
|
||||
'Language files (static strings) updated': 'Language files (static strings) updated',
|
||||
'languages': 'languages',
|
||||
'Languages': 'Languages',
|
||||
@@ -84,13 +97,18 @@
|
||||
'Login': 'Login',
|
||||
'Login to the Administrative Interface': 'Login to the Administrative Interface',
|
||||
'Logout': 'Logout',
|
||||
'Models': 'Models',
|
||||
'Match Pair': 'Match Pair',
|
||||
'Merge Lines': 'Merge Lines',
|
||||
'models': 'models',
|
||||
'Models': 'Models',
|
||||
'Modules': 'Modules',
|
||||
'modules': 'modules',
|
||||
'New Application Wizard': 'New Application Wizard',
|
||||
'New application wizard': 'New application wizard',
|
||||
'New simple application': 'New simple application',
|
||||
'Next Edit Point': 'Next Edit Point',
|
||||
'online designer': 'online designer',
|
||||
'Original/Translation': 'Original/Translation',
|
||||
'Overwrite installed app': 'Overwrite installed app',
|
||||
'Pack all': 'Pack all',
|
||||
'Peeking at file': 'Peeking at file',
|
||||
@@ -98,11 +116,14 @@
|
||||
'plugins': 'plugins',
|
||||
'Plural-Forms:': 'Plural-Forms:',
|
||||
'Powered by': 'Powered by',
|
||||
'Previous Edit Point': 'Previous Edit Point',
|
||||
'Private files': 'Private files',
|
||||
'private files': 'private files',
|
||||
'Reload routes': 'Reload routes',
|
||||
'Removed Breakpoint on %s at line %s': 'Removed Breakpoint on %s at line %s',
|
||||
'request': 'request',
|
||||
'response': 'response',
|
||||
'restart': 'restart',
|
||||
'restore': 'restore',
|
||||
'revert': 'revert',
|
||||
'rules are not defined': 'rules are not defined',
|
||||
@@ -114,12 +135,17 @@
|
||||
'Saved file hash:': 'Saved file hash:',
|
||||
'session': 'session',
|
||||
'session expired': 'session expired',
|
||||
'Set Breakpoint on %s at line %s: %s': 'Set Breakpoint on %s at line %s: %s',
|
||||
'shell': 'shell',
|
||||
'Site': 'Site',
|
||||
'skip to generate': 'skip to generate',
|
||||
'Start a new app': 'Start a new app',
|
||||
'Start wizard': 'Start wizard',
|
||||
'static': 'static',
|
||||
'Static files': 'Static files',
|
||||
'Step': 'Step',
|
||||
'Submit': 'Submit',
|
||||
'successful': 'successful',
|
||||
'test': 'test',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'The application logic, each URL path is mapped in one exposed function in the controller',
|
||||
'The data representation, define database tables and sets': 'The data representation, define database tables and sets',
|
||||
@@ -133,9 +159,12 @@
|
||||
'to previous version.': 'to previous version.',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'To create a plugin, name a file/folder plugin_[name]',
|
||||
'toggle breakpoint': 'toggle breakpoint',
|
||||
'Toggle Fullscreen': 'Toggle Fullscreen',
|
||||
'Traceback': 'Traceback',
|
||||
'Translation strings for the application': 'Translation strings for the application',
|
||||
'try view': 'try view',
|
||||
'Uninstall': 'Uninstall',
|
||||
'update': 'update',
|
||||
'update all languages': 'update all languages',
|
||||
'upload': 'upload',
|
||||
'Upload a package:': 'Upload a package:',
|
||||
@@ -151,4 +180,5 @@
|
||||
'Web Framework': 'Web Framework',
|
||||
'web2py is up to date': 'web2py is up to date',
|
||||
'web2py Recent Tweets': 'web2py Recent Tweets',
|
||||
'Wrap with Abbreviation': 'Wrap with Abbreviation',
|
||||
}
|
||||
|
||||
@@ -3,143 +3,26 @@
|
||||
'!langcode!': 'it',
|
||||
'!langname!': 'Italiano',
|
||||
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" è un\'espressione opzionale come "campo1=\'nuovo valore\'". Non si può fare "update" o "delete" dei risultati di un JOIN ',
|
||||
'%Y-%m-%d': '%d/%m/%Y',
|
||||
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',
|
||||
'%s %%{row} deleted': '%s righe ("record") cancellate',
|
||||
'%s %%{row} updated': '%s righe ("record") modificate',
|
||||
'%Y-%m-%d': '%d/%m/%Y',
|
||||
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',
|
||||
'(requires internet access)': '(requires internet access)',
|
||||
'(something like "it-it")': '(qualcosa simile a "it-it")',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
||||
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
||||
'A new version of web2py is available: %s': 'È disponibile una nuova versione di web2py: %s',
|
||||
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': "ATTENZIONE: L'accesso richiede una connessione sicura (HTTPS) o l'esecuzione di web2py in locale (connessione su localhost)",
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTZIONE: NON ESEGUIRE PIÙ TEST IN PARALLELO (I TEST NON SONO "THREAD SAFE")',
|
||||
'ATTENTION: you cannot edit the running application!': "ATTENZIONE: non puoi modificare l'applicazione correntemente in uso ",
|
||||
'About': 'informazioni',
|
||||
'About application': "Informazioni sull'applicazione",
|
||||
'Admin is disabled because insecure channel': 'amministrazione disabilitata: comunicazione non sicura',
|
||||
'Admin language': 'Admin language',
|
||||
'Administrator Password:': 'Password Amministratore:',
|
||||
'Application name:': 'Application name:',
|
||||
'Are you sure you want to delete file "%s"?': 'Confermi di voler cancellare il file "%s"?',
|
||||
'Are you sure you want to delete plugin "%s"?': 'Confermi di voler cancellare il plugin "%s"?',
|
||||
'Are you sure you want to uninstall application "%s"?': 'Confermi di voler disinstallare l\'applicazione "%s"?',
|
||||
'Are you sure you want to upgrade web2py now?': 'Confermi di voler aggiornare web2py ora?',
|
||||
'Available databases and tables': 'Database e tabelle disponibili',
|
||||
'Cannot be empty': 'Non può essere vuoto',
|
||||
'Cannot compile: there are errors in your app:': "Compilazione fallita: ci sono errori nell'applicazione.",
|
||||
'Change admin password': 'change admin password',
|
||||
'Check for upgrades': 'check for upgrades',
|
||||
'Check to delete': 'Seleziona per cancellare',
|
||||
'Checking for upgrades...': 'Controllo aggiornamenti in corso...',
|
||||
'Clean': 'pulisci',
|
||||
'Compile': 'compila',
|
||||
'Controller': 'Controller',
|
||||
'Controllers': 'Controllers',
|
||||
'Copyright': 'Copyright',
|
||||
'Create': 'crea',
|
||||
'Create new simple application': 'Crea nuova applicazione',
|
||||
'Current request': 'Richiesta (request) corrente',
|
||||
'Current response': 'Risposta (response) corrente',
|
||||
'Current session': 'Sessione (session) corrente',
|
||||
'DB Model': 'Modello di DB',
|
||||
'Database': 'Database',
|
||||
'Date and Time': 'Data and Ora',
|
||||
'Delete': 'Cancella',
|
||||
'Delete:': 'Cancella:',
|
||||
'Deploy': 'deploy',
|
||||
'Deploy on Google App Engine': 'Installa su Google App Engine',
|
||||
'EDIT': 'MODIFICA',
|
||||
'Edit': 'modifica',
|
||||
'Edit This App': 'Modifica questa applicazione',
|
||||
'Edit application': 'Modifica applicazione',
|
||||
'Edit current record': 'Modifica record corrente',
|
||||
'Editing Language file': 'Modifica file linguaggio',
|
||||
'Editing file "%s"': 'Modifica del file "%s"',
|
||||
'Enterprise Web Framework': 'Enterprise Web Framework',
|
||||
'Error logs for "%(app)s"': 'Log degli errori per "%(app)s"',
|
||||
'Errors': 'errori',
|
||||
'Exception instance attributes': 'Exception instance attributes',
|
||||
'Functions with no doctests will result in [passed] tests.': 'I test delle funzioni senza "doctests" risulteranno sempre [passed].',
|
||||
'Hello World': 'Salve Mondo',
|
||||
'Help': 'aiuto',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
|
||||
'Import/Export': 'Importa/Esporta',
|
||||
'Index': 'Indice',
|
||||
'Install': 'installa',
|
||||
'Installed applications': 'Applicazioni installate',
|
||||
'Internal State': 'Stato interno',
|
||||
'Invalid Query': 'Richiesta (query) non valida',
|
||||
'Invalid action': 'Azione non valida',
|
||||
'Language files (static strings) updated': 'Linguaggi (documenti con stringhe statiche) aggiornati',
|
||||
'Languages': 'Linguaggi',
|
||||
'Last saved on:': 'Ultimo salvataggio:',
|
||||
'Layout': 'Layout',
|
||||
'License for': 'Licenza relativa a',
|
||||
'Login': 'Accesso',
|
||||
'Login to the Administrative Interface': "Accesso all'interfaccia amministrativa",
|
||||
'Logout': 'uscita',
|
||||
'Main Menu': 'Menu principale',
|
||||
'Menu Model': 'Menu Modelli',
|
||||
'Models': 'Modelli',
|
||||
'Modules': 'Moduli',
|
||||
'NO': 'NO',
|
||||
'New Record': 'Nuovo elemento (record)',
|
||||
'New application wizard': 'New application wizard',
|
||||
'New simple application': 'New simple application',
|
||||
'No databases in this application': 'Nessun database presente in questa applicazione',
|
||||
'Original/Translation': 'Originale/Traduzione',
|
||||
'Overwrite installed app': 'sovrascrivi applicazione installata',
|
||||
'PAM authenticated user, cannot change password here': 'utente autenticato tramite PAM, impossibile modificare password qui',
|
||||
'Pack all': 'crea pacchetto',
|
||||
'Pack compiled': 'crea pacchetto del codice compilato',
|
||||
'Peeking at file': 'Uno sguardo al file',
|
||||
'Plugin "%s" in application': 'Plugin "%s" nell\'applicazione',
|
||||
'Plugins': 'I Plugins',
|
||||
'Powered by': 'Powered by',
|
||||
'Query:': 'Richiesta (query):',
|
||||
'Remove compiled': 'rimozione codice compilato',
|
||||
'Resolve Conflict file': 'File di risoluzione conflitto',
|
||||
'Rows in table': 'Righe nella tabella',
|
||||
'Rows selected': 'Righe selezionate',
|
||||
'Saved file hash:': 'Hash del file salvato:',
|
||||
'Site': 'sito',
|
||||
'Start wizard': 'start wizard',
|
||||
'Static files': 'Files statici',
|
||||
'Stylesheet': 'Foglio di stile (stylesheet)',
|
||||
'Sure you want to delete this object?': 'Vuoi veramente cancellare questo oggetto?',
|
||||
'TM': 'TM',
|
||||
'Testing application': 'Test applicazione in corsg',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La richiesta (query) è una condizione come ad esempio "db.tabella1.campo1==\'valore\'". Una condizione come "db.tabella1.campo1==db.tabella2.campo2" produce un "JOIN" SQL.',
|
||||
'There are no controllers': 'Non ci sono controller',
|
||||
'There are no models': 'Non ci sono modelli',
|
||||
'There are no modules': 'Non ci sono moduli',
|
||||
'There are no static files': 'Non ci sono file statici',
|
||||
'There are no translators, only default language is supported': 'Non ci sono traduzioni, viene solo supportato il linguaggio di base',
|
||||
'There are no views': 'Non ci sono viste ("view")',
|
||||
'This is the %(filename)s template': 'Questo è il template %(filename)s',
|
||||
'Ticket': 'Ticket',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Per creare un plugin, chiamare un file o cartella plugin_[nome]',
|
||||
'Unable to check for upgrades': 'Impossibile controllare presenza di aggiornamenti',
|
||||
'Unable to download app because:': 'Impossibile scaricare applicazione perché',
|
||||
'Unable to download because': 'Impossibile scaricare perché',
|
||||
'Unable to download because:': 'Unable to download because:',
|
||||
'Uninstall': 'disinstalla',
|
||||
'Update:': 'Aggiorna:',
|
||||
'Upload & install packed application': 'Carica ed installa pacchetto con applicazione',
|
||||
'Upload a package:': 'Upload a package:',
|
||||
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Per costruire richieste (query) più complesse si usano (...)&(...) come "e" (AND), (...)|(...) come "o" (OR), e ~(...) come negazione (NOT).',
|
||||
'Use an url:': 'Use an url:',
|
||||
'Version': 'Versione',
|
||||
'View': 'Vista',
|
||||
'Views': 'viste',
|
||||
'Welcome %s': 'Benvenuto %s',
|
||||
'Welcome to web2py': 'Benvenuto su web2py',
|
||||
'YES': 'SI',
|
||||
'additional code for your application': 'righe di codice aggiuntive per la tua applicazione',
|
||||
'Additional code for your application': 'Additional code for your application',
|
||||
'admin disabled because no admin password': 'amministrazione disabilitata per mancanza di password amministrativa',
|
||||
'admin disabled because not supported on google app engine': 'amministrazione non supportata da Google Apps Engine',
|
||||
'admin disabled because unable to access password file': 'amministrazione disabilitata per impossibilità di leggere il file delle password',
|
||||
'Admin is disabled because insecure channel': 'amministrazione disabilitata: comunicazione non sicura',
|
||||
'Admin language': 'Admin language',
|
||||
'administrative interface': 'administrative interface',
|
||||
'Administrator Password:': 'Password Amministratore:',
|
||||
'and rename it (required):': 'e rinominala (obbligatorio):',
|
||||
'and rename it:': 'e rinominala:',
|
||||
'appadmin': 'appadmin ',
|
||||
@@ -147,44 +30,104 @@
|
||||
'application "%s" uninstalled': 'applicazione "%s" disinstallata',
|
||||
'application compiled': 'applicazione compilata',
|
||||
'application is compiled and cannot be designed': "l'applicazione è compilata e non si può modificare",
|
||||
'Application name:': 'Application name:',
|
||||
'are not used': 'are not used',
|
||||
'are not used yet': 'are not used yet',
|
||||
'Are you sure you want to delete file "%s"?': 'Confermi di voler cancellare il file "%s"?',
|
||||
'Are you sure you want to delete plugin "%s"?': 'Confermi di voler cancellare il plugin "%s"?',
|
||||
'Are you sure you want to delete this object?': 'Are you sure you want to delete this object?',
|
||||
'Are you sure you want to uninstall application "%s"?': 'Confermi di voler disinstallare l\'applicazione "%s"?',
|
||||
'Are you sure you want to upgrade web2py now?': 'Confermi di voler aggiornare web2py ora?',
|
||||
'arguments': 'arguments',
|
||||
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': "ATTENZIONE: L'accesso richiede una connessione sicura (HTTPS) o l'esecuzione di web2py in locale (connessione su localhost)",
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTZIONE: NON ESEGUIRE PIÙ TEST IN PARALLELO (I TEST NON SONO "THREAD SAFE")',
|
||||
'ATTENTION: you cannot edit the running application!': "ATTENZIONE: non puoi modificare l'applicazione correntemente in uso ",
|
||||
'Available databases and tables': 'Database e tabelle disponibili',
|
||||
'back': 'indietro',
|
||||
'cache': 'cache',
|
||||
'cache, errors and sessions cleaned': 'pulitura cache, errori and sessioni ',
|
||||
'can be a git repo': 'can be a git repo',
|
||||
'Cannot be empty': 'Non può essere vuoto',
|
||||
'Cannot compile: there are errors in your app:': "Compilazione fallita: ci sono errori nell'applicazione.",
|
||||
'cannot create file': 'impossibile creare il file',
|
||||
'cannot upload file "%(filename)s"': 'impossibile caricare il file "%(filename)s"',
|
||||
'Change admin password': 'change admin password',
|
||||
'change password': 'cambia password',
|
||||
'check all': 'controlla tutto',
|
||||
'Check for upgrades': 'check for upgrades',
|
||||
'Check to delete': 'Seleziona per cancellare',
|
||||
'Checking for upgrades...': 'Controllo aggiornamenti in corso...',
|
||||
'Clean': 'pulisci',
|
||||
'click here for online examples': 'clicca per vedere gli esempi',
|
||||
'click here for the administrative interface': "clicca per l'interfaccia amministrativa",
|
||||
'click to check for upgrades': 'clicca per controllare presenza di aggiornamenti',
|
||||
'code': 'code',
|
||||
'collapse/expand all': 'collapse/expand all',
|
||||
'Compile': 'compila',
|
||||
'compiled application removed': "rimosso il codice compilato dell'applicazione",
|
||||
'Controller': 'Controller',
|
||||
'Controllers': 'Controllers',
|
||||
'controllers': 'controllers',
|
||||
'Copyright': 'Copyright',
|
||||
'Create': 'crea',
|
||||
'create file with filename:': 'crea un file col nome:',
|
||||
'create new application:': 'create new application:',
|
||||
'Create new simple application': 'Crea nuova applicazione',
|
||||
'created by': 'creato da',
|
||||
'crontab': 'crontab',
|
||||
'Current request': 'Richiesta (request) corrente',
|
||||
'Current response': 'Risposta (response) corrente',
|
||||
'Current session': 'Sessione (session) corrente',
|
||||
'currently running': 'currently running',
|
||||
'currently saved or': 'attualmente salvato o',
|
||||
'customize me!': 'Personalizzami!',
|
||||
'data uploaded': 'dati caricati',
|
||||
'Database': 'Database',
|
||||
'database': 'database',
|
||||
'database %s select': 'database %s select',
|
||||
'database administration': 'amministrazione database',
|
||||
'Date and Time': 'Data and Ora',
|
||||
'db': 'db',
|
||||
'DB Model': 'Modello di DB',
|
||||
'Debug': 'Debug',
|
||||
'defines tables': 'defininisce le tabelle',
|
||||
'Delete': 'Cancella',
|
||||
'delete': 'Cancella',
|
||||
'delete all checked': 'cancella tutti i selezionati',
|
||||
'delete plugin': 'cancella plugin',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Delete this file (you will be asked to confirm deletion)',
|
||||
'Delete:': 'Cancella:',
|
||||
'Deploy': 'deploy',
|
||||
'Deploy on Google App Engine': 'Installa su Google App Engine',
|
||||
'Deploy to OpenShift': 'Deploy to OpenShift',
|
||||
'design': 'progetta',
|
||||
'Detailed traceback description': 'Detailed traceback description',
|
||||
'direction: ltr': 'direction: ltr',
|
||||
'Disable': 'Disable',
|
||||
'docs': 'docs',
|
||||
'done!': 'fatto!',
|
||||
'download layouts': 'download layouts',
|
||||
'download plugins': 'download plugins',
|
||||
'EDIT': 'MODIFICA',
|
||||
'Edit': 'modifica',
|
||||
'Edit application': 'Modifica applicazione',
|
||||
'edit controller': 'modifica controller',
|
||||
'Edit current record': 'Modifica record corrente',
|
||||
'edit profile': 'modifica profilo',
|
||||
'Edit This App': 'Modifica questa applicazione',
|
||||
'edit views:': 'modifica viste (view):',
|
||||
'Editing file "%s"': 'Modifica del file "%s"',
|
||||
'Editing Language file': 'Modifica file linguaggio',
|
||||
'Enterprise Web Framework': 'Enterprise Web Framework',
|
||||
'Error logs for "%(app)s"': 'Log degli errori per "%(app)s"',
|
||||
'Error snapshot': 'Error snapshot',
|
||||
'Error ticket': 'Error ticket',
|
||||
'Errors': 'errori',
|
||||
'Exception instance attributes': 'Exception instance attributes',
|
||||
'Expand Abbreviation': 'Expand Abbreviation',
|
||||
'export as csv file': 'esporta come file CSV',
|
||||
'exposes': 'espone',
|
||||
'exposes:': 'exposes:',
|
||||
'extends': 'estende',
|
||||
'failed to reload module because:': 'ricaricamento modulo fallito perché:',
|
||||
'file "%(filename)s" created': 'creato il file "%(filename)s"',
|
||||
@@ -195,73 +138,188 @@
|
||||
'file does not exist': 'file inesistente',
|
||||
'file saved on %(time)s': "file salvato nell'istante %(time)s",
|
||||
'file saved on %s': 'file salvato: %s',
|
||||
'filter': 'filter',
|
||||
'Frames': 'Frames',
|
||||
'Functions with no doctests will result in [passed] tests.': 'I test delle funzioni senza "doctests" risulteranno sempre [passed].',
|
||||
'Get from URL:': 'Get from URL:',
|
||||
'Git Pull': 'Git Pull',
|
||||
'Git Push': 'Git Push',
|
||||
'Hello World': 'Salve Mondo',
|
||||
'Help': 'aiuto',
|
||||
'htmledit': 'modifica come html',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
|
||||
'Import/Export': 'Importa/Esporta',
|
||||
'includes': 'include',
|
||||
'Index': 'Indice',
|
||||
'insert new': 'inserisci nuovo',
|
||||
'insert new %s': 'inserisci nuovo %s',
|
||||
'inspect attributes': 'inspect attributes',
|
||||
'Install': 'installa',
|
||||
'Installed applications': 'Applicazioni installate',
|
||||
'internal error': 'errore interno',
|
||||
'Internal State': 'Stato interno',
|
||||
'Invalid action': 'Azione non valida',
|
||||
'invalid password': 'password non valida',
|
||||
'Invalid Query': 'Richiesta (query) non valida',
|
||||
'invalid request': 'richiesta non valida',
|
||||
'invalid ticket': 'ticket non valido',
|
||||
'Key bindings': 'Key bindings',
|
||||
'Key bindings for ZenCoding Plugin': 'Key bindings for ZenCoding Plugin',
|
||||
'language file "%(filename)s" created/updated': 'file linguaggio "%(filename)s" creato/aggiornato',
|
||||
'Language files (static strings) updated': 'Linguaggi (documenti con stringhe statiche) aggiornati',
|
||||
'languages': 'linguaggi',
|
||||
'Languages': 'Linguaggi',
|
||||
'Last saved on:': 'Ultimo salvataggio:',
|
||||
'Layout': 'Layout',
|
||||
'License for': 'Licenza relativa a',
|
||||
'loading...': 'caricamento...',
|
||||
'locals': 'locals',
|
||||
'login': 'accesso',
|
||||
'Login': 'Accesso',
|
||||
'Login to the Administrative Interface': "Accesso all'interfaccia amministrativa",
|
||||
'Logout': 'uscita',
|
||||
'Main Menu': 'Menu principale',
|
||||
'Menu Model': 'Menu Modelli',
|
||||
'merge': 'unisci',
|
||||
'models': 'modelli',
|
||||
'Models': 'Modelli',
|
||||
'Modules': 'Moduli',
|
||||
'modules': 'moduli',
|
||||
'new application "%s" created': 'creata la nuova applicazione "%s"',
|
||||
'New application wizard': 'New application wizard',
|
||||
'new plugin installed': 'installato nuovo plugin',
|
||||
'New Record': 'Nuovo elemento (record)',
|
||||
'new record inserted': 'nuovo record inserito',
|
||||
'New simple application': 'New simple application',
|
||||
'next 100 rows': 'prossime 100 righe',
|
||||
'NO': 'NO',
|
||||
'No databases in this application': 'Nessun database presente in questa applicazione',
|
||||
'no match': 'nessuna corrispondenza',
|
||||
'or import from csv file': 'oppure importa da file CSV',
|
||||
'or provide app url:': "oppure fornisci url dell'applicazione:",
|
||||
'Original/Translation': 'Originale/Traduzione',
|
||||
'Overwrite installed app': 'sovrascrivi applicazione installata',
|
||||
'Pack all': 'crea pacchetto',
|
||||
'Pack compiled': 'crea pacchetto del codice compilato',
|
||||
'pack plugin': 'crea pacchetto del plugin',
|
||||
'PAM authenticated user, cannot change password here': 'utente autenticato tramite PAM, impossibile modificare password qui',
|
||||
'password changed': 'password modificata',
|
||||
'Peeking at file': 'Uno sguardo al file',
|
||||
'plugin "%(plugin)s" deleted': 'plugin "%(plugin)s" cancellato',
|
||||
'Plugin "%s" in application': 'Plugin "%s" nell\'applicazione',
|
||||
'plugins': 'plugins',
|
||||
'Plugins': 'I Plugins',
|
||||
'Plural-Forms:': 'Plural-Forms:',
|
||||
'Powered by': 'Powered by',
|
||||
'previous 100 rows': '100 righe precedenti',
|
||||
'private files': 'private files',
|
||||
'Private files': 'Private files',
|
||||
'Query:': 'Richiesta (query):',
|
||||
'record': 'record',
|
||||
'record does not exist': 'il record non esiste',
|
||||
'record id': 'ID del record',
|
||||
'register': 'registrazione',
|
||||
'Remove compiled': 'rimozione codice compilato',
|
||||
'request': 'request',
|
||||
'Resolve Conflict file': 'File di risoluzione conflitto',
|
||||
'response': 'response',
|
||||
'restore': 'ripristino',
|
||||
'revert': 'versione precedente',
|
||||
'Rows in table': 'Righe nella tabella',
|
||||
'Rows selected': 'Righe selezionate',
|
||||
'rules are not defined': 'rules are not defined',
|
||||
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Run tests in this file (to run all files, you may also use the button labelled 'test')",
|
||||
'Running on %s': 'Running on %s',
|
||||
'Save': 'Save',
|
||||
'Save via Ajax': 'Save via Ajax',
|
||||
'Saved file hash:': 'Hash del file salvato:',
|
||||
'selected': 'selezionato',
|
||||
'session': 'session',
|
||||
'session expired': 'sessions scaduta',
|
||||
'shell': 'shell',
|
||||
'Site': 'sito',
|
||||
'some files could not be removed': 'non è stato possibile rimuovere alcuni files',
|
||||
'Start wizard': 'start wizard',
|
||||
'state': 'stato',
|
||||
'static': 'statico',
|
||||
'Static files': 'Files statici',
|
||||
'Stylesheet': 'Foglio di stile (stylesheet)',
|
||||
'submit': 'invia',
|
||||
'Submit': 'Submit',
|
||||
'Sure you want to delete this object?': 'Vuoi veramente cancellare questo oggetto?',
|
||||
'table': 'tabella',
|
||||
'test': 'test',
|
||||
'Testing application': 'Test applicazione in corsg',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La richiesta (query) è una condizione come ad esempio "db.tabella1.campo1==\'valore\'". Una condizione come "db.tabella1.campo1==db.tabella2.campo2" produce un "JOIN" SQL.',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'The application logic, each URL path is mapped in one exposed function in the controller',
|
||||
'the application logic, each URL path is mapped in one exposed function in the controller': 'logica dell\'applicazione, ogni percorso "URL" corrisponde ad una funzione esposta da un controller',
|
||||
'The data representation, define database tables and sets': 'The data representation, define database tables and sets',
|
||||
'the data representation, define database tables and sets': 'rappresentazione dei dati, definizione di tabelle di database e di "set" ',
|
||||
'The presentations layer, views are also known as templates': 'The presentations layer, views are also known as templates',
|
||||
'the presentations layer, views are also known as templates': 'Presentazione dell\'applicazione, viste (views, chiamate anche "templates")',
|
||||
'There are no controllers': 'Non ci sono controller',
|
||||
'There are no models': 'Non ci sono modelli',
|
||||
'There are no modules': 'Non ci sono moduli',
|
||||
'There are no plugins': 'There are no plugins',
|
||||
'There are no static files': 'Non ci sono file statici',
|
||||
'There are no translators, only default language is supported': 'Non ci sono traduzioni, viene solo supportato il linguaggio di base',
|
||||
'There are no views': 'Non ci sono viste ("view")',
|
||||
'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app',
|
||||
'these files are served without processing, your images go here': 'questi files vengono serviti così come sono, le immagini vanno qui',
|
||||
'These files are served without processing, your images go here': 'These files are served without processing, your images go here',
|
||||
'This is the %(filename)s template': 'Questo è il template %(filename)s',
|
||||
'Ticket': 'Ticket',
|
||||
'Ticket ID': 'Ticket ID',
|
||||
'TM': 'TM',
|
||||
'to previous version.': 'torna a versione precedente',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Per creare un plugin, chiamare un file o cartella plugin_[nome]',
|
||||
'toggle breakpoint': 'toggle breakpoint',
|
||||
'Toggle Fullscreen': 'Toggle Fullscreen',
|
||||
'Traceback': 'Traceback',
|
||||
'translation strings for the application': "stringhe di traduzioni per l'applicazione",
|
||||
'Translation strings for the application': 'Translation strings for the application',
|
||||
'try': 'prova',
|
||||
'try something like': 'prova qualcosa come',
|
||||
'try view': 'try view',
|
||||
'Unable to check for upgrades': 'Impossibile controllare presenza di aggiornamenti',
|
||||
'unable to create application "%s"': 'impossibile creare applicazione "%s"',
|
||||
'unable to delete file "%(filename)s"': 'impossibile rimuovere file "%(plugin)s"',
|
||||
'unable to delete file plugin "%(plugin)s"': 'impossibile rimuovere file di plugin "%(plugin)s"',
|
||||
'Unable to download app because:': 'Impossibile scaricare applicazione perché',
|
||||
'Unable to download because': 'Impossibile scaricare perché',
|
||||
'Unable to download because:': 'Unable to download because:',
|
||||
'unable to parse csv file': 'non riesco a decodificare questo file CSV',
|
||||
'unable to uninstall "%s"': 'impossibile disinstallare "%s"',
|
||||
'unable to upgrade because "%s"': 'impossibile aggiornare perché "%s"',
|
||||
'uncheck all': 'smarca tutti',
|
||||
'Uninstall': 'disinstalla',
|
||||
'update': 'aggiorna',
|
||||
'update all languages': 'aggiorna tutti i linguaggi',
|
||||
'Update:': 'Aggiorna:',
|
||||
'upgrade web2py now': 'upgrade web2py now',
|
||||
'upload': 'upload',
|
||||
'Upload & install packed application': 'Carica ed installa pacchetto con applicazione',
|
||||
'Upload a package:': 'Upload a package:',
|
||||
'Upload and install packed application': 'Upload and install packed application',
|
||||
'upload application:': 'carica applicazione:',
|
||||
'upload file:': 'carica file:',
|
||||
'upload plugin file:': 'carica file di plugin:',
|
||||
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Per costruire richieste (query) più complesse si usano (...)&(...) come "e" (AND), (...)|(...) come "o" (OR), e ~(...) come negazione (NOT).',
|
||||
'Use an url:': 'Use an url:',
|
||||
'variables': 'variables',
|
||||
'Version': 'Versione',
|
||||
'Version %s.%s.%s (%s) %s': 'Version %s.%s.%s (%s) %s',
|
||||
'versioning': 'sistema di versioni',
|
||||
'Versioning': 'Versioning',
|
||||
'view': 'vista',
|
||||
'View': 'Vista',
|
||||
'Views': 'viste',
|
||||
'views': 'viste',
|
||||
'web2py Recent Tweets': 'Tweets recenti per web2py',
|
||||
'Web Framework': 'Web Framework',
|
||||
'web2py is up to date': 'web2py è aggiornato',
|
||||
'web2py Recent Tweets': 'Tweets recenti per web2py',
|
||||
'web2py upgraded; please restart it': 'web2py aggiornato; prego riavviarlo',
|
||||
'Welcome %s': 'Benvenuto %s',
|
||||
'Welcome to web2py': 'Benvenuto su web2py',
|
||||
'YES': 'SI',
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
'%Y-%m-%d %H:%M:%S': '%Y/%m/%d %H:%M:%S',
|
||||
'(requires internet access)': '(потрібно мати доступ в інтернет)',
|
||||
'(something like "it-it")': '(щось схоже на "uk-ua")',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(не існує файлу **gluon/contrib/plural_rules/%s.py**)',
|
||||
'@markmin\x01Searching: **%s** %%{file}': 'Знайдено: **%s** %%{файл}',
|
||||
'Abort': 'Припинити',
|
||||
'About': 'Про',
|
||||
@@ -33,10 +34,12 @@
|
||||
'App does not exist or your are not authorized': 'Додаток не існує, або ви не авторизовані',
|
||||
'appadmin': 'Aдм.панель',
|
||||
'appadmin is disabled because insecure channel': "адмін.панель відключено через використання ненадійного каналу зв'язку",
|
||||
'Application': 'Додаток (Application)',
|
||||
'application "%s" uninstalled': 'додаток "%s" вилучено',
|
||||
'application %(appname)s installed with md5sum: %(digest)s': 'додаток %(appname)s встановлено з md5sum: %(digest)s',
|
||||
'Application cannot be generated in demo mode': 'В демо-режимі генерувати додатки не можна',
|
||||
'application compiled': 'додаток скомпільовано',
|
||||
'Application exists already': 'Додаток вже існує',
|
||||
'application is compiled and cannot be designed': 'додаток скомпільований. налаштування змінювати не можна',
|
||||
'Application name:': 'Назва додатку:',
|
||||
'are not used': 'не використовуються',
|
||||
@@ -159,6 +162,7 @@
|
||||
'Error snapshot': 'Розгорнутий знімок стану (Error snapshot)',
|
||||
'Error ticket': 'Позначка (ticket) про помилку',
|
||||
'Errors': 'Помилки',
|
||||
'Errors in form, please check it out.': 'Помилка у формі, будь-ласка перевірте її.',
|
||||
'Exception %(extype)s: %(exvalue)s': 'Виключення %(extype)s: %(exvalue)s',
|
||||
'Exception %s': 'Виключення %s',
|
||||
'Exception instance attributes': 'Атрибути примірника класу Exception (виключення)',
|
||||
@@ -387,6 +391,7 @@
|
||||
'There are no models': 'Моделей, наразі, нема',
|
||||
'There are no modules': 'Модулів поки що нема',
|
||||
'There are no plugins': 'Жодної втулки, наразі, не встановлено',
|
||||
'There are no private files': 'Приватних файлів поки що нема',
|
||||
'There are no static files': 'Статичних файлів, наразі, нема',
|
||||
'There are no translators': 'Перекладів нема',
|
||||
'There are no translators, only default language is supported': 'Перекладів нема, підтримується тільки мова оригіналу',
|
||||
@@ -405,6 +410,7 @@
|
||||
'ticket': 'позначка',
|
||||
'Ticket': 'Позначка (Ticket)',
|
||||
'Ticket ID': 'Ід.позначки (Ticket ID)',
|
||||
'Ticket Missing': 'Позначка (ticket) відсутня',
|
||||
'tickets': 'позначки (tickets)',
|
||||
'Time in Cache (h:m:s)': 'Час в кеші (г:хв:сек)',
|
||||
'to previous version.': 'до попередньої версії.',
|
||||
@@ -412,9 +418,11 @@
|
||||
'To emulate a breakpoint programatically, write:': 'Для встановлення точки зупинки програмним чином напишіть:',
|
||||
'to use the debugger!': 'щоб активувати ладнач!',
|
||||
'toggle breakpoint': '+/- точку зупинки',
|
||||
'Toggle Fullscreen': 'Перемкнути на весь екран',
|
||||
'Traceback': 'Стек викликів (Traceback)',
|
||||
'Translation strings for the application': 'Пари рядків <оригінал>:<переклад> для вибраної мови',
|
||||
'try something like': 'спробуйте щось схоже на',
|
||||
'Try the mobile interface': 'Спробуйте мобільний інтерфейс',
|
||||
'try view': 'дивитись результат',
|
||||
'Type PDB debugger command in here and hit Return (Enter) to execute it.': 'наберіть тут будь-які команди ладнача PDB і натисніть клавішу [Return] ([Enter]), щоб запустити їх на виконання.',
|
||||
'Type python statement in here and hit Return (Enter) to execute it.': 'Наберіть тут будь-які вирази Python і натисніть клавішу [Return] ([Enter]), щоб запустити їх на виконання.',
|
||||
@@ -460,7 +468,7 @@
|
||||
'Views': 'Відображення (Views)',
|
||||
'views': 'відображення',
|
||||
'WARNING:': 'ПОПЕРЕДЖЕННЯ:',
|
||||
'Web Framework': 'Web Framework',
|
||||
'Web Framework': 'Веб-каркас (Web Framework)',
|
||||
'web2py apps to deploy': 'Готові до розгортання додатки web2py',
|
||||
'web2py Debugger': 'Ладнач web2py',
|
||||
'web2py downgrade': 'повернення на попередню версію web2py',
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
EXPIRATION = 60 * 60 # logout after 60 minutes of inactivity
|
||||
CHECK_VERSION = True
|
||||
WEB2PY_URL = 'http://web2py.com'
|
||||
WEB2PY_VERSION_URL = WEB2PY_URL+'/examples/default/version'
|
||||
WEB2PY_VERSION_URL = WEB2PY_URL + '/examples/default/version'
|
||||
|
||||
###########################################################################
|
||||
# Preferences for EditArea
|
||||
# the user-interface feature that allows you to edit files in your web
|
||||
# browser.
|
||||
|
||||
## Default editor
|
||||
TEXT_EDITOR = 'ace' or 'edit_area' or 'amy'
|
||||
## Default editor (to change editor you need web2py.admin.editors.zip)
|
||||
TEXT_EDITOR = 'codemirror' or 'ace' or 'edit_area' or 'amy'
|
||||
|
||||
## Editor Color scheme (only for ace)
|
||||
TEXT_EDITOR_THEME = (
|
||||
"chrome", "clouds", "clouds_midnight", "cobalt", "crimson_editor", "dawn",
|
||||
"chrome", "clouds", "clouds_midnight", "cobalt", "crimson_editor", "dawn",
|
||||
"dreamweaver", "eclipse", "idle_fingers", "kr_theme", "merbivore",
|
||||
"merbivore_soft", "monokai", "mono_industrial", "pastel_on_dark",
|
||||
"merbivore_soft", "monokai", "mono_industrial", "pastel_on_dark",
|
||||
"solarized_dark", "solarized_light", "textmate", "tomorrow",
|
||||
"tomorrow_night", "tomorrow_night_blue", "tomorrow_night_bright",
|
||||
"tomorrow_night_eighties", "twilight", "vibrant_ink")[0]
|
||||
## Editor Keyboard bindings (only for ace)
|
||||
TEXT_EDITOR_KEYBINDING = '' #'emacs' or 'vi'
|
||||
|
||||
### edit_area
|
||||
|
||||
## Editor Keyboard bindings (only for ace and codemirror)
|
||||
TEXT_EDITOR_KEYBINDING = '' # 'emacs' or 'vi'
|
||||
|
||||
### edit_area only
|
||||
# The default font size, measured in 'points'. The value must be an integer > 0
|
||||
FONT_SIZE = 10
|
||||
|
||||
@@ -57,9 +59,9 @@ GAE_APPCFG = os.path.abspath(os.path.join('/usr/local/bin/appcfg.py'))
|
||||
|
||||
# To use web2py as a teaching tool, set MULTI_USER_MODE to True
|
||||
MULTI_USER_MODE = False
|
||||
EMAIL_SERVER = 'localhost'
|
||||
EMAIL_SENDER = 'professor@example.com'
|
||||
EMAIL_LOGIN = None
|
||||
EMAIL_SERVER = 'localhost'
|
||||
EMAIL_SENDER = 'professor@example.com'
|
||||
EMAIL_LOGIN = None
|
||||
|
||||
# configurable twitterbox, set to None/False to suppress
|
||||
TWITTER_HASH = "web2py"
|
||||
@@ -76,5 +78,3 @@ PLUGINS_APP = 'http://web2py.com/plugins'
|
||||
# set the language
|
||||
if 'adminLanguage' in request.cookies and not (request.cookies['adminLanguage'] is None):
|
||||
T.force(request.cookies['adminLanguage'].value)
|
||||
|
||||
|
||||
|
||||
@@ -28,5 +28,3 @@ from gluon.languages import findT, update_all_languages
|
||||
from gluon.myregex import *
|
||||
from gluon.restricted import *
|
||||
from gluon.compileapp import compile_application, remove_compiled_application
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import base64, os, time
|
||||
import base64
|
||||
import os
|
||||
import time
|
||||
from gluon import portalocker
|
||||
from gluon.admin import apath
|
||||
from gluon.fileutils import read_file
|
||||
@@ -24,7 +26,8 @@ elif not request.is_local and not DEMO_MODE:
|
||||
try:
|
||||
_config = {}
|
||||
port = int(request.env.server_port or 0)
|
||||
restricted(read_file(apath('../parameters_%i.py' % port, request)), _config)
|
||||
restricted(
|
||||
read_file(apath('../parameters_%i.py' % port, request)), _config)
|
||||
|
||||
if not 'password' in _config or not _config['password']:
|
||||
raise HTTP(200, T('admin disabled because no admin password'))
|
||||
@@ -38,7 +41,8 @@ except IOError:
|
||||
raise HTTP(200,
|
||||
T('admin disabled because not supported on google app engine'))
|
||||
else:
|
||||
raise HTTP(200, T('admin disabled because unable to access password file'))
|
||||
raise HTTP(
|
||||
200, T('admin disabled because unable to access password file'))
|
||||
|
||||
|
||||
def verify_password(password):
|
||||
@@ -50,7 +54,7 @@ def verify_password(password):
|
||||
elif _config['password'].startswith('pam_user:'):
|
||||
session.pam_user = _config['password'][9:].strip()
|
||||
import gluon.contrib.pam
|
||||
return gluon.contrib.pam.authenticate(session.pam_user,password)
|
||||
return gluon.contrib.pam.authenticate(session.pam_user, password)
|
||||
else:
|
||||
return _config['password'] == CRYPT()(password)[0]
|
||||
|
||||
@@ -63,6 +67,7 @@ deny_file = os.path.join(request.folder, 'private', 'hosts.deny')
|
||||
allowed_number_of_attempts = 5
|
||||
expiration_failed_logins = 3600
|
||||
|
||||
|
||||
def read_hosts_deny():
|
||||
import datetime
|
||||
hosts = {}
|
||||
@@ -75,7 +80,7 @@ def read_hosts_deny():
|
||||
continue
|
||||
fields = line.strip().split()
|
||||
if len(fields) > 2:
|
||||
hosts[fields[0].strip()] = ( # ip
|
||||
hosts[fields[0].strip()] = ( # ip
|
||||
int(fields[1].strip()), # n attemps
|
||||
int(fields[2].strip()) # last attempts
|
||||
)
|
||||
@@ -83,28 +88,30 @@ def read_hosts_deny():
|
||||
f.close()
|
||||
return hosts
|
||||
|
||||
|
||||
def write_hosts_deny(denied_hosts):
|
||||
f = open(deny_file, 'w')
|
||||
portalocker.lock(f, portalocker.LOCK_EX)
|
||||
for key, val in denied_hosts.items():
|
||||
if time.time()-val[1] < expiration_failed_logins:
|
||||
if time.time() - val[1] < expiration_failed_logins:
|
||||
line = '%s %s %s\n' % (key, val[0], val[1])
|
||||
f.write(line)
|
||||
portalocker.unlock(f)
|
||||
f.close()
|
||||
|
||||
|
||||
def login_record(success=True):
|
||||
denied_hosts = read_hosts_deny()
|
||||
val = (0,0)
|
||||
val = (0, 0)
|
||||
if success and request.client in denied_hosts:
|
||||
del denied_hosts[request.client]
|
||||
elif not success and not request.is_local:
|
||||
val = denied_hosts.get(request.client,(0,0))
|
||||
if time.time()-val[1]<expiration_failed_logins \
|
||||
val = denied_hosts.get(request.client, (0, 0))
|
||||
if time.time() - val[1] < expiration_failed_logins \
|
||||
and val[0] >= allowed_number_of_attempts:
|
||||
return val[0] # locked out
|
||||
time.sleep(2**val[0])
|
||||
val = (val[0]+1,int(time.time()))
|
||||
return val[0] # locked out
|
||||
time.sleep(2 ** val[0])
|
||||
val = (val[0] + 1, int(time.time()))
|
||||
denied_hosts[request.client] = val
|
||||
write_hosts_deny(denied_hosts)
|
||||
return val[0]
|
||||
@@ -123,17 +130,32 @@ if session.authorized:
|
||||
else:
|
||||
session.last_time = t0
|
||||
|
||||
|
||||
if request.vars.is_mobile in ('true', 'false', 'auto'):
|
||||
session.is_mobile = request.vars.is_mobile or 'auto'
|
||||
if request.controller == 'default' and request.function == 'index':
|
||||
if not request.vars.is_mobile:
|
||||
session.is_mobile = 'auto'
|
||||
if not session.is_mobile:
|
||||
session.is_mobile = 'auto'
|
||||
if session.is_mobile == 'true':
|
||||
is_mobile = True
|
||||
elif session.is_mobile == 'false':
|
||||
is_mobile = False
|
||||
else:
|
||||
is_mobile = request.user_agent().is_mobile
|
||||
|
||||
if request.controller == "webservices":
|
||||
basic = request.env.http_authorization
|
||||
if not basic or not basic[:6].lower() == 'basic ':
|
||||
raise HTTP(401,"Wrong credentials")
|
||||
raise HTTP(401, "Wrong credentials")
|
||||
(username, password) = base64.b64decode(basic[6:]).split(':')
|
||||
if not verify_password(password) or MULTI_USER_MODE:
|
||||
time.sleep(10)
|
||||
raise HTTP(403,"Not authorized")
|
||||
raise HTTP(403, "Not authorized")
|
||||
elif not session.authorized and not \
|
||||
(request.controller == 'default' and \
|
||||
request.function in ('index','user')):
|
||||
(request.controller + '/' + request.function in
|
||||
('default/index', 'default/user', 'plugin_jqmobile/index', 'plugin_jqmobile/about')):
|
||||
|
||||
if request.env.query_string:
|
||||
query_string = '?' + request.env.query_string
|
||||
@@ -150,8 +172,6 @@ elif session.authorized and \
|
||||
request.function == 'index':
|
||||
redirect(URL(request.application, 'default', 'site'))
|
||||
|
||||
|
||||
if request.controller=='appadmin' and DEMO_MODE:
|
||||
if request.controller == 'appadmin' and DEMO_MODE:
|
||||
session.flash = 'Appadmin disabled in demo mode'
|
||||
redirect(URL('default','sites'))
|
||||
|
||||
redirect(URL('default', 'sites'))
|
||||
|
||||
@@ -2,37 +2,41 @@
|
||||
|
||||
import os
|
||||
|
||||
def A_button(*a,**b):
|
||||
|
||||
def A_button(*a, **b):
|
||||
b['_data-role'] = 'button'
|
||||
b['_data-inline'] = 'true'
|
||||
return A(*a,**b)
|
||||
return A(*a, **b)
|
||||
|
||||
|
||||
def button(href, label):
|
||||
if request.user_agent().is_mobile:
|
||||
if is_mobile:
|
||||
ret = A_button(SPAN(label), _href=href)
|
||||
else:
|
||||
ret = A(SPAN(label),_class='button',_href=href)
|
||||
ret = A(SPAN(label), _class='button', _href=href)
|
||||
return ret
|
||||
|
||||
|
||||
def button_enable(href, app):
|
||||
if os.path.exists(os.path.join(apath(app,r=request),'DISABLED')):
|
||||
label = SPAN(T('Enable'),_style='color:red')
|
||||
if os.path.exists(os.path.join(apath(app, r=request), 'DISABLED')):
|
||||
label = SPAN(T('Enable'), _style='color:red')
|
||||
else:
|
||||
label = SPAN(T('Disable'),_style='color:green')
|
||||
id = 'enable_'+app
|
||||
return A(label,_class='button',_id=id,callback=href,target=id)
|
||||
label = SPAN(T('Disable'), _style='color:green')
|
||||
id = 'enable_' + app
|
||||
return A(label, _class='button', _id=id, callback=href, target=id)
|
||||
|
||||
|
||||
def sp_button(href, label):
|
||||
if request.user_agent().is_mobile:
|
||||
ret = A_button(SPAN(label), _href=href)
|
||||
else:
|
||||
ret = A(SPAN(label),_class='button special',_href=href)
|
||||
ret = A(SPAN(label), _class='button special', _href=href)
|
||||
return ret
|
||||
|
||||
|
||||
def helpicon():
|
||||
return IMG(_src=URL('static', 'images/help.png'), _alt='help')
|
||||
|
||||
|
||||
def searchbox(elementid):
|
||||
return TAG[''](LABEL(IMG(_id="search_start",_src=URL('static', 'images/search.png'), _alt=T('filter')), _class='icon', _for=elementid), ' ', INPUT(_id=elementid, _type='text', _size=12))
|
||||
|
||||
|
||||
return TAG[''](LABEL(IMG(_id="search_start", _src=URL('static', 'images/search.png'), _alt=T('filter')), _class='icon', _for=elementid), ' ', INPUT(_id=elementid, _type='text', _size=12))
|
||||
|
||||
@@ -4,37 +4,39 @@
|
||||
if MULTI_USER_MODE:
|
||||
db = DAL('sqlite://storage.sqlite') # if not, use SQLite or other DB
|
||||
from gluon.tools import *
|
||||
auth = Auth(globals(),db) # authentication/authorization
|
||||
crud = Crud(globals(),db) # for CRUD helpers using auth
|
||||
service = Service(globals()) # for json, xml, jsonrpc, xmlrpc, amfrpc
|
||||
auth = Auth(
|
||||
globals(), db) # authentication/authorization
|
||||
crud = Crud(
|
||||
globals(), db) # for CRUD helpers using auth
|
||||
service = Service(
|
||||
globals()) # for json, xml, jsonrpc, xmlrpc, amfrpc
|
||||
plugins = PluginManager()
|
||||
|
||||
mail = auth.settings.mailer
|
||||
mail.settings.server = EMAIL_SERVER
|
||||
mail.settings.sender = EMAIL_SENDER
|
||||
mail.settings.login = EMAIL_LOGIN
|
||||
mail.settings.login = EMAIL_LOGIN
|
||||
|
||||
auth.settings.extra_fields['auth_user'] = \
|
||||
[Field('is_manager','boolean',default=False,writable=False)]
|
||||
[Field('is_manager', 'boolean', default=False, writable=False)]
|
||||
auth.define_tables() # creates all needed tables
|
||||
auth.settings.registration_requires_verification = False
|
||||
auth.settings.registration_requires_approval = True
|
||||
auth.settings.reset_password_requires_verification = True
|
||||
|
||||
db.define_table('app',Field('name'),Field('owner',db.auth_user))
|
||||
db.define_table('app', Field('name'), Field('owner', db.auth_user))
|
||||
|
||||
if not session.authorized and MULTI_USER_MODE:
|
||||
if auth.user and not request.function=='user':
|
||||
if auth.user and not request.function == 'user':
|
||||
session.authorized = True
|
||||
elif not request.function=='user':
|
||||
redirect(URL('default','user/login'))
|
||||
elif not request.function == 'user':
|
||||
redirect(URL('default', 'user/login'))
|
||||
|
||||
|
||||
def is_manager():
|
||||
if not MULTI_USER_MODE:
|
||||
return True
|
||||
elif auth.user and (auth.user.id==1 or auth.user.is_manager):
|
||||
elif auth.user and (auth.user.id == 1 or auth.user.is_manager):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -7,31 +7,30 @@ _c = request.controller
|
||||
_f = request.function
|
||||
response.title = '%s %s' % (_f, '/'.join(request.args))
|
||||
response.subtitle = 'admin'
|
||||
response.menu = [(T('Site'), _f == 'site', URL(_a,'default','site'))]
|
||||
response.menu = [(T('Site'), _f == 'site', URL(_a, 'default', 'site'))]
|
||||
|
||||
if request.vars.app or request.args:
|
||||
_t = request.vars.app or request.args[0]
|
||||
response.menu.append((T('Edit'), _c == 'default' and _f == 'design',
|
||||
URL(_a,'default','design',args=_t)))
|
||||
URL(_a, 'default', 'design', args=_t)))
|
||||
response.menu.append((T('About'), _c == 'default' and _f == 'about',
|
||||
URL(_a,'default','about',args=_t,)))
|
||||
URL(_a, 'default', 'about', args=_t,)))
|
||||
response.menu.append((T('Errors'), _c == 'default' and _f == 'errors',
|
||||
URL(_a,'default','errors',args=_t)))
|
||||
URL(_a, 'default', 'errors', args=_t)))
|
||||
response.menu.append((T('Versioning'),
|
||||
_c == 'mercurial' and _f == 'commit',
|
||||
URL(_a,'mercurial','commit',args=_t)))
|
||||
URL(_a, 'mercurial', 'commit', args=_t)))
|
||||
|
||||
if not session.authorized:
|
||||
response.menu = [(T('Login'), True, URL('site'))]
|
||||
else:
|
||||
response.menu.append((T('Logout'), False,
|
||||
URL(_a,'default',f='logout')))
|
||||
response.menu.append((T('Debug'), False,
|
||||
URL(_a, 'debug','interact')))
|
||||
URL(_a, 'default', f='logout')))
|
||||
response.menu.append((T('Debug'), False,
|
||||
URL(_a, 'debug', 'interact')))
|
||||
|
||||
if os.path.exists('applications/examples'):
|
||||
response.menu.append((T('Help'), False, URL('examples','default','index')))
|
||||
response.menu.append(
|
||||
(T('Help'), False, URL('examples', 'default', 'index')))
|
||||
else:
|
||||
response.menu.append((T('Help'), False, 'http://web2py.com/examples'))
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
response.files.append(URL('static','plugin_multiselect/jquery.dimensions.js'))
|
||||
response.files.append(URL('static','plugin_multiselect/jquery.multiselect.js'))
|
||||
response.files.append(URL('static','plugin_multiselect/jquery.multiselect.css'))
|
||||
response.files.append(URL('static','plugin_multiselect/start.js'))
|
||||
|
||||
|
||||
response.files.append(
|
||||
URL('static', 'plugin_multiselect/jquery.multi-select.js'))
|
||||
response.files.append(URL('static', 'plugin_multiselect/multi-select.css'))
|
||||
response.files.append(URL('static', 'plugin_multiselect/start.js'))
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
2011.08.02, Version 0.2.0
|
||||
|
||||
* Split view (Julian Viereck)
|
||||
- split editor area horizontally or vertivally to show two files at the same
|
||||
time
|
||||
|
||||
* Code Folding (Julian Viereck)
|
||||
- Unstructured code folding
|
||||
- Will be the basis for language aware folding
|
||||
|
||||
* Mode behaviours (Chris Spencer)
|
||||
- Adds mode specific hooks which allow transformations of entered text
|
||||
- Autoclosing of braces, paranthesis and quotation marks in C style modes
|
||||
- Autoclosing of angular brackets in XML style modes
|
||||
|
||||
* New language modes
|
||||
- Clojure (Carin Meier)
|
||||
- C# (Rob Conery)
|
||||
- Groovy (Ben Tilford)
|
||||
- Scala (Ben Tilford)
|
||||
- JSON
|
||||
- OCaml (Sergi Mansilla)
|
||||
- Perl (Panagiotis Astithas)
|
||||
- SCSS/SASS (Andreas Madsen)
|
||||
- SVG
|
||||
- Textile (Kelley van Evert)
|
||||
- SCAD (Jacob Hansson)
|
||||
|
||||
* Live syntax checks
|
||||
- Lint for Css using CSS Lint <http://csslint.net/>
|
||||
- CoffeeScript
|
||||
|
||||
* New Themes
|
||||
- Crimson Editor (iebuggy)
|
||||
- Merbivore (Michael Schwartz)
|
||||
- Merbivore soft (Michael Schwartz)
|
||||
- Solarized dark/light <http://ethanschoonover.com/solarized> (David Alan
|
||||
Hjelle)
|
||||
- Vibrant Ink (Michael Schwartz)
|
||||
|
||||
* Small Features/Enhancements
|
||||
- Lots of render performance optimizations (Harutyun Amirjanyan)
|
||||
- Improved Ruby highlighting (Chris Wanstrath, Trent Ogren)
|
||||
- Improved PHP highlighting (Thomas Hruska)
|
||||
- Improved CSS highlighting (Sean Kellogg)
|
||||
- Clicks which cause the editor to be focused don't reset the selection
|
||||
- Make padding text layer specific so that print margin and active line
|
||||
highlight are not affected (Irakli Gozalishvili)
|
||||
- Added setFontSize method
|
||||
- Improved vi keybindings (Trent Ogren)
|
||||
- When unfocused make cursor transparent instead of removing it (Harutyun
|
||||
Amirjanyan)
|
||||
- Support for matching groups in tokenizer with arrays of tokens (Chris
|
||||
Spencer)
|
||||
|
||||
* Bug fixes
|
||||
- Add support for the new OSX scroll bars
|
||||
- Properly highlight JavaScript regexp literals
|
||||
- Proper handling of unicode characters in JavaScript identifiers
|
||||
- Fix remove lines command on last line (Harutyun Amirjanyan)
|
||||
- Fix scroll wheel sluggishness in Safari
|
||||
- Make keyboard infrastructure route keys like []^$ the right way (Julian
|
||||
Viereck)
|
||||
|
||||
2011.02.14, Version 0.1.6
|
||||
|
||||
* Floating Anchors
|
||||
- An Anchor is a floating pointer in the document.
|
||||
- Whenever text is inserted or deleted before the cursor, the position of
|
||||
the cursor is updated
|
||||
- Usesd for the cursor and selection
|
||||
- Basis for bookmarks, multiple cursors and snippets in the future
|
||||
* Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
|
||||
* New commands:
|
||||
- center selection in viewport
|
||||
- remove to end/start of line
|
||||
- split line
|
||||
- transpose letters
|
||||
* Refator markers
|
||||
- Custom code can be used to render markers
|
||||
- Markers can be in front or behind the text
|
||||
- Markers are now stored in the session (was in the renderer)
|
||||
* Lots of IE8 fixes including copy, cut and selections
|
||||
* Unit tests can also be run in the browser
|
||||
<https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
|
||||
* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
|
||||
* Add minimal node server server.js to run the Ace demo in Chrome
|
||||
* The top level editor.html demo has been renamed to index.html
|
||||
* Bug fixes
|
||||
- Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
|
||||
- Fixed isues when the editor was scrolled in the web page (Eric Allam)
|
||||
- Highlighting of Python string literals
|
||||
- Syntax rule for PHP comments
|
||||
|
||||
2011.02.08, Version 0.1.5
|
||||
|
||||
* Add Coffeescript Mode (Satoshi Murakami)
|
||||
* Fix word wrap bug (Julian Viereck)
|
||||
* Fix packaged version of the Eclipse mode
|
||||
* Loading of workers is more robust
|
||||
* Fix "click selection"
|
||||
* Allow tokizing empty lines (Daniel Krech)
|
||||
* Make PageUp/Down behavior more consistent with native OS (Joe Cheng)
|
||||
|
||||
2011.02.04, Version 0.1.4
|
||||
|
||||
* Add C/C++ mode contributed by Gastón Kleiman
|
||||
* Fix exception in key input
|
||||
|
||||
2011.02.04, Version 0.1.3
|
||||
|
||||
* Let the packaged version play nice with requireJS
|
||||
* Add Ruby mode contributed by Shlomo Zalman Heigh
|
||||
* Add Java mode contributed by Tom Tasche
|
||||
* Fix annotation bug
|
||||
* Changing a document added a new empty line at the end
|
||||
@@ -1,476 +0,0 @@
|
||||
Licensed under the tri-license MPL/LGPL/GPL.
|
||||
|
||||
MOZILLA PUBLIC LICENSE
|
||||
Version 1.1
|
||||
|
||||
---------------
|
||||
|
||||
1. Definitions.
|
||||
|
||||
1.0.1. "Commercial Use" means distribution or otherwise making the
|
||||
Covered Code available to a third party.
|
||||
|
||||
1.1. "Contributor" means each entity that creates or contributes to
|
||||
the creation of Modifications.
|
||||
|
||||
1.2. "Contributor Version" means the combination of the Original
|
||||
Code, prior Modifications used by a Contributor, and the Modifications
|
||||
made by that particular Contributor.
|
||||
|
||||
1.3. "Covered Code" means the Original Code or Modifications or the
|
||||
combination of the Original Code and Modifications, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.4. "Electronic Distribution Mechanism" means a mechanism generally
|
||||
accepted in the software development community for the electronic
|
||||
transfer of data.
|
||||
|
||||
1.5. "Executable" means Covered Code in any form other than Source
|
||||
Code.
|
||||
|
||||
1.6. "Initial Developer" means the individual or entity identified
|
||||
as the Initial Developer in the Source Code notice required by Exhibit
|
||||
A.
|
||||
|
||||
1.7. "Larger Work" means a work which combines Covered Code or
|
||||
portions thereof with code not governed by the terms of this License.
|
||||
|
||||
1.8. "License" means this document.
|
||||
|
||||
1.8.1. "Licensable" means having the right to grant, to the maximum
|
||||
extent possible, whether at the time of the initial grant or
|
||||
subsequently acquired, any and all of the rights conveyed herein.
|
||||
|
||||
1.9. "Modifications" means any addition to or deletion from the
|
||||
substance or structure of either the Original Code or any previous
|
||||
Modifications. When Covered Code is released as a series of files, a
|
||||
Modification is:
|
||||
A. Any addition to or deletion from the contents of a file
|
||||
containing Original Code or previous Modifications.
|
||||
|
||||
B. Any new file that contains any part of the Original Code or
|
||||
previous Modifications.
|
||||
|
||||
1.10. "Original Code" means Source Code of computer software code
|
||||
which is described in the Source Code notice required by Exhibit A as
|
||||
Original Code, and which, at the time of its release under this
|
||||
License is not already Covered Code governed by this License.
|
||||
|
||||
1.10.1. "Patent Claims" means any patent claim(s), now owned or
|
||||
hereafter acquired, including without limitation, method, process,
|
||||
and apparatus claims, in any patent Licensable by grantor.
|
||||
|
||||
1.11. "Source Code" means the preferred form of the Covered Code for
|
||||
making modifications to it, including all modules it contains, plus
|
||||
any associated interface definition files, scripts used to control
|
||||
compilation and installation of an Executable, or source code
|
||||
differential comparisons against either the Original Code or another
|
||||
well known, available Covered Code of the Contributor's choice. The
|
||||
Source Code can be in a compressed or archival form, provided the
|
||||
appropriate decompression or de-archiving software is widely available
|
||||
for no charge.
|
||||
|
||||
1.12. "You" (or "Your") means an individual or a legal entity
|
||||
exercising rights under, and complying with all of the terms of, this
|
||||
License or a future version of this License issued under Section 6.1.
|
||||
For legal entities, "You" includes any entity which controls, is
|
||||
controlled by, or is under common control with You. For purposes of
|
||||
this definition, "control" means (a) the power, direct or indirect,
|
||||
to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (b) ownership of more than fifty percent
|
||||
(50%) of the outstanding shares or beneficial ownership of such
|
||||
entity.
|
||||
|
||||
2. Source Code License.
|
||||
|
||||
2.1. The Initial Developer Grant.
|
||||
The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
(a) under intellectual property rights (other than patent or
|
||||
trademark) Licensable by Initial Developer to use, reproduce,
|
||||
modify, display, perform, sublicense and distribute the Original
|
||||
Code (or portions thereof) with or without Modifications, and/or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patents Claims infringed by the making, using or
|
||||
selling of Original Code, to make, have made, use, practice,
|
||||
sell, and offer for sale, and/or otherwise dispose of the
|
||||
Original Code (or portions thereof).
|
||||
|
||||
(c) the licenses granted in this Section 2.1(a) and (b) are
|
||||
effective on the date Initial Developer first distributes
|
||||
Original Code under the terms of this License.
|
||||
|
||||
(d) Notwithstanding Section 2.1(b) above, no patent license is
|
||||
granted: 1) for code that You delete from the Original Code; 2)
|
||||
separate from the Original Code; or 3) for infringements caused
|
||||
by: i) the modification of the Original Code or ii) the
|
||||
combination of the Original Code with other software or devices.
|
||||
|
||||
2.2. Contributor Grant.
|
||||
Subject to third party intellectual property claims, each Contributor
|
||||
hereby grants You a world-wide, royalty-free, non-exclusive license
|
||||
|
||||
(a) under intellectual property rights (other than patent or
|
||||
trademark) Licensable by Contributor, to use, reproduce, modify,
|
||||
display, perform, sublicense and distribute the Modifications
|
||||
created by such Contributor (or portions thereof) either on an
|
||||
unmodified basis, with other Modifications, as Covered Code
|
||||
and/or as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims infringed by the making, using, or
|
||||
selling of Modifications made by that Contributor either alone
|
||||
and/or in combination with its Contributor Version (or portions
|
||||
of such combination), to make, use, sell, offer for sale, have
|
||||
made, and/or otherwise dispose of: 1) Modifications made by that
|
||||
Contributor (or portions thereof); and 2) the combination of
|
||||
Modifications made by that Contributor with its Contributor
|
||||
Version (or portions of such combination).
|
||||
|
||||
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
|
||||
effective on the date Contributor first makes Commercial Use of
|
||||
the Covered Code.
|
||||
|
||||
(d) Notwithstanding Section 2.2(b) above, no patent license is
|
||||
granted: 1) for any code that Contributor has deleted from the
|
||||
Contributor Version; 2) separate from the Contributor Version;
|
||||
3) for infringements caused by: i) third party modifications of
|
||||
Contributor Version or ii) the combination of Modifications made
|
||||
by that Contributor with other software (except as part of the
|
||||
Contributor Version) or other devices; or 4) under Patent Claims
|
||||
infringed by Covered Code in the absence of Modifications made by
|
||||
that Contributor.
|
||||
|
||||
3. Distribution Obligations.
|
||||
|
||||
3.1. Application of License.
|
||||
The Modifications which You create or to which You contribute are
|
||||
governed by the terms of this License, including without limitation
|
||||
Section 2.2. The Source Code version of Covered Code may be
|
||||
distributed only under the terms of this License or a future version
|
||||
of this License released under Section 6.1, and You must include a
|
||||
copy of this License with every copy of the Source Code You
|
||||
distribute. You may not offer or impose any terms on any Source Code
|
||||
version that alters or restricts the applicable version of this
|
||||
License or the recipients' rights hereunder. However, You may include
|
||||
an additional document offering the additional rights described in
|
||||
Section 3.5.
|
||||
|
||||
3.2. Availability of Source Code.
|
||||
Any Modification which You create or to which You contribute must be
|
||||
made available in Source Code form under the terms of this License
|
||||
either on the same media as an Executable version or via an accepted
|
||||
Electronic Distribution Mechanism to anyone to whom you made an
|
||||
Executable version available; and if made available via Electronic
|
||||
Distribution Mechanism, must remain available for at least twelve (12)
|
||||
months after the date it initially became available, or at least six
|
||||
(6) months after a subsequent version of that particular Modification
|
||||
has been made available to such recipients. You are responsible for
|
||||
ensuring that the Source Code version remains available even if the
|
||||
Electronic Distribution Mechanism is maintained by a third party.
|
||||
|
||||
3.3. Description of Modifications.
|
||||
You must cause all Covered Code to which You contribute to contain a
|
||||
file documenting the changes You made to create that Covered Code and
|
||||
the date of any change. You must include a prominent statement that
|
||||
the Modification is derived, directly or indirectly, from Original
|
||||
Code provided by the Initial Developer and including the name of the
|
||||
Initial Developer in (a) the Source Code, and (b) in any notice in an
|
||||
Executable version or related documentation in which You describe the
|
||||
origin or ownership of the Covered Code.
|
||||
|
||||
3.4. Intellectual Property Matters
|
||||
(a) Third Party Claims.
|
||||
If Contributor has knowledge that a license under a third party's
|
||||
intellectual property rights is required to exercise the rights
|
||||
granted by such Contributor under Sections 2.1 or 2.2,
|
||||
Contributor must include a text file with the Source Code
|
||||
distribution titled "LEGAL" which describes the claim and the
|
||||
party making the claim in sufficient detail that a recipient will
|
||||
know whom to contact. If Contributor obtains such knowledge after
|
||||
the Modification is made available as described in Section 3.2,
|
||||
Contributor shall promptly modify the LEGAL file in all copies
|
||||
Contributor makes available thereafter and shall take other steps
|
||||
(such as notifying appropriate mailing lists or newsgroups)
|
||||
reasonably calculated to inform those who received the Covered
|
||||
Code that new knowledge has been obtained.
|
||||
|
||||
(b) Contributor APIs.
|
||||
If Contributor's Modifications include an application programming
|
||||
interface and Contributor has knowledge of patent licenses which
|
||||
are reasonably necessary to implement that API, Contributor must
|
||||
also include this information in the LEGAL file.
|
||||
|
||||
(c) Representations.
|
||||
Contributor represents that, except as disclosed pursuant to
|
||||
Section 3.4(a) above, Contributor believes that Contributor's
|
||||
Modifications are Contributor's original creation(s) and/or
|
||||
Contributor has sufficient rights to grant the rights conveyed by
|
||||
this License.
|
||||
|
||||
3.5. Required Notices.
|
||||
You must duplicate the notice in Exhibit A in each file of the Source
|
||||
Code. If it is not possible to put such notice in a particular Source
|
||||
Code file due to its structure, then You must include such notice in a
|
||||
location (such as a relevant directory) where a user would be likely
|
||||
to look for such a notice. If You created one or more Modification(s)
|
||||
You may add your name as a Contributor to the notice described in
|
||||
Exhibit A. You must also duplicate this License in any documentation
|
||||
for the Source Code where You describe recipients' rights or ownership
|
||||
rights relating to Covered Code. You may choose to offer, and to
|
||||
charge a fee for, warranty, support, indemnity or liability
|
||||
obligations to one or more recipients of Covered Code. However, You
|
||||
may do so only on Your own behalf, and not on behalf of the Initial
|
||||
Developer or any Contributor. You must make it absolutely clear than
|
||||
any such warranty, support, indemnity or liability obligation is
|
||||
offered by You alone, and You hereby agree to indemnify the Initial
|
||||
Developer and every Contributor for any liability incurred by the
|
||||
Initial Developer or such Contributor as a result of warranty,
|
||||
support, indemnity or liability terms You offer.
|
||||
|
||||
3.6. Distribution of Executable Versions.
|
||||
You may distribute Covered Code in Executable form only if the
|
||||
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
||||
and if You include a notice stating that the Source Code version of
|
||||
the Covered Code is available under the terms of this License,
|
||||
including a description of how and where You have fulfilled the
|
||||
obligations of Section 3.2. The notice must be conspicuously included
|
||||
in any notice in an Executable version, related documentation or
|
||||
collateral in which You describe recipients' rights relating to the
|
||||
Covered Code. You may distribute the Executable version of Covered
|
||||
Code or ownership rights under a license of Your choice, which may
|
||||
contain terms different from this License, provided that You are in
|
||||
compliance with the terms of this License and that the license for the
|
||||
Executable version does not attempt to limit or alter the recipient's
|
||||
rights in the Source Code version from the rights set forth in this
|
||||
License. If You distribute the Executable version under a different
|
||||
license You must make it absolutely clear that any terms which differ
|
||||
from this License are offered by You alone, not by the Initial
|
||||
Developer or any Contributor. You hereby agree to indemnify the
|
||||
Initial Developer and every Contributor for any liability incurred by
|
||||
the Initial Developer or such Contributor as a result of any such
|
||||
terms You offer.
|
||||
|
||||
3.7. Larger Works.
|
||||
You may create a Larger Work by combining Covered Code with other code
|
||||
not governed by the terms of this License and distribute the Larger
|
||||
Work as a single product. In such a case, You must make sure the
|
||||
requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation.
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Code due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description
|
||||
must be included in the LEGAL file described in Section 3.4 and must
|
||||
be included with all distributions of the Source Code. Except to the
|
||||
extent prohibited by statute or regulation, such description must be
|
||||
sufficiently detailed for a recipient of ordinary skill to be able to
|
||||
understand it.
|
||||
|
||||
5. Application of this License.
|
||||
|
||||
This License applies to code to which the Initial Developer has
|
||||
attached the notice in Exhibit A and to related Covered Code.
|
||||
|
||||
6. Versions of the License.
|
||||
|
||||
6.1. New Versions.
|
||||
Netscape Communications Corporation ("Netscape") may publish revised
|
||||
and/or new versions of the License from time to time. Each version
|
||||
will be given a distinguishing version number.
|
||||
|
||||
6.2. Effect of New Versions.
|
||||
Once Covered Code has been published under a particular version of the
|
||||
License, You may always continue to use it under the terms of that
|
||||
version. You may also choose to use such Covered Code under the terms
|
||||
of any subsequent version of the License published by Netscape. No one
|
||||
other than Netscape has the right to modify the terms applicable to
|
||||
Covered Code created under this License.
|
||||
|
||||
6.3. Derivative Works.
|
||||
If You create or use a modified version of this License (which you may
|
||||
only do in order to apply it to code which is not already Covered Code
|
||||
governed by this License), You must (a) rename Your license so that
|
||||
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
|
||||
"MPL", "NPL" or any confusingly similar phrase do not appear in your
|
||||
license (except to note that your license differs from this License)
|
||||
and (b) otherwise make it clear that Your version of the license
|
||||
contains terms which differ from the Mozilla Public License and
|
||||
Netscape Public License. (Filling in the name of the Initial
|
||||
Developer, Original Code or Contributor in the notice described in
|
||||
Exhibit A shall not of themselves be deemed to be modifications of
|
||||
this License.)
|
||||
|
||||
7. DISCLAIMER OF WARRANTY.
|
||||
|
||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
||||
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
8. TERMINATION.
|
||||
|
||||
8.1. This License and the rights granted hereunder will terminate
|
||||
automatically if You fail to comply with terms herein and fail to cure
|
||||
such breach within 30 days of becoming aware of the breach. All
|
||||
sublicenses to the Covered Code which are properly granted shall
|
||||
survive any termination of this License. Provisions which, by their
|
||||
nature, must remain in effect beyond the termination of this License
|
||||
shall survive.
|
||||
|
||||
8.2. If You initiate litigation by asserting a patent infringement
|
||||
claim (excluding declatory judgment actions) against Initial Developer
|
||||
or a Contributor (the Initial Developer or Contributor against whom
|
||||
You file such action is referred to as "Participant") alleging that:
|
||||
|
||||
(a) such Participant's Contributor Version directly or indirectly
|
||||
infringes any patent, then any and all rights granted by such
|
||||
Participant to You under Sections 2.1 and/or 2.2 of this License
|
||||
shall, upon 60 days notice from Participant terminate prospectively,
|
||||
unless if within 60 days after receipt of notice You either: (i)
|
||||
agree in writing to pay Participant a mutually agreeable reasonable
|
||||
royalty for Your past and future use of Modifications made by such
|
||||
Participant, or (ii) withdraw Your litigation claim with respect to
|
||||
the Contributor Version against such Participant. If within 60 days
|
||||
of notice, a reasonable royalty and payment arrangement are not
|
||||
mutually agreed upon in writing by the parties or the litigation claim
|
||||
is not withdrawn, the rights granted by Participant to You under
|
||||
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
|
||||
the 60 day notice period specified above.
|
||||
|
||||
(b) any software, hardware, or device, other than such Participant's
|
||||
Contributor Version, directly or indirectly infringes any patent, then
|
||||
any rights granted to You by such Participant under Sections 2.1(b)
|
||||
and 2.2(b) are revoked effective as of the date You first made, used,
|
||||
sold, distributed, or had made, Modifications made by that
|
||||
Participant.
|
||||
|
||||
8.3. If You assert a patent infringement claim against Participant
|
||||
alleging that such Participant's Contributor Version directly or
|
||||
indirectly infringes any patent where such claim is resolved (such as
|
||||
by license or settlement) prior to the initiation of patent
|
||||
infringement litigation, then the reasonable value of the licenses
|
||||
granted by such Participant under Sections 2.1 or 2.2 shall be taken
|
||||
into account in determining the amount or value of any payment or
|
||||
license.
|
||||
|
||||
8.4. In the event of termination under Sections 8.1 or 8.2 above,
|
||||
all end user license agreements (excluding distributors and resellers)
|
||||
which have been validly granted by You or any distributor hereunder
|
||||
prior to termination shall survive termination.
|
||||
|
||||
9. LIMITATION OF LIABILITY.
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
||||
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
|
||||
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
||||
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
|
||||
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
|
||||
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
||||
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
|
||||
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
||||
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
||||
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
|
||||
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
10. U.S. GOVERNMENT END USERS.
|
||||
|
||||
The Covered Code is a "commercial item," as that term is defined in
|
||||
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
|
||||
software" and "commercial computer software documentation," as such
|
||||
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
||||
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
||||
all U.S. Government End Users acquire Covered Code with only those
|
||||
rights set forth herein.
|
||||
|
||||
11. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. This License shall be governed by
|
||||
California law provisions (except to the extent applicable law, if
|
||||
any, provides otherwise), excluding its conflict-of-law provisions.
|
||||
With respect to disputes in which at least one party is a citizen of,
|
||||
or an entity chartered or registered to do business in the United
|
||||
States of America, any litigation relating to this License shall be
|
||||
subject to the jurisdiction of the Federal Courts of the Northern
|
||||
District of California, with venue lying in Santa Clara County,
|
||||
California, with the losing party responsible for costs, including
|
||||
without limitation, court costs and reasonable attorneys' fees and
|
||||
expenses. The application of the United Nations Convention on
|
||||
Contracts for the International Sale of Goods is expressly excluded.
|
||||
Any law or regulation which provides that the language of a contract
|
||||
shall be construed against the drafter shall not apply to this
|
||||
License.
|
||||
|
||||
12. RESPONSIBILITY FOR CLAIMS.
|
||||
|
||||
As between Initial Developer and the Contributors, each party is
|
||||
responsible for claims and damages arising, directly or indirectly,
|
||||
out of its utilization of rights under this License and You agree to
|
||||
work with Initial Developer and Contributors to distribute such
|
||||
responsibility on an equitable basis. Nothing herein is intended or
|
||||
shall be deemed to constitute any admission of liability.
|
||||
|
||||
13. MULTIPLE-LICENSED CODE.
|
||||
|
||||
Initial Developer may designate portions of the Covered Code as
|
||||
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
|
||||
Developer permits you to utilize portions of the Covered Code under
|
||||
Your choice of the NPL or the alternative licenses, if any, specified
|
||||
by the Initial Developer in the file described in Exhibit A.
|
||||
|
||||
EXHIBIT A -Mozilla Public License.
|
||||
|
||||
``The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.1 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is ______________________________________.
|
||||
|
||||
The Initial Developer of the Original Code is ________________________.
|
||||
Portions created by ______________________ are Copyright (C) ______
|
||||
_______________________. All Rights Reserved.
|
||||
|
||||
Contributor(s): ______________________________________.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms
|
||||
of the _____ license (the "[___] License"), in which case the
|
||||
provisions of [______] License are applicable instead of those
|
||||
above. If you wish to allow use of your version of this file only
|
||||
under the terms of the [____] License and not to allow others to use
|
||||
your version of this file under the MPL, indicate your decision by
|
||||
deleting the provisions above and replace them with the notice and
|
||||
other provisions required by the [___] License. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file
|
||||
under either the MPL or the [___] License."
|
||||
|
||||
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
||||
the notices in the Source Code files of the Original Code. You should
|
||||
use the text of this Exhibit A rather than the text found in the
|
||||
Original Code Source Code for Your Modifications.]
|
||||
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
@@ -1,199 +0,0 @@
|
||||
Ace (Ajax.org Cloud9 Editor)
|
||||
============================
|
||||
|
||||
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Syntax highlighting
|
||||
* Automatic indent and outdent
|
||||
* An optional command line
|
||||
* Handles huge documents (100,000 lines and more are no problem)
|
||||
* Fully customizable key bindings including VI and Emacs modes
|
||||
* Themes (TextMate themes can be imported)
|
||||
* Search and replace with regular expressions
|
||||
* Highlight matching parentheses
|
||||
* Toggle between soft tabs and real tabs
|
||||
* Displays hidden characters
|
||||
* Drag and drop text using the mouse
|
||||
* Line wrapping
|
||||
* Unstructured / user code folding
|
||||
* Live syntax checker (currently JavaScript/CoffeeScript)
|
||||
|
||||
Take Ace for a spin!
|
||||
--------------------
|
||||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
|
||||
|
||||
Getting the code
|
||||
----------------
|
||||
|
||||
Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
|
||||
|
||||
```bash
|
||||
git clone git://github.com/ajaxorg/ace.git
|
||||
cd ace
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
||||
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
|
||||
|
||||
The easiest version is simply:
|
||||
|
||||
```html
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
```
|
||||
|
||||
With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
|
||||
|
||||
```css
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
height: 400px;
|
||||
}
|
||||
```
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
```html
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
```javascript
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
```
|
||||
|
||||
By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
|
||||
|
||||
```html
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
Then the mode can be used like this:
|
||||
|
||||
```javascript
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js).
|
||||
|
||||
There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki).
|
||||
|
||||
If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss).
|
||||
|
||||
Running Ace
|
||||
-----------
|
||||
|
||||
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
|
||||
|
||||
```bash
|
||||
./static.py
|
||||
```
|
||||
|
||||
Or using Node.JS
|
||||
|
||||
```bash
|
||||
npm install mime
|
||||
./static.js
|
||||
```
|
||||
|
||||
The editor can then be opened at http://localhost:8888/index.html.
|
||||
|
||||
Package Ace
|
||||
-----------
|
||||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Make sure you at least version 0.3.0 of dryice
|
||||
|
||||
```bash
|
||||
npm install dryice
|
||||
```
|
||||
|
||||
Afterwards Ace can be built by calling
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js normal
|
||||
```
|
||||
|
||||
The packaged Ace will be put in the 'build' folder.
|
||||
|
||||
To build the bookmarklet version execute
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js bm
|
||||
```
|
||||
|
||||
Running the Unit Tests
|
||||
----------------------
|
||||
|
||||
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
|
||||
|
||||
```bash
|
||||
npm link .
|
||||
```
|
||||
|
||||
To run the tests call:
|
||||
|
||||
```bash
|
||||
node lib/ace/test/all.js
|
||||
```
|
||||
|
||||
You can also run the tests in your browser by serving:
|
||||
|
||||
http://localhost:8888/lib/ace/test/tests.html
|
||||
|
||||
This makes debugging failing tests way more easier.
|
||||
|
||||
Continuous Integration status
|
||||
-----------------------------
|
||||
|
||||
This project is tested with [Travis CI](http://travis-ci.org)
|
||||
[](http://travis-ci.org/ajaxorg/ace)
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
|
||||
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
|
||||
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
|
||||
|
||||
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email.
|
||||
|
||||
Email: fabian.jakobs@web.de
|
||||
|
||||
Fax: +31 (0) 206388953
|
||||
|
||||
Address: Ajax.org B.V.
|
||||
Keizersgracht 241
|
||||
1016 EA, Amsterdam
|
||||
the Netherlands
|
||||
@@ -1 +0,0 @@
|
||||
define("pilot/index",["require","exports","module","pilot/browser_focus","pilot/dom","pilot/event","pilot/event_emitter","pilot/fixoldbrowsers","pilot/keys","pilot/lang","pilot/oop","pilot/useragent","pilot/canon"],function(a,b,c){a("pilot/browser_focus"),a("pilot/dom"),a("pilot/event"),a("pilot/event_emitter"),a("pilot/fixoldbrowsers"),a("pilot/keys"),a("pilot/lang"),a("pilot/oop"),a("pilot/useragent"),a("pilot/canon")}),define("pilot/browser_focus",["require","exports","module","ace/lib/browser_focus"],function(a,b,c){console.warn("DEPRECATED: 'pilot/browser_focus' is deprecated. Use 'ace/lib/browser_focus' instead"),c.exports=a("ace/lib/browser_focus")}),define("pilot/dom",["require","exports","module","ace/lib/dom"],function(a,b,c){console.warn("DEPRECATED: 'pilot/dom' is deprecated. Use 'ace/lib/dom' instead"),c.exports=a("ace/lib/dom")}),define("pilot/event",["require","exports","module","ace/lib/event"],function(a,b,c){console.warn("DEPRECATED: 'pilot/event' is deprecated. Use 'ace/lib/event' instead"),c.exports=a("ace/lib/event")}),define("pilot/event_emitter",["require","exports","module","ace/lib/event_emitter"],function(a,b,c){console.warn("DEPRECATED: 'pilot/event_emitter' is deprecated. Use 'ace/lib/event_emitter' instead"),c.exports=a("ace/lib/event_emitter")}),define("pilot/fixoldbrowsers",["require","exports","module","ace/lib/fixoldbrowsers"],function(a,b,c){console.warn("DEPRECATED: 'pilot/fixoldbrowsers' is deprecated. Use 'ace/lib/fixoldbrowsers' instead"),c.exports=a("ace/lib/fixoldbrowsers")}),define("pilot/keys",["require","exports","module","ace/lib/keys"],function(a,b,c){console.warn("DEPRECATED: 'pilot/keys' is deprecated. Use 'ace/lib/keys' instead"),c.exports=a("ace/lib/keys")}),define("pilot/lang",["require","exports","module","ace/lib/lang"],function(a,b,c){console.warn("DEPRECATED: 'pilot/lang' is deprecated. Use 'ace/lib/lang' instead"),c.exports=a("ace/lib/lang")}),define("pilot/oop",["require","exports","module","ace/lib/oop"],function(a,b,c){console.warn("DEPRECATED: 'pilot/oop' is deprecated. Use 'ace/lib/oop' instead"),c.exports=a("ace/lib/oop")}),define("pilot/useragent",["require","exports","module","ace/lib/useragent"],function(a,b,c){console.warn("DEPRECATED: 'pilot/useragent' is deprecated. Use 'ace/lib/useragent' instead"),c.exports=a("ace/lib/useragent")}),define("pilot/canon",["require","exports","module"],function(a,b,c){console.warn("DEPRECATED: 'pilot/canon' is deprecated."),b.addCommand=function(){console.warn("DEPRECATED: 'canon.addCommand()' is deprecated. Use 'editor.commands.addCommand(command)' instead."),console.trace()},b.removeCommand=function(){console.warn("DEPRECATED: 'canon.removeCommand()' is deprecated. Use 'editor.commands.removeCommand(command)' instead."),console.trace()}})
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
define("ace/keyboard/keybinding/emacs",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}"use strict";var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","gotoright"),f("(h|left)","gotoleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(g)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}"use strict";var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
define("ace/theme/chrome",["require","exports","module","ace/lib/dom"],function(a,b,c){b.cssClass="ace-chrome",b.cssText=".ace-chrome .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-chrome .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-chrome .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-chrome .ace_gutter-layer { width: 100%; text-align: right;}.ace-chrome .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-chrome .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-chrome .ace_text-layer { cursor: text;}.ace-chrome .ace_cursor { border-left: 2px solid black;}.ace-chrome .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;} .ace-chrome .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-chrome .ace_line .ace_keyword { color: blue;}.ace-chrome .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-chrome .ace_line .ace_constant.ace_language { color: rgb(88, 92, 246);}.ace-chrome .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-chrome .ace_line .ace_invalid { background-color: rgb(153, 0, 0); color: white;}.ace-chrome .ace_line .ace_fold {}.ace-chrome .ace_line .ace_support.ace_function { color: rgb(60, 76, 114);}.ace-chrome .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-chrome .ace_line .ace_support.ace_type,.ace-chrome .ace_line .ace_support.ace_class { color: rgb(109, 121, 222);}.ace-chrome .ace_line .ace_keyword.ace_operator { color: rgb(104, 118, 135);}.ace-chrome .ace_line .ace_string { color: #1919a6;}.ace-chrome .ace_line .ace_comment { color: #236e24;}.ace-chrome .ace_line .ace_comment.ace_doc { color: #236e24;}.ace-chrome .ace_line .ace_comment.ace_doc.ace_tag { color: #236e24;}.ace-chrome .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 205);}.ace-chrome .ace_line .ace_variable { color: rgb(49, 132, 149);}.ace-chrome .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-chrome .ace_entity.ace_name.ace_function { color: #0000A2;}.ace-chrome .ace_markup.ace_markupine { text-decoration:underline;}.ace-chrome .ace_markup.ace_heading { color: rgb(12, 7, 255);}.ace-chrome .ace_markup.ace_list { color:rgb(185, 6, 144);}.ace-chrome .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-chrome .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-chrome .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-chrome .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-chrome .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.07);}.ace-chrome .ace_marker-layer .ace_selected_word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250);}.ace-chrome .ace_meta.ace_tag { color: rgb(147, 15, 128);}.ace-chrome .ace_string.ace_regex { color: rgb(255, 0, 0)}.ace-chrome .ace_entity.ace_other.ace_attribute-name{ color: #994409;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/clouds",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-clouds",b.cssText=".ace-clouds .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds .ace_gutter { background: #e8e8e8; color: #333;}.ace-clouds .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-clouds .ace_scroller { background-color: #FFFFFF;}.ace-clouds .ace_text-layer { cursor: text; color: #000000;}.ace-clouds .ace_cursor { border-left: 2px solid #000000;}.ace-clouds .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-clouds .ace_marker-layer .ace_selection { background: #BDD5FC;}.ace-clouds .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds .ace_marker-layer .ace_active_line { background: #FFFBD1;}.ace-clouds .ace_marker-layer .ace_selected_word { border: 1px solid #BDD5FC;} .ace-clouds .ace_invisible { color: #BFBFBF;}.ace-clouds .ace_keyword { color:#AF956F;}.ace-clouds .ace_keyword.ace_operator { color:#484848;}.ace-clouds .ace_constant.ace_language { color:#39946A;}.ace-clouds .ace_constant.ace_numeric { color:#46A609;}.ace-clouds .ace_invalid { background-color:#FF002A;}.ace-clouds .ace_fold { background-color: #AF956F; border-color: #000000;}.ace-clouds .ace_support.ace_function { color:#C52727;}.ace-clouds .ace_string { color:#5D90CD;}.ace-clouds .ace_comment { color:#BCC8BA;}.ace-clouds .ace_entity.ace_other.ace_attribute-name { color:#606060;}.ace-clouds .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/clouds_midnight",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-clouds-midnight",b.cssText=".ace-clouds-midnight .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds-midnight .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds-midnight .ace_gutter { background: #e8e8e8; color: #333;}.ace-clouds-midnight .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-clouds-midnight .ace_scroller { background-color: #191919;}.ace-clouds-midnight .ace_text-layer { cursor: text; color: #929292;}.ace-clouds-midnight .ace_cursor { border-left: 2px solid #7DA5DC;}.ace-clouds-midnight .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #7DA5DC;} .ace-clouds-midnight .ace_marker-layer .ace_selection { background: #000000;}.ace-clouds-midnight .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds-midnight .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds-midnight .ace_marker-layer .ace_active_line { background: rgba(215, 215, 215, 0.031);}.ace-clouds-midnight .ace_marker-layer .ace_selected_word { border: 1px solid #000000;} .ace-clouds-midnight .ace_invisible { color: #BFBFBF;}.ace-clouds-midnight .ace_keyword { color:#927C5D;}.ace-clouds-midnight .ace_keyword.ace_operator { color:#4B4B4B;}.ace-clouds-midnight .ace_constant.ace_language { color:#39946A;}.ace-clouds-midnight .ace_constant.ace_numeric { color:#46A609;}.ace-clouds-midnight .ace_invalid { color:#FFFFFF;background-color:#E92E2E;}.ace-clouds-midnight .ace_fold { background-color: #927C5D; border-color: #929292;}.ace-clouds-midnight .ace_support.ace_function { color:#E92E2E;}.ace-clouds-midnight .ace_string { color:#5D90CD;}.ace-clouds-midnight .ace_comment { color:#3C403B;}.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name { color:#606060;}.ace-clouds-midnight .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/cobalt",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-cobalt",b.cssText=".ace-cobalt .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-cobalt .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-cobalt .ace_gutter { background: #e8e8e8; color: #333;}.ace-cobalt .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-cobalt .ace_scroller { background-color: #002240;}.ace-cobalt .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-cobalt .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-cobalt .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-cobalt .ace_marker-layer .ace_selection { background: rgba(179, 101, 57, 0.75);}.ace-cobalt .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-cobalt .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.15);}.ace-cobalt .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.35);}.ace-cobalt .ace_marker-layer .ace_selected_word { border: 1px solid rgba(179, 101, 57, 0.75);} .ace-cobalt .ace_invisible { color: rgba(255, 255, 255, 0.15);}.ace-cobalt .ace_keyword { color:#FF9D00;}.ace-cobalt .ace_constant { color:#FF628C;}.ace-cobalt .ace_invalid { color:#F8F8F8;background-color:#800F00;}.ace-cobalt .ace_support { color:#80FFBB;}.ace-cobalt .ace_fold { background-color: #FF9D00; border-color: #FFFFFF;}.ace-cobalt .ace_support.ace_function { color:#FFB054;}.ace-cobalt .ace_string.ace_regexp { color:#80FFC2;}.ace-cobalt .ace_comment { font-style:italic;color:#0088FF;}.ace-cobalt .ace_variable { color:#CCCCCC;}.ace-cobalt .ace_variable.ace_language { color:#FF80E1;}.ace-cobalt .ace_meta.ace_tag { color:#9EFFFF;}.ace-cobalt .ace_markup.ace_underline { text-decoration:underline;}.ace-cobalt .ace_markup.ace_heading { color:#C8E4FD;background-color:#001221;}.ace-cobalt .ace_markup.ace_list { background-color:#130D26;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/crimson_editor",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssText=".ace-crimson-editor .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-crimson-editor .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-crimson-editor .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-crimson-editor .ace_gutter-layer { width: 100%; text-align: right;}.ace-crimson-editor .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-crimson-editor .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-crimson-editor .ace_text-layer { cursor: text; color: rgb(64, 64, 64);}.ace-crimson-editor .ace_cursor { border-left: 2px solid black;}.ace-crimson-editor .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;}.ace-crimson-editor .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-crimson-editor .ace_line .ace_identifier { color: black;}.ace-crimson-editor .ace_line .ace_keyword { color: blue;}.ace-crimson-editor .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-crimson-editor .ace_line .ace_constant.ace_language { color: rgb(255, 156, 0);}.ace-crimson-editor .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-crimson-editor .ace_line .ace_invalid { text-decoration: line-through; color: rgb(224, 0, 0);}.ace-crimson-editor .ace_line .ace_fold {}.ace-crimson-editor .ace_line .ace_support.ace_function { color: rgb(192, 0, 0);}.ace-crimson-editor .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-crimson-editor .ace_line .ace_support.ace_type,.ace-crimson-editor .ace_line .ace_support.ace_class { color: rgb(109, 121, 222);}.ace-crimson-editor .ace_line .ace_keyword.ace_operator { color: rgb(49, 132, 149);}.ace-crimson-editor .ace_line .ace_string { color: rgb(128, 0, 128);}.ace-crimson-editor .ace_line .ace_comment { color: rgb(76, 136, 107);}.ace-crimson-editor .ace_line .ace_comment.ace_doc { color: rgb(0, 102, 255);}.ace-crimson-editor .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191);}.ace-crimson-editor .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 64);}.ace-crimson-editor .ace_line .ace_variable { color: rgb(0, 64, 128);}.ace-crimson-editor .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-crimson-editor .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-crimson-editor .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-crimson-editor .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-crimson-editor .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-crimson-editor .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}.ace-crimson-editor .ace_meta.ace_tag { color:rgb(28, 2, 255);}.ace-crimson-editor .ace_marker-layer .ace_selected_word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250);}.ace-crimson-editor .ace_string.ace_regex { color: rgb(192, 0, 192);}",b.cssClass="ace-crimson-editor";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/dawn",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-dawn",b.cssText=".ace-dawn .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-dawn .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-dawn .ace_gutter { background: #e8e8e8; color: #333;}.ace-dawn .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-dawn .ace_scroller { background-color: #F9F9F9;}.ace-dawn .ace_text-layer { cursor: text; color: #080808;}.ace-dawn .ace_cursor { border-left: 2px solid #000000;}.ace-dawn .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-dawn .ace_marker-layer .ace_selection { background: rgba(39, 95, 255, 0.30);}.ace-dawn .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-dawn .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(75, 75, 126, 0.50);}.ace-dawn .ace_marker-layer .ace_active_line { background: rgba(36, 99, 180, 0.12);}.ace-dawn .ace_marker-layer .ace_selected_word { border: 1px solid rgba(39, 95, 255, 0.30);} .ace-dawn .ace_invisible { color: rgba(75, 75, 126, 0.50);}.ace-dawn .ace_keyword { color:#794938;}.ace-dawn .ace_constant { color:#811F24;}.ace-dawn .ace_invalid.ace_illegal { text-decoration:underline;font-style:italic;color:#F8F8F8;background-color:#B52A1D;}.ace-dawn .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#B52A1D;}.ace-dawn .ace_support { color:#691C97;}.ace-dawn .ace_fold { background-color: #794938; border-color: #080808;}.ace-dawn .ace_support.ace_function { color:#693A17;}.ace-dawn .ace_string { color:#0B6125;}.ace-dawn .ace_string.ace_regexp { color:#CF5628;}.ace-dawn .ace_comment { font-style:italic;color:#5A525F;}.ace-dawn .ace_variable { color:#234A97;}.ace-dawn .ace_markup.ace_underline { text-decoration:underline;}.ace-dawn .ace_markup.ace_heading { color:#19356D;}.ace-dawn .ace_markup.ace_list { color:#693A17;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/dreamweaver",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-tm",b.cssText=".ace-tm .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tm .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tm .ace_gutter { background: #e8e8e8; color: #333;}.ace-tm .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tm .ace_fold { background-color: #00F;}.ace-tm .ace_text-layer { cursor: text;}.ace-tm .ace_cursor { border-left: 2px solid black;}.ace-tm .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;} .ace-tm .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-tm .ace_line .ace_keyword { color: blue;}.ace-tm .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-tm .ace_line .ace_constant.ace_language { color: rgb(88, 92, 246);}.ace-tm .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_invalid { background-color: rgb(153, 0, 0); color: white;}.ace-tm .ace_line .ace_support.ace_function { color: rgb(60, 76, 114);}.ace-tm .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_support.ace_type,.ace-tm .ace_line .ace_support.ace_class { color: #009;}.ace-tm .ace_line .ace_support.ace_php_tag { color: #f00;}.ace-tm .ace_line .ace_keyword.ace_operator { color: rgb(104, 118, 135);}.ace-tm .ace_line .ace_string { color: #00F;}.ace-tm .ace_line .ace_comment { color: rgb(76, 136, 107);}.ace-tm .ace_line .ace_comment.ace_doc { color: rgb(0, 102, 255);}.ace-tm .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191);}.ace-tm .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 205);}.ace-tm .ace_line .ace_variable { color: #06F}.ace-tm .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function { color: #00F;}.ace-tm .ace_markup.ace_markupine { text-decoration:underline;}.ace-tm .ace_markup.ace_heading { color: rgb(12, 7, 255);}.ace-tm .ace_markup.ace_list { color:rgb(185, 6, 144);}.ace-tm .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-tm .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_marker-layer .ace_selected_word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_meta.ace_tag { color:#009;}.ace-tm .ace_meta.ace_tag.ace_anchor { color:#060;}.ace-tm .ace_meta.ace_tag.ace_form { color:#F90;}.ace-tm .ace_meta.ace_tag.ace_image { color:#909;}.ace-tm .ace_meta.ace_tag.ace_script { color:#900;}.ace-tm .ace_meta.ace_tag.ace_style { color:#909;}.ace-tm .ace_meta.ace_tag.ace_table { color:#099;}.ace-tm .ace_string.ace_regex { color: rgb(255, 0, 0)}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/eclipse",["require","exports","module","ace/lib/dom"],function(a,b,c){"use strict",b.isDark=!1,b.cssText=".ace-eclipse .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-eclipse .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-eclipse .ace_gutter { background: rgb(227, 227, 227); border-right: 1px solid rgb(159, 159, 159); color: rgb(136, 136, 136);}.ace-eclipse .ace_print_margin { width: 1px; background: #b1b4ba;}.ace-eclipse .ace_fold { background-color: rgb(60, 76, 114);}.ace-eclipse .ace_text-layer { cursor: text;}.ace-eclipse .ace_cursor { border-left: 1px solid black;}.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable { color: rgb(127, 0, 85);}.ace-eclipse .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-eclipse .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-eclipse .ace_line .ace_function { color: rgb(60, 76, 114);}.ace-eclipse .ace_line .ace_string { color: rgb(42, 0, 255);}.ace-eclipse .ace_line .ace_comment { color: rgb(63, 127, 95);}.ace-eclipse .ace_line .ace_comment.ace_doc { color: rgb(63, 95, 191);}.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(127, 159, 191);}.ace-eclipse .ace_line .ace_constant.ace_numeric {}.ace-eclipse .ace_line .ace_tag { color: rgb(63, 127, 127);}.ace-eclipse .ace_line .ace_type { color: rgb(127, 0, 127);}.ace-eclipse .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-eclipse .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-eclipse .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-eclipse .ace_line .ace_meta.ace_tag { color:rgb(63, 127, 127);}.ace-eclipse .ace_entity.ace_other.ace_attribute-name { color:rgb(127, 0, 127);}.ace-eclipse .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}",b.cssClass="ace-eclipse";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/idle_fingers",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-idle-fingers",b.cssText=".ace-idle-fingers .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-idle-fingers .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-idle-fingers .ace_gutter { background: #e8e8e8; color: #333;}.ace-idle-fingers .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-idle-fingers .ace_scroller { background-color: #323232;}.ace-idle-fingers .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-idle-fingers .ace_cursor { border-left: 2px solid #91FF00;}.ace-idle-fingers .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #91FF00;} .ace-idle-fingers .ace_marker-layer .ace_selection { background: rgba(90, 100, 126, 0.88);}.ace-idle-fingers .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-idle-fingers .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404040;}.ace-idle-fingers .ace_marker-layer .ace_active_line { background: #353637;}.ace-idle-fingers .ace_marker-layer .ace_selected_word { border: 1px solid rgba(90, 100, 126, 0.88);} .ace-idle-fingers .ace_invisible { color: #404040;}.ace-idle-fingers .ace_keyword { color:#CC7833;}.ace-idle-fingers .ace_constant { color:#6C99BB;}.ace-idle-fingers .ace_invalid { color:#FFFFFF;background-color:#FF0000;}.ace-idle-fingers .ace_fold { background-color: #CC7833; border-color: #FFFFFF;}.ace-idle-fingers .ace_support.ace_function { color:#B83426;}.ace-idle-fingers .ace_string { color:#A5C261;}.ace-idle-fingers .ace_string.ace_regexp { color:#CCCC33;}.ace-idle-fingers .ace_comment { font-style:italic;color:#BC9458;}.ace-idle-fingers .ace_meta.ace_tag { color:#FFE5BB;}.ace-idle-fingers .ace_entity.ace_name { color:#FFC66D;}.ace-idle-fingers .ace_markup.ace_underline { text-decoration:underline;}.ace-idle-fingers .ace_collab.ace_user1 { color:#323232;background-color:#FFF980; }";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/kr_theme",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-kr-theme",b.cssText=".ace-kr-theme .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-kr-theme .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-kr-theme .ace_gutter { background: #e8e8e8; color: #333;}.ace-kr-theme .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-kr-theme .ace_scroller { background-color: #0B0A09;}.ace-kr-theme .ace_text-layer { cursor: text; color: #FCFFE0;}.ace-kr-theme .ace_cursor { border-left: 2px solid #FF9900;}.ace-kr-theme .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FF9900;} .ace-kr-theme .ace_marker-layer .ace_selection { background: rgba(170, 0, 255, 0.45);}.ace-kr-theme .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-kr-theme .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 177, 111, 0.32);}.ace-kr-theme .ace_marker-layer .ace_active_line { background: #38403D;}.ace-kr-theme .ace_marker-layer .ace_selected_word { border: 1px solid rgba(170, 0, 255, 0.45);} .ace-kr-theme .ace_invisible { color: rgba(255, 177, 111, 0.32);}.ace-kr-theme .ace_keyword { color:#949C8B;}.ace-kr-theme .ace_constant { color:rgba(210, 117, 24, 0.76);}.ace-kr-theme .ace_invalid { color:#F8F8F8;background-color:#A41300;}.ace-kr-theme .ace_support { color:#9FC28A;}.ace-kr-theme .ace_fold { background-color: #949C8B; border-color: #FCFFE0;}.ace-kr-theme .ace_support.ace_function { color:#85873A;}.ace-kr-theme .ace_string.ace_regexp { color:rgba(125, 255, 192, 0.65);}.ace-kr-theme .ace_comment { font-style:italic;color:#706D5B;}.ace-kr-theme .ace_variable { color:#D1A796;}.ace-kr-theme .ace_variable.ace_language { color:#FF80E1;}.ace-kr-theme .ace_meta.ace_tag { color:#BABD9C;}.ace-kr-theme .ace_markup.ace_underline { text-decoration:underline;}.ace-kr-theme .ace_markup.ace_list { background-color:#0F0040;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/merbivore",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-merbivore",b.cssText=".ace-merbivore .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-merbivore .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-merbivore .ace_gutter { background: #e8e8e8; color: #333;}.ace-merbivore .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-merbivore .ace_scroller { background-color: #161616;}.ace-merbivore .ace_text-layer { cursor: text; color: #E6E1DC;}.ace-merbivore .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-merbivore .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-merbivore .ace_marker-layer .ace_selection { background: #454545;}.ace-merbivore .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-merbivore .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404040;}.ace-merbivore .ace_marker-layer .ace_active_line { background: #333435;}.ace-merbivore .ace_marker-layer .ace_selected_word { border: 1px solid #454545;} .ace-merbivore .ace_invisible { color: #404040;}.ace-merbivore .ace_keyword { color:#FC6F09;}.ace-merbivore .ace_constant { color:#1EDAFB;}.ace-merbivore .ace_constant.ace_language { color:#FDC251;}.ace-merbivore .ace_constant.ace_library { color:#8DFF0A;}.ace-merbivore .ace_constant.ace_numeric { color:#58C554;}.ace-merbivore .ace_invalid { color:#FFFFFF;background-color:#990000;}.ace-merbivore .ace_fold { background-color: #FC6F09; border-color: #E6E1DC;}.ace-merbivore .ace_support.ace_function { color:#FC6F09;}.ace-merbivore .ace_string { color:#8DFF0A;}.ace-merbivore .ace_comment { font-style:italic;color:#AD2EA4;}.ace-merbivore .ace_meta.ace_tag { color:#FC6F09;}.ace-merbivore .ace_entity.ace_other.ace_attribute-name { color:#FFFF89;}.ace-merbivore .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/merbivore_soft",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-merbivore-soft",b.cssText=".ace-merbivore-soft .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-merbivore-soft .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-merbivore-soft .ace_gutter { background: #e8e8e8; color: #333;}.ace-merbivore-soft .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-merbivore-soft .ace_scroller { background-color: #1C1C1C;}.ace-merbivore-soft .ace_text-layer { cursor: text; color: #E6E1DC;}.ace-merbivore-soft .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-merbivore-soft .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-merbivore-soft .ace_marker-layer .ace_selection { background: #494949;}.ace-merbivore-soft .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-merbivore-soft .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404040;}.ace-merbivore-soft .ace_marker-layer .ace_active_line { background: #333435;}.ace-merbivore-soft .ace_marker-layer .ace_selected_word { border: 1px solid #494949;} .ace-merbivore-soft .ace_invisible { color: #404040;}.ace-merbivore-soft .ace_keyword { color:#FC803A;}.ace-merbivore-soft .ace_constant { color:#68C1D8;}.ace-merbivore-soft .ace_constant.ace_language { color:#E1C582;}.ace-merbivore-soft .ace_constant.ace_library { color:#8EC65F;}.ace-merbivore-soft .ace_constant.ace_numeric { color:#7FC578;}.ace-merbivore-soft .ace_invalid { color:#FFFFFF;background-color:#FE3838;}.ace-merbivore-soft .ace_invalid.ace_deprecated { color:#FFFFFF;background-color:#FE3838;}.ace-merbivore-soft .ace_fold { background-color: #FC803A; border-color: #E6E1DC;}.ace-merbivore-soft .ace_string { color:#8EC65F;}.ace-merbivore-soft .ace_comment { font-style:italic;color:#AC4BB8;}.ace-merbivore-soft .ace_meta { font-style:italic;color:#AC4BB8;}.ace-merbivore-soft .ace_meta.ace_tag { color:#FC803A;}.ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name { color:#EAF1A3;}.ace-merbivore-soft .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/mono_industrial",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-mono-industrial",b.cssText=".ace-mono-industrial .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-mono-industrial .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-mono-industrial .ace_gutter { background: #e8e8e8; color: #333;}.ace-mono-industrial .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-mono-industrial .ace_scroller { background-color: #222C28;}.ace-mono-industrial .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-mono-industrial .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-mono-industrial .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-mono-industrial .ace_marker-layer .ace_selection { background: rgba(145, 153, 148, 0.40);}.ace-mono-industrial .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-mono-industrial .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(102, 108, 104, 0.50);}.ace-mono-industrial .ace_marker-layer .ace_active_line { background: rgba(12, 13, 12, 0.25);}.ace-mono-industrial .ace_marker-layer .ace_selected_word { border: 1px solid rgba(145, 153, 148, 0.40);} .ace-mono-industrial .ace_invisible { color: rgba(102, 108, 104, 0.50);}.ace-mono-industrial .ace_keyword { color:#A39E64;}.ace-mono-industrial .ace_keyword.ace_operator { color:#A8B3AB;}.ace-mono-industrial .ace_constant { color:#E98800;}.ace-mono-industrial .ace_constant.ace_numeric { color:#E98800;}.ace-mono-industrial .ace_invalid { color:#FFFFFF;background-color:rgba(153, 0, 0, 0.68);}.ace-mono-industrial .ace_fold { background-color: #A8B3AB; border-color: #FFFFFF;}.ace-mono-industrial .ace_support.ace_function { color:#588E60;}.ace-mono-industrial .ace_comment { color:#666C68;background-color:#151C19;}.ace-mono-industrial .ace_variable.ace_language { color:#648BD2;}.ace-mono-industrial .ace_entity.ace_other.ace_attribute-name { color:#909993;}.ace-mono-industrial .ace_entity.ace_name { color:#5778B6;}.ace-mono-industrial .ace_entity.ace_name.ace_function { color:#A8B3AB;}.ace-mono-industrial .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/monokai",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-monokai",b.cssText=".ace-monokai .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-monokai .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-monokai .ace_gutter { background: #e8e8e8; color: #333;}.ace-monokai .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-monokai .ace_scroller { background-color: #272822;}.ace-monokai .ace_text-layer { cursor: text; color: #F8F8F2;}.ace-monokai .ace_cursor { border-left: 2px solid #F8F8F0;}.ace-monokai .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #F8F8F0;} .ace-monokai .ace_marker-layer .ace_selection { background: #49483E;}.ace-monokai .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-monokai .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #49483E;}.ace-monokai .ace_marker-layer .ace_active_line { background: #49483E;}.ace-monokai .ace_marker-layer .ace_selected_word { border: 1px solid #49483E;} .ace-monokai .ace_invisible { color: #49483E;}.ace-monokai .ace_keyword { color:#F92672;}.ace-monokai .ace_constant.ace_language { color:#AE81FF;}.ace-monokai .ace_constant.ace_numeric { color:#AE81FF;}.ace-monokai .ace_invalid { color:#F8F8F0;background-color:#F92672;}.ace-monokai .ace_invalid.ace_deprecated { color:#F8F8F0;background-color:#AE81FF;}.ace-monokai .ace_fold { background-color: #A6E22E; border-color: #F8F8F2;}.ace-monokai .ace_support.ace_function { color:#66D9EF;}.ace-monokai .ace_string { color:#E6DB74;}.ace-monokai .ace_comment { color:#75715E;}.ace-monokai .ace_entity.ace_other.ace_attribute-name { color:#A6E22E;}.ace-monokai .ace_entity.ace_name.ace_function { color:#A6E22E;}.ace-monokai .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/pastel_on_dark",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-pastel-on-dark",b.cssText=".ace-pastel-on-dark .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-pastel-on-dark .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-pastel-on-dark .ace_gutter { background: #e8e8e8; color: #333;}.ace-pastel-on-dark .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-pastel-on-dark .ace_scroller { background-color: #2C2828;}.ace-pastel-on-dark .ace_text-layer { cursor: text; color: #8F938F;}.ace-pastel-on-dark .ace_cursor { border-left: 2px solid #A7A7A7;}.ace-pastel-on-dark .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #A7A7A7;} .ace-pastel-on-dark .ace_marker-layer .ace_selection { background: rgba(221, 240, 255, 0.20);}.ace-pastel-on-dark .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-pastel-on-dark .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.25);}.ace-pastel-on-dark .ace_marker-layer .ace_active_line { background: rgba(255, 255, 255, 0.031);}.ace-pastel-on-dark .ace_marker-layer .ace_selected_word { border: 1px solid rgba(221, 240, 255, 0.20);} .ace-pastel-on-dark .ace_invisible { color: rgba(255, 255, 255, 0.25);}.ace-pastel-on-dark .ace_keyword { color:#757aD8;}.ace-pastel-on-dark .ace_keyword.ace_operator { color:#797878;}.ace-pastel-on-dark .ace_constant { color:#4FB7C5;}.ace-pastel-on-dark .ace_constant.ace_language { color:#DE8E30;}.ace-pastel-on-dark .ace_constant.ace_numeric { color:#CCCCCC;}.ace-pastel-on-dark .ace_invalid { color:#F8F8F8;background-color:rgba(86, 45, 86, 0.75);}.ace-pastel-on-dark .ace_invalid.ace_illegal { color:#F8F8F8;background-color:rgba(86, 45, 86, 0.75);}.ace-pastel-on-dark .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#D2A8A1;}.ace-pastel-on-dark .ace_fold { background-color: #757aD8; border-color: #8F938F;}.ace-pastel-on-dark .ace_support.ace_function { color:#AEB2F8;}.ace-pastel-on-dark .ace_string { color:#66A968;}.ace-pastel-on-dark .ace_string.ace_regexp { color:#E9C062;}.ace-pastel-on-dark .ace_comment { color:#A6C6FF;}.ace-pastel-on-dark .ace_variable { color:#BEBF55;}.ace-pastel-on-dark .ace_variable.ace_language { color:#C1C144;}.ace-pastel-on-dark .ace_xml_pe { color:#494949;}.ace-pastel-on-dark .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/solarized_dark",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-solarized-dark",b.cssText=".ace-solarized-dark .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-solarized-dark .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-solarized-dark .ace_gutter { background: #e8e8e8; color: #333;}.ace-solarized-dark .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-solarized-dark .ace_scroller { background-color: #002B36;}.ace-solarized-dark .ace_text-layer { cursor: text; color: #93A1A1;}.ace-solarized-dark .ace_cursor { border-left: 2px solid #D30102;}.ace-solarized-dark .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #D30102;} .ace-solarized-dark .ace_marker-layer .ace_selection { background: #073642;}.ace-solarized-dark .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-solarized-dark .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(147, 161, 161, 0.50);}.ace-solarized-dark .ace_marker-layer .ace_active_line { background: #073642;}.ace-solarized-dark .ace_marker-layer .ace_selected_word { border: 1px solid #073642;} .ace-solarized-dark .ace_invisible { color: rgba(147, 161, 161, 0.50);}.ace-solarized-dark .ace_keyword { color:#859900;}.ace-solarized-dark .ace_constant.ace_language { color:#B58900;}.ace-solarized-dark .ace_constant.ace_numeric { color:#D33682;}.ace-solarized-dark .ace_fold { background-color: #268BD2; border-color: #93A1A1;}.ace-solarized-dark .ace_support.ace_function { color:#268BD2;}.ace-solarized-dark .ace_string { color:#2AA198;}.ace-solarized-dark .ace_string.ace_regexp { color:#D30102;}.ace-solarized-dark .ace_comment { font-style:italic;color:#657B83;}.ace-solarized-dark .ace_variable.ace_language { color:#268BD2;}.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name { color:#93A1A1;}.ace-solarized-dark .ace_entity.ace_name.ace_function { color:#268BD2;}.ace-solarized-dark .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/solarized_light",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-solarized-light",b.cssText=".ace-solarized-light .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-solarized-light .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-solarized-light .ace_gutter { background: #e8e8e8; color: #333;}.ace-solarized-light .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-solarized-light .ace_scroller { background-color: #FDF6E3;}.ace-solarized-light .ace_text-layer { cursor: text; color: #586E75;}.ace-solarized-light .ace_cursor { border-left: 2px solid #000000;}.ace-solarized-light .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-solarized-light .ace_marker-layer .ace_selection { background: #073642;}.ace-solarized-light .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-solarized-light .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(147, 161, 161, 0.50);}.ace-solarized-light .ace_marker-layer .ace_active_line { background: #EEE8D5;}.ace-solarized-light .ace_marker-layer .ace_selected_word { border: 1px solid #073642;} .ace-solarized-light .ace_invisible { color: rgba(147, 161, 161, 0.50);}.ace-solarized-light .ace_keyword { color:#859900;}.ace-solarized-light .ace_constant.ace_language { color:#B58900;}.ace-solarized-light .ace_constant.ace_numeric { color:#D33682;}.ace-solarized-light .ace_fold { background-color: #268BD2; border-color: #586E75;}.ace-solarized-light .ace_support.ace_function { color:#268BD2;}.ace-solarized-light .ace_string { color:#2AA198;}.ace-solarized-light .ace_string.ace_regexp { color:#D30102;}.ace-solarized-light .ace_comment { color:#93A1A1;}.ace-solarized-light .ace_variable.ace_language { color:#268BD2;}.ace-solarized-light .ace_entity.ace_other.ace_attribute-name { color:#93A1A1;}.ace-solarized-light .ace_entity.ace_name.ace_function { color:#268BD2;}.ace-solarized-light .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/tomorrow",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-tomorrow",b.cssText=".ace-tomorrow .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tomorrow .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tomorrow .ace_gutter { background: #e8e8e8; color: #333;}.ace-tomorrow .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tomorrow .ace_scroller { background-color: #FFFFFF;}.ace-tomorrow .ace_text-layer { cursor: text; color: #4D4D4C;}.ace-tomorrow .ace_cursor { border-left: 2px solid #AEAFAD;}.ace-tomorrow .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #AEAFAD;} .ace-tomorrow .ace_marker-layer .ace_selection { background: #D6D6D6;}.ace-tomorrow .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-tomorrow .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #D1D1D1;}.ace-tomorrow .ace_marker-layer .ace_active_line { background: #EFEFEF;}.ace-tomorrow .ace_marker-layer .ace_selected_word { border: 1px solid #D6D6D6;} .ace-tomorrow .ace_invisible { color: #D1D1D1;}.ace-tomorrow .ace_keyword { color:#8959A8;}.ace-tomorrow .ace_keyword.ace_operator { color:#3E999F;}.ace-tomorrow .ace_constant.ace_language { color:#F5871F;}.ace-tomorrow .ace_constant.ace_numeric { color:#F5871F;}.ace-tomorrow .ace_invalid { color:#FFFFFF;background-color:#C82829;}.ace-tomorrow .ace_invalid.ace_deprecated { color:#FFFFFF;background-color:#8959A8;}.ace-tomorrow .ace_fold { background-color: #4271AE; border-color: #4D4D4C;}.ace-tomorrow .ace_support.ace_function { color:#4271AE;}.ace-tomorrow .ace_string { color:#718C00;}.ace-tomorrow .ace_string.ace_regexp { color:#C82829;}.ace-tomorrow .ace_comment { color:#8E908C;}.ace-tomorrow .ace_variable { color:#C82829;}.ace-tomorrow .ace_meta.ace_tag { color:#C82829;}.ace-tomorrow .ace_entity.ace_other.ace_attribute-name { color:#C82829;}.ace-tomorrow .ace_entity.ace_name.ace_function { color:#4271AE;}.ace-tomorrow .ace_markup.ace_underline { text-decoration:underline;}.ace-tomorrow .ace_markup.ace_heading { color:#718C00;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/tomorrow_night",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-tomorrow-night",b.cssText=".ace-tomorrow-night .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tomorrow-night .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tomorrow-night .ace_gutter { background: #e8e8e8; color: #333;}.ace-tomorrow-night .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tomorrow-night .ace_scroller { background-color: #1D1F21;}.ace-tomorrow-night .ace_text-layer { cursor: text; color: #C5C8C6;}.ace-tomorrow-night .ace_cursor { border-left: 2px solid #AEAFAD;}.ace-tomorrow-night .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #AEAFAD;} .ace-tomorrow-night .ace_marker-layer .ace_selection { background: #373B41;}.ace-tomorrow-night .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-tomorrow-night .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #4B4E55;}.ace-tomorrow-night .ace_marker-layer .ace_active_line { background: #282A2E;}.ace-tomorrow-night .ace_marker-layer .ace_selected_word { border: 1px solid #373B41;} .ace-tomorrow-night .ace_invisible { color: #4B4E55;}.ace-tomorrow-night .ace_keyword { color:#B294BB;}.ace-tomorrow-night .ace_keyword.ace_operator { color:#8ABEB7;}.ace-tomorrow-night .ace_constant.ace_language { color:#DE935F;}.ace-tomorrow-night .ace_constant.ace_numeric { color:#DE935F;}.ace-tomorrow-night .ace_invalid { color:#CED2CF;background-color:#DF5F5F;}.ace-tomorrow-night .ace_invalid.ace_deprecated { color:#CED2CF;background-color:#B798BF;}.ace-tomorrow-night .ace_fold { background-color: #81A2BE; border-color: #C5C8C6;}.ace-tomorrow-night .ace_support.ace_function { color:#81A2BE;}.ace-tomorrow-night .ace_string { color:#B5BD68;}.ace-tomorrow-night .ace_string.ace_regexp { color:#CC6666;}.ace-tomorrow-night .ace_comment { color:#969896;}.ace-tomorrow-night .ace_variable { color:#CC6666;}.ace-tomorrow-night .ace_meta.ace_tag { color:#CC6666;}.ace-tomorrow-night .ace_entity.ace_other.ace_attribute-name { color:#CC6666;}.ace-tomorrow-night .ace_entity.ace_name.ace_function { color:#81A2BE;}.ace-tomorrow-night .ace_markup.ace_underline { text-decoration:underline;}.ace-tomorrow-night .ace_markup.ace_heading { color:#B5BD68;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/tomorrow_night_blue",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-tomorrow-night-blue",b.cssText=".ace-tomorrow-night-blue .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tomorrow-night-blue .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tomorrow-night-blue .ace_gutter { background: #e8e8e8; color: #333;}.ace-tomorrow-night-blue .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tomorrow-night-blue .ace_scroller { background-color: #002451;}.ace-tomorrow-night-blue .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-tomorrow-night-blue .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-tomorrow-night-blue .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-tomorrow-night-blue .ace_marker-layer .ace_selection { background: #003F8E;}.ace-tomorrow-night-blue .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-tomorrow-night-blue .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404F7D;}.ace-tomorrow-night-blue .ace_marker-layer .ace_active_line { background: #00346E;}.ace-tomorrow-night-blue .ace_marker-layer .ace_selected_word { border: 1px solid #003F8E;} .ace-tomorrow-night-blue .ace_invisible { color: #404F7D;}.ace-tomorrow-night-blue .ace_keyword { color:#EBBBFF;}.ace-tomorrow-night-blue .ace_keyword.ace_operator { color:#99FFFF;}.ace-tomorrow-night-blue .ace_constant.ace_language { color:#FFC58F;}.ace-tomorrow-night-blue .ace_constant.ace_numeric { color:#FFC58F;}.ace-tomorrow-night-blue .ace_invalid { color:#FFFFFF;background-color:#F99DA5;}.ace-tomorrow-night-blue .ace_invalid.ace_deprecated { color:#FFFFFF;background-color:#EBBBFF;}.ace-tomorrow-night-blue .ace_fold { background-color: #BBDAFF; border-color: #FFFFFF;}.ace-tomorrow-night-blue .ace_support.ace_function { color:#BBDAFF;}.ace-tomorrow-night-blue .ace_string { color:#D1F1A9;}.ace-tomorrow-night-blue .ace_string.ace_regexp { color:#FF9DA4;}.ace-tomorrow-night-blue .ace_comment { color:#7285B7;}.ace-tomorrow-night-blue .ace_variable { color:#FF9DA4;}.ace-tomorrow-night-blue .ace_meta.ace_tag { color:#FF9DA4;}.ace-tomorrow-night-blue .ace_entity.ace_other.ace_attribute-name { color:#FF9DA4;}.ace-tomorrow-night-blue .ace_entity.ace_name.ace_function { color:#BBDAFF;}.ace-tomorrow-night-blue .ace_markup.ace_underline { text-decoration:underline;}.ace-tomorrow-night-blue .ace_markup.ace_heading { color:#D1F1A9;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/tomorrow_night_bright",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-tomorrow-night-bright",b.cssText=".ace-tomorrow-night-bright .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tomorrow-night-bright .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tomorrow-night-bright .ace_gutter { background: #e8e8e8; color: #333;}.ace-tomorrow-night-bright .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tomorrow-night-bright .ace_scroller { background-color: #000000;}.ace-tomorrow-night-bright .ace_text-layer { cursor: text; color: #DEDEDE;}.ace-tomorrow-night-bright .ace_cursor { border-left: 2px solid #9F9F9F;}.ace-tomorrow-night-bright .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #9F9F9F;} .ace-tomorrow-night-bright .ace_marker-layer .ace_selection { background: #424242;}.ace-tomorrow-night-bright .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-tomorrow-night-bright .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #343434;}.ace-tomorrow-night-bright .ace_marker-layer .ace_active_line { background: #2A2A2A;}.ace-tomorrow-night-bright .ace_marker-layer .ace_selected_word { border: 1px solid #424242;} .ace-tomorrow-night-bright .ace_invisible { color: #343434;}.ace-tomorrow-night-bright .ace_keyword { color:#C397D8;}.ace-tomorrow-night-bright .ace_keyword.ace_operator { color:#70C0B1;}.ace-tomorrow-night-bright .ace_constant.ace_language { color:#E78C45;}.ace-tomorrow-night-bright .ace_constant.ace_numeric { color:#E78C45;}.ace-tomorrow-night-bright .ace_invalid { color:#CED2CF;background-color:#DF5F5F;}.ace-tomorrow-night-bright .ace_invalid.ace_deprecated { color:#CED2CF;background-color:#B798BF;}.ace-tomorrow-night-bright .ace_fold { background-color: #7AA6DA; border-color: #DEDEDE;}.ace-tomorrow-night-bright .ace_support.ace_function { color:#7AA6DA;}.ace-tomorrow-night-bright .ace_string { color:#B9CA4A;}.ace-tomorrow-night-bright .ace_string.ace_regexp { color:#D54E53;}.ace-tomorrow-night-bright .ace_comment { color:#969896;}.ace-tomorrow-night-bright .ace_variable { color:#D54E53;}.ace-tomorrow-night-bright .ace_meta.ace_tag { color:#D54E53;}.ace-tomorrow-night-bright .ace_entity.ace_other.ace_attribute-name { color:#D54E53;}.ace-tomorrow-night-bright .ace_entity.ace_name.ace_function { color:#7AA6DA;}.ace-tomorrow-night-bright .ace_markup.ace_underline { text-decoration:underline;}.ace-tomorrow-night-bright .ace_markup.ace_heading { color:#B9CA4A;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/tomorrow_night_eighties",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-tomorrow-night-eighties",b.cssText=".ace-tomorrow-night-eighties .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tomorrow-night-eighties .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tomorrow-night-eighties .ace_gutter { background: #e8e8e8; color: #333;}.ace-tomorrow-night-eighties .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tomorrow-night-eighties .ace_scroller { background-color: #2D2D2D;}.ace-tomorrow-night-eighties .ace_text-layer { cursor: text; color: #CCCCCC;}.ace-tomorrow-night-eighties .ace_cursor { border-left: 2px solid #CCCCCC;}.ace-tomorrow-night-eighties .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #CCCCCC;} .ace-tomorrow-night-eighties .ace_marker-layer .ace_selection { background: #515151;}.ace-tomorrow-night-eighties .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-tomorrow-night-eighties .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #6A6A6A;}.ace-tomorrow-night-eighties .ace_marker-layer .ace_active_line { background: #393939;}.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected_word { border: 1px solid #515151;} .ace-tomorrow-night-eighties .ace_invisible { color: #6A6A6A;}.ace-tomorrow-night-eighties .ace_keyword { color:#CC99CC;}.ace-tomorrow-night-eighties .ace_keyword.ace_operator { color:#66CCCC;}.ace-tomorrow-night-eighties .ace_constant.ace_language { color:#F99157;}.ace-tomorrow-night-eighties .ace_constant.ace_numeric { color:#F99157;}.ace-tomorrow-night-eighties .ace_invalid { color:#CDCDCD;background-color:#F2777A;}.ace-tomorrow-night-eighties .ace_invalid.ace_deprecated { color:#CDCDCD;background-color:#CC99CC;}.ace-tomorrow-night-eighties .ace_fold { background-color: #6699CC; border-color: #CCCCCC;}.ace-tomorrow-night-eighties .ace_support.ace_function { color:#6699CC;}.ace-tomorrow-night-eighties .ace_string { color:#99CC99;}.ace-tomorrow-night-eighties .ace_comment { color:#999999;}.ace-tomorrow-night-eighties .ace_variable { color:#F2777A;}.ace-tomorrow-night-eighties .ace_meta.ace_tag { color:#F2777A;}.ace-tomorrow-night-eighties .ace_entity.ace_other.ace_attribute-name { color:#F2777A;}.ace-tomorrow-night-eighties .ace_entity.ace_name.ace_function { color:#6699CC;}.ace-tomorrow-night-eighties .ace_markup.ace_underline { text-decoration:underline;}.ace-tomorrow-night-eighties .ace_markup.ace_heading { color:#99CC99;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/twilight",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-twilight",b.cssText=".ace-twilight .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-twilight .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-twilight .ace_gutter { background: #e8e8e8; color: #333;}.ace-twilight .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-twilight .ace_scroller { background-color: #141414;}.ace-twilight .ace_text-layer { cursor: text; color: #F8F8F8;}.ace-twilight .ace_cursor { border-left: 2px solid #A7A7A7;}.ace-twilight .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #A7A7A7;} .ace-twilight .ace_marker-layer .ace_selection { background: rgba(221, 240, 255, 0.20);}.ace-twilight .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-twilight .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.25);}.ace-twilight .ace_marker-layer .ace_active_line { background: rgba(255, 255, 255, 0.031);}.ace-twilight .ace_marker-layer .ace_selected_word { border: 1px solid rgba(221, 240, 255, 0.20);} .ace-twilight .ace_invisible { color: rgba(255, 255, 255, 0.25);}.ace-twilight .ace_keyword { color:#CDA869;}.ace-twilight .ace_constant { color:#CF6A4C;}.ace-twilight .ace_invalid.ace_illegal { color:#F8F8F8;background-color:rgba(86, 45, 86, 0.75);}.ace-twilight .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#D2A8A1;}.ace-twilight .ace_support { color:#9B859D;}.ace-twilight .ace_fold { background-color: #AC885B; border-color: #F8F8F8;}.ace-twilight .ace_support.ace_function { color:#DAD085;}.ace-twilight .ace_string { color:#8F9D6A;}.ace-twilight .ace_string.ace_regexp { color:#E9C062;}.ace-twilight .ace_comment { font-style:italic;color:#5F5A60;}.ace-twilight .ace_variable { color:#7587A6;}.ace-twilight .ace_xml_pe { color:#494949;}.ace-twilight .ace_meta.ace_tag { color:#AC885B;}.ace-twilight .ace_entity.ace_name.ace_function { color:#AC885B;}.ace-twilight .ace_markup.ace_underline { text-decoration:underline;}.ace-twilight .ace_markup.ace_heading { color:#CF6A4C;}.ace-twilight .ace_markup.ace_list { color:#F9EE98;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
@@ -1 +0,0 @@
|
||||
define("ace/theme/vibrant_ink",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!0,b.cssClass="ace-vibrant-ink",b.cssText=".ace-vibrant-ink .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-vibrant-ink .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-vibrant-ink .ace_gutter { background: #e8e8e8; color: #333;}.ace-vibrant-ink .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-vibrant-ink .ace_scroller { background-color: #0F0F0F;}.ace-vibrant-ink .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-vibrant-ink .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-vibrant-ink .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-vibrant-ink .ace_marker-layer .ace_selection { background: #6699CC;}.ace-vibrant-ink .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-vibrant-ink .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404040;}.ace-vibrant-ink .ace_marker-layer .ace_active_line { background: #333333;}.ace-vibrant-ink .ace_marker-layer .ace_selected_word { border: 1px solid #6699CC;} .ace-vibrant-ink .ace_invisible { color: #404040;}.ace-vibrant-ink .ace_keyword { color:#FF6600;}.ace-vibrant-ink .ace_constant { color:#339999;}.ace-vibrant-ink .ace_constant.ace_numeric { color:#99CC99;}.ace-vibrant-ink .ace_invalid { color:#CCFF33;background-color:#000000;}.ace-vibrant-ink .ace_invalid.ace_deprecated { color:#CCFF33;background-color:#000000;}.ace-vibrant-ink .ace_fold { background-color: #FFCC00; border-color: #FFFFFF;}.ace-vibrant-ink .ace_support.ace_function { color:#FFCC00;}.ace-vibrant-ink .ace_string { color:#66FF00;}.ace-vibrant-ink .ace_string.ace_regexp { color:#44B4CC;}.ace-vibrant-ink .ace_comment { color:#9933CC;}.ace-vibrant-ink .ace_entity.ace_other.ace_attribute-name { font-style:italic;color:#99CC99;}.ace-vibrant-ink .ace_entity.ace_name.ace_function { color:#FFCC00;}.ace-vibrant-ink .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})
|
||||
23
applications/admin/static/codemirror/LICENSE
Normal file
23
applications/admin/static/codemirror/LICENSE
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Please note that some subdirectories of the CodeMirror distribution
|
||||
include their own LICENSE files, and are released under different
|
||||
licences.
|
||||
8
applications/admin/static/codemirror/README.md
Normal file
8
applications/admin/static/codemirror/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# CodeMirror [](http://travis-ci.org/marijnh/CodeMirror)
|
||||
|
||||
CodeMirror is a JavaScript component that provides a code editor in
|
||||
the browser. When a mode is available for the language you are coding
|
||||
in, it will color your code, and optionally help with indentation.
|
||||
|
||||
The project page is http://codemirror.net
|
||||
The manual is at http://codemirror.net/doc/manual.html
|
||||
284
applications/admin/static/codemirror/emmet.min.js
vendored
Normal file
284
applications/admin/static/codemirror/emmet.min.js
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
/* from http://code.google.com/p/zen-coding/ MIT license */
|
||||
var _=function(){function h(a,b,d){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual&&k.isFunction(a.isEqual))return a.isEqual(b);if(b.isEqual&&k.isFunction(b.isEqual))return b.isEqual(a);var c=i.call(a);if(c!=i.call(b))return!1;switch(c){case "[object String]":return a==String(b);case "[object Number]":return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case "[object Date]":case "[object Boolean]":return+a==+b;case "[object RegExp]":return a.source==
|
||||
b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object")return!1;for(var e=d.length;e--;)if(d[e]==a)return!0;d.push(a);var e=0,f=!0;if(c=="[object Array]"){if(e=a.length,f=e==b.length)for(;e--;)if(!(f=e in a==e in b&&h(a[e],b[e],d)))break}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return!1;for(var j in a)if(k.has(a,j)&&(e++,!(f=k.has(b,j)&&h(a[j],b[j],d))))break;if(f){for(j in b)if(k.has(b,j)&&!e--)break;
|
||||
f=!e}}d.pop();return f}var e=this,g=e._,f={},c=Array.prototype,b=Object.prototype,a=c.slice,d=c.unshift,i=b.toString,j=b.hasOwnProperty,l=c.forEach,n=c.map,m=c.reduce,o=c.reduceRight,q=c.filter,r=c.every,t=c.some,x=c.indexOf,u=c.lastIndexOf,b=Array.isArray,z=Object.keys,A=Function.prototype.bind,k=function(a){return new B(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=k;exports._=k}else e._=k;k.VERSION="1.3.3";var v=k.each=k.forEach=function(a,
|
||||
b,d){if(a!=null)if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,e=a.length;c<e;c++){if(c in a&&b.call(d,a[c],c,a)===f)break}else for(c in a)if(k.has(a,c)&&b.call(d,a[c],c,a)===f)break};k.map=k.collect=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.map===n)return a.map(b,c);v(a,function(a,e,i){d[d.length]=b.call(c,a,e,i)});if(a.length===+a.length)d.length=a.length;return d};k.reduce=k.foldl=k.inject=function(a,b,d,c){var e=arguments.length>2;a==null&&(a=[]);if(m&&
|
||||
a.reduce===m)return c&&(b=k.bind(b,c)),e?a.reduce(b,d):a.reduce(b);v(a,function(a,i,f){e?d=b.call(c,d,a,i,f):(d=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return d};k.reduceRight=k.foldr=function(a,b,d,c){var e=arguments.length>2;a==null&&(a=[]);if(o&&a.reduceRight===o)return c&&(b=k.bind(b,c)),e?a.reduceRight(b,d):a.reduceRight(b);var i=k.toArray(a).reverse();c&&!e&&(b=k.bind(b,c));return e?k.reduce(i,b,d,c):k.reduce(i,b)};k.find=k.detect=function(a,b,d){var c;
|
||||
F(a,function(a,e,i){if(b.call(d,a,e,i))return c=a,!0});return c};k.filter=k.select=function(a,b,d){var c=[];if(a==null)return c;if(q&&a.filter===q)return a.filter(b,d);v(a,function(a,e,i){b.call(d,a,e,i)&&(c[c.length]=a)});return c};k.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,i){b.call(c,a,e,i)||(d[d.length]=a)});return d};k.every=k.all=function(a,b,d){var c=!0;if(a==null)return c;if(r&&a.every===r)return a.every(b,d);v(a,function(a,e,i){if(!(c=c&&b.call(d,a,e,i)))return f});
|
||||
return!!c};var F=k.some=k.any=function(a,b,c){b||(b=k.identity);var d=!1;if(a==null)return d;if(t&&a.some===t)return a.some(b,c);v(a,function(a,e,i){if(d||(d=b.call(c,a,e,i)))return f});return!!d};k.include=k.contains=function(a,b){var d=!1;return a==null?d:x&&a.indexOf===x?a.indexOf(b)!=-1:d=F(a,function(a){return a===b})};k.invoke=function(b,d){var c=a.call(arguments,2);return k.map(b,function(a){return(k.isFunction(d)?d||a:a[d]).apply(a,c)})};k.pluck=function(a,b){return k.map(a,function(a){return a[b]})};
|
||||
k.max=function(a,b,d){if(!b&&k.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!b&&k.isEmpty(a))return-Infinity;var c={computed:-Infinity};v(a,function(a,e,i){e=b?b.call(d,a,e,i):a;e>=c.computed&&(c={value:a,computed:e})});return c.value};k.min=function(a,b,d){if(!b&&k.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!b&&k.isEmpty(a))return Infinity;var c={computed:Infinity};v(a,function(a,e,i){e=b?b.call(d,a,e,i):a;e<c.computed&&(c={value:a,computed:e})});return c.value};k.shuffle=
|
||||
function(a){var b=[],d;v(a,function(a,c){d=Math.floor(Math.random()*(c+1));b[c]=b[d];b[d]=a});return b};k.sortBy=function(a,b,d){var c=k.isFunction(b)?b:function(a){return a[b]};return k.pluck(k.map(a,function(a,b,e){return{value:a,criteria:c.call(d,a,b,e)}}).sort(function(a,b){var d=a.criteria,c=b.criteria;return d===void 0?1:c===void 0?-1:d<c?-1:d>c?1:0}),"value")};k.groupBy=function(a,b){var d={},c=k.isFunction(b)?b:function(a){return a[b]};v(a,function(a,b){var e=c(a,b);(d[e]||(d[e]=[])).push(a)});
|
||||
return d};k.sortedIndex=function(a,b,d){d||(d=k.identity);for(var c=0,e=a.length;c<e;){var i=c+e>>1;d(a[i])<d(b)?c=i+1:e=i}return c};k.toArray=function(b){return!b?[]:k.isArray(b)?a.call(b):k.isArguments(b)?a.call(b):b.toArray&&k.isFunction(b.toArray)?b.toArray():k.values(b)};k.size=function(a){return k.isArray(a)?a.length:k.keys(a).length};k.first=k.head=k.take=function(b,d,c){return d!=null&&!c?a.call(b,0,d):b[0]};k.initial=function(b,d,c){return a.call(b,0,b.length-(d==null||c?1:d))};k.last=function(b,
|
||||
d,c){return d!=null&&!c?a.call(b,Math.max(b.length-d,0)):b[b.length-1]};k.rest=k.tail=function(b,d,c){return a.call(b,d==null||c?1:d)};k.compact=function(a){return k.filter(a,function(a){return!!a})};k.flatten=function(a,b){return k.reduce(a,function(a,d){if(k.isArray(d))return a.concat(b?d:k.flatten(d));a[a.length]=d;return a},[])};k.without=function(b){return k.difference(b,a.call(arguments,1))};k.uniq=k.unique=function(a,b,d){var d=d?k.map(a,d):a,c=[];a.length<3&&(b=!0);k.reduce(d,function(d,e,
|
||||
i){if(b?k.last(d)!==e||!d.length:!k.include(d,e))d.push(e),c.push(a[i]);return d},[]);return c};k.union=function(){return k.uniq(k.flatten(arguments,!0))};k.intersection=k.intersect=function(b){var d=a.call(arguments,1);return k.filter(k.uniq(b),function(a){return k.every(d,function(b){return k.indexOf(b,a)>=0})})};k.difference=function(b){var d=k.flatten(a.call(arguments,1),!0);return k.filter(b,function(a){return!k.include(d,a)})};k.zip=function(){for(var b=a.call(arguments),d=k.max(k.pluck(b,"length")),
|
||||
c=Array(d),e=0;e<d;e++)c[e]=k.pluck(b,""+e);return c};k.indexOf=function(a,b,d){if(a==null)return-1;var c;if(d)return d=k.sortedIndex(a,b),a[d]===b?d:-1;if(x&&a.indexOf===x)return a.indexOf(b);d=0;for(c=a.length;d<c;d++)if(d in a&&a[d]===b)return d;return-1};k.lastIndexOf=function(a,b){if(a==null)return-1;if(u&&a.lastIndexOf===u)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};k.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,
|
||||
c=Math.max(Math.ceil((b-a)/d),0),e=0,i=Array(c);e<c;)i[e++]=a,a+=d;return i};var G=function(){};k.bind=function(b,d){var c,e;if(b.bind===A&&A)return A.apply(b,a.call(arguments,1));if(!k.isFunction(b))throw new TypeError;e=a.call(arguments,2);return c=function(){if(!(this instanceof c))return b.apply(d,e.concat(a.call(arguments)));G.prototype=b.prototype;var i=new G,f=b.apply(i,e.concat(a.call(arguments)));return Object(f)===f?f:i}};k.bindAll=function(b){var d=a.call(arguments,1);d.length==0&&(d=k.functions(b));
|
||||
v(d,function(a){b[a]=k.bind(b[a],b)});return b};k.memoize=function(a,b){var d={};b||(b=k.identity);return function(){var c=b.apply(this,arguments);return k.has(d,c)?d[c]:d[c]=a.apply(this,arguments)}};k.delay=function(b,d){var c=a.call(arguments,2);return setTimeout(function(){return b.apply(null,c)},d)};k.defer=function(b){return k.delay.apply(k,[b,1].concat(a.call(arguments,1)))};k.throttle=function(a,b){var d,c,e,i,f,j,g=k.debounce(function(){f=i=!1},b);return function(){d=this;c=arguments;var k;
|
||||
e||(e=setTimeout(function(){e=null;f&&a.apply(d,c);g()},b));i?f=!0:j=a.apply(d,c);g();i=!0;return j}};k.debounce=function(a,b,d){var c;return function(){var e=this,i=arguments;d&&!c&&a.apply(e,i);clearTimeout(c);c=setTimeout(function(){c=null;d||a.apply(e,i)},b)}};k.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}};k.wrap=function(b,d){return function(){var c=[b].concat(a.call(arguments,0));return d.apply(this,c)}};k.compose=function(){var a=arguments;
|
||||
return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};k.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};k.keys=z||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)k.has(a,d)&&(b[b.length]=d);return b};k.values=function(a){return k.map(a,k.identity)};k.functions=k.methods=function(a){var b=[],d;for(d in a)k.isFunction(a[d])&&b.push(d);return b.sort()};k.extend=function(b){v(a.call(arguments,
|
||||
1),function(a){for(var d in a)b[d]=a[d]});return b};k.pick=function(b){var d={};v(k.flatten(a.call(arguments,1)),function(a){a in b&&(d[a]=b[a])});return d};k.defaults=function(b){v(a.call(arguments,1),function(a){for(var d in a)b[d]==null&&(b[d]=a[d])});return b};k.clone=function(a){return!k.isObject(a)?a:k.isArray(a)?a.slice():k.extend({},a)};k.tap=function(a,b){b(a);return a};k.isEqual=function(a,b){return h(a,b,[])};k.isEmpty=function(a){if(a==null)return!0;if(k.isArray(a)||k.isString(a))return a.length===
|
||||
0;for(var b in a)if(k.has(a,b))return!1;return!0};k.isElement=function(a){return!!(a&&a.nodeType==1)};k.isArray=b||function(a){return i.call(a)=="[object Array]"};k.isObject=function(a){return a===Object(a)};k.isArguments=function(a){return i.call(a)=="[object Arguments]"};if(!k.isArguments(arguments))k.isArguments=function(a){return!(!a||!k.has(a,"callee"))};k.isFunction=function(a){return i.call(a)=="[object Function]"};k.isString=function(a){return i.call(a)=="[object String]"};k.isNumber=function(a){return i.call(a)==
|
||||
"[object Number]"};k.isFinite=function(a){return k.isNumber(a)&&isFinite(a)};k.isNaN=function(a){return a!==a};k.isBoolean=function(a){return a===!0||a===!1||i.call(a)=="[object Boolean]"};k.isDate=function(a){return i.call(a)=="[object Date]"};k.isRegExp=function(a){return i.call(a)=="[object RegExp]"};k.isNull=function(a){return a===null};k.isUndefined=function(a){return a===void 0};k.has=function(a,b){return j.call(a,b)};k.noConflict=function(){e._=g;return this};k.identity=function(a){return a};
|
||||
k.times=function(a,b,d){for(var c=0;c<a;c++)b.call(d,c)};k.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};k.result=function(a,b){if(a==null)return null;var d=a[b];return k.isFunction(d)?d.call(a):d};k.mixin=function(a){v(k.functions(a),function(b){H(b,k[b]=a[b])})};var s=0;k.uniqueId=function(a){var b=s++;return a?a+b:b};k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,
|
||||
escape:/<%-([\s\S]+?)%>/g};var w=/.^/,y={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},C;for(C in y)y[y[C]]=C;var I=/\\|'|\r|\n|\t|\u2028|\u2029/g,J=/\\(\\|'|r|n|t|u2028|u2029)/g,D=function(a){return a.replace(J,function(a,b){return y[b]})};k.template=function(a,b,d){d=k.defaults(d||{},k.templateSettings);a="__p+='"+a.replace(I,function(a){return"\\"+y[a]}).replace(d.escape||w,function(a,b){return"'+\n_.escape("+D(b)+")+\n'"}).replace(d.interpolate||w,function(a,b){return"'+\n("+
|
||||
D(b)+")+\n'"}).replace(d.evaluate||w,function(a,b){return"';\n"+D(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",c=new Function(d.variable||"obj","_",a);if(b)return c(b,k);b=function(a){return c.call(this,a,k)};b.source="function("+(d.variable||"obj")+"){\n"+a+"}";return b};k.chain=function(a){return k(a).chain()};var B=function(a){this._wrapped=a};k.prototype=B.prototype;
|
||||
var E=function(a,b){return b?k(a).chain():a},H=function(b,c){B.prototype[b]=function(){var b=a.call(arguments);d.call(b,this._wrapped);return E(c.apply(k,b),this._chain)}};k.mixin(k);v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=c[a];B.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var c=d.length;(a=="shift"||a=="splice")&&c===0&&delete d[0];return E(d,this._chain)}});v(["concat","join","slice"],function(a){var b=c[a];B.prototype[a]=function(){return E(b.apply(this._wrapped,
|
||||
arguments),this._chain)}});B.prototype.chain=function(){this._chain=!0;return this};B.prototype.value=function(){return this._wrapped};return k}.call({}),emmet=function(h,e){function g(a,b,i){var f;f=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)};e.extend(f,a);c.prototype=a.prototype;f.prototype=new c;b&&e.extend(f.prototype,b);i&&e.extend(f,i);f.prototype.constructor=f;f.__super__=a.prototype;return f}var f={_:e},c=function(){},b=null;return{define:function(a,
|
||||
b){a in f||(f[a]=e.isFunction(b)?this.exec(b):b)},require:function(a){!(a in f)&&b&&b(a);return f[a]},exec:function(a,b){return a.call(b||h,e.bind(this.require,this),e,this)},extend:function(a,b){var c=g(this,a,b);c.extend=this.extend;if(a.hasOwnProperty("toString"))c.prototype.toString=a.toString;return c},expandAbbreviation:function(a,b,c,e){if(!a)return"";var b=b||"html",c=c||"plain",f=this.require("filters"),g=this.require("utils"),h=this.require("abbreviationParser"),c=this.require("profile").get(c,
|
||||
b);this.require("tabStops").resetTabstopIndex();a=f.extractFromAbbreviation(a);e=h.parse(a[0],{syntax:b,contextNode:e});b=f.composeList(b,c,a[1]);f.apply(e,b,c);return g.replaceVariables(e.toString())},defaultSyntax:function(){return"html"},defaultProfile:function(){return"plain"},log:function(){h.console&&h.console.log&&h.console.log.apply(h.console,arguments)},setModuleLoader:function(a){b=a}}}(this,_);
|
||||
emmet.define("abbreviationParser",function(h,e){function g(){this.parent=null;this.children=[];this._attributes=[];this.abbreviation="";this.counter=1;this._name=null;this._text="";this.repeatCount=1;this.hasImplicitRepeat=!1;this._data={};this.padding=this.content=this.end=this.start=""}function f(a){return a.substring(1,a.length-1)}function c(a){for(var a=h("utils").trim(a),b=new g,d=b.addChild(),i,j=h("stringStream").create(a),a=1E3,m;!j.eol()&&--a>0;)switch(i=j.peek(),i){case "(":j.start=j.pos;
|
||||
if(j.skipToPair("(",")"))i=c(f(j.current())),(m=j.match(/^\*(\d+)?/,!0))&&d._setRepeat(m[1]),e.each(i.children,function(a){d.addChild(a)});else throw'Invalid abbreviation: mo matching ")" found for character at '+j.pos;break;case ">":d=d.addChild();j.next();break;case "+":d=d.parent.addChild();j.next();break;case "^":i=d.parent||d;d=(i.parent||i).addChild();j.next();break;default:j.start=j.pos,j.eatWhile(function(a){if(a=="["||a=="{"){if(j.skipToPair(a,q[a]))return j.backUp(1),!0;throw'Invalid abbreviation: mo matching "'+
|
||||
q[a]+'" found for character at '+j.pos;}return a=="+"?(j.next(),a=j.eol()||~"+>^*".indexOf(j.peek()),j.backUp(1),a):a!="("&&n(a)}),d.setAbbreviation(j.current()),j.start=j.pos}if(a<1)throw"Endless loop detected";return b}function b(a){var a=h("utils").trim(a),b=[],a=h("stringStream").create(a);for(a.eatSpace();!a.eol();)if(a.start=a.pos,a.eatWhile(o)){var d=a.current(),c="";if(a.peek()=="="){a.next();a.start=a.pos;var e=a.peek();if(e=='"'||e=="'"){a.next();a:{for(var c=a,i=void 0;i=c.next();)if(i===
|
||||
e){c=!0;break a}c=!1}if(c)c=a.current(),c=c.substring(1,c.length-1);else throw"Invalid attribute value";}else if(a.eatWhile(/[^\s\]]/))c=a.current();else throw"Invalid attribute value";}b.push({name:d,value:c});a.eatSpace()}else break;return b}function a(a){for(var c=[],e={"#":"id",".":"class"},i=null,j=h("stringStream").create(a);!j.eol();)switch(j.peek()){case "#":case ".":if(i===null)i=j.pos;var g=e[j.peek()];j.next();j.start=j.pos;j.eatWhile(o);c.push({name:g,value:j.current()});break;case "[":if(i===
|
||||
null)i=j.pos;j.start=j.pos;if(!j.skipToPair("[","]"))throw"Invalid attribute set definition";c=c.concat(b(f(j.current())));break;default:j.next()}return!c.length?null:{element:a.substring(0,i),attributes:d(c)}}function d(a){var a=e.map(a,function(a){return e.clone(a)}),b={};return e.filter(a,function(a){if(!(a.name in b))return b[a.name]=a;var d=b[a.name];a.name.toLowerCase()=="class"?d.value+=(d.value.length?" ":"")+a.value:d.value=a.value;return!1})}function i(a){if(!~a.indexOf("{"))return null;
|
||||
for(var b=h("stringStream").create(a);!b.eol();)switch(b.peek()){case "[":case "(":b.skipToPair(b.peek(),q[b.peek()]);break;case "{":return b.start=b.pos,b.skipToPair("{","}"),{element:a.substring(0,b.start),text:f(b.current())};default:b.next()}}function j(a){for(var b=a.children.length-1,d,c;b>=0;b--)if(c=a.children[b],c.isRepeating()){d=c.repeatCount;c.repeatCount=1;for(c.updateProperty("counter",1);--d>0;)c.parent.addChild(c.clone(),b+1).updateProperty("counter",d+1)}e.each(a.children,j);return a}
|
||||
function l(a){for(var b=a.children.length-1;b>=0;b--){var d=a.children[b];d.isGroup()?d.replace(l(d).children):d.isEmpty()&&d.remove()}e.each(a.children,l);return a}function n(a){var b=a.charCodeAt(0);return b>64&&b<91||b>96&&b<123||b>47&&b<58||"#.*:$-_!@|".indexOf(a)!=-1}var m=/^[\w\-\$\:@\!]+\+?$/i,o=/[\w\-:\$]/,q={"[":"]","(":")","{":"}"},r=Array.prototype.splice,t=[],x=[],u=[];g.prototype={addChild:function(a,b){a=a||new g;a.parent=this;e.isUndefined(b)?this.children.push(a):this.children.splice(b,
|
||||
0,a);return a},clone:function(){var a=new g;e.each(["abbreviation","counter","_name","_text","repeatCount","hasImplicitRepeat","start","end","content","padding"],function(b){a[b]=this[b]},this);a._attributes=e.map(this._attributes,function(a){return e.clone(a)});a._data=e.clone(this._data);a.children=e.map(this.children,function(b){b=b.clone();b.parent=a;return b});return a},remove:function(){if(this.parent)this.parent.children=e.without(this.parent.children,this);return this},replace:function(){var a=
|
||||
this.parent,b=e.indexOf(a.children,this),d=e.flatten(arguments);r.apply(a.children,[b,1].concat(d));e.each(d,function(b){b.parent=a})},updateProperty:function(a,b){this[a]=b;e.each(this.children,function(d){d.updateProperty(a,b)})},find:function(a){return this.findAll(a)[0]},findAll:function(a){if(!e.isFunction(a))var b=a.toLowerCase(),a=function(a){return a.name().toLowerCase()==b};var d=[];e.each(this.children,function(b){a(b)&&d.push(b);d=d.concat(b.findAll(a))});return e.compact(d)},data:function(a,
|
||||
b){if(arguments.length==2&&(this._data[a]=b,a=="resource"&&h("elements").is(b,"snippet")&&(this.content=b.data,this._text)))this.content=h("abbreviationUtils").insertChildContent(b.data,this._text);return this._data[a]},name:function(){var a=this.matchedResource();return h("elements").is(a,"element")?a.name:this._name},attributeList:function(){var a=[],b=this.matchedResource();h("elements").is(b,"element")&&e.isArray(b.attributes)&&(a=a.concat(b.attributes));return d(a.concat(this._attributes))},
|
||||
attribute:function(a,b){if(arguments.length==2){var d=e.indexOf(e.pluck(this._attributes,"name"),a.toLowerCase());if(~d)this._attributes[d].value=b}return(e.find(this.attributeList(),function(b){return b.name==a})||{}).value},matchedResource:function(){return this.data("resource")},index:function(){return this.parent?e.indexOf(this.parent.children,this):-1},_setRepeat:function(a){a?this.repeatCount=parseInt(a,10)||1:this.hasImplicitRepeat=!0},setAbbreviation:function(b){var d=this;this.abbreviation=
|
||||
b=(b||"").replace(/\*(\d+)?$/,function(a,b){d._setRepeat(b);return""});var c=i(b);if(c)b=c.element,this.content=this._text=c.text;if(c=a(b))b=c.element,this._attributes=c.attributes;if((this._name=b)&&!m.test(this._name))throw"Invalid abbreviation";},toString:function(){var a=h("utils"),b=this.start,d=this.end,c=this.content,i=this;e.each(u,function(a){b=a(b,i,"start");c=a(c,i,"content");d=a(d,i,"end")});var j=e.map(this.children,function(a){return a.toString()}).join(""),c=h("abbreviationUtils").insertChildContent(c,
|
||||
j,{keepVariable:!1});return b+a.padString(c,this.padding)+d},hasEmptyChildren:function(){return!!e.find(this.children,function(a){return a.isEmpty()})},hasImplicitName:function(){return!this._name&&!this.isTextNode()},isGroup:function(){return!this.abbreviation},isEmpty:function(){return!this.abbreviation&&!this.children.length},isRepeating:function(){return this.repeatCount>1||this.hasImplicitRepeat},isTextNode:function(){return!this.name()&&!this.attributeList().length},isElement:function(){return!this.isEmpty()&&
|
||||
!this.isTextNode()},deepestChild:function(){if(!this.children.length)return null;for(var a=this;a.children.length;)a=e.last(a.children);return a}};u.push(function(a,b){return h("utils").replaceCounter(a,b.counter)});return{parse:function(a,b){var b=b||{},d=c(a);if(b.contextNode){d._name=b.contextNode.name;var i={};e.each(d._attributes,function(a){i[a.name]=a});e.each(b.contextNode.attributes,function(a){a.name in i?i[a.name].value=a.value:(a=e.clone(a),d._attributes.push(a),i[a.name]=a)})}e.each(t,
|
||||
function(a){a(d,b)});d=l(j(d));e.each(x,function(a){a(d,b)});return d},AbbreviationNode:g,addPreprocessor:function(a){e.include(t,a)||t.push(a)},removeFilter:function(a){preprocessor=e.without(t,a)},addPostprocessor:function(a){e.include(x,a)||x.push(a)},removePostprocessor:function(a){x=e.without(x,a)},addOutputProcessor:function(a){e.include(u,a)||u.push(a)},removeOutputProcessor:function(a){u=e.without(u,a)},isAllowedChar:function(a){a=String(a);return n(a)||~">+^[](){}".indexOf(a)}}});
|
||||
emmet.exec(function(h,e){function g(f,c){var b=h("resources"),a=h("elements"),d=h("abbreviationParser");e.each(e.clone(f.children),function(i){var j=b.getMatchedResource(i,c);if(e.isString(j))i.data("resource",a.create("snippet",j));else if(a.is(j,"reference")){j=d.parse(j.data,{syntax:c});if(i.repeatCount>1){var f=j.findAll(function(a){return a.hasImplicitRepeat});e.each(f,function(a){a.repeatCount=i.repeatCount;a.hasImplicitRepeat=!1})}var h=j.deepestChild();h&&e.each(i.children,function(a){h.addChild(a)});
|
||||
i.replace(j.children)}else i.data("resource",j);g(i,c)})}h("abbreviationParser").addPreprocessor(function(e,c){var b=c.syntax||emmet.defaultSyntax();g(e,b)})});
|
||||
emmet.exec(function(h,e){function g(a){for(var b=h("range"),c=[],a=h("stringStream").create(a);!a.eol();){if(a.peek()=="\\")a.next();else if(a.start=a.pos,a.match(d,!0)){c.push(b.create(a.start,d));continue}a.next()}return c}function f(a,b){var d=h("utils"),c=g(a);c.reverse();e.each(c,function(c){a=d.replaceSubstring(a,b,c)});return a}function c(a){return g(a.content).length?!0:!!e.find(a.attributeList(),function(a){return!!g(a.value).length})}function b(a,b){var d=a.findAll(function(a){return c(a)});
|
||||
c(a)&&d.unshift(a);d.length?e.each(d,function(a){a.content=f(a.content,b);e.each(a._attributes,function(a){a.value=f(a.value,b)})}):(d=a.deepestChild()||a,d.content=h("abbreviationUtils").insertChildContent(d.content,b))}var a=h("abbreviationParser"),d="$#";a.addPreprocessor(function(a,b){if(b.pastedContent){var d=h("utils").splitByLines(b.pastedContent,!0);a.findAll(function(a){if(a.hasImplicitRepeat)return a.data("paste",d),a.repeatCount=d.length})}});a.addPostprocessor(function(a,d){!a.findAll(function(a){var d=
|
||||
a.data("paste"),c="";e.isArray(d)?c=d[a.counter-1]:e.isFunction(d)?c=d(a.counter-1,a.content):d&&(c=d);c&&b(a,c);a.data("paste",null);return!e.isUndefined(d)}).length&&d.pastedContent&&b(a,d.pastedContent)})});emmet.exec(function(h,e){function g(f){var c=h("tagName");e.each(f.children,function(b){if(b.hasImplicitName()||b.data("forceNameResolving"))b._name=c.resolve(b.parent.name());g(b)});return f}h("abbreviationParser").addPostprocessor(g)});
|
||||
emmet.define("cssParser",function(h,e){function g(a){return typeof a!=="undefined"}function f(){return{"char":i.chnum,line:i.linenum}}function c(a,b,d){var c=i,d=d||{};j.push({charstart:g(d["char"])?d["char"]:c.chnum,charend:g(d.charend)?d.charend:c.chnum,linestart:g(d.line)?d.line:c.linenum,lineend:g(d.lineend)?d.lineend:c.linenum,value:a,type:b||a})}function b(a,b){var d=i,c=b||{},e=g(c["char"])?c["char"]:d.chnum,c=g(c.line)?c.line:d.linenum;return{name:"ParseError",message:a+" at line "+(c+1)+
|
||||
" char "+(e+1),walker:d,tokens:j}}function a(a){var b=i,d=b.ch,e=f(),j=a?a+d:d,d=b.nextChar();for(a&&(e["char"]-=a.length);n(d)||m(d);)j+=d,d=b.nextChar();c(j,"identifier",e)}function d(){var d=i.ch;if(d===" "||d==="\t"){for(var e=i.ch,j="",g=f();e===" "||e==="\t";)j+=e,e=i.nextChar();c(j,"white",g)}else{if(d==="/"){var e=i,d=g=e.ch,h,u=f();h=e.nextChar();if(h!=="*")u.charend=u["char"],u.lineend=u.line,j=c(d,d,u);else{for(;!(g==="*"&&h==="/");)d+=h,g=h,h=e.nextChar();d+=h;e.nextChar();c(d,"comment",
|
||||
u)}return j}if(d==='"'||d==="'"){e=i;d=g=j=e.ch;u=f();for(j=e.nextChar();j!==g;){if(j==="\n")if(h=e.nextChar(),h==="\\")d+=j+h;else throw b("Unterminated string",u);else d+=j==="\\"?j+e.nextChar():j;j=e.nextChar()}d+=j;e.nextChar();c(d,"string",u)}else if(d==="("){e=i;j=e.ch;g=0;d=j;h=f();for(j=e.nextChar();j!==")"&&!g;){if(j==="(")g++;else if(j===")")g--;else if(j===!1)throw b("Unterminated brace",h);d+=j;j=e.nextChar()}d+=j;e.nextChar();c(d,"brace",h)}else{if(d==="-"||d==="."||m(d)){j=i;g=j.ch;
|
||||
d=f();h=g;var u=h===".",z,g=j.nextChar();z=!m(g);if(u&&z)d.charend=d["char"],d.lineend=d.line,e=c(h,".",d);else if(h==="-"&&z)e=a("-");else{for(;g!==!1&&(m(g)||!u&&g===".");)g==="."&&(u=!0),h+=g,g=j.nextChar();c(h,"number",d)}return e}if(n(d))return a();if(l(d))return e=i,d=e.ch,j=f(),h=e.nextChar(),h==="="&&l(d,!0)?(d+=h,c(d,"match",j),e.nextChar(),g=void 0):(j.charend=j["char"]+1,j.lineend=j.line,c(d,d,j)),g;if(d==="\n")c("line"),i.nextChar();else throw b("Unrecognized character");}}}var i,j=[],
|
||||
l,n,m;i={lines:null,total_lines:0,linenum:-1,line:"",ch:"",chnum:-1,init:function(a){var b=i;b.lines=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n");b.total_lines=b.lines.length;b.chnum=-1;b.linenum=-1;b.ch="";b.line="";b.nextLine();b.nextChar()},nextLine:function(){this.linenum+=1;this.line=this.total_lines<=this.linenum?!1:this.lines[this.linenum];if(this.chnum!==-1)this.chnum=0;return this.line},nextChar:function(){for(this.chnum+=1;this.line.charAt(this.chnum)==="";){if(this.nextLine()===
|
||||
!1)return this.ch=!1;this.chnum=-1;return this.ch="\n"}return this.ch=this.line.charAt(this.chnum)},peek:function(){return this.line.charAt(this.chnum+1)}};n=function(a){return a==="_"||a==="-"||a>="a"&&a<="z"||a>="A"&&a<="Z"};m=function(a){return a!==!1&&a>="0"&&a<="9"};l=function(){for(var a="{}[]()+*=.,;:>~|\\%$#@^!".split(""),b="*^|$~".split(""),d={},c={},e=0;e<a.length;e+=1)d[a[e]]=!0;for(e=0;e<b.length;e+=1)c[b[e]]=!0;return function(a,b){return b?!!c[a]:!!d[a]}}();return{lex:function(a){i.init(a);
|
||||
for(j=[];i.ch!==!1;)d();return j},parse:function(a){var b=0;return e.map(this.lex(a),function(d){if(d.type=="line")d.value=a.charAt(b)=="\r"&&a.charAt(b+1)=="\n"?"\r\n":a.charAt(b);return{type:d.type,start:b,end:b+=d.value.length}})},toSource:function(a){for(var b=0,d=a.length,c,e="";b<d;b+=1)c=a[b],e+=c.type==="line"?"\n":c.value;return e}}});
|
||||
emmet.define("xmlParser",function(h){function e(a,d){function e(b){d.tokenize=b;return b(a,d)}var i=a.next();if(i=="<")if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?e(c("atom","]]\>")):null:a.match("--")?e(c("comment","--\>")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),e(b(1))):null;else if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),d.tokenize=c("meta","?>"),"meta";else{A=a.eat("/")?"closeTag":"openTag";a.eatSpace();for(z="";i=a.eat(/[^\s\u00a0=<>\"\'\/?]/);)z+=i;d.tokenize=g;return"tag"}else return i==
|
||||
"&"?(a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"))?"atom":"error":(a.eatWhile(/[^&<]/),"text")}function g(a,b){var d=a.next();return d==">"||d=="/"&&a.eat(">")?(b.tokenize=e,A=d==">"?"endTag":"selfcloseTag","tag"):d=="="?(A="equals",null):/[\'\"]/.test(d)?(b.tokenize=f(d),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function f(a){return function(b,d){for(;!b.eol();)if(b.next()==a){d.tokenize=g;break}return"string"}}
|
||||
function c(a,b){return function(d,c){for(;!d.eol();){if(d.match(b)){c.tokenize=e;break}d.next()}return a}}function b(a){return function(d,c){for(var i;(i=d.next())!=null;)if(i=="<")return c.tokenize=b(a+1),c.tokenize(d,c);else if(i==">")if(a==1){c.tokenize=e;break}else return c.tokenize=b(a-1),c.tokenize(d,c);return"meta"}}function a(){for(var a=arguments.length-1;a>=0;a--)k.cc.push(arguments[a])}function d(){a.apply(null,arguments);return!0}function i(){if(k.context)k.context=k.context.prev}function j(a){if(a==
|
||||
"openTag")return k.tagName=z,d(o,l(k.startOfLine));else if(a=="closeTag")return a=!1,k.context?k.context.tagName!=z&&(u.implicitlyClosed.hasOwnProperty(k.context.tagName.toLowerCase())&&i(),a=!k.context||k.context.tagName!=z):a=!0,a&&(v="error"),d(n(a));return d()}function l(a){return function(b){if(b=="selfcloseTag"||b=="endTag"&&u.autoSelfClosers.hasOwnProperty(k.tagName.toLowerCase()))return m(k.tagName.toLowerCase()),d();if(b=="endTag"){m(k.tagName.toLowerCase());var b=k.tagName,c=u.doNotIndent.hasOwnProperty(b)||
|
||||
k.context&&k.context.noIndent;k.context={prev:k.context,tagName:b,indent:k.indented,startOfLine:a,noIndent:c}}return d()}}function n(a){return function(b){a&&(v="error");if(b=="endTag")return i(),d();v="error";return d(arguments.callee)}}function m(a){for(var b;;){if(!k.context)break;b=k.context.tagName.toLowerCase();if(!u.contextGrabbers.hasOwnProperty(b)||!u.contextGrabbers[b].hasOwnProperty(a))break;i()}}function o(b){if(b=="word")return v="attribute",d(q,o);if(b=="endTag"||b=="selfcloseTag")return a();
|
||||
v="error";return d(o)}function q(b){if(b=="equals")return d(r,o);u.allowMissing||(v="error");return b=="endTag"||b=="selfcloseTag"?a():d()}function r(b){if(b=="string")return d(t);if(b=="word"&&u.allowUnquoted)return v="string",d();v="error";return b=="endTag"||b=="selfCloseTag"?a():d()}function t(b){return b=="string"?d(t):a()}function x(a,b){if(a.sol())b.startOfLine=!0,b.indented=0;if(a.eatSpace())return null;v=A=z=null;var d=b.tokenize(a,b);b.type=A;if((d||A)&&d!="comment")for(k=b;;)if((b.cc.pop()||
|
||||
j)(A||d))break;b.startOfLine=!1;return v||d}var u={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!0,allowMissing:!0},z=null,A=null,k=null,v;return{parse:function(a,b){for(var b=b||0,d={tokenize:e,cc:[],indented:0,startOfLine:!0,tagName:null,context:null},c=h("stringStream").create(a),i=[];!c.eol();)i.push({type:x(c,d),start:c.start+b,end:c.pos+b}),c.start=c.pos;return i}}});
|
||||
emmet.define("utils",function(h,e){function g(c){this._data=[];this.length=0;c&&this.append(c)}var f="${0}";g.prototype={append:function(c){this._data.push(c);this.length+=c.length},toString:function(){return this._data.join("")},valueOf:function(){return this.toString()}};return{reTag:/<\/?[\w:\-]+(?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*\s*(\/?)>$/,endsWithTag:function(c){return this.reTag.test(c)},isNumeric:function(c){typeof c=="string"&&(c=c.charCodeAt(0));return c&&c>47&&
|
||||
c<58},trim:function(c){return(c||"").replace(/^\s+|\s+$/g,"")},getNewline:function(){var c=h("resources");if(!c)return"\n";c=c.getVariable("newline");return e.isString(c)?c:"\n"},setNewline:function(c){var b=h("resources");b.setVariable("newline",c);b.setVariable("nl",c)},splitByLines:function(c,b){var a=this.getNewline(),a=(c||"").replace(/\r\n/g,"\n").replace(/\n\r/g,"\n").replace(/\r/g,"\n").replace(/\n/g,a).split(a);b&&(a=e.filter(a,function(a){return a.length&&!!this.trim(a)},this));return a},
|
||||
normalizeNewline:function(c){return this.splitByLines(c).join(this.getNewline())},repeatString:function(c,b){for(var a=[],d=0;d<b;d++)a.push(c);return a.join("")},padString:function(c,b){var a=e.isNumber(b)?this.repeatString(h("resources").getVariable("indentation")||"\t",b):b,d=[],i=this.splitByLines(c),j=this.getNewline();d.push(i[0]);for(var f=1;f<i.length;f++)d.push(j+a+i[f]);return d.join("")},zeroPadString:function(c,b){for(var a="",d=c.length;b>d++;)a+="0";return a+c},unindentString:function(c,
|
||||
b){for(var a=this.splitByLines(c),d=0;d<a.length;d++)a[d].search(b)==0&&(a[d]=a[d].substr(b.length));return a.join(this.getNewline())},replaceUnescapedSymbol:function(c,b,a){for(var d=0,i=c.length,j=b.length,f=0;d<i;)if(c.charAt(d)=="\\")d+=j+1;else if(c.substr(d,j)==b){var g=j;f++;var h=a;if(e.isFunction(a))(h=a(c,b,d,f))?(g=h[0].length,h=h[1]):h=!1;h===!1?d++:(c=c.substring(0,d)+h+c.substring(d+g),i=c.length,d+=h.length)}else d++;return c},replaceVariables:function(c,b){var b=b||{},a=e.isFunction(b)?
|
||||
b:function(a,d){return d in b?b[d]:null},d=h("resources");return h("tabStops").processText(c,{variable:function(b){var c=a(b.token,b.name,b);c===null&&(c=d.getVariable(b.name));if(c===null||e.isUndefined(c))c=b.token;return c}})},replaceCounter:function(c,b){var b=String(b),a=this;return this.replaceUnescapedSymbol(String(c),"$",function(d,c,e){if(d.charAt(e+1)=="{"||a.isNumeric(d.charAt(e+1)))return!1;for(c=e+1;d.charAt(c)=="$"&&d.charAt(c+1)!="{";)c++;return[d.substring(e,c),a.zeroPadString(b,c-
|
||||
e)]})},matchesTag:function(c){return this.reTag.test(c||"")},escapeText:function(c){return c.replace(/([\$\\])/g,"\\$1")},unescapeText:function(c){return c.replace(/\\(.)/g,"$1")},getCaretPlaceholder:function(){return e.isFunction(f)?f.apply(this,arguments):f},setCaretPlaceholder:function(c){f=c},getLinePadding:function(c){return(c.match(/^(\s+)/)||[""])[0]},getLinePaddingFromPosition:function(c,b){return this.getLinePadding(this.findNewlineBounds(c,b).substring(c))},escapeForRegexp:function(c){return c.replace(RegExp("[.*+?|()\\[\\]{}\\\\]",
|
||||
"g"),"\\$&")},prettifyNumber:function(c,b){return c.toFixed(typeof b=="undefined"?2:b).replace(/\.?0+$/,"")},stringBuilder:function(c){return new g(c)},replaceSubstring:function(c,b,a,d){if(e.isObject(a)&&"end"in a)d=a.end,a=a.start;e.isString(d)&&(d=a+d.length);e.isUndefined(d)&&(d=a);return a<0||a>c.length?c:c.substring(0,a)+b+c.substring(d)},narrowToNonSpace:function(c,b,a){b=h("range").create(b,a);for(a=/[\s\n\r\u00a0]/;b.start<b.end;){if(!a.test(c.charAt(b.start)))break;b.start++}for(;b.end>
|
||||
b.start;)if(b.end--,!a.test(c.charAt(b.end))){b.end++;break}return b},findNewlineBounds:function(c,b){for(var a=c.length,d=0,e=a-1,j=b-1;j>0;j--){var f=c.charAt(j);if(f=="\n"||f=="\r"){d=j+1;break}}for(j=b;j<a;j++)if(f=c.charAt(j),f=="\n"||f=="\r"){e=j;break}return h("range").create(d,e-d)},deepMerge:function(){var c,b,a,d,i,f=arguments[0]||{},g=1,h=arguments.length;for(!e.isObject(f)&&!e.isFunction(f)&&(f={});g<h;g++)if((c=arguments[g])!=null)for(b in c)a=f[b],d=c[b],f!==d&&(d&&(e.isObject(d)||(i=
|
||||
e.isArray(d)))?(i?(i=!1,a=a&&e.isArray(a)?a:[]):a=a&&e.isObject(a)?a:{},f[b]=this.deepMerge(a,d)):d!==void 0&&(f[b]=d));return f}}});
|
||||
emmet.define("range",function(h,e){function g(f,c){e.isObject(f)&&"start"in f?(this.start=Math.min(f.start,f.end),this.end=Math.max(f.start,f.end)):e.isArray(f)?(this.start=f[0],this.end=f[1]):(c=e.isString(c)?c.length:+c,this.start=f,this.end=f+c)}g.prototype={length:function(){return Math.abs(this.end-this.start)},equal:function(e){return this.start===e.start&&this.end===e.end},shift:function(e){this.start+=e;this.end+=e;return this},overlap:function(e){return e.start<=this.end&&e.end>=this.start},
|
||||
intersection:function(e){if(this.overlap(e)){var c=Math.max(e.start,this.start);return new g(c,Math.min(e.end,this.end)-c)}return null},union:function(e){if(this.overlap(e)){var c=Math.min(e.start,this.start);return new g(c,Math.max(e.end,this.end)-c)}return null},inside:function(e){return this.start<=e&&this.end>e},include:function(e){return this.start<=e.start&&this.end>=e.end},substring:function(e){return this.length()>0?e.substring(this.start,this.end):""},clone:function(){return new g(this.start,
|
||||
this.length())},toArray:function(){return[this.start,this.end]},toString:function(){return"{"+this.start+", "+this.length()+"}"}};return{create:function(f,c){return e.isUndefined(f)||f===null?null:f instanceof g?f:new g(f,c)},create2:function(f,c){e.isNumber(f)&&e.isNumber(c)&&(c-=f);return this.create(f,c)}}});
|
||||
emmet.define("handlerList",function(h,e){function g(){this._list=[]}g.prototype={add:function(f,c){this._list.push(e.extend({order:0},c||{},{fn:f}))},remove:function(f){this._list=e.without(this._list,e.find(this._list,function(c){return c.fn===f}))},list:function(){return e.sortBy(this._list,"order").reverse()},listFn:function(){return e.pluck(this.list(),"fn")},exec:function(f,c){var c=c||[],b=null;e.find(this.list(),function(a){b=a.fn.apply(a,c);if(b!==f)return!0});return b}};return{create:function(){return new g}}});
|
||||
emmet.define("tokenIterator",function(h,e){function g(e){this.tokens=e;this._position=0;this.reset()}g.prototype={next:function(){if(this.hasNext()){var e=this.tokens[++this._i];this._position=e.start;return e}return null},current:function(){return this.tokens[this._i]},position:function(){return this._position},hasNext:function(){return this._i<this._il-1},reset:function(){this._i=-1;this._il=this.tokens.length},item:function(){return this.tokens[this._i]},itemNext:function(){return this.tokens[this._i+
|
||||
1]},itemPrev:function(){return this.tokens[this._i-1]},nextUntil:function(f,c){for(var b,a=e.isString(f)?function(a){return a.type==f}:f;b=this.next();)if(c&&c.call(this,b),a.call(this,b))break}};return{create:function(e){return new g(e)}}});
|
||||
emmet.define("stringStream",function(){function h(e){this.pos=this.start=0;this.string=e}h.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var g=this.string.charAt(this.pos);if(typeof e=="string"?g==e:g&&(e.test?e.test(g):e(g)))return++this.pos,g},eatWhile:function(e){for(var g=this.pos;this.eat(e););
|
||||
return this.pos>g},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){e=this.string.indexOf(e,this.pos);if(e>-1)return this.pos=e,!0},skipToPair:function(e,g){for(var f=0,c,b=this.pos,a=this.string.length;b<a;)if(c=this.string.charAt(b++),c==e)f++;else if(c==g&&(f--,f<1))return this.pos=b,!0;return!1},backUp:function(e){this.pos-=e},match:function(e,g,f){if(typeof e==
|
||||
"string"){if(f=f?function(c){return c.toLowerCase()}:function(c){return c},f(this.string).indexOf(f(e),this.pos)==this.pos)return g!==!1&&(this.pos+=e.length),!0}else return(e=this.string.slice(this.pos).match(e))&&g!==!1&&(this.pos+=e[0].length),e},current:function(){return this.string.slice(this.start,this.pos)}};return{create:function(e){return new h(e)}}});
|
||||
emmet.define("resources",function(h,e){function g(a){return a==b?i:j}function f(b,d,c){var e=g(b),j=[],f=null;e&&d in e&&(f=e[d],c in f&&j.push(f[c]));var l=null;f&&"extends"in f?l=f:b==a&&d in i&&"extends"in i[d]&&(l=i[d]);if(l){if(!l["extends"]||!l["extends"].__emmet_parsed__){d=l["extends"].split(",");f=h("utils");for(b=0;b<d.length;b++)d[b]=f.trim(d[b]);l["extends"]=d;l["extends"].__emmet_parsed__=!0}for(b=0;b<l["extends"].length;b++)d=l["extends"][b],e[d]&&e[d][c]&&j.push(e[d][c])}return j}function c(a,
|
||||
b,c,e){for(var b=f(a,b,c),i=null,j=h("elements"),g=0,l=b.length;g<l;g++)if(a=b[g],e in a){if(!a[e]||!a[e].__emmet_parsed__){b=a[e];i=h("utils");b=i.replaceUnescapedSymbol(b,"|",i.getCaretPlaceholder());switch(c){case "abbreviations":c=a;g=j=e;i=b;h("utils").trim(g);l=h("elements");g=void 0;i=(g=d.exec(i))?l.create("element",g[1],g[2],g[4]=="/"):l.create("reference",i);c[j]=i;a[e].__ref=b;break;case "snippets":a[e]=j.create("snippet",b)}a[e].__emmet_parsed__=!0}i=a[e];break}return i}var b="system",
|
||||
a="user",d=/^<(\w+\:?[\w\-]*)((?:\s+[\w\:\-]+\s*=\s*(['"]).*?\3)*)\s*(\/?)>/,i={},j={},l=h("handlerList").create();return{setVocabulary:function(a,d){d==b?i=a:j=a},getVocabulary:g,getResource:function(d,e,i){return c(a,d,e,i)||c(b,d,e,i)},getAbbreviation:function(a,b){b=b||"";return this.getResource(a,"abbreviations",b)||this.getResource(a,"abbreviations",b.replace(/\-/g,":"))},getSnippet:function(a,b){b=b||"";return this.getResource(a,"snippets",b)||this.getResource(a,"snippets",b.replace(/\-/g,
|
||||
":"))},getMatchedResource:function(a,b){return l.exec(null,e.toArray(arguments))||this.getAbbreviation(b,a.name())||this.getSnippet(b,a.name())},getVariable:function(d){return f(a,"variables",d)[0]||f(b,"variables",d)[0]},setVariable:function(a,b){var d=g("user")||{};if(!("variables"in d))d.variables={};d.variables[a]=b;this.setVocabulary(d,"user")},getSubset:function(d,c){return f(a,d,c)[0]||f(b,d,c)[0]},hasSyntax:function(d){return d in g(a)||d in g(b)},addResolver:function(a,b){l.add(a,b)},removeResolver:function(a){l.remove(a)}}});
|
||||
emmet.define("actions",function(h,e){function g(c){return h("utils").trim(c.charAt(0).toUpperCase()+c.substring(1).replace(/_[a-z]/g,function(b){return" "+b.charAt(1).toUpperCase()}))}var f={};return{add:function(c,b,a){c=c.toLowerCase();a=a||{};if(!a.label)a.label=g(c);f[c]={name:c,fn:b,options:a}},get:function(c){return f[c.toLowerCase()]},run:function(c,b){e.isArray(b)||(b=e.rest(arguments));var a=this.get(c);return a?a.fn.apply(emmet,b):(emmet.log('Action "%s" is not defined',c),!1)},getAll:function(){return f},
|
||||
getList:function(){return e.values(this.getAll())},getMenu:function(c){var b=[],c=c||[];e.each(this.getList(),function(a){if(!a.options.hidden&&!e.include(c,a.name)){var d=g(a.name),i=b;if(a.options.label)for(var j=a.options.label.split("/"),d=j.pop(),f,h;f=j.shift();)h=e.find(i,function(a){return a.type=="submenu"&&a.name==f}),h||(h={name:f,type:"submenu",items:[]},i.push(h)),i=h.items;i.push({type:"action",name:a.name,label:d})}});return b},getActionNameForMenuTitle:function(c,b){var a=null;e.find(b||
|
||||
this.getMenu(),function(b){if(b.type=="action"){if(b.label==c||b.name==c)return a=b.name}else return a=this.getActionNameForMenuTitle(c,b.items)},this);return a||null}}});
|
||||
emmet.define("profile",function(h,e){function g(b){e.extend(this,a,b)}function f(a,b){switch(String(b||"").toLowerCase()){case "lower":return a.toLowerCase();case "upper":return a.toUpperCase()}return a}function c(a,c){return b[a.toLowerCase()]=new g(c)}var b={},a={tag_case:"asis",attr_case:"asis",attr_quotes:"double",tag_nl:"decide",tag_nl_leaf:!1,place_cursor:!0,indent:!0,inline_break:3,self_closing_tag:"xhtml",filters:""};g.prototype={tagName:function(a){return f(a,this.tag_case)},attributeName:function(a){return f(a,
|
||||
this.attr_case)},attributeQuote:function(){return this.attr_quotes=="single"?"'":'"'},selfClosing:function(){return this.self_closing_tag=="xhtml"?" /":this.self_closing_tag===!0?"/":""},cursor:function(){return this.place_cursor?h("utils").getCaretPlaceholder():""}};c("xhtml");c("html",{self_closing_tag:!1});c("xml",{self_closing_tag:!0,tag_nl:!0});c("plain",{tag_nl:!1,indent:!1,place_cursor:!1});c("line",{tag_nl:!1,indent:!1});return{create:function(b,i){return arguments.length==2?c(b,i):new g(e.defaults(b||
|
||||
{},a))},get:function(a,c){if(c&&e.isString(a)){var j=h("resources").getSubset(c,"profile");j&&(a=j)}return!a?b.plain:a instanceof g?a:e.isString(a)&&a.toLowerCase()in b?b[a.toLowerCase()]:this.create(a)},remove:function(a){a=(a||"").toLowerCase();a in b&&delete b[a]},stringCase:f}});
|
||||
emmet.define("editorUtils",function(h){return{isInsideTag:function(e,g){for(var f=/^<\/?\w[\w\:\-]*.*?>/,c=g;c>-1;){if(e.charAt(c)=="<")break;c--}return c!=-1&&(f=f.exec(e.substring(c)))&&g>c&&g<c+f[0].length?!0:!1},outputInfo:function(e,g,f){return{syntax:String(g||e.getSyntax()),profile:String(f||e.getProfileName()),content:String(e.getContent())}},unindent:function(e,g){return h("utils").unindentString(g,this.getCurrentLinePadding(e))},getCurrentLinePadding:function(e){return h("utils").getLinePadding(e.getCurrentLine())}}});
|
||||
emmet.define("actionUtils",function(h){return{mimeTypes:{gif:"image/gif",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",svg:"image/svg+xml",html:"text/html",htm:"text/html"},extractAbbreviation:function(e){for(var g=e.length,f=-1,c=0,b=0,a=0,d=h("utils"),i=h("abbreviationParser");;){g--;if(g<0){f=0;break}var j=e.charAt(g);if(j=="]")b++;else if(j=="["){if(!b){f=g+1;break}b--}else if(j=="}")a++;else if(j=="{"){if(!a){f=g+1;break}a--}else if(j==")")c++;else if(j=="("){if(!c){f=g+1;break}c--}else if(!b&&
|
||||
!a&&(!i.isAllowedChar(j)||j==">"&&d.endsWithTag(e.substring(0,g+1)))){f=g+1;break}}return f!=-1&&!a&&!b&&!c?e.substring(f):""},getImageSize:function(e){var g=function(){return e.charCodeAt(f++)};if(e.substr(0,8)==="\u0089PNG\r\n\u001a\n"){var f=e.indexOf("IHDR")+4;return{width:g()<<24|g()<<16|g()<<8|g(),height:g()<<24|g()<<16|g()<<8|g()}}else if(e.substr(0,4)==="GIF8")return f=6,{width:g()|g()<<8,height:g()|g()<<8};else if(e.substr(0,2)==="\u00ff\u00d8")for(var f=2,c=e.length;f<c;){if(g()!=255)break;
|
||||
var b=g();if(b==218)break;var a=g()<<8|g();if(b>=192&&b<=207&&!(b&4)&&!(b&8))return f+=1,{height:g()<<8|g(),width:g()<<8|g()};else f+=a-2}},captureContext:function(e){if(String(e.getSyntax())in{html:1,xml:1,xsl:1}){var g=h("html_matcher").getTags(String(e.getContent()),e.getCaretPos(),String(e.getProfileName()));if(g&&g[0]&&g[0].type=="tag"){for(var e=/([\w\-:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,f=g[0],g=f.full_tag.replace(/^<[\w\-\:]+/,""),f={name:f.name,attributes:[]},
|
||||
c;c=e.exec(g);)f.attributes.push({name:c[1],value:c[2]});return f}}return null},findExpressionBounds:function(e,g){for(var f=String(e.getContent()),c=f.length,b=e.getCaretPos()-1,a=b+1;b>=0&&g(f.charAt(b),b,f);)b--;for(;a<c&&g(f.charAt(a),a,f);)a++;if(a>b)return h("range").create([++b,a])},compoundUpdate:function(e,g){if(g){var f=e.getSelectionRange();e.replaceContent(g.data,g.start,g.end,!0);e.createSelection(g.caret,g.caret+f.end-f.start);return!0}return!1}}});
|
||||
emmet.define("abbreviationUtils",function(h,e){return{isSnippet:function(e){return h("elements").is(e.matchedResource(),"snippet")},isUnary:function(e){var f=e.matchedResource();return e.children.length||this.isSnippet(e)?!1:f&&f.is_empty||h("tagName").isEmptyElement(e.name())},isInline:function(e){return e.isTextNode()||!e.name()||h("tagName").isInlineLevel(e.name())},isBlock:function(e){return h("elements").is(e.matchedResource(),"snippet")||!this.isInline(e)},hasTagsInContent:function(e){return h("utils").matchesTag(e.content)},
|
||||
hasBlockChildren:function(h){return this.hasTagsInContent(h)&&this.isBlock(h)||e.any(h.children,function(e){return this.isBlock(e)},this)},insertChildContent:function(g,f,c){var c=e.extend({keepVariable:!0,appendIfNoChild:!0},c||{}),b=!1,a=h("utils"),g=a.replaceVariables(g,function(d,e,j){var h=d;e=="child"&&(h=a.padString(f,a.getLinePaddingFromPosition(g,j.start)),b=!0,c.keepVariable&&(h+=d));return h});!b&&c.appendIfNoChild&&(g+=f);return g}}});
|
||||
emmet.define("base64",function(){return{encode:function(h){for(var e=[],g,f,c,b,a,d,i=0,j=h.length;i<j;)b=h.charCodeAt(i++),a=h.charCodeAt(i++),d=h.charCodeAt(i++),g=b&255,f=a&255,c=d&255,b=g>>2,g=(g&3)<<4|f>>4,f=(f&15)<<2|c>>6,c&=63,isNaN(a)?f=c=64:isNaN(d)&&(c=64),e.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c));return e.join("")},decode:function(h){var e,g,f,c,b,a=0,d=0,i=[],j=h.length;if(!h)return h;h+="";do e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(h.charAt(a++)),
|
||||
f=e<<18|g<<12|c<<6|b,e=f>>16&255,g=f>>8&255,f&=255,c==64?i[d++]=String.fromCharCode(e):b==64?i[d++]=String.fromCharCode(e,g):i[d++]=String.fromCharCode(e,g,f);while(a<j);return i.join("")}}});
|
||||
(function(){function h(a){if(!a||a!="html")a="xhtml";n=a}function e(a,b){var d=a[1].toLowerCase();return{name:d,full_tag:a[0],start:b,end:b+a[0].length,unary:Boolean(a[3])||d in j&&n=="html",has_close:Boolean(a[3]),type:"tag",close_self:d in l&&n=="html"}}function g(a,b){return{start:a,end:b,type:"comment"}}function f(a){for(var b={},a=a.split(","),d=0;d<a.length;d++)b[a[d]]=!0;return b}function c(a,b,d){var d=d||0,c=-1,e=-1;if(a&&!b)c=a.start,e=a.end;else if(a&&b)a.start<d&&a.end>d||b.start<=d&&
|
||||
b.end>d?(c=a.start,e=b.end):(c=a.end,e=b.start);return[c,e]}function b(a,b,d){m.opening_tag=a;m.closing_tag=b;a=c(a,b,d||0);m.start_ix=a[0];m.end_ix=a[1];return m.start_ix!=-1?[m.start_ix,m.end_ix]:null}function a(a,b,j,f){function n(b,d){arguments.length==1&&(d=w);return a.substr(d,b.length)==b}function m(b){for(;b--;)if(a.charAt(b)=="<"&&n("<\!--",b))break;return b}f=f||c;h(j);var j=[],k=[],l=null,q=null,o=a.length,s,w;j.last=k.last=function(){return this[this.length-1]};for(w=b;w--&&w>=0;)if(s=
|
||||
a.charAt(w),s=="<"){var y=a.substring(w,o);if(s=y.match(i))s=e(s,w),s.start<b&&s.end>b?q=s:k.push(s);else if(s=y.match(d))if(s=e(s,w),s.unary){if(s.start<b&&s.end>b)return f(s,null,b)}else if(k.last()&&k.last().name==s.name)k.pop();else{l=s;break}else if(y.indexOf("<\!--")==0&&(s=y.search("--\>")+w+3,w<b&&s>=b))return f(g(w,s))}else s=="-"&&n("--\>")&&(w=m(w));if(!l)return f(null);if(!q)for(w=b;w<o;w++)if(s=a.charAt(w),s=="<")if(y=a.substring(w,o),s=y.match(d))s=e(s,w),s.unary||j.push(s);else if(s=
|
||||
y.match(i))if(s=e(s,w),j.last()&&j.last().name==s.name)j.pop();else{q=s;break}else n("<\!--")&&(w+=y.search("--\>")+2);else if(s=="-"&&n("--\>")&&(!j.last()||j.last().type!="comment"))return s=w+3,f(g(m(w),s));return f(l,q,b)}var d=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,i=/^<\/([\w\:\-]+)[^>]*>/,j=f("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");f("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul");
|
||||
f("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");var l=f("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),n="xhtml",m={opening_tag:null,closing_tag:null,start_ix:-1,end_ix:-1},o=function(d,c,e){return a(d,c,e,b)};o.start_tag=d;o.end_tag=i;o.find=function(b,d,c){return a(b,d,c)};o.getTags=function(b,d,c){return a(b,d,c,function(a,b){return[a,b]})};o.last_match=
|
||||
m;try{emmet.define("html_matcher",function(){return o})}catch(q){}})();
|
||||
emmet.define("tabStops",function(h,e){var g=100,f=0,c={replaceCarets:!1,escape:function(b){return"\\"+b},tabstop:function(b){return b.token},variable:function(b){return b.token}};h("abbreviationParser").addOutputProcessor(function(b,a){var d=0,c=h("tabStops"),e=h("utils"),b=c.processText(b,{tabstop:function(a){var b=parseInt(a.group);if(b==0)return"${0}";b>d&&(d=b);return a.placeholder?"${"+(b+f)+":"+a.placeholder+"}":"${"+(b+f)+"}"}}),b=e.replaceVariables(b,c.variablesResolver(a));f+=d+1;return b});
|
||||
return{extract:function(b,a){var d=h("utils"),i={carets:""},j=[],a=e.extend({},c,a,{tabstop:function(a){var b=a.token,d="";if(a.placeholder=="cursor")j.push({start:a.start,end:a.start+b.length,group:"carets",value:""});else{if("placeholder"in a)i[a.group]=a.placeholder;a.group in i&&(d=i[a.group]);j.push({start:a.start,end:a.start+b.length,group:a.group,value:d})}return b}});a.replaceCarets&&(b=b.replace(RegExp(d.escapeForRegexp(d.getCaretPlaceholder()),"g"),"${0:cursor}"));var b=this.processText(b,
|
||||
a),f=d.stringBuilder(),g=0,d=e.map(j,function(a){f.append(b.substring(g,a.start));var d=f.length,c=i[a.group]||"";f.append(c);g=a.end;return{group:a.group,start:d,end:d+c.length}});f.append(b.substring(g));return{text:f.toString(),tabstops:e.sortBy(d,"start")}},processText:function(b,a){for(var a=e.extend({},c,a),d=h("utils").stringBuilder(),i=h("stringStream").create(b),j,f;j=i.next();)if(j=="\\"&&!i.eol())d.append(a.escape(i.next()));else{f=j;if(j=="$")if(i.start=i.pos-1,i.match(/^[0-9]+/))f=a.tabstop({start:d.length,
|
||||
group:i.current().substr(1),token:i.current()});else if(j=i.match(/^\{([a-z_\-][\w\-]*)\}/))f=a.variable({start:d.length,name:j[1],token:i.current()});else if(j=i.match(/^\{([0-9]+)(:.+?)?\}/)){f={start:d.length,group:j[1],token:i.current()};if(j[2])f.placeholder=j[2].substr(1);f=a.tabstop(f)}d.append(f)}return d.toString()},upgrade:function(b,a){var d=0,c={tabstop:function(b){var c=parseInt(b.group);c>d&&(d=c);return b.placeholder?"${"+(c+a)+":"+b.placeholder+"}":"${"+(c+a)+"}"}};e.each(["start",
|
||||
"end","content"],function(a){b[a]=this.processText(b[a],c)},this);return d},variablesResolver:function(b){var a={},d=h("resources");return function(c,f){if(f=="child")return c;if(f=="cursor")return h("utils").getCaretPlaceholder();var l=b.attribute(f);if(!e.isUndefined(l))return l;if(l=d.getVariable(f))return l;a[f]||(a[f]=g++);return"${"+a[f]+":"+f+"}"}},resetPlaceholderCounter:function(){console.log("deprecated");g=100},resetTabstopIndex:function(){f=0;g=100}}});
|
||||
emmet.define("preferences",function(h,e){var g={},f={},c=null,b=null;return{define:function(a,b,c){var j=a;e.isString(a)&&(j={},j[a]={value:b,description:c});e.each(j,function(a,b){f[b]=e.isObject(a)&&"value"in a&&e.keys(a).length<3?a:{value:a}})},set:function(a,b){var c=a;e.isString(a)&&(c={},c[a]=b);e.each(c,function(a,b){if(!(b in f))throw'Property "'+b+'" is not defined. You should define it first with `define` method of current module';if(a!==f[b].value){switch(typeof f[b].value){case "boolean":var d=
|
||||
a;e.isString(d)?(d=d.toLowerCase(),a=d=="yes"||d=="true"||d=="1"):a=!!d;break;case "number":a=parseInt(a+"",10)||0;break;default:a+=""}g[b]=a}else b in g&&delete g[p]})},get:function(a){if(a in g)return g[a];if(a in f)return f[a].value},getArray:function(a){a=this.get(a);e.isUndefined(a)||(a=e.map(a.split(","),h("utils").trim),a.length||(a=null));return a},description:function(a){return a in f?f[a].description:void 0},remove:function(a){e.isArray(a)||(a=[a]);e.each(a,function(a){a in g&&delete g[a];
|
||||
a in f&&delete f[a]})},list:function(){return e.map(e.keys(f).sort(),function(a){return{name:a,value:this.get(a),type:typeof f[a].value,description:f[a].description}},this)},load:function(a){e.each(a,function(a,b){this.set(b,a)},this)},exportModified:function(){return e.clone(g)},reset:function(){g={}},_startTest:function(){c=f;b=g;f={};g={}},_stopTest:function(){f=c;g=b}}});
|
||||
emmet.define("filters",function(h,e){function g(c){return!c?[]:e.isString(c)?c.split(/[\|,]/g):c}var f={};return{add:function(c,b){f[c]=b},apply:function(c,b,a){var d=h("utils"),a=h("profile").get(a);e.each(g(b),function(b){(b=d.trim(b.toLowerCase()))&&b in f&&(c=f[b](c,a))});return c},composeList:function(c,b,a){b=h("profile").get(b);c=g(b.filters||h("resources").getSubset(c,"filters")||"html");a&&(c=c.concat(g(a)));if(!c||!c.length)c=g("html");return c},extractFromAbbreviation:function(c){var b=
|
||||
"",c=c.replace(/\|([\w\|\-]+)$/,function(a,d){b=d;return""});return[c,g(b)]}}});
|
||||
emmet.define("elements",function(h,e){function g(a){return{data:a}}var f={},c=/([\w\-]+)\s*=\s*(['"])(.*?)\2/g,b={add:function(a,b){var c=this;f[a]=function(){var e=b.apply(c,arguments);if(e)e.type=a;return e}},get:function(a){return f[a]},create:function(a){var b=[].slice.call(arguments,1),c=this.get(a);return c?c.apply(this,b):null},is:function(a,b){return a&&a.type===b}};b.add("element",function(a,b,f){var h={name:a,is_empty:!!f};if(b)if(h.attributes=[],e.isArray(b))h.attributes=b;else if(e.isString(b))for(;a=
|
||||
c.exec(b);)h.attributes.push({name:a[1],value:a[3]});else e.each(b,function(a,b){h.attributes.push({name:b,value:a})});return h});b.add("snippet",g);b.add("reference",g);b.add("empty",function(){return{}});return b});
|
||||
emmet.define("editTree",function(h,e,g){function f(a,b){this.options=e.extend({offset:0},b);this.source=a;this._children=[];this._positions={name:0};this.initialize.apply(this,arguments)}function c(a,b,c){this.parent=a;this._name=b.value;this._value=c?c.value:"";this._positions={name:b.start,value:c?c.start:-1};this.initialize.apply(this,arguments)}var b=h("range").create;f.extend=g.extend;f.prototype={initialize:function(){},_updateSource:function(a,d,c){var f=b(d,e.isUndefined(c)?0:c-d),g=a.length-
|
||||
f.length(),n=function(a){e.each(a,function(b,d){b>=f.end&&(a[d]+=g)})};n(this._positions);e.each(this.list(),function(a){n(a._positions)});this.source=h("utils").replaceSubstring(this.source,a,f)},add:function(a,b){var e=new c(a,b);this._children.push(e);return e},get:function(a){return e.isNumber(a)?this.list()[a]:e.isString(a)?e.find(this.list(),function(b){return b.name()===a}):a},getAll:function(a){e.isArray(a)||(a=[a]);var b=[],c=[];e.each(a,function(a){e.isString(a)?b.push(a):e.isNumber(a)&&
|
||||
c.push(a)});return e.filter(this.list(),function(a,f){return e.include(c,f)||e.include(b,a.name())})},value:function(a,b,c){var f=this.get(a);if(f)return f.value(b);if(!e.isUndefined(b))return this.add(a,b,c)},values:function(a){return e.map(this.getAll(a),function(a){return a.value()})},remove:function(a){if(a=this.get(a))this._updateSource("",a.fullRange()),this._children=e.without(this._children,a)},list:function(){return this._children},indexOf:function(a){return e.indexOf(this.list(),this.get(a))},
|
||||
name:function(a){if(!e.isUndefined(a)&&this._name!==(a=String(a)))this._updateSource(a,this._positions.name,this._positions.name+this._name.length),this._name=a;return this._name},nameRange:function(a){return b(this._positions.name+(a?this.options.offset:0),this.name())},range:function(a){return b(a?this.options.offset:0,this.toString())},itemFromPosition:function(a,b){return e.find(this.list(),function(c){return c.range(b).inside(a)})},toString:function(){return this.source}};c.extend=g.extend;c.prototype=
|
||||
{initialize:function(){},_pos:function(a,b){return a+(b?this.parent.options.offset:0)},value:function(a){if(!e.isUndefined(a)&&this._value!==(a=String(a)))this.parent._updateSource(a,this.valueRange()),this._value=a;return this._value},name:function(a){if(!e.isUndefined(a)&&this._name!==(a=String(a)))this.parent._updateSource(a,this.nameRange()),this._name=a;return this._name},namePosition:function(a){return this._pos(this._positions.name,a)},valuePosition:function(a){return this._pos(this._positions.value,
|
||||
a)},range:function(a){return b(this.namePosition(a),this.toString())},fullRange:function(a){return this.range(a)},nameRange:function(a){return b(this.namePosition(a),this.name())},valueRange:function(a){return b(this.valuePosition(a),this.value())},toString:function(){return this.name()+this.value()},valueOf:function(){return this.toString()}};return{EditContainer:f,EditElement:c,createToken:function(a,b,c){a={start:a||0,value:b||"",type:c};a.end=a.start+a.value.length;return a}}});
|
||||
emmet.define("cssEditTree",function(h,e){function g(a,b){return h("range").create(a,b)}function f(a,b){var b=b||d|i,c=["white","line"];if((b&i)==i)for(;a.length&&e.include(c,e.last(a).type);)a.pop();if((b&d)==d)for(;a.length&&e.include(c,a[0].type);)a.shift();return a}function c(a){var b=["white","line",":"],c=[],h,j;a.nextUntil(function(){return!e.include(b,this.itemNext().type)});for(j=a.current().end;h=a.next();){if(h.type=="}"||h.type==";")return f(c,d|(h.type=="}"?i:0)),c.length?(j=c[0].start,
|
||||
a=e.last(c).end):a=j,g(j,a-j);c.push(h)}if(c.length)return g(c[0].start,e.last(c).end-c[0].start)}function b(a){var b=h("stringStream").create(a),d=[],c=/[\s\u00a0,]/,f=function(){b.next();d.push(g(b.start,b.current()));b.start=b.pos};b.eatSpace();for(b.start=b.pos;a=b.next();)if(a=='"'||a=="'"){b.next();if(!b.skipTo(a))break;f()}else if(a=="("){b.backUp(1);if(!b.skipToPair("(",")"))break;b.backUp(1);f()}else if(c.test(a))d.push(g(b.start,b.current().length-1)),b.eatWhile(c),b.start=b.pos;f();return e.chain(d).filter(function(a){return!!a.length()}).uniq(!1,
|
||||
function(a){return a.toString()}).value()}var a={styleBefore:"\n\t",styleSeparator:": ",offset:0},d=1,i=2,j=h("editTree").EditContainer.extend({initialize:function(b){e.defaults(this.options,a);var d=h("editTree"),i=h("tokenIterator").create(h("cssParser").parse(b)),j,r=[],t;for(j=i.position();t=i.next();){if(t.type=="{")break;r.push(t)}f(r);r.length?(j=r[0].start,r=e.last(r).end):r=j;j=g(j,r-j);this._positions.name=j.start;this._name=j.substring(b);if(!i.current()||i.current().type!="{")throw"Invalid CSS rule";
|
||||
for(this._positions.contentStart=i.position()+1;j=i.next();){if(r=j.type=="identifier")a:{r=i.tokens;t=i._i+1;for(var x=r.length;t<x;t++){if(r[t].type==":"){r=!0;break a}if(r[t].type=="identifier"||r[t].type=="line"){r=!1;break a}}r=!1}r&&(j=g(j),r=c(i),t=i.current()&&i.current().type==";"?g(i.current()):g(r.end,0),this._children.push(new l(this,d.createToken(j.start,j.substring(b)),d.createToken(r.start,r.substring(b)),d.createToken(t.start,t.substring(b)))))}this._saveStyle()},_saveStyle:function(){var a=
|
||||
this._positions.contentStart,b=this.source,d=h("utils");e.each(this.list(),function(c){c.styleBefore=b.substring(a,c.namePosition());var f=d.splitByLines(c.styleBefore);if(f.length>1)c.styleBefore="\n"+e.last(f);c.styleSeparator=b.substring(c.nameRange().end,c.valuePosition());c.styleBefore=e.last(c.styleBefore.split("*/"));c.styleSeparator=c.styleSeparator.replace(/\/\*.*?\*\//g,"");a=c.range().end})},add:function(a,b,d){var c=this.list(),f=this._positions.contentStart,i=e.pick(this.options,"styleBefore",
|
||||
"styleSeparator"),j=h("editTree");if(e.isUndefined(d))d=c.length;var g=c[d];if(g)f=g.fullRange().start;else if(g=c[d-1])g.end(";"),f=g.range().end;g&&(i=e.pick(g,"styleBefore","styleSeparator"));a=j.createToken(f+i.styleBefore.length,a);b=j.createToken(a.end+i.styleSeparator.length,b);j=new l(this,a,b,j.createToken(b.end,";"));e.extend(j,i);this._updateSource(j.styleBefore+j.toString(),f);this._children.splice(d,0,j);return j}}),l=h("editTree").EditElement.extend({initialize:function(a,b,d,c){this.styleBefore=
|
||||
a.options.styleBefore;this.styleSeparator=a.options.styleSeparator;this._end=c.value;this._positions.end=c.start},valueParts:function(a){var d=b(this.value());if(a){var c=this.valuePosition(!0);e.each(d,function(a){a.shift(c)})}return d},end:function(a){if(!e.isUndefined(a)&&this._end!==a)this.parent._updateSource(a,this._positions.end,this._positions.end+this._end.length),this._end=a;return this._end},fullRange:function(a){a=this.range(a);a.start-=this.styleBefore.length;return a},toString:function(){return this.name()+
|
||||
this.styleSeparator+this.value()+this.end()}});return{parse:function(a,b){return new j(a,b)},parseFromPosition:function(a,b,d){d=this.extractRule(a,b,d);return!d||!d.inside(b)?null:this.parse(d.substring(a),{offset:d.start})},extractRule:function(a,b,d){for(var c="",e=a.length,f=-1,i;b>=0;){i=a.charAt(b);if(i=="{"){f=b;break}else if(i=="}"&&!d){b++;break}b--}for(;b<e;){i=a.charAt(b);if(i=="{")f=b;else if(i=="}"){f!=-1&&(c=a.substring(f,b+1));break}b++}if(c){b=f-1;for(d="";b>=0;){i=a.charAt(b);if("{}/\\<>".indexOf(i)!=
|
||||
-1)break;b--}d=a.substring(b+1,f).replace(/^[\s\n\r]+/m,"");return h("range").create(f-d.length,c.length+d.length)}return null},baseName:function(a){return a.replace(/^\s*\-\w+\-/,"")},findParts:b}});
|
||||
emmet.define("xmlEditTree",function(h,e){var g={styleBefore:" ",styleSeparator:"=",styleQuote:'"',offset:0},f=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/m,c=h("editTree").EditContainer.extend({initialize:function(a){e.defaults(this.options,g);this._positions.name=1;var d=null,c=h("xmlParser").parse(a),f=h("range");e.each(c,function(c){c.value=f.create(c).substring(a);switch(c.type){case "tag":if(/^<[^\/]+/.test(c.value))this._name=c.value.substring(1);
|
||||
break;case "attribute":d&&this._children.push(new b(this,d));d=c;break;case "string":this._children.push(new b(this,d,c)),d=null}},this);d&&this._children.push(new b(this,d));this._saveStyle()},_saveStyle:function(){var a=this.nameRange().end,b=this.source;e.each(this.list(),function(c){c.styleBefore=b.substring(a,c.namePosition());if(c.valuePosition()!==-1)c.styleSeparator=b.substring(c.namePosition()+c.name().length,c.valuePosition()-c.styleQuote.length);a=c.range().end})},add:function(a,d,c){var f=
|
||||
this.list(),g=this.nameRange().end,n=h("editTree"),m=e.pick(this.options,"styleBefore","styleSeparator","styleQuote");if(e.isUndefined(c))c=f.length;var o=f[c];if(o)g=o.fullRange().start;else if(o=f[c-1])g=o.range().end;o&&(m=e.pick(o,"styleBefore","styleSeparator","styleQuote"));d=m.styleQuote+d+m.styleQuote;a=new b(this,n.createToken(g+m.styleBefore.length,a),n.createToken(g+m.styleBefore.length+a.length+m.styleSeparator.length,d));e.extend(a,m);this._updateSource(a.styleBefore+a.toString(),g);
|
||||
this._children.splice(c,0,a);return a}}),b=h("editTree").EditElement.extend({initialize:function(a,b,c){this.styleBefore=a.options.styleBefore;this.styleSeparator=a.options.styleSeparator;b="";a=a.options.styleQuote;if(c)b=c.value,a=b.charAt(0),a=='"'||a=="'"?b=b.substring(1):a="",a&&b.charAt(b.length-1)==a&&(b=b.substring(0,b.length-1));this.styleQuote=a;this._value=b;this._positions.value=c?c.start+a.length:-1},fullRange:function(a){a=this.range(a);a.start-=this.styleBefore.length;return a},toString:function(){return this.name()+
|
||||
this.styleSeparator+this.styleQuote+this.value()+this.styleQuote}});return{parse:function(a,b){return new c(a,b)},parseFromPosition:function(a,b,c){c=this.extractTag(a,b,c);return!c||!c.inside(b)?null:this.parse(c.substring(a),{offset:c.start})},extractTag:function(a,b,c){var e=a.length,g,n=h("range"),m=Math.min(2E3,e),o=null,q=function(b){var c;if(a.charAt(b)=="<"&&(c=a.substr(b,m).match(f)))return n.create(b,c[0])};for(g=b;g>=0;g--)if(o=q(g))break;if(o&&(o.inside(b)||c))return o;if(!o&&c)return null;
|
||||
for(g=b;g<e;g++)if(o=q(g))return o}}});
|
||||
emmet.define("expandAbbreviation",function(h,e){var g=h("handlerList").create(),f=null,c=h("actions");c.add("expand_abbreviation",function(b,a,c){var f=e.toArray(arguments),j=h("editorUtils").outputInfo(b,a,c);f[1]=j.syntax;f[2]=j.profile;return g.exec(!1,f)});c.add("expand_abbreviation_with_tab",function(b,a,d){c.run("expand_abbreviation",b,a,d)||b.replaceContent(h("resources").getVariable("indentation"),b.getCaretPos())},{hidden:!0});g.add(function(b,a,c){var e=b.getSelectionRange().end,g=f.findAbbreviation(b);
|
||||
return g&&(a=emmet.expandAbbreviation(g,a,c,h("actionUtils").captureContext(b)))?(b.replaceContent(a,e-g.length,e),!0):!1},{order:-1});return f={addHandler:function(b,a){g.add(b,a)},removeHandler:function(b){g.remove(b,options)},findAbbreviation:function(b){var a=h("range").create(b.getSelectionRange()),c=String(b.getContent());if(a.length())return a.substring(c);b=b.getCurrentLineRange();return h("actionUtils").extractAbbreviation(c.substring(b.start,a.start))}}});
|
||||
emmet.define("wrapWithAbbreviation",function(h){h("actions").add("wrap_with_abbreviation",function(e,g,f,c){var c=h("editorUtils").outputInfo(e,f,c),b=h("utils"),a=h("editorUtils"),d=h("html_matcher"),g=g||e.prompt("Enter abbreviation");if(!g)return null;var g=String(g),i=e.getSelectionRange(),f=i.start,i=i.end;if(f==i){i=d(c.content,f,c.profile);if(!i||i[0]==-1)return!1;i=b.narrowToNonSpace(c.content,i[0],i[1]-i[0]);f=i.start;i=i.end}b=b.escapeText(c.content.substring(f,i));return(g=h("wrapWithAbbreviation").wrap(g,
|
||||
a.unindent(e,b),c.syntax,c.profile))?(e.replaceContent(g,f,i),!0):!1});return{wrap:function(e,g,f,c){var b=h("filters"),a=h("utils"),f=f||emmet.defaultSyntax(),c=c||emmet.defaultProfile();h("tabStops").resetTabstopIndex();e=b.extractFromAbbreviation(e);return(g=h("abbreviationParser").parse(e[0],{syntax:f,pastedContent:g}))?(f=b.composeList(f,c,e[1]),b.apply(g,f,c),a.replaceVariables(g.toString())):null}}});
|
||||
emmet.exec(function(h,e){function g(b,a){var c=a-(b.options.offset||0),f=/^[\s\n\r]/;return e.find(b.list(),function(a){return a.range().end===c?f.test(b.source.charAt(c)):a.range().inside(c)})}function f(b,a,c,e){for(var f=-1,g=-1;a--;)if(b.substr(a,c.length)==c){f=a;break}if(f!=-1){a=f;for(c=b.length;c>=a++;)if(b.substr(a,e.length)==e){g=a+e.length;break}}return f!=-1&&g!=-1?h("range").create(f,g-f):null}function c(b,a,c,e){function g(b){return b.replace(RegExp("^"+q.escapeForRegexp(a)+"\\s*"),
|
||||
function(a){m-=a.length;return""}).replace(RegExp("\\s*"+q.escapeForRegexp(c)+"$"),"")}var l=h("editorUtils"),n=l.outputInfo(b).content,m=b.getCaretPos(),o=null,q=h("utils");(o=f(n,m,a,c))&&o.overlap(e)?(e=o,o=g(e.substring(n))):(o=a+" "+e.substring(n).replace(RegExp(q.escapeForRegexp(a)+"\\s*|\\s*"+q.escapeForRegexp(c),"g"),"")+" "+c,m+=a.length+1);return o!==null?(b.setCaretPos(e.start),b.replaceContent(l.unindent(b,o),e.start,e.end),b.setCaretPos(m),!0):!1}h("actions").add("toggle_comment",function(b){var a=
|
||||
h("editorUtils").outputInfo(b);if(a.syntax=="css"){var d=b.getCaretPos(),e=h("html_matcher").getTags(a.content,d);if(e&&e[0]&&e[0].type=="tag"&&e[0].start<=d&&e[0].end>=d)a.syntax="html"}if(a.syntax=="css"){e=h("range").create(b.getSelectionRange());a=h("editorUtils").outputInfo(b);if(!e.length()&&(d=h("cssEditTree").parseFromPosition(a.content,b.getCaretPos())))e=(e=g(d,b.getCaretPos()))?e.range(!0):h("range").create(d.nameRange(!0).start,d.source);e.length()||(e=h("range").create(b.getCurrentLineRange()),
|
||||
h("utils").narrowToNonSpace(a.content,e));b=c(b,"/*","*/",e)}else{a=h("range").create(b.getSelectionRange());d=h("editorUtils").outputInfo(b);if(!a.length()&&(d=h("html_matcher").getTags(d.content,b.getCaretPos(),d.profile))&&d[0])a.start=d[0].start,a.end=d[1]?d[1].end:d[0].end;b=c(b,"<\!--","--\>",a)}return b})});
|
||||
emmet.exec(function(h){function e(e,f,c){function b(b){for(var c=b;c>=0;){var d=a.charAt(c);if(d=="\n"||d=="\r")break;c--}return a.substring(c,b)}for(var f=f||1,c=e.getCaretPos()+(c||0),a=String(e.getContent()),e=a.length,d=-1,h=/^\s+$/;c<=e&&c>=0;){c+=f;var j=a.charAt(c),l=a.charAt(c+1),n=a.charAt(c-1);switch(j){case '"':case "'":l==j&&n=="="&&(d=c+1);break;case ">":l=="<"&&(d=c+1);break;case "\n":case "\r":h.test(b(c-1))&&(d=c)}if(d!=-1)break}return d}h=h("actions");h.add("prev_edit_point",function(g){var f=
|
||||
g.getCaretPos(),c=e(g,-1);c==f&&(c=e(g,-1,-2));return c!=-1?(g.setCaretPos(c),!0):!1},{label:"Previous Edit Point"});h.add("next_edit_point",function(g){var f=e(g,1);f!=-1&&g.setCaretPos(f)})});
|
||||
emmet.exec(function(h,e){function g(a,b,c,d){var e=h("range"),f=h("editorUtils").outputInfo(a).content,g=f.length,j,i=e.create(-1,0),l=e.create(a.getSelectionRange());j=l.start;for(var n=1E5;j>=0&&j<g&&--n>0;){if(e=c(f,j,b)){if(i.equal(e))break;i=e.clone();if(j=d(e.substring(f),e.start,l.clone()))return a.createSelection(j.start,j.end),!0;else j=b?e.start:e.end-1}j+=b?-1:1}return!1}function f(a){var b=!0;return g(a,!1,function(a,c){if(b){b=!1;var d;a:{d=c;for(var e;d>=0;){if(e=i(a,d)){d=e;break a}d--}d=
|
||||
null}return d}else return i(a,c)},function(a,b,c){return d(a,b,c,!1)})}function c(a){return g(a,!0,i,function(a,b,c){return d(a,b,c,!0)})}function b(b,c,d){var d=d||0,f=h("range"),g=[],i=-1,l="",n="",q,m;e.each(c,function(c){switch(c.type){case "tag":m=b.substring(c.start,c.end);/^<[\w\:\-]/.test(m)&&g.push(f.create({start:c.start+1,end:c.end}));break;case "attribute":i=c.start;l=b.substring(c.start,c.end);break;case "string":g.push(f.create(i,c.end-i)),q=f.create(c),n=q.substring(b),j(n.charAt(0))&&
|
||||
q.start++,j(n.charAt(n.length-1))&&q.end--,g.push(q),l=="class"&&(g=g.concat(a(q.substring(b),q.start)))}});e.each(g,function(a){a.shift(d)});return e.chain(g).filter(function(a){return!!a.length()}).uniq(!1,function(a){return a.toString()}).value()}function a(a,b){var b=b||0,c=[],d=h("stringStream").create(a),e=h("range");d.eatSpace();d.start=d.pos;for(var f;f=d.next();)if(/[\s\u00a0]/.test(f))c.push(e.create(d.start+b,d.pos-d.start-1)),d.eatSpace(),d.start=d.pos;c.push(e.create(d.start+b,d.pos-
|
||||
d.start));return c}function d(a,c,d,f){a=b(a,h("xmlParser").parse(a),c);f&&a.reverse();return(c=e.find(a,function(a){return a.equal(d)}))?(f=e.indexOf(a,c),f<a.length-1?a[f+1]:null):f?e.find(a,function(a){return a.start<d.start}):!c&&(f=e.filter(a,function(a){return a.inside(d.end)}),f.length>1)?f[1]:e.find(a,function(a){return a.end>d.end})}function i(a,b){var c;if(a.charAt(b)=="<"&&(c=a.substring(b,a.length).match(q)))return h("range").create(b,c[0])}function j(a){return a=='"'||a=="'"}function l(a){var b=
|
||||
a.valueRange(!0),c=[a.range(!0),b],d=h("stringStream"),f=h("cssEditTree"),g=h("range"),j=a.value();e.each(a.valueParts(),function(a){var h=a.clone();c.push(h.shift(b.start));var i=d.create(a.substring(j));if(i.match(/^[\w\-]+\(/,!0)){i.start=i.pos;i.skipToPair("(",")");var n=i.current();c.push(g.create(h.start+i.start,n));e.each(f.findParts(n),function(a){c.push(g.create(h.start+i.start+a.start,a.substring(n)))})}});return e.chain(c).filter(function(a){return!!a.length()}).uniq(!1,function(a){return a.toString()}).value()}
|
||||
function n(a,b,c){var d=null,f=null,g=a.list(),h,j;c?(g.reverse(),h=function(a){return a.range(!0).start<=b.start},j=function(a){return a.start<b.start}):(h=function(a){return a.range(!0).end>=b.end},j=function(a){return a.end>b.start});for(;d=e.find(g,h);){a=l(d);c&&a.reverse();if(f=e.find(a,function(a){return a.equal(b)})){if(f=e.indexOf(a,f),f!=a.length-1){f=a[f+1];break}}else{f=e.filter(a,function(a){return a.inside(b.end)});if(f.length>1){f=f[1];break}if(f=e.find(a,j))break}f=null;b.start=b.end=
|
||||
c?d.range(!0).start-1:d.range(!0).end+1}return f}function m(a,b,c){a=h("cssEditTree").parse(a,{offset:b});b=a.nameRange(!0);return c.end<b.end?b:n(a,c,!1)}function o(a,b,c){b=h("cssEditTree").parse(a,{offset:b});a=n(b,c,!0);return!a&&(b=b.nameRange(!0),c.start>b.start)?b:a}var q=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,r=h("actions");r.add("select_next_item",function(a){return a.getSyntax()=="css"?g(a,!1,h("cssEditTree").extractRule,m):f(a)});r.add("select_previous_item",
|
||||
function(a){return a.getSyntax()=="css"?g(a,!0,h("cssEditTree").extractRule,o):c(a)})});
|
||||
emmet.exec(function(h){function e(c,b,a){var b=String((b||"out").toLowerCase()),d=h("editorUtils").outputInfo(c,a),a=d.syntax,e=h("range"),g=e.create(c.getSelectionRange()),d=d.content,l=null,l=f.last_match.opening_tag,n=f.last_match.closing_tag;if(b=="in"&&l&&g.length())if(n)l.start==g.start?d.charAt(l.end)=="<"?(b=e.create(f.find(d,l.end+1,a)),l=b.start==l.end&&b.end==n.start?e.create(f(d,l.end+1,a)):e.create(l.end,n.start-l.end)):l=e.create(l.end,n.start-l.end):(b=d.substring(0,n.start).indexOf("<",
|
||||
l.end),l=e.create(f(d,b!=-1?b+1:l.end,a)));else return!1;else l=e.create(f(d,g.end,a));return l&&l.start!=-1?(c.createSelection(l.start,l.end),!0):!1}var g=h("actions"),f=h("html_matcher");g.add("match_pair",e,{hidden:!0});g.add("match_pair_inward",function(c){return e(c,"in")},{label:"HTML/Match Pair Tag (inward)"});g.add("match_pair_outward",function(c){return e(c,"out")},{label:"HTML/Match Pair Tag (outward)"});g.add("matching_pair",function(c){var b=String(c.getContent()),a=c.getCaretPos();b.charAt(a)==
|
||||
"<"&&a++;var d=f.getTags(b,a,String(c.getProfileName()));if(d&&d[0]&&(b=d[0],d=d[1]))if(b.start<=a&&b.end>=a)return c.setCaretPos(d.start),!0;else if(d.start<=a&&d.end>=a)return c.setCaretPos(b.start),!0;return!1},{label:"HTML/Go To Matching Tag Pair"})});
|
||||
emmet.exec(function(h){h("actions").add("remove_tag",function(e){var g=h("utils"),f=h("editorUtils").outputInfo(e),c=h("html_matcher").getTags(f.content,e.getCaretPos(),f.profile);if(c&&c[0]){if(c[1]){var b=g.narrowToNonSpace(f.content,c[0].end,c[1].start-c[0].end),a=g.findNewlineBounds(f.content,b.start),a=g.getLinePadding(a.substring(f.content)),f=b.substring(f.content),f=g.unindentString(f,a);e.replaceContent(g.getCaretPlaceholder()+g.escapeText(f),c[0].start,c[1].end)}else e.replaceContent(g.getCaretPlaceholder(),
|
||||
c[0].start,c[0].end);return!0}return!1},{label:"HTML/Remove Tag"})});
|
||||
emmet.exec(function(h){h("actions").add("split_join_tag",function(e,g){var f=h("html_matcher"),c=h("editorUtils").outputInfo(e,null,g),b=h("profile").get(c.profile);if((f=f.getTags(c.content,e.getCaretPos(),c.profile))&&f[0]){if(f[1]){c=h("utils");b=f[0].full_tag.replace(/\s*>$/,(b.self_closing_tag===!0?"/":" /")+">");if(b.length+f[0].start<e.getCaretPos())b+=c.getCaretPlaceholder();else var a=e.getCaretPos()-f[0].start,b=c.replaceSubstring(b,c.getCaretPlaceholder(),a);e.replaceContent(b,f[0].start,
|
||||
f[1].end)}else{var d=h("utils"),c=d.getNewline(),a=h("resources").getVariable("indentation"),d=d.getCaretPlaceholder(),b=b.tag_nl===!0?c+a+d+c:d,b=f[0].full_tag.replace(/\s*\/>$/,">")+b+"</"+f[0].name+">";e.replaceContent(b,f[0].start,f[0].end)}f=!0}else f=!1;return f},{label:"HTML/Split\\Join Tag Declaration"})});
|
||||
emmet.define("reflectCSSValue",function(h,e){function g(b){var a=h("cssEditTree"),d=h("editorUtils").outputInfo(b),b=b.getCaretPos();if(a=a.parseFromPosition(d.content,b))if(d=a.itemFromPosition(b,!0)){var e=a.source,f=a.options.offset,b=b-f-d.range().start;c.exec(!1,[d]);if(e!==a.source)return{data:a.source,start:f,end:f+e.length,caret:f+d.range().start+b}}}function f(b){var b=h("cssEditTree").baseName(b),a;if(b=="opacity"||b=="filter")return/^(?:\-\w+\-)?(?:opacity|filter)$/;else if(a=b.match(/^border-radius-(top|bottom)(left|right)/))return RegExp("^(?:\\-\\w+\\-)?(?:"+
|
||||
b+"|border-"+a[1]+"-"+a[2]+"-radius)$");else if(a=b.match(/^border-(top|bottom)-(left|right)-radius/))return RegExp("^(?:\\-\\w+\\-)?(?:"+b+"|border-radius-"+a[1]+a[2]+")$");return RegExp("^(?:\\-\\w+\\-)?"+b+"$")}var c=h("handlerList").create();h("actions").add("reflect_css_value",function(b){return b.getSyntax()!="css"?!1:h("actionUtils").compoundUpdate(b,g(b))},{label:"CSS/Reflect Value"});c.add(function(b){var a=f(b.name());e.each(b.parent.list(),function(c){if(a.test(c.name())){var e;var f=b.name(),
|
||||
g=b.value(),n=c.name();e=c.value();var m=h("cssEditTree"),o=h("utils"),f=m.baseName(f),n=m.baseName(n);e=f=="opacity"&&n=="filter"?e.replace(/opacity=[^)]*/i,"opacity="+Math.floor(parseFloat(g)*100)):f=="filter"&&n=="opacity"?(f=g.match(/opacity=([^)]*)/i))?o.prettifyNumber(parseInt(f[1])/100):e:g;c.value(e)}})},{order:-1});return{addHandler:function(b,a){c.add(b,a)},removeHandler:function(b){c.remove(b,options)}}});
|
||||
emmet.exec(function(h){h("actions").add("evaluate_math_expression",function(e){var g=h("actionUtils"),f=h("utils"),c=String(e.getContent()),b=h("range").create(e.getSelectionRange());b.length()||(b=g.findExpressionBounds(e,function(a){return f.isNumeric(a)||".+-*/\\".indexOf(a)!=-1}));if(b&&b.length()){g=b.substring(c);g=g.replace(/([\d\.\-]+)\\([\d\.\-]+)/g,"Math.round($1/$2)");try{var a=f.prettifyNumber((new Function("return "+g))());e.replaceContent(a,b.start,b.end);e.setCaretPos(b.start+a.length);
|
||||
return!0}catch(d){}}return!1},{label:"Numbers/Evaluate Math Expression"})});
|
||||
emmet.exec(function(h,e){function g(b,a){var c=h("utils"),g=!1,j=!1,l=h("actionUtils").findExpressionBounds(b,function(a,b,e){return c.isNumeric(a)?!0:a=="."?!c.isNumeric(e.charAt(b+1))?!1:j?!1:j=!0:a=="-"?g?!1:g=!0:!1});if(l&&l.length()){var n=l.substring(String(b.getContent())),m=parseFloat(n);if(!e.isNaN(m)){m=c.prettifyNumber(m+a);if(/^(\-?)0+[1-9]/.test(n)){var o="";RegExp.$1&&(o="-",m=m.substring(1));m=m.split(".");m[0]=c.zeroPadString(m[0],f(n));m=o+m.join(".")}b.replaceContent(m,l.start,l.end);
|
||||
b.createSelection(l.start,l.start+m.length);return!0}}return!1}function f(b){b=b.replace(/^\-/,"");return~b.indexOf(".")?b.split(".")[0].length:b.length}var c=h("actions");e.each([1,-1,10,-10,0.1,-0.1],function(b){var a=b>0?"increment":"decrement";c.add(a+"_number_by_"+String(Math.abs(b)).replace(".","").substring(0,2),function(a){return g(a,b)},{label:"Numbers/"+a.charAt(0).toUpperCase()+a.substring(1)+" number by "+Math.abs(b)})})});
|
||||
emmet.exec(function(h,e){var g=h("actions"),f=h("preferences");f.define("css.closeBraceIndentation","\n","Indentation before closing brace of CSS rule. Some users prefereindented closing brace of CSS rule for better readability. This preference\u2019s value will be automatically inserted before closing brace when user adds newline in newly created CSS rule (e.g. when \u201cInsert formatted linebreak\u201d action will be performed in CSS file). If you\u2019re such user, you may want to write put a value like <code>\\n\\t</code> in this preference.");
|
||||
g.add("insert_formatted_line_break_only",function(c){var b=h("utils"),a=h("resources"),d=h("editorUtils").outputInfo(c),g=c.getCaretPos(),j=b.getNewline();if(e.include(["html","xml","xsl"],d.syntax)){if(a=a.getVariable("indentation"),d=h("html_matcher").getTags(d.content,g,d.profile),d[0]&&d[1]&&d[0].type=="tag"&&d[0].end==g&&d[1].start==g)return c.replaceContent(j+a+b.getCaretPlaceholder()+j,g),!0}else if(d.syntax=="css"&&(d=d.content,g&&d.charAt(g-1)=="{")){var l=f.get("css.closeBraceIndentation"),
|
||||
a=a.getVariable("indentation"),n=d.charAt(g)=="}";if(!n)for(var m=g,o=d.length,q;m<o;m++){q=d.charAt(m);if(q=="{")break;if(q=="}"){l="";n=!0;break}}n||(l+="}");b=j+a+b.getCaretPlaceholder()+l;c.replaceContent(b,g);return!0}return!1},{hidden:!0});g.add("insert_formatted_line_break",function(c){if(!g.run("insert_formatted_line_break_only",c)){for(var b=h("utils"),a=h("editorUtils").getCurrentLinePadding(c),d=String(c.getContent()),e=c.getCaretPos(),f=d.length,b=b.getNewline(),l="",n=c.getCurrentLineRange().end+
|
||||
1,m;n<f;n++)if(m=d.charAt(n),m==" "||m=="\t")l+=m;else break;l.length>a.length?c.replaceContent(b+l,e,e,!0):c.replaceContent(b,e)}return!0},{hidden:!0})});
|
||||
emmet.exec(function(h){h("actions").add("merge_lines",function(e){var g=h("html_matcher"),f=h("utils"),c=h("editorUtils").outputInfo(e),b=h("range").create(e.getSelectionRange());if(!b.length()&&(g=g(c.content,e.getCaretPos(),c.profile)))b.start=g[0],b.end=g[1];if(b.length()){c=b.substring(c.content);f=f.splitByLines(c);for(c=1;c<f.length;c++)f[c]=f[c].replace(/^\s+/,"");c=f.join("").replace(/\s{2,}/," ");e.replaceContent(c,b.start,b.end);e.createSelection(b.start,b.start+c.length);return!0}return!1})});
|
||||
emmet.exec(function(h){function e(e,f,c){c=c||0;return f.charAt(c)==e.charAt(0)&&f.substr(c,e.length)==e}h("actions").add("encode_decode_data_url",function(g){var f=String(g.getSelection()),c=g.getCaretPos();if(!f)for(var b=String(g.getContent());c-- >=0;)if(e("src=",b,c)){if(b=b.substr(c).match(/^(src=(["'])?)([^'"<>\s]+)\1?/))f=b[3],c+=b[1].length;break}else if(e("url(",b,c)){if(b=b.substr(c).match(/^(url\((['"])?)([^'"\)\s]+)\1?/))f=b[3],c+=b[1].length;break}if(f)if(e("data:",f))if(b=String(g.prompt("Enter path to file (absolute or relative)"))){var a=
|
||||
h("file"),d=a.createPath(g.getFilePath(),b);if(!d)throw"Can't save file";a.save(d,h("base64").decode(f.replace(/^data\:.+?;.+?,/,"")));g.replaceContent("$0"+b,c,c+f.length);g=!0}else g=!1;else{b=h("file");a=h("actionUtils");d=g.getFilePath();if(d===null)throw"You should save your file before using this action";d=b.locateFile(d,f);if(d===null)throw"Can't find "+f+" file";var i=h("base64").encode(String(b.read(d)));if(!i)throw"Can't encode file content to base64";i="data:"+(a.mimeTypes[String(b.getExt(d))]||
|
||||
"application/octet-stream")+";base64,"+i;g.replaceContent("$0"+i,c,c+f.length);g=!0}else g=!1;return g},{label:"Encode\\Decode data:URL image"})});
|
||||
emmet.exec(function(h,e){function g(e,c){var b;if(c){if(/^data:/.test(c))b=h("base64").decode(c.replace(/^data\:.+?;.+?,/,""));else{b=h("file");var a=b.locateFile(e.getFilePath(),c);if(a===null)throw"Can't find "+c+" file";b=String(b.read(a))}return h("actionUtils").getImageSize(b)}}h("actions").add("update_image_size",function(f){var c;if(String(f.getSyntax())=="css")a:{c=f.getCaretPos();var b=h("editorUtils").outputInfo(f);if(b=h("cssEditTree").parseFromPosition(b.content,c,!0)){var a=b.itemFromPosition(c,
|
||||
!0),d;if(a&&(d=/url\((["']?)(.+?)\1\)/i.exec(a.value()||"")))if(d=g(f,d[2])){a=b.range(!0);b.value("width",d.width+"px");b.value("height",d.height+"px",b.indexOf("width")+1);c=e.extend(a,{data:b.toString(),caret:c});break a}}c=null}else a:{c=f.getCaretPos();b=h("editorUtils").outputInfo(f);if((b=h("xmlEditTree").parseFromPosition(b.content,c,!0))&&b.name().toLowerCase()=="img")if(d=g(f,b.value("src"))){a=b.range(!0);b.value("width",d.width);b.value("height",d.height,b.indexOf("width")+1);c=e.extend(a,
|
||||
{data:b.toString(),caret:c});break a}c=null}return h("actionUtils").compoundUpdate(f,c)})});
|
||||
emmet.define("cssResolver",function(h,e){function g(a){var b=a&&a.charCodeAt(0);return a&&a=="."||b>47&&b<58}function f(a){a=h("utils").trim(a);if(~a.indexOf("/*"))return!1;a=h("tabStops").processText(a,{replaceCarets:!0,tabstop:function(){return"value"}});return a.split(":").length==2}function c(a){var b=h("utils"),a=b.trim(a);if(a.indexOf(":")==-1)return{name:a,value:o};a=a.split(":");return{name:b.trim(a.shift()),value:b.trim(a.join(":")).replace(/^(\$\{0\}|\$0)(\s*;?)$/,"${1}$2")}}function b(a,
|
||||
b){var c=n[b];c||(c=e.find(n,function(a){return a.prefix==b}));return c&&c.supports&&e.include(c.supports,a)}function a(a,c){var d=[];e.each(n,function(c,e){b(a,e)&&d.push(e)});!d.length&&!c&&e.each(n,function(a,b){a.obsolete||d.push(b)});return d}function d(a,b){e.isString(b)&&(b={prefix:b});n[a]=e.extend({},l,b)}function i(a,b){if(!e.isString(a))a=a.data;if(!f(a))return a;b&&(~a.indexOf(";")?a=a.split(";").join(" !important;"):a+=" !important");var c=a.indexOf(":");return a=a.substring(0,c).replace(/\s+$/,
|
||||
"")+q.get("css.valueSeparator")+h("utils").trim(a.substring(c+1))}var j=null,l={prefix:"emmet",obsolete:!1,transformName:function(a){return"-"+this.prefix+"-"+a},supports:null},n={},m={p:"%",e:"em",x:"ex"},o="${1};",q=h("preferences");q.define("css.valueSeparator",": ","Defines a symbol that should be placed between CSS property and value when expanding CSS abbreviations.");q.define("css.autoInsertVendorPrefixes",!0,"Automatically generate vendor-prefixed copies of expanded CSS property. By default, Emmet will generate vendor-prefixed NaN(e.g. <code>-bxsh</code>). With this option enabled, you don\u2019t need dashes before abbreviations: Emmet will produce vendor-prefixed properties for you.");
|
||||
var r=e.template("A comma-separated list of CSS properties that may have <code><%= vendor %></code> vendor prefix. This list is used to generate a list of prefixed properties when expanding <code>-property</code> abbreviations. Empty list means that all possible CSS values may have <code><%= vendor %></code> prefix.");e.each({webkit:"animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-clip, background-composite, background-origin, background-size, border-fit, border-horizontal-spacing, border-image, border-vertical-spacing, box-align, box-direction, box-flex, box-flex-group, box-lines, box-ordinal-group, box-orient, box-pack, box-reflect, box-shadow, color-correction, column-break-after, column-break-before, column-break-inside, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-span, column-width, dashboard-region, font-smoothing, highlight, hyphenate-character, hyphenate-limit-after, hyphenate-limit-before, hyphens, line-box-contain, line-break, line-clamp, locale, margin-before-collapse, margin-after-collapse, marquee-direction, marquee-increment, marquee-repetition, marquee-style, mask-attachment, mask-box-image, mask-box-image-outset, mask-box-image-repeat, mask-box-image-slice, mask-box-image-source, mask-box-image-width, mask-clip, mask-composite, mask-image, mask-origin, mask-position, mask-repeat, mask-size, nbsp-mode, perspective, perspective-origin, rtl-ordering, text-combine, text-decorations-in-effect, text-emphasis-color, text-emphasis-position, text-emphasis-style, text-fill-color, text-orientation, text-security, text-stroke-color, text-stroke-width, transform, transition, transform-origin, transform-style, transition-delay, transition-duration, transition-property, transition-timing-function, user-drag, user-modify, user-select, writing-mode, svg-shadow",
|
||||
moz:"animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-inline-policy, binding, border-bottom-colors, border-image, border-left-colors, border-right-colors, border-top-colors, box-align, box-direction, box-flex, box-ordinal-group, box-orient, box-pack, box-shadow, box-sizing, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-width, float-edge, font-feature-settings, font-language-override, force-broken-image-icon, hyphens, image-region, orient, outline-radius-bottomleft, outline-radius-bottomright, outline-radius-topleft, outline-radius-topright, perspective, perspective-origin, stack-sizing, tab-size, text-blink, text-decoration-color, text-decoration-line, text-decoration-style, text-size-adjust, transform, transform-origin, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-focus, user-input, user-modify, user-select, window-shadow",
|
||||
ms:"accelerator, animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, backface-visibility, background-position-x, background-position-y, behavior, block-progression, box-align, box-direction, box-flex, box-line-progression, box-lines, box-ordinal-group, box-orient, box-pack, content-zoom-boundary, content-zoom-boundary-max, content-zoom-boundary-min, content-zoom-chaining, content-zoom-snap, content-zoom-snap-points, content-zoom-snap-type, content-zooming, filter, flow-from, flow-into, font-feature-settings, grid-column, grid-column-align, grid-column-span, grid-columns, grid-layer, grid-row, grid-row-align, grid-row-span, grid-rows, high-contrast-adjust, hyphenate-limit-chars, hyphenate-limit-lines, hyphenate-limit-zone, hyphens, ime-mode, interpolation-mode, layout-flow, layout-grid, layout-grid-char, layout-grid-line, layout-grid-mode, layout-grid-type, line-break, overflow-style, overflow-x, overflow-y, perspective, perspective-origin, perspective-origin-x, perspective-origin-y, scroll-boundary, scroll-boundary-bottom, scroll-boundary-left, scroll-boundary-right, scroll-boundary-top, scroll-chaining, scroll-rails, scroll-snap-points-x, scroll-snap-points-y, scroll-snap-type, scroll-snap-x, scroll-snap-y, scrollbar-arrow-color, scrollbar-base-color, scrollbar-darkshadow-color, scrollbar-face-color, scrollbar-highlight-color, scrollbar-shadow-color, scrollbar-track-color, text-align-last, text-autospace, text-justify, text-kashida-space, text-overflow, text-size-adjust, text-underline-position, touch-action, transform, transform-origin, transform-origin-x, transform-origin-y, transform-origin-z, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-select, word-break, word-wrap, wrap-flow, wrap-margin, wrap-through, writing-mode, zoom",
|
||||
o:"dashboard-region, animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, border-image, link, link-source, object-fit, object-position, tab-size, table-baseline, transform, transform-origin, transition, transition-delay, transition-duration, transition-property, transition-timing-function, accesskey, input-format, input-required, marquee-dir, marquee-loop, marquee-speed, marquee-style"},
|
||||
function(a,b){q.define("css."+b+"Properties",a,r({vendor:b}))});q.define("css.unitlessProperties","z-index, line-height, opacity, font-weight","The list of properties whose values \u200b\u200bmust not contain units.");d("w",{prefix:"webkit",supports:q.getArray("css.webkitProperties")});d("m",{prefix:"moz",supports:q.getArray("css.mozProperties")});d("s",{prefix:"ms",supports:q.getArray("css.msProperties")});d("o",{prefix:"o",supports:q.getArray("css.oProperties")});var t=q.getArray("css.unitlessProperties"),
|
||||
x=["css","less","sass","scss"];h("resources").addResolver(function(a,b){return e.include(x,b)&&a.isElement()?j.expandToSnippet(a.abbreviation):null});var u=h("expandAbbreviation");u.addHandler(function(a,b,c){if(!e.include(x,b))return!1;var d=a.getSelectionRange().end,f=u.findAbbreviation(a);return f&&(b=emmet.expandAbbreviation(f,b,c))?(f=d-f.length,c=d,a.getContent().charAt(d)==";"&&c++,a.replaceContent(b,f,c),!0):!1});return j={addPrefix:d,supportsPrefix:b,prefixed:function(a,c){return b(a,c)?
|
||||
"-"+c+"-"+a:a},listPrefixes:function(){return e.map(n,function(a){return a.prefix})},getPrefix:function(a){return n[a]},removePrefix:function(a){a in n&&delete n[a]},addUnitAlias:function(a,b){m[a]=b},getUnitAlias:function(a){return m[a]},removeUnitAlias:function(a){a in m&&delete m[a]},extractPrefixes:function(a){if(a.charAt(0)!="-")return{property:a,prefixes:null};for(var b=1,c=a.length,d,e=[];b<c;){d=a.charAt(b);if(d=="-"){b++;break}if(d in n)e.push(d);else{e.length=0;b=1;break}b++}if(b==c-1)b=
|
||||
1,e.length=1;return{property:a.substring(b),prefixes:e.length?e:"all"}},findValuesInAbbreviation:function(a){for(var b=0,c=a.length,d;b<c;){d=a.charAt(b);if(g(d)||d=="-"&&g(a.charAt(b+1)))return a.substring(b);b++}return""},parseValues:function(a){for(var b="",c=[],d=0,e=a.length,f,h;d<e;)if(f=a.charAt(d),f=="-"&&b)c.push(b),b="",d++;else if(b+=f,d++,h=a.charAt(d),f!="-"&&!g(f)&&(g(h)||h=="-"))c.push(b),b="";b&&c.push(b);return c},extractValues:function(a){var b=this.findValuesInAbbreviation(a);return!b?
|
||||
{property:a,values:null}:{property:a.substring(0,a.length-b.length),values:this.parseValues(b)}},normalizeValue:function(a,b){b=(b||"").toLowerCase();return a.replace(/^(\-?[0-9\.]+)([a-z]*)$/,function(a,c,d){return!d&&(c=="0"||e.include(t,b))?c:!d?c+(~c.indexOf(".")?"em":"px"):c+(d in m?m[d]:d)})},expand:function(b,d){var g=h("resources"),j=q.get("css.autoInsertVendorPrefixes"),l;if(l=/^(.+)\!$/.test(b))b=RegExp.$1;var m=g.getSnippet("css",b);if(m&&!j)return i(m,l);var m=this.extractPrefixes(b),
|
||||
r=this.extractValues(m.property),r=e.extend(m,r);if(m=g.getSnippet("css",r.property)){if(!e.isString(m))m=m.data}else m=r.property+":"+o;if(!f(m))return m;var t=c(m),u=[];!d&&r.values&&(d=e.map(r.values,function(a){return this.normalizeValue(a,t.name)},this).join(" ")+";");t.value=d||t.value;g=r.prefixes=="all"||j?a(t.name,j&&r.prefixes!="all"):r.prefixes;e.each(g,function(a){a in n&&u.push(i(n[a].transformName(t.name)+":"+t.value,l))});u.push(i(t.name+":"+t.value,l));return u},expandToSnippet:function(a,
|
||||
b){var c=this.expand(a,b);return e.isArray(c)?c.join("\n"):!e.isString(c)?c.data:String(c)}}});
|
||||
emmet.define("cssGradient",function(h,e){function g(a){return h("utils").trim(a).replace(/\s+/g," ")}function f(a){var a=g(a),b=null,a=a.replace(/^(\w+\(.+?\))\s*/,function(a,c){b=c;return""});b||(a=a.split(" "),b=a[0],a=a[1]||"");var c={color:b};a&&a.replace(/^(\-?[\d\.]+)([a-z%]+)?$/,function(a,b,d){c.position=b;~b.indexOf(".")?d="":d||(d="%");if(d)c.unit=d});return c}function c(a){var b=0;e.each(a,function(c,d){if(!d)return c.position=c.position||0;if(d==a.length-1&&!("position"in c))c.position=
|
||||
1;if("position"in c){var f=a[b].position||0,g=(c.position-f)/(d-b);e.each(a.slice(b,d),function(a,b){a.position=f+g*b});b=d}})}function b(a){var b=parseFloat(a);if(!e.isNaN(b))switch(b%360){case 0:return"left";case 90:return"bottom";case 180:return"right";case 240:return"top"}return a}function a(a){a=b(a);if(n.test(a))throw"The direction is an angle that can\u2019t be converted.";var c=function(b){return~a.indexOf(b)?"100%":"0"};return c("right")+" "+c("bottom")+", "+c("left")+" "+c("top")}function d(a){var b=
|
||||
o.getArray("css.gradient.prefixes"),b=e.map(b,function(b){return"-"+b+"-"+a});b.push(a);return b}function i(a,b,c){var f=a.parent,g=h("utils"),j=h("cssResolver"),i=o.getArray("css.gradient.prefixes");e.each(f.getAll(d(a.name())),function(b){b!=a&&/gradient/i.test(b.value())&&f.remove(b)});var k=a.value();c||(c=h("range").create(0,a.value()));var n=function(a){return g.replaceSubstring(k,a,c)},l=h("cssGradient");a.value(n(l.toString(b)));var m=[];e.each(i,function(c){var d=j.prefixed(a.name(),c);if(c==
|
||||
"webkit"&&o.get("css.gradient.oldWebkit"))try{m.push({name:d,value:n(l.oldWebkitLinearGradient(b))})}catch(e){}m.push({name:d,value:n(l.toString(b,c))})});m=m.sort(function(a,b){return b.name.length-a.name.length});e.each(m,function(b){f.add(b.name,b.value,f.indexOf(a))})}function j(a){var b=a.value(),c=h("cssGradient"),d=null;return(a=e.find(a.valueParts(),function(a){return d=c.parse(a.substring(b))}))&&d?{gradient:d,valueRange:a}:null}var l=["top","to bottom","0deg"],n=/\d+deg/i,m=/top|bottom|left|right/i,
|
||||
o=h("preferences");o.define("css.gradient.prefixes","webkit, moz, ms, o","A comma-separated list of vendor-prefixes for which values should be generated.");o.define("css.gradient.oldWebkit",!0,"Generate gradient definition for old Webkit implementations");o.define("css.gradient.omitDefaultDirection",!0,"Do not output default direction definition in generated gradients.");h("expandAbbreviation").addHandler(function(a,b,c){b=h("editorUtils").outputInfo(a,b,c);if(b.syntax!="css")return!1;var d=a.getCaretPos();
|
||||
if(b=h("cssEditTree").parseFromPosition(b.content,d,!0))if((c=b.itemFromPosition(d,!0))||(c=e.find(b.list(),function(a){return a.range(!0).end==d})),c){var f=j(c);if(f){c.end(";");var g=b.options.offset||0,n=g+b.toString().length;i(c,f.gradient,f.valueRange);a.replaceContent(b.toString(),g,n,!0);a.setCaretPos(c.valueRange(!0).end);return!0}}return!1});h("reflectCSSValue").addHandler(function(a){var b=h("cssGradient"),c=h("utils"),f=j(a);if(!f)return!1;var g=a.value(),i=function(a){return c.replaceSubstring(g,
|
||||
a,f.valueRange)};e.each(a.parent.getAll(d(a.name())),function(c){if(c!==a){var d=c.value().match(/^\s*(\-([a-z]+)\-)?linear\-gradient/);d?c.value(i(b.toString(f.gradient,d[2]||""))):c.value().match(/\s*\-webkit\-gradient/)&&c.value(i(b.oldWebkitLinearGradient(f.gradient)))}});return!0});return{parse:function(a){var b=null,a=h("utils").trim(a).replace(/^([\w\-]+)\((.+?)\)$/,function(a,c,d){c=c.toLowerCase().replace(/^\-[a-z]+\-/,"");if(c=="linear-gradient"||c=="lg"){for(var a=l[0],d=h("stringStream").create(h("utils").trim(d)),
|
||||
c=[],j;j=d.next();)d.peek()==","?(c.push(d.current()),d.next(),d.eatSpace(),d.start=d.pos):j=="("&&d.skipTo(")");c.push(d.current());c=e.compact(e.map(c,g));if(c.length){if(n.test(c[0])||m.test(c[0]))a=c.shift();b={type:"linear",direction:a,colorStops:e.map(c,f)}}else b=null;return""}return a});return b},oldWebkitLinearGradient:function(b){e.isString(b)&&(b=this.parse(b));if(!b)return null;var d=e.map(b.colorStops,e.clone);e.each(d,function(a){if("position"in a)if(~a.position.indexOf(".")||a.unit==
|
||||
"%")a.position=parseFloat(a.position)/(a.unit=="%"?100:1);else throw"Can't convert color stop '"+(a.position+(a.unit||""))+"'";});c(d);d=e.map(d,function(a,b){return!a.position&&!b?"from("+a.color+")":a.position==1&&b==d.length-1?"to("+a.color+")":"color-stop("+a.position.toFixed(2).replace(/\.?0+$/,"")+", "+a.color+")"});return"-webkit-gradient(linear, "+a(b.direction)+", "+d.join(", ")+")"},toString:function(a,b){if(a.type=="linear"){var c=(b?"-"+b+"-":"")+"linear-gradient",d=e.map(a.colorStops,
|
||||
function(a){return a.color+("position"in a?" "+a.position+(a.unit||""):"")});a.direction&&(!o.get("css.gradient.omitDefaultDirection")||!e.include(l,a.direction))&&d.unshift(a.direction);return c+"("+d.join(", ")+")"}}}});emmet.exec(function(h,e){var g=h("handlerList").create(),f=h("resources");e.extend(f,{addGenerator:function(c,b,a){e.isString(c)&&(c=RegExp(c));g.add(function(a,e){var f;return(f=c.exec(a.name()))?b(f,a,e):null},a)}});f.addResolver(function(c,b){return g.exec(null,e.toArray(arguments))})});
|
||||
emmet.define("tagName",function(h,e){var g={empty:"area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,keygen,command".split(","),blockLevel:"address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,link,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul,h1,h2,h3,h4,h5,h6".split(","),inlineLevel:"a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var".split(",")},
|
||||
f={ul:"li",ol:"li",table:"tr",tr:"td",tbody:"tr",thead:"tr",tfoot:"tr",colgroup:"col",select:"option",optgroup:"option",audio:"source",video:"source",object:"param",map:"area"};return{resolve:function(c){c=(c||"").toLowerCase();return c in f?this.getMapping(c):this.isInlineLevel(c)?"span":"div"},getMapping:function(c){return f[c.toLowerCase()]},isInlineLevel:function(c){return this.isTypeOf(c,"inlineLevel")},isBlockLevel:function(c){return this.isTypeOf(c,"blockLevel")},isEmptyElement:function(c){return this.isTypeOf(c,
|
||||
"empty")},isTypeOf:function(c,b){return e.include(g[b],c)},addMapping:function(c,b){f[c]=b},removeMapping:function(c){c in f&&delete f[c]},addElementToCollection:function(c,b){g[b]||(g[b]=[]);var a=this.getCollection(b);e.include(a,c)||a.push(c)},removeElementFromCollection:function(c,b){b in g&&(g[b]=e.without(this.getCollection(b),c))},getCollection:function(c){return g[c]}}});
|
||||
emmet.exec(function(h,e){function g(){return{element:d.get("bem.elementSeparator"),modifier:d.get("bem.modifierSeparator")}}function f(a){if(h("abbreviationUtils").isSnippet(a))return a;a.__bem={block:"",element:"",modifier:""};var d=c(a.attribute("class")).split(" "),f=/^[a-z]\-/i;a.__bem.block=e.find(d,function(a){return f.test(a)});if(!a.__bem.block)f=/^[a-z]/i,a.__bem.block=e.find(d,function(a){return f.test(a)})||"";d=e.chain(d).map(function(c){var d;d=b(c,a,"element");d=b(d,a,"modifier");var e=
|
||||
"",f="",h="",c=g();~d.indexOf(c.element)?(e=d.split(c.element),h=e[1].split(c.modifier),e=e[0],f=h.shift(),h=h.join(c.modifier)):~d.indexOf(c.modifier)&&(h=d.split(c.modifier),e=h.shift(),h=h.join(c.modifier));if(e||f||h){if(!e)e=a.__bem.block;d=e;var i=[];f&&(d+=c.element+f);i.push(d);h&&i.push(d+c.modifier+h);a.__bem.block=e;a.__bem.element=f;a.__bem.modifier=h;c=i}else c=d;return c}).flatten().uniq().value();a.attribute("class",d.join(" "));return a}function c(a){var b=h("utils"),a=(" "+(a||"")+
|
||||
" ").replace(/\s+/g," "),c=d.get("bem.shortElementPrefix");c&&(c=RegExp("\\s("+b.escapeForRegexp(c)+"+)","g"),a=a.replace(c,function(a,c){return" "+b.repeatString(g().element,c.length)}));return b.trim(a)}function b(a,b,c){var d=g(),e=RegExp("^("+d[c]+")+","g");if(e.test(a)){for(var f=0,e=a.replace(e,function(a){f=a.length/d[c].length;return""}),h=b;h.parent&&f--;)h=h.parent;if(!h||!h.__bem)h=b;if(h&&h.__bem)return a=h.__bem.block,c=="modifier"&&h.__bem.element&&(a+=d.element+h.__bem.element),a+d[c]+
|
||||
e}return a}function a(b,c){b.name&&f(b,c);var d=h("abbreviationUtils");e.each(b.children,function(b){a(b,c);!d.isSnippet(b)&&b.start&&(i=!0)});return b}var d=h("preferences");d.define("bem.elementSeparator","__","Class name\u2019s element separator.");d.define("bem.modifierSeparator","_","Class name\u2019s modifier separator.");d.define("bem.shortElementPrefix","-","Symbol for describing short \u201cblock-element\u201d notation. Class names prefixed with this symbol will be treated as element name for parent\u2018s block name. Each symbol instance traverses one level up in parsed tree for block name lookup. Empty value will disable short notation.");
|
||||
var i=!1;h("filters").add("bem",function(b,c){i=!1;b=a(b,c);i&&(b=h("filters").apply(b,"html",c));return b})});
|
||||
emmet.exec(function(h,e){function g(b,a,d){var f=h("utils"),g=c.get("filter.commentTrigger");if(g=="*"||e.find(g.split(","),function(a){return!!b.attribute(f.trim(a))}))g={node:b,name:b.name(),padding:b.parent?b.parent.padding:"",attr:function(a,c,d){return(a=b.attribute(a))?(c||"")+a+(d||""):""}},a=f.normalizeNewline(a?a(g):""),d=f.normalizeNewline(d?d(g):""),b.start=b.start.replace(/</,a+"<"),b.end=b.end.replace(/>/,">"+d)}function f(b,a,c){var i=h("abbreviationUtils");e.each(b.children,function(b){i.isBlock(b)&&
|
||||
g(b,a,c);f(b,a,c)});return b}var c=h("preferences");c.define("filter.commentAfter",'\n<\!-- /<%= attr("id", "#") %><%= attr("class", ".") %> --\>',"A definition of comment that should be placed <i>after</i> matched element when <code>comment</code> filter is applied. This definition is an ERB-style template passed to <code>_.template()</code> function (see Underscore.js docs for details). In template context, the following properties and functions are availabe:\n<ul><li><code>attr(name, before, after)</code> \u2013 a function that outputsspecified attribute value concatenated with <code>before</code> and <code>after</code> strings. If attribute doesn't exists, the empty string will be returned.</li><li><code>node</code> \u2013 current node (instance of <code>AbbreviationNode</code>)</li><li><code>name</code> \u2013 name of current tag</li><li><code>padding</code> \u2013 current string padding, can be used for formatting</li></ul>");
|
||||
c.define("filter.commentBefore","","A definition of comment that should be placed <i>before</i> matched element when <code>comment</code> filter is applied. For more info, read description of <code>filter.commentAfter</code> property");c.define("filter.commentTrigger","id, class","A comma-separated list of attribute names that should exist in abbreviatoin where comment should be added. If you wish to add comment for every element, set this option to <code>*</code>");h("filters").add("c",function(b){var a=
|
||||
e.template(c.get("filter.commentBefore")),d=e.template(c.get("filter.commentAfter"));return f(b,a,d)})});emmet.exec(function(h,e){function g(c){return c.replace(/([<>&])/g,function(b,a){return f[a]})}var f={"<":"<",">":">","&":"&"};h("filters").add("e",function b(a){e.each(a.children,function(a){a.start=g(a.start);a.end=g(a.end);a.content=g(a.content);b(a)});return a})});
|
||||
emmet.exec(function(h,e){function g(){return h("resources").getVariable("indentation")}function f(b){return b.parent&&!b.parent.parent&&!b.index()}function c(b,a){var c=h("abbreviationUtils");if(a.tag_nl===!0||c.isBlock(b))return!0;if(!b.parent||!a.inline_break)return!1;var f=0;return!!e.find(b.parent.children,function(b){b.isTextNode()||!c.isInline(b)?f=0:c.isInline(b)&&f++;if(f>=a.inline_break)return!0})}h("filters").add("_format",function a(d,i,j){var j=j||0,l=h("abbreviationUtils");e.each(d.children,
|
||||
function(d){if(l.isSnippet(d)){if(!f(d))d.start=h("utils").getNewline()+d.start}else{d.start=d.end="%s";var e=h("utils"),o=h("abbreviationUtils"),q=o.isUnary(d),e=e.getNewline();if(i.tag_nl!==!1){var r=i.tag_nl===!0&&(i.tag_nl_leaf||d.children.length);if(!d.isTextNode()){if(c(d,i)){if(!f(d)&&(!o.isSnippet(d.parent)||d.index()))d.start=e+d.start;if(o.hasBlockChildren(d)||d.children.length&&c(d.children[0],i)||r&&!q)d.end=e+d.end;if(o.hasTagsInContent(d)||r&&!d.children.length&&!q)d.start+=e+g()}else if(o.isInline(d)&&
|
||||
d.parent&&h("abbreviationUtils").hasBlockChildren(d.parent)&&!f(d))d.start=e+d.start;else if(o.isInline(d)&&o.hasBlockChildren(d))d.end=e+d.end;d.padding=g()}}}a(d,i,j+1)});return d})});
|
||||
emmet.exec(function(h,e){function g(f,c){var b="",a=[],d=c.attributeQuote(),g=c.cursor();e.each(f.attributeList(),function(e){var f=c.attributeName(e.name);switch(f.toLowerCase()){case "id":b+="#"+(e.value||g);break;case "class":b+="."+h("utils").trim(e.value||g).replace(/\s+/g,".");break;default:a.push(":"+f+" => "+d+(e.value||g)+d)}});a.length&&(b+="{"+a.join(", ")+"}");return b}h("filters").add("haml",function c(b,a,d){var d=d||0,i=h("abbreviationUtils");d||(b=h("filters").apply(b,"_format",a));
|
||||
e.each(b.children,function(b){if(!i.isSnippet(b)&&b.parent){var e=h("abbreviationUtils"),n=h("utils"),m=g(b,a),o=a.cursor(),e=e.isUnary(b),q=a.self_closing_tag&&e?"/":"",r="",r="%"+a.tagName(b.name());r.toLowerCase()=="%div"&&m&&m.indexOf("{")==-1&&(r="");b.end="";b.start=n.replaceSubstring(b.start,r+m+q+" ",b.start.indexOf("%s"),"%s");!b.children.length&&!e&&(b.start+=o)}c(b,a,d+1)});return b})});
|
||||
emmet.exec(function(h,e){function g(f,c){var b=c.attributeQuote(),a=c.cursor();return e.map(f.attributeList(),function(d){return" "+c.attributeName(d.name)+"="+b+(d.value||a)+b}).join("")}h("filters").add("html",function c(b,a,d){var d=d||0,i=h("abbreviationUtils");d||(b=h("filters").apply(b,"_format",a));e.each(b.children,function(b){if(!i.isSnippet(b)&&b.parent){var e=h("abbreviationUtils"),n=h("utils"),m=g(b,a),o=a.cursor(),e=e.isUnary(b),q="",r="";if(!b.isTextNode()){var t=a.tagName(b.name());
|
||||
e?(q="<"+t+m+a.selfClosing()+">",b.end=""):(q="<"+t+m+">",r="</"+t+">")}b.start=n.replaceSubstring(b.start,q,b.start.indexOf("%s"),"%s");b.end=n.replaceSubstring(b.end,r,b.end.indexOf("%s"),"%s");!b.children.length&&!e&&b.content.indexOf(o)==-1&&(b.start+=o)}c(b,a,d+1)});return b})});
|
||||
emmet.exec(function(h,e){var g=/^\s+/,f=/[\n\r]/g;h("filters").add("s",function b(a){var d=h("abbreviationUtils");e.each(a.children,function(a){if(!d.isSnippet(a))a.start=a.start.replace(g,""),a.end=a.end.replace(g,"");a.start=a.start.replace(f,"");a.end=a.end.replace(f,"");a.content=a.content.replace(f,"");b(a)});return a})});
|
||||
emmet.exec(function(h,e){function g(f,c){e.each(f.children,function(b){if(b.content)b.content=b.content.replace(c,"");g(b,c)});return f}h("preferences").define("filter.trimRegexp","[\\s|\\u00a0]*[\\d|#|\\-|*|\\u2022]+\\.?\\s*","Regular expression used to remove list markers (numbers, dashes, bullets, etc.) in <code>t</code> (trim) filter. The trim filter is useful for wrapping with abbreviation lists, pased from other documents (for example, Word documents).");h("filters").add("t",function(e){var c=
|
||||
RegExp(h("preferences").get("filter.trimRegexp"));return g(e,c)})});emmet.exec(function(h,e){var g={"xsl:variable":1,"xsl:with-param":1};h("filters").add("xsl",function c(b){var a=h("abbreviationUtils");e.each(b.children,function(b){if(!a.isSnippet(b)&&(b.name()||"").toLowerCase()in g&&b.children.length)b.start=b.start.replace(/\s+select\s*=\s*(['"]).*?\1/,"");c(b)});return b})});
|
||||
emmet.exec(function(h,e){function g(a,b){return Math.round(Math.random()*(b-a)+a)}function f(a,b){for(var c=a.length,d=Math.min(c,b),f=[];f.length<d;){var h=g(0,c-1);e.include(f,h)||f.push(h)}return e.map(f,function(b){return a[b]})}function c(a,b){a.length&&(a[0]=a[0].charAt(0).toUpperCase()+a[0].substring(1));return a.join(" ")+(b||(e.isString("?!...")?"?!...".charAt(g(0,4)):"?!..."[g(0,4)]))}function b(a){var b=a.length,c=0,c=b>3&&b<=6?g(0,1):b>6&&b<=12?g(0,2):g(1,4);e.each(f(e.range(c)),function(b){a[b]+=
|
||||
","})}h("abbreviationParser").addPreprocessor(function(e){var h=/^(?:lorem|lipsum)(\d*)$/i,l;e.findAll(function(e){if(e._name&&(l=e._name.match(h))){var i=l[1]||30;e._name="";e.data("forceNameResolving",e.isRepeating()||e.attributeList().length);e.data("paste",function(e){var h=[],j=0;e||(e=a.slice(0,i+1),e.length>5&&(e[4]+=","),j+=e.length,h.push(c(e,".")));for(;j<i;)e=f(d,Math.min(g(3,12)*g(1,5),i-j)),j+=e.length,b(e),h.push(c(e));return h.join(" ")})}})});var a="lorem ipsum dolor sit amet consectetur adipisicing elit".split(" "),
|
||||
d=["exercitationem","perferendis","perspiciatis","laborum","eveniet","sunt","iure","nam","nobis","eum","cum","officiis","excepturi","odio","consectetur","quasi","aut","quisquam","vel","eligendi","itaque","non","odit","tempore","quaerat","dignissimos","facilis","neque","nihil","expedita","vitae","vero","ipsum","nisi","animi","cumque","pariatur","velit","modi","natus","iusto","eaque","sequi","illo","sed","ex","et","voluptatibus","tempora","veritatis","ratione","assumenda","incidunt","nostrum","placeat",
|
||||
"aliquid","fuga","provident","praesentium","rem","necessitatibus","suscipit","adipisci","quidem","possimus","voluptas","debitis","sint","accusantium","unde","sapiente","voluptate","qui","aspernatur","laudantium","soluta","amet","quo","aliquam","saepe","culpa","libero","ipsa","dicta","reiciendis","nesciunt","doloribus","autem","impedit","minima","maiores","repudiandae","ipsam","obcaecati","ullam","enim","totam","delectus","ducimus","quis","voluptates","dolores","molestiae","harum","dolorem","quia",
|
||||
"voluptatem","molestias","magni","distinctio","omnis","illum","dolorum","voluptatum","ea","quas","quam","corporis","quae","blanditiis","atque","deserunt","laboriosam","earum","consequuntur","hic","cupiditate","quibusdam","accusamus","ut","rerum","error","minus","eius","ab","ad","nemo","fugit","officia","at","in","id","quos","reprehenderit","numquam","iste","fugiat","sit","inventore","beatae","repellendus","magnam","recusandae","quod","explicabo","doloremque","aperiam","consequatur","asperiores","commodi",
|
||||
"optio","dolor","labore","temporibus","repellat","veniam","architecto","est","esse","mollitia","nulla","a","similique","eos","alias","dolore","tenetur","deleniti","porro","facere","maxime","corrupti"]});emmet.require("actions").add("select_line",function(h){var e=h.getCurrentLineRange();h.createSelection(e.start,e.end);return!0});
|
||||
emmet.require("resources").setVocabulary({variables:{lang:"en",locale:"en-US",charset:"UTF-8",indentation:"\t",newline:"\n"},css:{filters:"html",snippets:{"@i":"@import url(|);","@m":"@media print {\n\t|\n}","@f":"@font-face {\n\tfont-family:|;\n\tsrc:url(|);\n}","!":"!important",pos:"position:|;","pos:s":"position:static;","pos:a":"position:absolute;","pos:r":"position:relative;","pos:f":"position:fixed;",t:"top:|;","t:a":"top:auto;",r:"right:|;","r:a":"right:auto;",b:"bottom:|;","b:a":"bottom:auto;",
|
||||
brad:"-webkit-border-radius: ${1:radius};\n-moz-border-radius: $1;\nborder-radius: $1;",bsha:"-webkit-box-shadow: ${1:hoff} ${2:voff} ${3:blur} ${4:rgba(0,0,0,0.5)};\n-moz-box-shadow: $1 $2 $3 $4;\nbox-shadow: $1 $2 $3 $4;",l:"left:|;","l:a":"left:auto;",z:"z-index:|;","z:a":"z-index:auto;",fl:"float:|;","fl:n":"float:none;","fl:l":"float:left;","fl:r":"float:right;",cl:"clear:|;","cl:n":"clear:none;","cl:l":"clear:left;","cl:r":"clear:right;","cl:b":"clear:both;",d:"display:|;","d:n":"display:none;",
|
||||
"d:b":"display:block;","d:i":"display:inline;","d:ib":"display:inline-block;","d:li":"display:list-item;","d:ri":"display:run-in;","d:cp":"display:compact;","d:tb":"display:table;","d:itb":"display:inline-table;","d:tbcp":"display:table-caption;","d:tbcl":"display:table-column;","d:tbclg":"display:table-column-group;","d:tbhg":"display:table-header-group;","d:tbfg":"display:table-footer-group;","d:tbr":"display:table-row;","d:tbrg":"display:table-row-group;","d:tbc":"display:table-cell;","d:rb":"display:ruby;",
|
||||
"d:rbb":"display:ruby-base;","d:rbbg":"display:ruby-base-group;","d:rbt":"display:ruby-text;","d:rbtg":"display:ruby-text-group;",v:"visibility:|;","v:v":"visibility:visible;","v:h":"visibility:hidden;","v:c":"visibility:collapse;",ov:"overflow:|;","ov:v":"overflow:visible;","ov:h":"overflow:hidden;","ov:s":"overflow:scroll;","ov:a":"overflow:auto;",ovx:"overflow-x:|;","ovx:v":"overflow-x:visible;","ovx:h":"overflow-x:hidden;","ovx:s":"overflow-x:scroll;","ovx:a":"overflow-x:auto;",ovy:"overflow-y:|;",
|
||||
"ovy:v":"overflow-y:visible;","ovy:h":"overflow-y:hidden;","ovy:s":"overflow-y:scroll;","ovy:a":"overflow-y:auto;",ovs:"overflow-style:|;","ovs:a":"overflow-style:auto;","ovs:s":"overflow-style:scrollbar;","ovs:p":"overflow-style:panner;","ovs:m":"overflow-style:move;","ovs:mq":"overflow-style:marquee;",zoo:"zoom:1;",cp:"clip:|;","cp:a":"clip:auto;","cp:r":"clip:rect(|);",bxz:"box-sizing:|;","bxz:cb":"box-sizing:content-box;","bxz:bb":"box-sizing:border-box;",bxsh:"box-shadow:${1:hoff} ${2:voff} ${3:radius} ${4:color};",
|
||||
"bxsh:n":"box-shadow:none;",m:"margin:|;","m:a":"margin:auto;",mt:"margin-top:|;","mt:a":"margin-top:auto;",mr:"margin-right:|;","mr:a":"margin-right:auto;",mb:"margin-bottom:|;","mb:a":"margin-bottom:auto;",ml:"margin-left:|;","ml:a":"margin-left:auto;",p:"padding:|;",pt:"padding-top:|;",pr:"padding-right:|;",pb:"padding-bottom:|;",pl:"padding-left:|;",w:"width:|;","w:a":"width:auto;",h:"height:|;","h:a":"height:auto;",maw:"max-width:|;","maw:n":"max-width:none;",mah:"max-height:|;","mah:n":"max-height:none;",
|
||||
miw:"min-width:|;",mih:"min-height:|;",o:"outline:|;","o:n":"outline:none;",oo:"outline-offset:|;",ow:"outline-width:|;",os:"outline-style:|;",oc:"outline-color:${1:#000};","oc:i":"outline-color:invert;",bd:"border:|;","bd+":"border:${1:1px} ${2:solid} ${3:#000};","bd:n":"border:none;",bdbk:"border-break:|;","bdbk:c":"border-break:close;",bdcl:"border-collapse:|;","bdcl:c":"border-collapse:collapse;","bdcl:s":"border-collapse:separate;",bdc:"border-color:${1:#000};",bdi:"border-image:url(|);","bdi:n":"border-image:none;",
|
||||
bdti:"border-top-image:url(|);","bdti:n":"border-top-image:none;",bdri:"border-right-image:url(|);","bdri:n":"border-right-image:none;",bdbi:"border-bottom-image:url(|);","bdbi:n":"border-bottom-image:none;",bdli:"border-left-image:url(|);","bdli:n":"border-left-image:none;",bdci:"border-corner-image:url(|);","bdci:n":"border-corner-image:none;","bdci:c":"border-corner-image:continue;",bdtli:"border-top-left-image:url(|);","bdtli:n":"border-top-left-image:none;","bdtli:c":"border-top-left-image:continue;",
|
||||
bdtri:"border-top-right-image:url(|);","bdtri:n":"border-top-right-image:none;","bdtri:c":"border-top-right-image:continue;",bdbri:"border-bottom-right-image:url(|);","bdbri:n":"border-bottom-right-image:none;","bdbri:c":"border-bottom-right-image:continue;",bdbli:"border-bottom-left-image:url(|);","bdbli:n":"border-bottom-left-image:none;","bdbli:c":"border-bottom-left-image:continue;",bdf:"border-fit:|;","bdf:c":"border-fit:clip;","bdf:r":"border-fit:repeat;","bdf:sc":"border-fit:scale;","bdf:st":"border-fit:stretch;",
|
||||
"bdf:ow":"border-fit:overwrite;","bdf:of":"border-fit:overflow;","bdf:sp":"border-fit:space;",bdl:"border-length:|;","bdl:a":"border-length:auto;",bdsp:"border-spacing:|;",bds:"border-style:|;","bds:n":"border-style:none;","bds:h":"border-style:hidden;","bds:dt":"border-style:dotted;","bds:ds":"border-style:dashed;","bds:s":"border-style:solid;","bds:db":"border-style:double;","bds:dtds":"border-style:dot-dash;","bds:dtdtds":"border-style:dot-dot-dash;","bds:w":"border-style:wave;","bds:g":"border-style:groove;",
|
||||
"bds:r":"border-style:ridge;","bds:i":"border-style:inset;","bds:o":"border-style:outset;",bdw:"border-width:|;",bdt:"border-top:|;","bdt+":"border-top:${1:1px} ${2:solid} ${3:#000};","bdt:n":"border-top:none;",bdtw:"border-top-width:|;",bdts:"border-top-style:|;","bdts:n":"border-top-style:none;",bdtc:"border-top-color:${1:#000};",bdr:"border-right:|;","bdr+":"border-right:${1:1px} ${2:solid} ${3:#000};","bdr:n":"border-right:none;",bdrw:"border-right-width:|;",bdrs:"border-right-style:|;","bdrs:n":"border-right-style:none;",
|
||||
bdrc:"border-right-color:${1:#000};",bdb:"border-bottom:|;","bdb+":"border-bottom:${1:1px} ${2:solid} ${3:#000};","bdb:n":"border-bottom:none;",bdbw:"border-bottom-width:|;",bdbs:"border-bottom-style:|;","bdbs:n":"border-bottom-style:none;",bdbc:"border-bottom-color:${1:#000};",bdl:"border-left:|;","bdl+":"border-left:${1:1px} ${2:solid} ${3:#000};","bdl:n":"border-left:none;",bdlw:"border-left-width:|;",bdls:"border-left-style:|;","bdls:n":"border-left-style:none;",bdlc:"border-left-color:${1:#000};",
|
||||
bdrs:"border-radius:|;",bdtrrs:"border-top-right-radius:|;",bdtlrs:"border-top-left-radius:|;",bdbrrs:"border-bottom-right-radius:|;",bdblrs:"border-bottom-left-radius:|;",bg:"background:|;","bg+":"background:${1:#fff} url(${2}) ${3:0} ${4:0} ${5:no-repeat};","bg:n":"background:none;","bg:ie":"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1:x}.png',sizingMethod='${2:crop}');",bgc:"background-color:${1:#fff};",bgi:"background-image:url(|);","bgi:n":"background-image:none;",bgr:"background-repeat:|;",
|
||||
"bgr:n":"background-repeat:no-repeat;","bgr:x":"background-repeat:repeat-x;","bgr:y":"background-repeat:repeat-y;",bga:"background-attachment:|;","bga:f":"background-attachment:fixed;","bga:s":"background-attachment:scroll;",bgp:"background-position:${1:0} ${2:0};",bgpx:"background-position-x:|;",bgpy:"background-position-y:|;",bgbk:"background-break:|;","bgbk:bb":"background-break:bounding-box;","bgbk:eb":"background-break:each-box;","bgbk:c":"background-break:continuous;",bgcp:"background-clip:|;",
|
||||
"bgcp:bb":"background-clip:border-box;","bgcp:pb":"background-clip:padding-box;","bgcp:cb":"background-clip:content-box;","bgcp:nc":"background-clip:no-clip;",bgo:"background-origin:|;","bgo:pb":"background-origin:padding-box;","bgo:bb":"background-origin:border-box;","bgo:cb":"background-origin:content-box;",bgz:"background-size:|;","bgz:a":"background-size:auto;","bgz:ct":"background-size:contain;","bgz:cv":"background-size:cover;",c:"color:${1:#000};",tbl:"table-layout:|;","tbl:a":"table-layout:auto;",
|
||||
"tbl:f":"table-layout:fixed;",cps:"caption-side:|;","cps:t":"caption-side:top;","cps:b":"caption-side:bottom;",ec:"empty-cells:|;","ec:s":"empty-cells:show;","ec:h":"empty-cells:hide;",lis:"list-style:|;","lis:n":"list-style:none;",lisp:"list-style-position:|;","lisp:i":"list-style-position:inside;","lisp:o":"list-style-position:outside;",list:"list-style-type:|;","list:n":"list-style-type:none;","list:d":"list-style-type:disc;","list:c":"list-style-type:circle;","list:s":"list-style-type:square;",
|
||||
"list:dc":"list-style-type:decimal;","list:dclz":"list-style-type:decimal-leading-zero;","list:lr":"list-style-type:lower-roman;","list:ur":"list-style-type:upper-roman;",lisi:"list-style-image:|;","lisi:n":"list-style-image:none;",q:"quotes:|;","q:n":"quotes:none;","q:ru":"quotes:'\\00AB' '\\00BB' '\\201E' '\\201C';","q:en":"quotes:'\\201C' '\\201D' '\\2018' '\\2019';",ct:"content:|;","ct:n":"content:normal;","ct:oq":"content:open-quote;","ct:noq":"content:no-open-quote;","ct:cq":"content:close-quote;",
|
||||
"ct:ncq":"content:no-close-quote;","ct:a":"content:attr(|);","ct:c":"content:counter(|);","ct:cs":"content:counters(|);",coi:"counter-increment:|;",cor:"counter-reset:|;",va:"vertical-align:|;","va:sup":"vertical-align:super;","va:t":"vertical-align:top;","va:tt":"vertical-align:text-top;","va:m":"vertical-align:middle;","va:bl":"vertical-align:baseline;","va:b":"vertical-align:bottom;","va:tb":"vertical-align:text-bottom;","va:sub":"vertical-align:sub;",ta:"text-align:|;","ta:l":"text-align:left;",
|
||||
"ta:c":"text-align:center;","ta:r":"text-align:right;",tal:"text-align-last:|;","tal:a":"text-align-last:auto;","tal:l":"text-align-last:left;","tal:c":"text-align-last:center;","tal:r":"text-align-last:right;",td:"text-decoration:|;","td:n":"text-decoration:none;","td:u":"text-decoration:underline;","td:o":"text-decoration:overline;","td:l":"text-decoration:line-through;",te:"text-emphasis:|;","te:n":"text-emphasis:none;","te:ac":"text-emphasis:accent;","te:dt":"text-emphasis:dot;","te:c":"text-emphasis:circle;",
|
||||
"te:ds":"text-emphasis:disc;","te:b":"text-emphasis:before;","te:a":"text-emphasis:after;",th:"text-height:|;","th:a":"text-height:auto;","th:f":"text-height:font-size;","th:t":"text-height:text-size;","th:m":"text-height:max-size;",ti:"text-indent:|;","ti:-":"text-indent:-9999px;",tj:"text-justify:|;","tj:a":"text-justify:auto;","tj:iw":"text-justify:inter-word;","tj:ii":"text-justify:inter-ideograph;","tj:ic":"text-justify:inter-cluster;","tj:d":"text-justify:distribute;","tj:k":"text-justify:kashida;",
|
||||
"tj:t":"text-justify:tibetan;",to:"text-outline:|;","to+":"text-outline:${1:0} ${2:0} ${3:#000};","to:n":"text-outline:none;",tr:"text-replace:|;","tr:n":"text-replace:none;",tt:"text-transform:|;","tt:n":"text-transform:none;","tt:c":"text-transform:capitalize;","tt:u":"text-transform:uppercase;","tt:l":"text-transform:lowercase;",tw:"text-wrap:|;","tw:n":"text-wrap:normal;","tw:no":"text-wrap:none;","tw:u":"text-wrap:unrestricted;","tw:s":"text-wrap:suppress;",tsh:"text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000};",
|
||||
"tsh+":"text-shadow:${1:0} ${2:0} ${3:0} ${4:#000};","tsh:n":"text-shadow:none;",trf:"transform:|;","trf:skx":"transform: skewX(${1:angle});","trf:sky":"transform: skewY(${1:angle});","trf:sc":"transform: scale(${1:x}, ${2:y});","trf:scx":"transform: scaleX(${1:x});","trf:scy":"transform: scaleY(${1:y});","trf:r":"transform: rotate(${1:angle});","trf:t":"transform: translate(${1:x}, ${2:y});","trf:tx":"transform: translateX(${1:x});","trf:ty":"transform: translateY(${1:y});",lh:"line-height:|;",whs:"white-space:|;",
|
||||
"whs:n":"white-space:normal;","whs:p":"white-space:pre;","whs:nw":"white-space:nowrap;","whs:pw":"white-space:pre-wrap;","whs:pl":"white-space:pre-line;",whsc:"white-space-collapse:|;","whsc:n":"white-space-collapse:normal;","whsc:k":"white-space-collapse:keep-all;","whsc:l":"white-space-collapse:loose;","whsc:bs":"white-space-collapse:break-strict;","whsc:ba":"white-space-collapse:break-all;",wob:"word-break:|;","wob:n":"word-break:normal;","wob:k":"word-break:keep-all;","wob:l":"word-break:loose;",
|
||||
"wob:bs":"word-break:break-strict;","wob:ba":"word-break:break-all;",wos:"word-spacing:|;",wow:"word-wrap:|;","wow:nm":"word-wrap:normal;","wow:n":"word-wrap:none;","wow:u":"word-wrap:unrestricted;","wow:s":"word-wrap:suppress;",lts:"letter-spacing:|;",f:"font:|;","f+":"font:${1:1em} ${2:Arial,sans-serif};",fw:"font-weight:|;","fw:n":"font-weight:normal;","fw:b":"font-weight:bold;","fw:br":"font-weight:bolder;","fw:lr":"font-weight:lighter;",fs:"font-style:|;","fs:n":"font-style:normal;","fs:i":"font-style:italic;",
|
||||
"fs:o":"font-style:oblique;",fv:"font-variant:|;","fv:n":"font-variant:normal;","fv:sc":"font-variant:small-caps;",fz:"font-size:|;",fza:"font-size-adjust:|;","fza:n":"font-size-adjust:none;",ff:"font-family:|;","ff:s":"font-family:serif;","ff:ss":"font-family:sans-serif;","ff:c":"font-family:cursive;","ff:f":"font-family:fantasy;","ff:m":"font-family:monospace;",fef:"font-effect:|;","fef:n":"font-effect:none;","fef:eg":"font-effect:engrave;","fef:eb":"font-effect:emboss;","fef:o":"font-effect:outline;",
|
||||
fem:"font-emphasize:|;",femp:"font-emphasize-position:|;","femp:b":"font-emphasize-position:before;","femp:a":"font-emphasize-position:after;",fems:"font-emphasize-style:|;","fems:n":"font-emphasize-style:none;","fems:ac":"font-emphasize-style:accent;","fems:dt":"font-emphasize-style:dot;","fems:c":"font-emphasize-style:circle;","fems:ds":"font-emphasize-style:disc;",fsm:"font-smooth:|;","fsm:a":"font-smooth:auto;","fsm:n":"font-smooth:never;","fsm:aw":"font-smooth:always;",fst:"font-stretch:|;",
|
||||
"fst:n":"font-stretch:normal;","fst:uc":"font-stretch:ultra-condensed;","fst:ec":"font-stretch:extra-condensed;","fst:c":"font-stretch:condensed;","fst:sc":"font-stretch:semi-condensed;","fst:se":"font-stretch:semi-expanded;","fst:e":"font-stretch:expanded;","fst:ee":"font-stretch:extra-expanded;","fst:ue":"font-stretch:ultra-expanded;",op:"opacity:|;","op:ie":"filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);","op:ms":"-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';",
|
||||
rz:"resize:|;","rz:n":"resize:none;","rz:b":"resize:both;","rz:h":"resize:horizontal;","rz:v":"resize:vertical;",cur:"cursor:|;","cur:a":"cursor:auto;","cur:d":"cursor:default;","cur:c":"cursor:crosshair;","cur:ha":"cursor:hand;","cur:he":"cursor:help;","cur:m":"cursor:move;","cur:p":"cursor:pointer;","cur:t":"cursor:text;",pgbb:"page-break-before:|;","pgbb:au":"page-break-before:auto;","pgbb:al":"page-break-before:always;","pgbb:l":"page-break-before:left;","pgbb:r":"page-break-before:right;",pgbi:"page-break-inside:|;",
|
||||
"pgbi:au":"page-break-inside:auto;","pgbi:av":"page-break-inside:avoid;",pgba:"page-break-after:|;","pgba:au":"page-break-after:auto;","pgba:al":"page-break-after:always;","pgba:l":"page-break-after:left;","pgba:r":"page-break-after:right;",orp:"orphans:|;",wid:"widows:|;"}},html:{filters:"html",snippets:{"cc:ie6":"<\!--[if lte IE 6]>\n\t${child}|\n<![endif]--\>","cc:ie":"<\!--[if IE]>\n\t${child}|\n<![endif]--\>","cc:noie":"<\!--[if !IE]><\!--\>\n\t${child}|\n<\!--<![endif]--\>","html:4t":'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}">\n\t<title></title>\n</head>\n<body>\n\t${child}|\n</body>\n</html>',
|
||||
"html:4s":'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n<html lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}">\n\t<title></title>\n</head>\n<body>\n\t${child}|\n</body>\n</html>',"html:xt":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}" />\n\t<title></title>\n</head>\n<body>\n\t${child}|\n</body>\n</html>',
|
||||
"html:xs":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}" />\n\t<title></title>\n</head>\n<body>\n\t${child}|\n</body>\n</html>',"html:xxs":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}">\n<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=${charset}" />\n\t<title></title>\n</head>\n<body>\n\t${child}|\n</body>\n</html>',
|
||||
"html:5":'<!doctype html>\n<html lang="${lang}">\n<head>\n\t<meta charset="${charset}">\n\t<title></title>\n</head>\n<body>\n\t${child}|\n</body>\n</html>'},abbreviations:{a:'<a href="">',"a:link":'<a href="http://|">',"a:mail":'<a href="mailto:|">',abbr:'<abbr title="">',acronym:'<acronym title="">',base:'<base href="" />',bdo:'<bdo dir="">',"bdo:r":'<bdo dir="rtl">',"bdo:l":'<bdo dir="ltr">',link:'<link rel="stylesheet" href="" />',"link:css":'<link rel="stylesheet" href="${1:style}.css" media="all" />',
|
||||
"link:print":'<link rel="stylesheet" href="${1:print}.css" media="print" />',"link:favicon":'<link rel="shortcut icon" type="image/x-icon" href="${1:favicon.ico}" />',"link:touch":'<link rel="apple-touch-icon" href="${1:favicon.png}" />',"link:rss":'<link rel="alternate" type="application/rss+xml" title="RSS" href="${1:rss.xml}" />',"link:atom":'<link rel="alternate" type="application/atom+xml" title="Atom" href="${1:atom.xml}" />',"meta:utf":'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />',
|
||||
"meta:win":'<meta http-equiv="Content-Type" content="text/html;charset=windows-1251" />',"meta:compat":'<meta http-equiv="X-UA-Compatible" content="${1:IE=7}" />',style:"<style>",script:"<script>","script:src":'<script src="">',img:'<img src="" alt="" />',iframe:'<iframe src="" frameborder="0">',embed:'<embed src="" type="" />',object:'<object data="" type="">',param:'<param name="" value="" />',map:'<map name="">',area:'<area shape="" coords="" href="" alt="" />',"area:d":'<area shape="default" href="" alt="" />',
|
||||
"area:c":'<area shape="circle" coords="" href="" alt="" />',"area:r":'<area shape="rect" coords="" href="" alt="" />',"area:p":'<area shape="poly" coords="" href="" alt="" />',form:'<form action="">',"form:get":'<form action="" method="get">',"form:post":'<form action="" method="post">',label:'<label for="">',input:'<input type="" />',"input:hidden":'<input type="hidden" name="" />',"input:h":'<input type="hidden" name="" />',"input:text":'<input type="text" name="" id="" />',"input:t":'<input type="text" name="" id="" />',
|
||||
"input:search":'<input type="search" name="" id="" />',"input:email":'<input type="email" name="" id="" />',"input:url":'<input type="url" name="" id="" />',"input:password":'<input type="password" name="" id="" />',"input:p":'<input type="password" name="" id="" />',"input:datetime":'<input type="datetime" name="" id="" />',"input:date":'<input type="date" name="" id="" />',"input:datetime-local":'<input type="datetime-local" name="" id="" />',"input:month":'<input type="month" name="" id="" />',
|
||||
"input:week":'<input type="week" name="" id="" />',"input:time":'<input type="time" name="" id="" />',"input:number":'<input type="number" name="" id="" />',"input:color":'<input type="color" name="" id="" />',"input:checkbox":'<input type="checkbox" name="" id="" />',"input:c":'<input type="checkbox" name="" id="" />',"input:radio":'<input type="radio" name="" id="" />',"input:r":'<input type="radio" name="" id="" />',"input:range":'<input type="range" name="" id="" />',"input:file":'<input type="file" name="" id="" />',
|
||||
"input:f":'<input type="file" name="" id="" />',"input:submit":'<input type="submit" value="" />',"input:s":'<input type="submit" value="" />',"input:image":'<input type="image" src="" alt="" />',"input:i":'<input type="image" src="" alt="" />',"input:reset":'<input type="reset" value="" />',"input:button":'<input type="button" value="" />',"input:b":'<input type="button" value="" />',select:'<select name="" id=""></select>',option:'<option value=""></option>',textarea:'<textarea name="" id="" cols="${1:30}" rows="${2:10}">',
|
||||
"menu:context":'<menu type="context">',"menu:c":'<menu type="context">',"menu:toolbar":'<menu type="toolbar">',"menu:t":'<menu type="toolbar">',video:'<video src="">',audio:'<audio src="">',"html:xml":'<html xmlns="http://www.w3.org/1999/xhtml">',bq:"<blockquote>",acr:"<acronym>",fig:"<figure>",figc:"<figcaption>",ifr:"<iframe>",emb:"<embed>",obj:"<object>",src:"<source>",cap:"<caption>",colg:"<colgroup>",fst:"<fieldset>",btn:"<button>",optg:"<optgroup>",opt:"<option>",tarea:"<textarea>",leg:"<legend>",
|
||||
sect:"<section>",art:"<article>",hdr:"<header>",ftr:"<footer>",adr:"<address>",dlg:"<dialog>",str:"<strong>",prog:"<progress>",fset:"<fieldset>",datag:"<datagrid>",datal:"<datalist>",kg:"<keygen>",out:"<output>",det:"<details>",cmd:"<command>","ol+":"ol>li","ul+":"ul>li","dl+":"dl>dt+dd","map+":"map>area","table+":"table>tr>td","colgroup+":"colgroup>col","colg+":"colgroup>col","tr+":"tr>td","select+":"select>option","optgroup+":"optgroup>option","optg+":"optgroup>option"}},xml:{"extends":"html",profile:"xml",
|
||||
filters:"html"},xsl:{"extends":"html",filters:"html, xsl",abbreviations:{tm:'<xsl:template match="" mode="">',tmatch:"tm",tn:'<xsl:template name="">',tname:"tn",call:'<xsl:call-template name=""/>',ap:'<xsl:apply-templates select="" mode=""/>',api:"<xsl:apply-imports/>",imp:'<xsl:import href=""/>',inc:'<xsl:include href=""/>',ch:"<xsl:choose>","xsl:when":'<xsl:when test="">',wh:"xsl:when",ot:"<xsl:otherwise>","if":'<xsl:if test="">',par:'<xsl:param name="">',pare:'<xsl:param name="" select=""/>',"var":'<xsl:variable name="">',
|
||||
vare:'<xsl:variable name="" select=""/>',wp:'<xsl:with-param name="" select=""/>',key:'<xsl:key name="" match="" use=""/>',elem:'<xsl:element name="">',attr:'<xsl:attribute name="">',attrs:'<xsl:attribute-set name="">',cp:'<xsl:copy select=""/>',co:'<xsl:copy-of select=""/>',val:'<xsl:value-of select=""/>',each:'<xsl:for-each select="">',"for":"each",tex:"<xsl:text></xsl:text>",com:"<xsl:comment>",msg:'<xsl:message terminate="no">',fall:"<xsl:fallback>",num:'<xsl:number value=""/>',nam:'<namespace-alias stylesheet-prefix="" result-prefix=""/>',
|
||||
pres:'<xsl:preserve-space elements=""/>',strip:'<xsl:strip-space elements=""/>',proc:'<xsl:processing-instruction name="">',sort:'<xsl:sort select="" order=""/>',"choose+":"xsl:choose>xsl:when+xsl:otherwise"}},haml:{filters:"haml","extends":"html"},scss:{filters:"haml","extends":"css"},sass:{filters:"haml","extends":"css"},less:{filters:"haml","extends":"css"}},"system");
|
||||
emmet.exec(function(h,e){var g={"Cmd-E":"expand_abbreviation",Tab:"expand_abbreviation","Cmd-D":"match_pair_outward","Shift-Cmd-D":"match_pair_inward","Shift-Cmd-A":"wrap_with_abbreviation","Ctrl-Alt-Right":"next_edit_point","Ctrl-Alt-Left":"prev_edit_point","Cmd-L":"select_line","Cmd-Shift-M":"merge_lines","Cmd-/":"toggle_comment","Cmd-J":"split_join_tag","Cmd-K":"remove_tag","Shift-Cmd-Y":"evaluate_math_expression","Ctrl-Up":"increment_number_by_1","Ctrl-Down":"decrement_number_by_1","Alt-Up":"increment_number_by_01",
|
||||
"Alt-Down":"decrement_number_by_01","Ctrl-Alt-Up":"increment_number_by_10","Ctrl-Alt-Down":"decrement_number_by_10","Cmd-.":"select_next_item","Cmd-,":"select_previous_item","Cmd-B":"reflect_css_value",Enter:"insert_formatted_line_break"},f={"text/html":"html","application/xml":"xml","text/xsl":"xsl","text/css":"css","text/x-less":"less"};if(!(/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent)||/Mac/.test(navigator.platform))){var c={};e.each(g,function(a,b){c[b.replace("Cmd",
|
||||
"Ctrl")]=a});g=c}CodeMirror.defaults.profile="html";var b={context:null,getSelectionRange:function(){var a=this.getCaretPos();return{start:a,end:a+this.getSelection().length}},createSelection:function(a,b){a==b?this.context.setCursor(this.context.posFromIndex(a)):this.context.setSelection(this.context.posFromIndex(a),this.context.posFromIndex(b))},getCurrentLineRange:function(){var a=this.context.getCursor(!0);return{start:this.context.indexFromPos({line:a.line,ch:0}),end:this.context.indexFromPos({line:a.line,
|
||||
ch:this.context.getLine(a.line).length})}},getCaretPos:function(){return this.context.indexFromPos(this.context.getCursor(!0))},setCaretPos:function(a){this.createSelection(a,a)},getCurrentLine:function(){return this.context.getLine(this.context.getCursor(!0).line)||""},replaceContent:function(a,b,c,f){e.isUndefined(c)&&(c=e.isUndefined(b)?content.length:b);e.isUndefined(b)&&(b=0);var g=h("utils");f||(a=g.padString(a,g.getLinePaddingFromPosition(this.getContent(),b)));var f=h("tabStops").extract(a,
|
||||
{escape:function(a){return a}}),a=f.text,n=f.tabstops[0];n?(n.start+=b,n.end+=b):n={start:a.length+b,end:a.length+b};var m=this;this.context.compoundChange(function(){m.context.replaceRange(a,m.context.posFromIndex(b),m.context.posFromIndex(c));m.createSelection(n.start,n.end)})},getContent:function(){return this.context.getValue()},getSyntax:function(){var a=this.context.getOption("mode");a in f&&(a=f[a]);var b=this.getCaretPos();h("resources").hasSyntax(a)||(a="html");if(a=="html"){var c=h("html_matcher").getTags(this.getContent(),
|
||||
b);c&&c[0]&&c[0].type=="tag"&&c[0].name.toLowerCase()=="style"&&c[0].end<=b&&c[1].start>=b&&(a="css")}return a},getProfileName:function(){if(this.context.getOption("profile"))return this.context.getOption("profile");switch(this.getSyntax()){case "xml":case "xsl":return"xml";case "html":var a=h("resources").getVariable("profile");a||(a=this.getContent().search(/<!DOCTYPE[^>]+XHTML/i)!=-1?"xhtml":"html");return a}return"xhtml"},prompt:function(a){return prompt(a)},getSelection:function(){return this.context.getSelection()||
|
||||
""},getFilePath:function(){return location.href}};if(!CodeMirror.defaults.extraKeys)CodeMirror.defaults.extraKeys={};e.each(g,function(a,c){CodeMirror.defaults.extraKeys[c]=function(c){b.context=c;var d="\t";c.getOption("indentWithTabs")||(d=h("utils").repeatString(" ",c.getOption("indentUnit")));h("resources").setVariable("indentation",d);try{if(h("actions").run(a,b))return!0}catch(e){}throw CodeMirror.Pass;}})});
|
||||
29
applications/admin/static/codemirror/keymap/emacs.js
vendored
Normal file
29
applications/admin/static/codemirror/keymap/emacs.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// TODO number prefixes
|
||||
(function() {
|
||||
// Really primitive kill-ring implementation.
|
||||
var killRing = [];
|
||||
function addToRing(str) {
|
||||
killRing.push(str);
|
||||
if (killRing.length > 50) killRing.shift();
|
||||
}
|
||||
function getFromRing() { return killRing[killRing.length - 1] || ""; }
|
||||
function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }
|
||||
|
||||
CodeMirror.keyMap.emacs = {
|
||||
"Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");},
|
||||
"Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},
|
||||
"Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},
|
||||
"Alt-W": function(cm) {addToRing(cm.getSelection());},
|
||||
"Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());},
|
||||
"Alt-Y": function(cm) {cm.replaceSelection(popFromRing());},
|
||||
"Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd",
|
||||
"Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace",
|
||||
"Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete",
|
||||
fallthrough: ["basic", "emacsy"]
|
||||
};
|
||||
|
||||
CodeMirror.keyMap["emacs-Ctrl-X"] = {
|
||||
"Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close",
|
||||
auto: "emacs", nofallthrough: true
|
||||
};
|
||||
})();
|
||||
786
applications/admin/static/codemirror/keymap/vim.js
vendored
Normal file
786
applications/admin/static/codemirror/keymap/vim.js
vendored
Normal file
@@ -0,0 +1,786 @@
|
||||
// Supported keybindings:
|
||||
//
|
||||
// Cursor movement:
|
||||
// h, j, k, l
|
||||
// e, E, w, W, b, B
|
||||
// Ctrl-f, Ctrl-b
|
||||
// Ctrl-n, Ctrl-p
|
||||
// $, ^, 0
|
||||
// G
|
||||
// ge, gE
|
||||
// gg
|
||||
// f<char>, F<char>, t<char>, T<char>
|
||||
// Ctrl-o, Ctrl-i TODO (FIXME - Ctrl-O wont work in Chrome)
|
||||
// /, ?, n, N TODO (does not work)
|
||||
// #, * TODO
|
||||
//
|
||||
// Entering insert mode:
|
||||
// i, I, a, A, o, O
|
||||
// s
|
||||
// ce, cb (without support for number of actions like c3e - TODO)
|
||||
// cc
|
||||
// S, C TODO
|
||||
// cf<char>, cF<char>, ct<char>, cT<char>
|
||||
//
|
||||
// Deleting text:
|
||||
// x, X
|
||||
// J
|
||||
// dd, D
|
||||
// de, db (without support for number of actions like d3e - TODO)
|
||||
// df<char>, dF<char>, dt<char>, dT<char>
|
||||
//
|
||||
// Yanking and pasting:
|
||||
// yy, Y
|
||||
// p, P
|
||||
// p'<char> TODO - test
|
||||
// y'<char> TODO - test
|
||||
// m<char> TODO - test
|
||||
//
|
||||
// Changing text in place:
|
||||
// ~
|
||||
// r<char>
|
||||
//
|
||||
// Visual mode:
|
||||
// v, V TODO
|
||||
//
|
||||
// Misc:
|
||||
// . TODO
|
||||
//
|
||||
|
||||
(function() {
|
||||
var count = "";
|
||||
var sdir = "f";
|
||||
var buf = "";
|
||||
var yank = 0;
|
||||
var mark = [];
|
||||
var reptTimes = 0;
|
||||
function emptyBuffer() { buf = ""; }
|
||||
function pushInBuffer(str) { buf += str; }
|
||||
function pushCountDigit(digit) { return function(cm) {count += digit;}; }
|
||||
function popCount() { var i = parseInt(count, 10); count = ""; return i || 1; }
|
||||
function iterTimes(func) {
|
||||
for (var i = 0, c = popCount(); i < c; ++i) func(i, i == c - 1);
|
||||
}
|
||||
function countTimes(func) {
|
||||
if (typeof func == "string") func = CodeMirror.commands[func];
|
||||
return function(cm) { iterTimes(function () { func(cm); }); };
|
||||
}
|
||||
|
||||
function iterObj(o, f) {
|
||||
for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]);
|
||||
}
|
||||
function iterList(l, f) {
|
||||
for (var i = 0; i < l.length; ++i) f(l[i]);
|
||||
}
|
||||
function toLetter(ch) {
|
||||
// T -> t, Shift-T -> T, '*' -> *, "Space" -> " "
|
||||
if (ch.slice(0, 6) == "Shift-") {
|
||||
return ch.slice(0, 1);
|
||||
} else {
|
||||
if (ch == "Space") return " ";
|
||||
if (ch.length == 3 && ch[0] == "'" && ch[2] == "'") return ch[1];
|
||||
return ch.toLowerCase();
|
||||
}
|
||||
}
|
||||
var SPECIAL_SYMBOLS = "~`!@#$%^&*()_-+=[{}]\\|/?.,<>:;\"\'1234567890";
|
||||
function toCombo(ch) {
|
||||
// t -> T, T -> Shift-T, * -> '*', " " -> "Space"
|
||||
if (ch == " ") return "Space";
|
||||
var specialIdx = SPECIAL_SYMBOLS.indexOf(ch);
|
||||
if (specialIdx != -1) return "'" + ch + "'";
|
||||
if (ch.toLowerCase() == ch) return ch.toUpperCase();
|
||||
return "Shift-" + ch.toUpperCase();
|
||||
}
|
||||
|
||||
var word = [/\w/, /[^\w\s]/], bigWord = [/\S/];
|
||||
function findWord(line, pos, dir, regexps) {
|
||||
var stop = 0, next = -1;
|
||||
if (dir > 0) { stop = line.length; next = 0; }
|
||||
var start = stop, end = stop;
|
||||
// Find bounds of next one.
|
||||
outer: for (; pos != stop; pos += dir) {
|
||||
for (var i = 0; i < regexps.length; ++i) {
|
||||
if (regexps[i].test(line.charAt(pos + next))) {
|
||||
start = pos;
|
||||
for (; pos != stop; pos += dir) {
|
||||
if (!regexps[i].test(line.charAt(pos + next))) break;
|
||||
}
|
||||
end = pos;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {from: Math.min(start, end), to: Math.max(start, end)};
|
||||
}
|
||||
function moveToWord(cm, regexps, dir, times, where) {
|
||||
var cur = cm.getCursor();
|
||||
|
||||
for (var i = 0; i < times; i++) {
|
||||
var line = cm.getLine(cur.line), startCh = cur.ch, word;
|
||||
while (true) {
|
||||
// If we're at start/end of line, start on prev/next respectivly
|
||||
if (cur.ch == line.length && dir > 0) {
|
||||
cur.line++;
|
||||
cur.ch = 0;
|
||||
line = cm.getLine(cur.line);
|
||||
} else if (cur.ch == 0 && dir < 0) {
|
||||
cur.line--;
|
||||
cur.ch = line.length;
|
||||
line = cm.getLine(cur.line);
|
||||
}
|
||||
if (!line) break;
|
||||
|
||||
// On to the actual searching
|
||||
word = findWord(line, cur.ch, dir, regexps);
|
||||
cur.ch = word[where == "end" ? "to" : "from"];
|
||||
if (startCh == cur.ch && word.from != word.to) cur.ch = word[dir < 0 ? "from" : "to"];
|
||||
else break;
|
||||
}
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
function joinLineNext(cm) {
|
||||
var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line);
|
||||
CodeMirror.commands.goLineEnd(cm);
|
||||
if (cur.line != cm.lineCount()) {
|
||||
CodeMirror.commands.goLineEnd(cm);
|
||||
cm.replaceSelection(" ", "end");
|
||||
CodeMirror.commands.delCharRight(cm);
|
||||
}
|
||||
}
|
||||
function delTillMark(cm, cHar) {
|
||||
var i = mark[cHar];
|
||||
if (i === undefined) {
|
||||
// console.log("Mark not set"); // TODO - show in status bar
|
||||
return;
|
||||
}
|
||||
var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;
|
||||
cm.setCursor(start);
|
||||
for (var c = start; c <= end; c++) {
|
||||
pushInBuffer("\n"+cm.getLine(start));
|
||||
cm.removeLine(start);
|
||||
}
|
||||
}
|
||||
function yankTillMark(cm, cHar) {
|
||||
var i = mark[cHar];
|
||||
if (i === undefined) {
|
||||
// console.log("Mark not set"); // TODO - show in status bar
|
||||
return;
|
||||
}
|
||||
var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;
|
||||
for (var c = start; c <= end; c++) {
|
||||
pushInBuffer("\n"+cm.getLine(c));
|
||||
}
|
||||
cm.setCursor(start);
|
||||
}
|
||||
function goLineStartText(cm) {
|
||||
// Go to the start of the line where the text begins, or the end for whitespace-only lines
|
||||
var cur = cm.getCursor(), firstNonWS = cm.getLine(cur.line).search(/\S/);
|
||||
cm.setCursor(cur.line, firstNonWS == -1 ? line.length : firstNonWS, true);
|
||||
}
|
||||
|
||||
function charIdxInLine(cm, cHar, motion_options) {
|
||||
// Search for cHar in line.
|
||||
// motion_options: {forward, inclusive}
|
||||
// If inclusive = true, include it too.
|
||||
// If forward = true, search forward, else search backwards.
|
||||
// If char is not found on this line, do nothing
|
||||
var cur = cm.getCursor(), line = cm.getLine(cur.line), idx;
|
||||
var ch = toLetter(cHar), mo = motion_options;
|
||||
if (mo.forward) {
|
||||
idx = line.indexOf(ch, cur.ch + 1);
|
||||
if (idx != -1 && mo.inclusive) idx += 1;
|
||||
} else {
|
||||
idx = line.lastIndexOf(ch, cur.ch);
|
||||
if (idx != -1 && !mo.inclusive) idx += 1;
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
function moveTillChar(cm, cHar, motion_options) {
|
||||
// Move to cHar in line, as found by charIdxInLine.
|
||||
var idx = charIdxInLine(cm, cHar, motion_options), cur = cm.getCursor();
|
||||
if (idx != -1) cm.setCursor({line: cur.line, ch: idx});
|
||||
}
|
||||
|
||||
function delTillChar(cm, cHar, motion_options) {
|
||||
// delete text in this line, untill cHar is met,
|
||||
// as found by charIdxInLine.
|
||||
// If char is not found on this line, do nothing
|
||||
var idx = charIdxInLine(cm, cHar, motion_options);
|
||||
var cur = cm.getCursor();
|
||||
if (idx !== -1) {
|
||||
if (motion_options.forward) {
|
||||
cm.replaceRange("", {line: cur.line, ch: cur.ch}, {line: cur.line, ch: idx});
|
||||
} else {
|
||||
cm.replaceRange("", {line: cur.line, ch: idx}, {line: cur.line, ch: cur.ch});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function enterInsertMode(cm) {
|
||||
// enter insert mode: switch mode and cursor
|
||||
popCount();
|
||||
cm.setOption("keyMap", "vim-insert");
|
||||
}
|
||||
|
||||
function dialog(cm, text, shortText, f) {
|
||||
if (cm.openDialog) cm.openDialog(text, f);
|
||||
else f(prompt(shortText, ""));
|
||||
}
|
||||
function showAlert(cm, text) {
|
||||
var esc = text.replace(/[<&]/, function(ch) { return ch == "<" ? "<" : "&"; });
|
||||
if (cm.openDialog) cm.openDialog(esc + " <button type=button>OK</button>");
|
||||
else alert(text);
|
||||
}
|
||||
|
||||
// main keymap
|
||||
var map = CodeMirror.keyMap.vim = {
|
||||
// Pipe (|); TODO: should be *screen* chars, so need a util function to turn tabs into spaces?
|
||||
"'|'": function(cm) {
|
||||
cm.setCursor(cm.getCursor().line, popCount() - 1, true);
|
||||
},
|
||||
"A": function(cm) {
|
||||
cm.setCursor(cm.getCursor().line, cm.getCursor().ch+1, true);
|
||||
enterInsertMode(cm);
|
||||
},
|
||||
"Shift-A": function(cm) { CodeMirror.commands.goLineEnd(cm); enterInsertMode(cm);},
|
||||
"I": function(cm) { enterInsertMode(cm);},
|
||||
"Shift-I": function(cm) { goLineStartText(cm); enterInsertMode(cm);},
|
||||
"O": function(cm) {
|
||||
CodeMirror.commands.goLineEnd(cm);
|
||||
CodeMirror.commands.newlineAndIndent(cm);
|
||||
enterInsertMode(cm);
|
||||
},
|
||||
"Shift-O": function(cm) {
|
||||
CodeMirror.commands.goLineStart(cm);
|
||||
cm.replaceSelection("\n", "start");
|
||||
cm.indentLine(cm.getCursor().line);
|
||||
enterInsertMode(cm);
|
||||
},
|
||||
"G": function(cm) { cm.setOption("keyMap", "vim-prefix-g");},
|
||||
"Shift-D": function(cm) {
|
||||
// commented out verions works, but I left original, cause maybe
|
||||
// I don't know vim enouth to see what it does
|
||||
/* var cur = cm.getCursor();
|
||||
var f = {line: cur.line, ch: cur.ch}, t = {line: cur.line};
|
||||
pushInBuffer(cm.getRange(f, t));
|
||||
*/
|
||||
emptyBuffer();
|
||||
mark["Shift-D"] = cm.getCursor(false).line;
|
||||
cm.setCursor(cm.getCursor(true).line);
|
||||
delTillMark(cm,"Shift-D"); mark = [];
|
||||
},
|
||||
|
||||
"S": function (cm) {
|
||||
countTimes(function (_cm) {
|
||||
CodeMirror.commands.delCharRight(_cm);
|
||||
})(cm);
|
||||
enterInsertMode(cm);
|
||||
},
|
||||
"M": function(cm) {cm.setOption("keyMap", "vim-prefix-m"); mark = [];},
|
||||
"Y": function(cm) {cm.setOption("keyMap", "vim-prefix-y"); emptyBuffer(); yank = 0;},
|
||||
"Shift-Y": function(cm) {
|
||||
emptyBuffer();
|
||||
mark["Shift-D"] = cm.getCursor(false).line;
|
||||
cm.setCursor(cm.getCursor(true).line);
|
||||
yankTillMark(cm,"Shift-D"); mark = [];
|
||||
},
|
||||
"/": function(cm) {var f = CodeMirror.commands.find; f && f(cm); sdir = "f";},
|
||||
"'?'": function(cm) {
|
||||
var f = CodeMirror.commands.find;
|
||||
if (f) { f(cm); CodeMirror.commands.findPrev(cm); sdir = "r"; }
|
||||
},
|
||||
"N": function(cm) {
|
||||
var fn = CodeMirror.commands.findNext;
|
||||
if (fn) sdir != "r" ? fn(cm) : CodeMirror.commands.findPrev(cm);
|
||||
},
|
||||
"Shift-N": function(cm) {
|
||||
var fn = CodeMirror.commands.findNext;
|
||||
if (fn) sdir != "r" ? CodeMirror.commands.findPrev(cm) : fn.findNext(cm);
|
||||
},
|
||||
"Shift-G": function(cm) {
|
||||
count == "" ? cm.setCursor(cm.lineCount()) : cm.setCursor(parseInt(count, 10)-1);
|
||||
popCount();
|
||||
CodeMirror.commands.goLineStart(cm);
|
||||
},
|
||||
"':'": function(cm) {
|
||||
var exModeDialog = ': <input type="text" style="width: 90%"/>';
|
||||
dialog(cm, exModeDialog, ':', function(command) {
|
||||
if (command.match(/^\d+$/)) {
|
||||
cm.setCursor(command - 1, cm.getCursor().ch);
|
||||
} else {
|
||||
showAlert(cm, "Bad command: " + command);
|
||||
}
|
||||
});
|
||||
},
|
||||
nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
|
||||
// standard mode switching
|
||||
iterList(["d", "t", "T", "f", "F", "c", "r"],
|
||||
function (ch) {
|
||||
CodeMirror.keyMap.vim[toCombo(ch)] = function (cm) {
|
||||
cm.setOption("keyMap", "vim-prefix-" + ch);
|
||||
emptyBuffer();
|
||||
};
|
||||
});
|
||||
|
||||
function addCountBindings(keyMap) {
|
||||
// Add bindings for number keys
|
||||
keyMap["0"] = function(cm) {
|
||||
count.length > 0 ? pushCountDigit("0")(cm) : CodeMirror.commands.goLineStart(cm);
|
||||
};
|
||||
for (var i = 1; i < 10; ++i) keyMap[i] = pushCountDigit(i);
|
||||
}
|
||||
addCountBindings(CodeMirror.keyMap.vim);
|
||||
|
||||
// main num keymap
|
||||
// Add bindings that are influenced by number keys
|
||||
iterObj({
|
||||
"Left": "goColumnLeft", "Right": "goColumnRight",
|
||||
"Down": "goLineDown", "Up": "goLineUp", "Backspace": "goCharLeft",
|
||||
"Space": "goCharRight",
|
||||
"X": function(cm) {CodeMirror.commands.delCharRight(cm);},
|
||||
"P": function(cm) {
|
||||
var cur = cm.getCursor().line;
|
||||
if (buf!= "") {
|
||||
if (buf[0] == "\n") CodeMirror.commands.goLineEnd(cm);
|
||||
cm.replaceRange(buf, cm.getCursor());
|
||||
}
|
||||
},
|
||||
"Shift-X": function(cm) {CodeMirror.commands.delCharLeft(cm);},
|
||||
"Shift-J": function(cm) {joinLineNext(cm);},
|
||||
"Shift-P": function(cm) {
|
||||
var cur = cm.getCursor().line;
|
||||
if (buf!= "") {
|
||||
CodeMirror.commands.goLineUp(cm);
|
||||
CodeMirror.commands.goLineEnd(cm);
|
||||
cm.replaceSelection(buf, "end");
|
||||
}
|
||||
cm.setCursor(cur+1);
|
||||
},
|
||||
"'~'": function(cm) {
|
||||
var cur = cm.getCursor(), cHar = cm.getRange({line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});
|
||||
cHar = cHar != cHar.toLowerCase() ? cHar.toLowerCase() : cHar.toUpperCase();
|
||||
cm.replaceRange(cHar, {line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});
|
||||
cm.setCursor(cur.line, cur.ch+1);
|
||||
},
|
||||
"Ctrl-B": function(cm) {CodeMirror.commands.goPageUp(cm);},
|
||||
"Ctrl-F": function(cm) {CodeMirror.commands.goPageDown(cm);},
|
||||
"Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
||||
"U": "undo", "Ctrl-R": "redo"
|
||||
}, function(key, cmd) { map[key] = countTimes(cmd); });
|
||||
|
||||
// empty key maps
|
||||
iterList([
|
||||
"vim-prefix-d'",
|
||||
"vim-prefix-y'",
|
||||
"vim-prefix-df",
|
||||
"vim-prefix-dF",
|
||||
"vim-prefix-dt",
|
||||
"vim-prefix-dT",
|
||||
"vim-prefix-c",
|
||||
"vim-prefix-cf",
|
||||
"vim-prefix-cF",
|
||||
"vim-prefix-ct",
|
||||
"vim-prefix-cT",
|
||||
"vim-prefix-",
|
||||
"vim-prefix-f",
|
||||
"vim-prefix-F",
|
||||
"vim-prefix-t",
|
||||
"vim-prefix-T",
|
||||
"vim-prefix-r",
|
||||
"vim-prefix-m"
|
||||
],
|
||||
function (prefix) {
|
||||
CodeMirror.keyMap[prefix] = {
|
||||
auto: "vim",
|
||||
nofallthrough: true,
|
||||
style: "fat-cursor"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.keyMap["vim-prefix-g"] = {
|
||||
"E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, word, -1, 1, "start"));}),
|
||||
"Shift-E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, bigWord, -1, 1, "start"));}),
|
||||
"G": function (cm) { cm.setCursor({line: 0, ch: cm.getCursor().ch});},
|
||||
auto: "vim", nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
|
||||
CodeMirror.keyMap["vim-prefix-d"] = {
|
||||
"D": countTimes(function(cm) {
|
||||
pushInBuffer("\n"+cm.getLine(cm.getCursor().line));
|
||||
cm.removeLine(cm.getCursor().line);
|
||||
cm.setOption("keyMap", "vim");
|
||||
}),
|
||||
"'": function(cm) {
|
||||
cm.setOption("keyMap", "vim-prefix-d'");
|
||||
emptyBuffer();
|
||||
},
|
||||
"B": function(cm) {
|
||||
var cur = cm.getCursor();
|
||||
var line = cm.getLine(cur.line);
|
||||
var index = line.lastIndexOf(" ", cur.ch);
|
||||
|
||||
pushInBuffer(line.substring(index, cur.ch));
|
||||
cm.replaceRange("", {line: cur.line, ch: index}, cur);
|
||||
cm.setOption("keyMap", "vim");
|
||||
},
|
||||
nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
// FIXME - does not work for bindings like "d3e"
|
||||
addCountBindings(CodeMirror.keyMap["vim-prefix-d"]);
|
||||
|
||||
CodeMirror.keyMap["vim-prefix-c"] = {
|
||||
"B": function (cm) {
|
||||
countTimes("delWordLeft")(cm);
|
||||
enterInsertMode(cm);
|
||||
},
|
||||
"C": function (cm) {
|
||||
iterTimes(function (i, last) {
|
||||
CodeMirror.commands.deleteLine(cm);
|
||||
if (i) {
|
||||
CodeMirror.commands.delCharRight(cm);
|
||||
if (last) CodeMirror.commands.deleteLine(cm);
|
||||
}
|
||||
});
|
||||
enterInsertMode(cm);
|
||||
},
|
||||
nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
|
||||
iterList(["vim-prefix-d", "vim-prefix-c", "vim-prefix-"], function (prefix) {
|
||||
iterList(["f", "F", "T", "t"],
|
||||
function (ch) {
|
||||
CodeMirror.keyMap[prefix][toCombo(ch)] = function (cm) {
|
||||
cm.setOption("keyMap", prefix + ch);
|
||||
emptyBuffer();
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
var MOTION_OPTIONS = {
|
||||
"t": {inclusive: false, forward: true},
|
||||
"f": {inclusive: true, forward: true},
|
||||
"T": {inclusive: false, forward: false},
|
||||
"F": {inclusive: true, forward: false}
|
||||
};
|
||||
|
||||
function setupPrefixBindingForKey(m) {
|
||||
CodeMirror.keyMap["vim-prefix-m"][m] = function(cm) {
|
||||
mark[m] = cm.getCursor().line;
|
||||
};
|
||||
CodeMirror.keyMap["vim-prefix-d'"][m] = function(cm) {
|
||||
delTillMark(cm,m);
|
||||
};
|
||||
CodeMirror.keyMap["vim-prefix-y'"][m] = function(cm) {
|
||||
yankTillMark(cm,m);
|
||||
};
|
||||
CodeMirror.keyMap["vim-prefix-r"][m] = function (cm) {
|
||||
var cur = cm.getCursor();
|
||||
cm.replaceRange(toLetter(m),
|
||||
{line: cur.line, ch: cur.ch},
|
||||
{line: cur.line, ch: cur.ch + 1});
|
||||
CodeMirror.commands.goColumnLeft(cm);
|
||||
};
|
||||
// all commands, related to motions till char in line
|
||||
iterObj(MOTION_OPTIONS, function (ch, options) {
|
||||
CodeMirror.keyMap["vim-prefix-" + ch][m] = function(cm) {
|
||||
moveTillChar(cm, m, options);
|
||||
};
|
||||
CodeMirror.keyMap["vim-prefix-d" + ch][m] = function(cm) {
|
||||
delTillChar(cm, m, options);
|
||||
};
|
||||
CodeMirror.keyMap["vim-prefix-c" + ch][m] = function(cm) {
|
||||
delTillChar(cm, m, options);
|
||||
enterInsertMode(cm);
|
||||
};
|
||||
});
|
||||
}
|
||||
for (var i = 65; i < 65 + 26; i++) { // uppercase alphabet char codes
|
||||
var ch = String.fromCharCode(i);
|
||||
setupPrefixBindingForKey(toCombo(ch));
|
||||
setupPrefixBindingForKey(toCombo(ch.toLowerCase()));
|
||||
}
|
||||
for (var i = 0; i < SPECIAL_SYMBOLS.length; ++i) {
|
||||
setupPrefixBindingForKey(toCombo(SPECIAL_SYMBOLS.charAt(i)));
|
||||
}
|
||||
setupPrefixBindingForKey("Space");
|
||||
|
||||
CodeMirror.keyMap["vim-prefix-y"] = {
|
||||
"Y": countTimes(function(cm) { pushInBuffer("\n"+cm.getLine(cm.getCursor().line+yank)); yank++; }),
|
||||
"'": function(cm) {cm.setOption("keyMap", "vim-prefix-y'"); emptyBuffer();},
|
||||
nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
|
||||
CodeMirror.keyMap["vim-insert"] = {
|
||||
// TODO: override navigation keys so that Esc will cancel automatic indentation from o, O, i_<CR>
|
||||
"Esc": function(cm) {
|
||||
cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1, true);
|
||||
cm.setOption("keyMap", "vim");
|
||||
},
|
||||
"Ctrl-N": "autocomplete",
|
||||
"Ctrl-P": "autocomplete",
|
||||
fallthrough: ["default"]
|
||||
};
|
||||
|
||||
function findMatchedSymbol(cm, cur, symb) {
|
||||
var line = cur.line;
|
||||
var symb = symb ? symb : cm.getLine(line)[cur.ch];
|
||||
|
||||
// Are we at the opening or closing char
|
||||
var forwards = ['(', '[', '{'].indexOf(symb) != -1;
|
||||
|
||||
var reverseSymb = (function(sym) {
|
||||
switch (sym) {
|
||||
case '(' : return ')';
|
||||
case '[' : return ']';
|
||||
case '{' : return '}';
|
||||
case ')' : return '(';
|
||||
case ']' : return '[';
|
||||
case '}' : return '{';
|
||||
default : return null;
|
||||
}
|
||||
})(symb);
|
||||
|
||||
// Couldn't find a matching symbol, abort
|
||||
if (reverseSymb == null) return cur;
|
||||
|
||||
// Tracking our imbalance in open/closing symbols. An opening symbol wii be
|
||||
// the first thing we pick up if moving forward, this isn't true moving backwards
|
||||
var disBal = forwards ? 0 : 1;
|
||||
|
||||
while (true) {
|
||||
if (line == cur.line) {
|
||||
// First pass, do some special stuff
|
||||
var currLine = forwards ? cm.getLine(line).substr(cur.ch).split('') : cm.getLine(line).substr(0,cur.ch).split('').reverse();
|
||||
} else {
|
||||
var currLine = forwards ? cm.getLine(line).split('') : cm.getLine(line).split('').reverse();
|
||||
}
|
||||
|
||||
for (var index = 0; index < currLine.length; index++) {
|
||||
if (currLine[index] == symb) disBal++;
|
||||
else if (currLine[index] == reverseSymb) disBal--;
|
||||
|
||||
if (disBal == 0) {
|
||||
if (forwards && cur.line == line) return {line: line, ch: index + cur.ch};
|
||||
else if (forwards) return {line: line, ch: index};
|
||||
else return {line: line, ch: currLine.length - index - 1 };
|
||||
}
|
||||
}
|
||||
|
||||
if (forwards) line++;
|
||||
else line--;
|
||||
}
|
||||
}
|
||||
|
||||
function selectCompanionObject(cm, revSymb, inclusive) {
|
||||
var cur = cm.getCursor();
|
||||
|
||||
var end = findMatchedSymbol(cm, cur, revSymb);
|
||||
var start = findMatchedSymbol(cm, end);
|
||||
start.ch += inclusive ? 1 : 0;
|
||||
end.ch += inclusive ? 0 : 1;
|
||||
|
||||
return {start: start, end: end};
|
||||
}
|
||||
|
||||
// These are our motion commands to be used for navigation and selection with
|
||||
// certian other commands. All should return a cursor object.
|
||||
var motionList = ['B', 'E', 'J', 'K', 'H', 'L', 'W', 'Shift-W', "'^'", "'$'", "'%'", 'Esc'];
|
||||
|
||||
motions = {
|
||||
'B': function(cm, times) { return moveToWord(cm, word, -1, times); },
|
||||
'Shift-B': function(cm, times) { return moveToWord(cm, bigWord, -1, times); },
|
||||
'E': function(cm, times) { return moveToWord(cm, word, 1, times, 'end'); },
|
||||
'Shift-E': function(cm, times) { return moveToWord(cm, bigWord, 1, times, 'end'); },
|
||||
'J': function(cm, times) {
|
||||
var cur = cm.getCursor();
|
||||
return {line: cur.line+times, ch : cur.ch};
|
||||
},
|
||||
|
||||
'K': function(cm, times) {
|
||||
var cur = cm.getCursor();
|
||||
return {line: cur.line-times, ch: cur.ch};
|
||||
},
|
||||
|
||||
'H': function(cm, times) {
|
||||
var cur = cm.getCursor();
|
||||
return {line: cur.line, ch: cur.ch-times};
|
||||
},
|
||||
|
||||
'L': function(cm, times) {
|
||||
var cur = cm.getCursor();
|
||||
return {line: cur.line, ch: cur.ch+times};
|
||||
},
|
||||
'W': function(cm, times) { return moveToWord(cm, word, 1, times); },
|
||||
'Shift-W': function(cm, times) { return moveToWord(cm, bigWord, 1, times); },
|
||||
"'^'": function(cm, times) {
|
||||
var cur = cm.getCursor();
|
||||
var line = cm.getLine(cur.line).split('');
|
||||
|
||||
// Empty line :o
|
||||
if (line.length == 0) return cur;
|
||||
|
||||
for (var index = 0; index < line.length; index++) {
|
||||
if (line[index].match(/[^\s]/)) return {line: cur.line, ch: index};
|
||||
}
|
||||
},
|
||||
"'$'": function(cm) {
|
||||
var cur = cm.getCursor();
|
||||
var line = cm.getLine(cur.line);
|
||||
return {line: cur.line, ch: line.length};
|
||||
},
|
||||
"'%'": function(cm) { return findMatchedSymbol(cm, cm.getCursor()); },
|
||||
"Esc" : function(cm) {
|
||||
cm.setOption('vim');
|
||||
reptTimes = 0;
|
||||
|
||||
return cm.getCursor();
|
||||
}
|
||||
};
|
||||
|
||||
// Map our movement actions each operator and non-operational movement
|
||||
motionList.forEach(function(key, index, array) {
|
||||
CodeMirror.keyMap['vim-prefix-d'][key] = function(cm) {
|
||||
// Get our selected range
|
||||
var start = cm.getCursor();
|
||||
var end = motions[key](cm, reptTimes ? reptTimes : 1);
|
||||
|
||||
// Set swap var if range is of negative length
|
||||
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;
|
||||
|
||||
// Take action, switching start and end if swap var is set
|
||||
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
|
||||
cm.replaceRange("", swap ? end : start, swap ? start : end);
|
||||
|
||||
// And clean up
|
||||
reptTimes = 0;
|
||||
cm.setOption("keyMap", "vim");
|
||||
};
|
||||
|
||||
CodeMirror.keyMap['vim-prefix-c'][key] = function(cm) {
|
||||
var start = cm.getCursor();
|
||||
var end = motions[key](cm, reptTimes ? reptTimes : 1);
|
||||
|
||||
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;
|
||||
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
|
||||
cm.replaceRange("", swap ? end : start, swap ? start : end);
|
||||
|
||||
reptTimes = 0;
|
||||
cm.setOption('keyMap', 'vim-insert');
|
||||
};
|
||||
|
||||
CodeMirror.keyMap['vim-prefix-y'][key] = function(cm) {
|
||||
var start = cm.getCursor();
|
||||
var end = motions[key](cm, reptTimes ? reptTimes : 1);
|
||||
|
||||
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;
|
||||
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
|
||||
|
||||
reptTimes = 0;
|
||||
cm.setOption("keyMap", "vim");
|
||||
};
|
||||
|
||||
CodeMirror.keyMap['vim'][key] = function(cm) {
|
||||
var cur = motions[key](cm, reptTimes ? reptTimes : 1);
|
||||
cm.setCursor(cur.line, cur.ch);
|
||||
|
||||
reptTimes = 0;
|
||||
};
|
||||
});
|
||||
|
||||
var nums = [1,2,3,4,5,6,7,8,9];
|
||||
nums.forEach(function(key, index, array) {
|
||||
CodeMirror.keyMap['vim'][key] = function (cm) {
|
||||
reptTimes = (reptTimes * 10) + key;
|
||||
};
|
||||
CodeMirror.keyMap['vim-prefix-d'][key] = function (cm) {
|
||||
reptTimes = (reptTimes * 10) + key;
|
||||
};
|
||||
CodeMirror.keyMap['vim-prefix-y'][key] = function (cm) {
|
||||
reptTimes = (reptTimes * 10) + key;
|
||||
};
|
||||
CodeMirror.keyMap['vim-prefix-c'][key] = function (cm) {
|
||||
reptTimes = (reptTimes * 10) + key;
|
||||
};
|
||||
});
|
||||
|
||||
// Create our keymaps for each operator and make xa and xi where x is an operator
|
||||
// change to the corrosponding keymap
|
||||
var operators = ['d', 'y', 'c'];
|
||||
operators.forEach(function(key, index, array) {
|
||||
CodeMirror.keyMap['vim-prefix-'+key+'a'] = {
|
||||
auto: 'vim', nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
CodeMirror.keyMap['vim-prefix-'+key+'i'] = {
|
||||
auto: 'vim', nofallthrough: true, style: "fat-cursor"
|
||||
};
|
||||
|
||||
CodeMirror.keyMap['vim-prefix-'+key]['A'] = function(cm) {
|
||||
reptTimes = 0;
|
||||
cm.setOption('keyMap', 'vim-prefix-' + key + 'a');
|
||||
};
|
||||
|
||||
CodeMirror.keyMap['vim-prefix-'+key]['I'] = function(cm) {
|
||||
reptTimes = 0;
|
||||
cm.setOption('keyMap', 'vim-prefix-' + key + 'i');
|
||||
};
|
||||
});
|
||||
|
||||
function regexLastIndexOf(string, pattern, startIndex) {
|
||||
for (var i = startIndex == null ? string.length : startIndex; i >= 0; --i)
|
||||
if (pattern.test(string.charAt(i))) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Create our text object functions. They work similar to motions but they
|
||||
// return a start cursor as well
|
||||
var textObjectList = ['W', 'Shift-[', 'Shift-9', '['];
|
||||
var textObjects = {
|
||||
'W': function(cm, inclusive) {
|
||||
var cur = cm.getCursor();
|
||||
var line = cm.getLine(cur.line);
|
||||
|
||||
var line_to_char = new String(line.substring(0, cur.ch));
|
||||
var start = regexLastIndexOf(line_to_char, /[^a-zA-Z0-9]/) + 1;
|
||||
var end = motions["E"](cm, 1) ;
|
||||
|
||||
end.ch += inclusive ? 1 : 0 ;
|
||||
return {start: {line: cur.line, ch: start}, end: end };
|
||||
},
|
||||
'Shift-[': function(cm, inclusive) { return selectCompanionObject(cm, '}', inclusive); },
|
||||
'Shift-9': function(cm, inclusive) { return selectCompanionObject(cm, ')', inclusive); },
|
||||
'[': function(cm, inclusive) { return selectCompanionObject(cm, ']', inclusive); }
|
||||
};
|
||||
|
||||
// One function to handle all operation upon text objects. Kinda funky but it works
|
||||
// better than rewriting this code six times
|
||||
function textObjectManipulation(cm, object, remove, insert, inclusive) {
|
||||
// Object is the text object, delete object if remove is true, enter insert
|
||||
// mode if insert is true, inclusive is the difference between a and i
|
||||
var tmp = textObjects[object](cm, inclusive);
|
||||
var start = tmp.start;
|
||||
var end = tmp.end;
|
||||
|
||||
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true ;
|
||||
|
||||
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
|
||||
if (remove) cm.replaceRange("", swap ? end : start, swap ? start : end);
|
||||
if (insert) cm.setOption('keyMap', 'vim-insert');
|
||||
}
|
||||
|
||||
// And finally build the keymaps up from the text objects
|
||||
for (var i = 0; i < textObjectList.length; ++i) {
|
||||
var object = textObjectList[i];
|
||||
(function(object) {
|
||||
CodeMirror.keyMap['vim-prefix-di'][object] = function(cm) { textObjectManipulation(cm, object, true, false, false); };
|
||||
CodeMirror.keyMap['vim-prefix-da'][object] = function(cm) { textObjectManipulation(cm, object, true, false, true); };
|
||||
CodeMirror.keyMap['vim-prefix-yi'][object] = function(cm) { textObjectManipulation(cm, object, false, false, false); };
|
||||
CodeMirror.keyMap['vim-prefix-ya'][object] = function(cm) { textObjectManipulation(cm, object, false, false, true); };
|
||||
CodeMirror.keyMap['vim-prefix-ci'][object] = function(cm) { textObjectManipulation(cm, object, true, true, false); };
|
||||
CodeMirror.keyMap['vim-prefix-ca'][object] = function(cm) { textObjectManipulation(cm, object, true, true, true); };
|
||||
})(object)
|
||||
}
|
||||
})();
|
||||
173
applications/admin/static/codemirror/lib/codemirror.css
vendored
Normal file
173
applications/admin/static/codemirror/lib/codemirror.css
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
.CodeMirror {
|
||||
line-height: 1em;
|
||||
font-family: monospace;
|
||||
|
||||
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
|
||||
position: relative;
|
||||
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
overflow: auto;
|
||||
height: 300px;
|
||||
/* This is needed to prevent an IE[67] bug where the scrolled content
|
||||
is visible outside of the scrolling box. */
|
||||
position: relative;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Vertical scrollbar */
|
||||
.CodeMirror-scrollbar {
|
||||
position: absolute;
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
z-index: 5;
|
||||
}
|
||||
.CodeMirror-scrollbar-inner {
|
||||
/* This needs to have a nonzero width in order for the scrollbar to appear
|
||||
in Firefox and IE9. */
|
||||
width: 1px;
|
||||
}
|
||||
.CodeMirror-scrollbar.cm-sb-overlap {
|
||||
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
|
||||
rather than sitting to the right of it. */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
float: none;
|
||||
right: 0;
|
||||
min-width: 12px;
|
||||
}
|
||||
.CodeMirror-scrollbar.cm-sb-nonoverlap {
|
||||
min-width: 12px;
|
||||
}
|
||||
.CodeMirror-scrollbar.cm-sb-ie7 {
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
.CodeMirror-gutter {
|
||||
position: absolute; left: 0; top: 0;
|
||||
z-index: 10;
|
||||
background-color: #f7f7f7;
|
||||
border-right: 1px solid #eee;
|
||||
min-width: 2em;
|
||||
height: 100%;
|
||||
}
|
||||
.CodeMirror-gutter-text {
|
||||
color: #aaa;
|
||||
text-align: right;
|
||||
padding: .4em .2em .4em .4em;
|
||||
white-space: pre !important;
|
||||
cursor: default;
|
||||
}
|
||||
.CodeMirror-lines {
|
||||
padding: .4em;
|
||||
white-space: pre;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.CodeMirror pre {
|
||||
-moz-border-radius: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-o-border-radius: 0;
|
||||
border-radius: 0;
|
||||
border-width: 0; margin: 0; padding: 0; background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
padding: 0; margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.CodeMirror-wrap pre {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
.CodeMirror-wrap .CodeMirror-scroll {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror textarea {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.CodeMirror pre.CodeMirror-cursor {
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
border-left: 1px solid black;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
background: rgba(0, 200, 0, .4);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
|
||||
}
|
||||
/* Kludge to turn off filter in ie9+, which also accepts rgba */
|
||||
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
|
||||
.CodeMirror-focused pre.CodeMirror-cursor {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
div.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
|
||||
|
||||
.CodeMirror-searching {
|
||||
background: #ffa;
|
||||
background: rgba(255, 255, 0, .4);
|
||||
}
|
||||
|
||||
/* Default theme */
|
||||
|
||||
.cm-s-default span.cm-keyword {color: #708;}
|
||||
.cm-s-default span.cm-atom {color: #219;}
|
||||
.cm-s-default span.cm-number {color: #164;}
|
||||
.cm-s-default span.cm-def {color: #00f;}
|
||||
.cm-s-default span.cm-variable {color: black;}
|
||||
.cm-s-default span.cm-variable-2 {color: #05a;}
|
||||
.cm-s-default span.cm-variable-3 {color: #085;}
|
||||
.cm-s-default span.cm-property {color: black;}
|
||||
.cm-s-default span.cm-operator {color: black;}
|
||||
.cm-s-default span.cm-comment {color: #a50;}
|
||||
.cm-s-default span.cm-string {color: #a11;}
|
||||
.cm-s-default span.cm-string-2 {color: #f50;}
|
||||
.cm-s-default span.cm-meta {color: #555;}
|
||||
.cm-s-default span.cm-error {color: #f00;}
|
||||
.cm-s-default span.cm-qualifier {color: #555;}
|
||||
.cm-s-default span.cm-builtin {color: #30a;}
|
||||
.cm-s-default span.cm-bracket {color: #cc7;}
|
||||
.cm-s-default span.cm-tag {color: #170;}
|
||||
.cm-s-default span.cm-attribute {color: #00c;}
|
||||
.cm-s-default span.cm-header {color: blue;}
|
||||
.cm-s-default span.cm-quote {color: #090;}
|
||||
.cm-s-default span.cm-hr {color: #999;}
|
||||
.cm-s-default span.cm-link {color: #00c;}
|
||||
|
||||
span.cm-header, span.cm-strong {font-weight: bold;}
|
||||
span.cm-em {font-style: italic;}
|
||||
span.cm-emstrong {font-style: italic; font-weight: bold;}
|
||||
span.cm-link {text-decoration: underline;}
|
||||
|
||||
span.cm-invalidchar {color: #f00;}
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
|
||||
@media print {
|
||||
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror pre.CodeMirror-cursor {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
}
|
||||
3237
applications/admin/static/codemirror/lib/codemirror.js
vendored
Normal file
3237
applications/admin/static/codemirror/lib/codemirror.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
164
applications/admin/static/codemirror/lib/util/closetag.js
vendored
Normal file
164
applications/admin/static/codemirror/lib/util/closetag.js
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* Tag-closer extension for CodeMirror.
|
||||
*
|
||||
* This extension adds a "closeTag" utility function that can be used with key bindings to
|
||||
* insert a matching end tag after the ">" character of a start tag has been typed. It can
|
||||
* also complete "</" if a matching start tag is found. It will correctly ignore signal
|
||||
* characters for empty tags, comments, CDATA, etc.
|
||||
*
|
||||
* The function depends on internal parser state to identify tags. It is compatible with the
|
||||
* following CodeMirror modes and will ignore all others:
|
||||
* - htmlmixed
|
||||
* - xml
|
||||
*
|
||||
* See demos/closetag.html for a usage example.
|
||||
*
|
||||
* @author Nathan Williams <nathan@nlwillia.net>
|
||||
* Contributed under the same license terms as CodeMirror.
|
||||
*/
|
||||
(function() {
|
||||
/** Option that allows tag closing behavior to be toggled. Default is true. */
|
||||
CodeMirror.defaults['closeTagEnabled'] = true;
|
||||
|
||||
/** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */
|
||||
CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
|
||||
|
||||
/** Array of tag names where an end tag is forbidden. */
|
||||
CodeMirror.defaults['closeTagVoid'] = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||
|
||||
/**
|
||||
* Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
|
||||
* - cm: The editor instance.
|
||||
* - ch: The character being processed.
|
||||
* - indent: Optional. An array of tag names to indent when closing. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
|
||||
* Pass false to disable indentation. Pass an array to override the default list of tag names.
|
||||
* - vd: Optional. An array of tag names that should not be closed. Omit to use the default void (end tag forbidden) tag list defined in the 'closeTagVoid' option. Ignored in xml mode.
|
||||
*/
|
||||
CodeMirror.defineExtension("closeTag", function(cm, ch, indent, vd) {
|
||||
if (!cm.getOption('closeTagEnabled')) {
|
||||
throw CodeMirror.Pass;
|
||||
}
|
||||
|
||||
var mode = cm.getOption('mode');
|
||||
|
||||
if (mode == 'text/html' || mode == 'xml') {
|
||||
|
||||
/*
|
||||
* Relevant structure of token:
|
||||
*
|
||||
* htmlmixed
|
||||
* className
|
||||
* state
|
||||
* htmlState
|
||||
* type
|
||||
* tagName
|
||||
* context
|
||||
* tagName
|
||||
* mode
|
||||
*
|
||||
* xml
|
||||
* className
|
||||
* state
|
||||
* tagName
|
||||
* type
|
||||
*/
|
||||
|
||||
var pos = cm.getCursor();
|
||||
var tok = cm.getTokenAt(pos);
|
||||
var state = tok.state;
|
||||
|
||||
if (state.mode && state.mode != 'html') {
|
||||
throw CodeMirror.Pass; // With htmlmixed, we only care about the html sub-mode.
|
||||
}
|
||||
|
||||
if (ch == '>') {
|
||||
var type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
|
||||
|
||||
if (tok.className == 'tag' && type == 'closeTag') {
|
||||
throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
|
||||
}
|
||||
|
||||
cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
|
||||
pos = {line: pos.line, ch: pos.ch + 1};
|
||||
cm.setCursor(pos);
|
||||
|
||||
tok = cm.getTokenAt(cm.getCursor());
|
||||
state = tok.state;
|
||||
type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
|
||||
|
||||
if (tok.className == 'tag' && type != 'selfcloseTag') {
|
||||
var tagName = state.htmlState ? state.htmlState.tagName : state.tagName; // htmlmixed : xml
|
||||
if (tagName.length > 0 && shouldClose(cm, vd, tagName)) {
|
||||
insertEndTag(cm, indent, pos, tagName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Undo the '>' insert and allow cm to handle the key instead.
|
||||
cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
|
||||
cm.replaceSelection("");
|
||||
|
||||
} else if (ch == '/') {
|
||||
if (tok.className == 'tag' && tok.string == '<') {
|
||||
var tagName = state.htmlState ? (state.htmlState.context ? state.htmlState.context.tagName : '') : (state.context ? state.context.tagName : ''); // htmlmixed : xml
|
||||
if (tagName.length > 0) {
|
||||
completeEndTag(cm, pos, tagName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw CodeMirror.Pass; // Bubble if not handled
|
||||
});
|
||||
|
||||
function insertEndTag(cm, indent, pos, tagName) {
|
||||
if (shouldIndent(cm, indent, tagName)) {
|
||||
cm.replaceSelection('\n\n</' + tagName + '>', 'end');
|
||||
cm.indentLine(pos.line + 1);
|
||||
cm.indentLine(pos.line + 2);
|
||||
cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
|
||||
} else {
|
||||
cm.replaceSelection('</' + tagName + '>');
|
||||
cm.setCursor(pos);
|
||||
}
|
||||
}
|
||||
|
||||
function shouldIndent(cm, indent, tagName) {
|
||||
if (typeof indent == 'undefined' || indent == null || indent == true) {
|
||||
indent = cm.getOption('closeTagIndent');
|
||||
}
|
||||
if (!indent) {
|
||||
indent = [];
|
||||
}
|
||||
return indexOf(indent, tagName.toLowerCase()) != -1;
|
||||
}
|
||||
|
||||
function shouldClose(cm, vd, tagName) {
|
||||
if (cm.getOption('mode') == 'xml') {
|
||||
return true; // always close xml tags
|
||||
}
|
||||
if (typeof vd == 'undefined' || vd == null) {
|
||||
vd = cm.getOption('closeTagVoid');
|
||||
}
|
||||
if (!vd) {
|
||||
vd = [];
|
||||
}
|
||||
return indexOf(vd, tagName.toLowerCase()) == -1;
|
||||
}
|
||||
|
||||
// C&P from codemirror.js...would be nice if this were visible to utilities.
|
||||
function indexOf(collection, elt) {
|
||||
if (collection.indexOf) return collection.indexOf(elt);
|
||||
for (var i = 0, e = collection.length; i < e; ++i)
|
||||
if (collection[i] == elt) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
function completeEndTag(cm, pos, tagName) {
|
||||
cm.replaceSelection('/' + tagName + '>');
|
||||
cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
|
||||
}
|
||||
|
||||
})();
|
||||
27
applications/admin/static/codemirror/lib/util/dialog.css
vendored
Normal file
27
applications/admin/static/codemirror/lib/util/dialog.css
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
.CodeMirror-dialog {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog > div {
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0;
|
||||
background: white;
|
||||
border-bottom: 1px solid #eee;
|
||||
z-index: 15;
|
||||
padding: .1em .8em;
|
||||
overflow: hidden;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog input {
|
||||
border: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
width: 20em;
|
||||
color: inherit;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog button {
|
||||
font-size: 70%;
|
||||
}
|
||||
70
applications/admin/static/codemirror/lib/util/dialog.js
vendored
Normal file
70
applications/admin/static/codemirror/lib/util/dialog.js
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
||||
|
||||
(function() {
|
||||
function dialogDiv(cm, template) {
|
||||
var wrap = cm.getWrapperElement();
|
||||
var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
|
||||
dialog.className = "CodeMirror-dialog";
|
||||
dialog.innerHTML = '<div>' + template + '</div>';
|
||||
return dialog;
|
||||
}
|
||||
|
||||
CodeMirror.defineExtension("openDialog", function(template, callback) {
|
||||
var dialog = dialogDiv(this, template);
|
||||
var closed = false, me = this;
|
||||
function close() {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
dialog.parentNode.removeChild(dialog);
|
||||
}
|
||||
var inp = dialog.getElementsByTagName("input")[0], button;
|
||||
if (inp) {
|
||||
CodeMirror.connect(inp, "keydown", function(e) {
|
||||
if (e.keyCode == 13 || e.keyCode == 27) {
|
||||
CodeMirror.e_stop(e);
|
||||
close();
|
||||
me.focus();
|
||||
if (e.keyCode == 13) callback(inp.value);
|
||||
}
|
||||
});
|
||||
inp.focus();
|
||||
CodeMirror.connect(inp, "blur", close);
|
||||
} else if (button = dialog.getElementsByTagName("button")[0]) {
|
||||
CodeMirror.connect(button, "click", function() {
|
||||
close();
|
||||
me.focus();
|
||||
});
|
||||
button.focus();
|
||||
CodeMirror.connect(button, "blur", close);
|
||||
}
|
||||
return close;
|
||||
});
|
||||
|
||||
CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
|
||||
var dialog = dialogDiv(this, template);
|
||||
var buttons = dialog.getElementsByTagName("button");
|
||||
var closed = false, me = this, blurring = 1;
|
||||
function close() {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
dialog.parentNode.removeChild(dialog);
|
||||
me.focus();
|
||||
}
|
||||
buttons[0].focus();
|
||||
for (var i = 0; i < buttons.length; ++i) {
|
||||
var b = buttons[i];
|
||||
(function(callback) {
|
||||
CodeMirror.connect(b, "click", function(e) {
|
||||
CodeMirror.e_preventDefault(e);
|
||||
close();
|
||||
if (callback) callback(me);
|
||||
});
|
||||
})(callbacks[i]);
|
||||
CodeMirror.connect(b, "blur", function() {
|
||||
--blurring;
|
||||
setTimeout(function() { if (blurring <= 0) close(); }, 200);
|
||||
});
|
||||
CodeMirror.connect(b, "focus", function() { ++blurring; });
|
||||
}
|
||||
});
|
||||
})();
|
||||
196
applications/admin/static/codemirror/lib/util/foldcode.js
vendored
Normal file
196
applications/admin/static/codemirror/lib/util/foldcode.js
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
// the tagRangeFinder function is
|
||||
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
|
||||
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
|
||||
CodeMirror.tagRangeFinder = function(cm, line, hideEnd) {
|
||||
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
||||
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
||||
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
|
||||
|
||||
var lineText = cm.getLine(line);
|
||||
var found = false;
|
||||
var tag = null;
|
||||
var pos = 0;
|
||||
while (!found) {
|
||||
pos = lineText.indexOf("<", pos);
|
||||
if (-1 == pos) // no tag on line
|
||||
return;
|
||||
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
// ok we weem to have a start tag
|
||||
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
var gtPos = lineText.indexOf(">", pos + 1);
|
||||
if (-1 == gtPos) { // end of start tag not in line
|
||||
var l = line + 1;
|
||||
var foundGt = false;
|
||||
var lastLine = cm.lineCount();
|
||||
while (l < lastLine && !foundGt) {
|
||||
var lt = cm.getLine(l);
|
||||
var gt = lt.indexOf(">");
|
||||
if (-1 != gt) { // found a >
|
||||
foundGt = true;
|
||||
var slash = lt.lastIndexOf("/", gt);
|
||||
if (-1 != slash && slash < gt) {
|
||||
var str = lineText.substr(slash, gt - slash + 1);
|
||||
if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag
|
||||
if (hideEnd === true) l++;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
}
|
||||
l++;
|
||||
}
|
||||
found = true;
|
||||
}
|
||||
else {
|
||||
var slashPos = lineText.lastIndexOf("/", gtPos);
|
||||
if (-1 == slashPos) { // cannot be empty tag
|
||||
found = true;
|
||||
// don't continue
|
||||
}
|
||||
else { // empty tag?
|
||||
// check if really empty tag
|
||||
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
|
||||
if (!str.match( /\/\s*\>/ )) { // finally not empty
|
||||
found = true;
|
||||
// don't continue
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
var subLine = lineText.substr(pos + 1);
|
||||
tag = subLine.match(xmlNAMERegExp);
|
||||
if (tag) {
|
||||
// we have an element name, wooohooo !
|
||||
tag = tag[0];
|
||||
// do we have the close tag on same line ???
|
||||
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
// we don't, so we have a candidate...
|
||||
}
|
||||
else
|
||||
found = false;
|
||||
}
|
||||
if (!found)
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
|
||||
var startTagRegExp = new RegExp(startTag, "g");
|
||||
var endTag = "</" + tag + ">";
|
||||
var depth = 1;
|
||||
var l = line + 1;
|
||||
var lastLine = cm.lineCount();
|
||||
while (l < lastLine) {
|
||||
lineText = cm.getLine(l);
|
||||
var match = lineText.match(startTagRegExp);
|
||||
if (match) {
|
||||
for (var i = 0; i < match.length; i++) {
|
||||
if (match[i] == endTag)
|
||||
depth--;
|
||||
else
|
||||
depth++;
|
||||
if (!depth) {
|
||||
if (hideEnd === true) l++;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
}
|
||||
l++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
CodeMirror.braceRangeFinder = function(cm, line, hideEnd) {
|
||||
var lineText = cm.getLine(line), at = lineText.length, startChar, tokenType;
|
||||
for (;;) {
|
||||
var found = lineText.lastIndexOf("{", at);
|
||||
if (found < 0) break;
|
||||
tokenType = cm.getTokenAt({line: line, ch: found}).className;
|
||||
if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
|
||||
at = found - 1;
|
||||
}
|
||||
if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
|
||||
var count = 1, lastLine = cm.lineCount(), end;
|
||||
outer: for (var i = line + 1; i < lastLine; ++i) {
|
||||
var text = cm.getLine(i), pos = 0;
|
||||
for (;;) {
|
||||
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
|
||||
if (nextOpen < 0) nextOpen = text.length;
|
||||
if (nextClose < 0) nextClose = text.length;
|
||||
pos = Math.min(nextOpen, nextClose);
|
||||
if (pos == text.length) break;
|
||||
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
|
||||
if (pos == nextOpen) ++count;
|
||||
else if (!--count) { end = i; break outer; }
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
if (end == null || end == line + 1) return;
|
||||
if (hideEnd === true) end++;
|
||||
return end;
|
||||
};
|
||||
|
||||
CodeMirror.indentRangeFinder = function(cm, line) {
|
||||
var tabSize = cm.getOption("tabSize");
|
||||
var myIndent = cm.getLineHandle(line).indentation(tabSize), last;
|
||||
for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {
|
||||
var handle = cm.getLineHandle(i);
|
||||
if (!/^\s*$/.test(handle.text)) {
|
||||
if (handle.indentation(tabSize) <= myIndent) break;
|
||||
last = i;
|
||||
}
|
||||
}
|
||||
if (!last) return null;
|
||||
return last + 1;
|
||||
};
|
||||
|
||||
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
|
||||
var folded = [];
|
||||
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">▼</div>%N%';
|
||||
|
||||
function isFolded(cm, n) {
|
||||
for (var i = 0; i < folded.length; ++i) {
|
||||
var start = cm.lineInfo(folded[i].start);
|
||||
if (!start) folded.splice(i--, 1);
|
||||
else if (start.line == n) return {pos: i, region: folded[i]};
|
||||
}
|
||||
}
|
||||
|
||||
function expand(cm, region) {
|
||||
cm.clearMarker(region.start);
|
||||
for (var i = 0; i < region.hidden.length; ++i)
|
||||
cm.showLine(region.hidden[i]);
|
||||
}
|
||||
|
||||
return function(cm, line) {
|
||||
cm.operation(function() {
|
||||
var known = isFolded(cm, line);
|
||||
if (known) {
|
||||
folded.splice(known.pos, 1);
|
||||
expand(cm, known.region);
|
||||
} else {
|
||||
var end = rangeFinder(cm, line, hideEnd);
|
||||
if (end == null) return;
|
||||
var hidden = [];
|
||||
for (var i = line + 1; i < end; ++i) {
|
||||
var handle = cm.hideLine(i);
|
||||
if (handle) hidden.push(handle);
|
||||
}
|
||||
var first = cm.setMarker(line, markText);
|
||||
var region = {start: first, hidden: hidden};
|
||||
cm.onDeleteLine(first, function() { expand(cm, region); });
|
||||
folded.push(region);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
299
applications/admin/static/codemirror/lib/util/formatting.js
vendored
Normal file
299
applications/admin/static/codemirror/lib/util/formatting.js
vendored
Normal file
@@ -0,0 +1,299 @@
|
||||
// ============== Formatting extensions ============================
|
||||
// A common storage for all mode-specific formatting features
|
||||
if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {};
|
||||
|
||||
// Returns the extension of the editor's current mode
|
||||
CodeMirror.defineExtension("getModeExt", function () {
|
||||
var mname = CodeMirror.resolveMode(this.getOption("mode")).name;
|
||||
var ext = CodeMirror.modeExtensions[mname];
|
||||
if (!ext) throw new Error("No extensions found for mode " + mname);
|
||||
return ext;
|
||||
});
|
||||
|
||||
// If the current mode is 'htmlmixed', returns the extension of a mode located at
|
||||
// the specified position (can be htmlmixed, css or javascript). Otherwise, simply
|
||||
// returns the extension of the editor's current mode.
|
||||
CodeMirror.defineExtension("getModeExtAtPos", function (pos) {
|
||||
var token = this.getTokenAt(pos);
|
||||
if (token && token.state && token.state.mode)
|
||||
return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode];
|
||||
else
|
||||
return this.getModeExt();
|
||||
});
|
||||
|
||||
// Comment/uncomment the specified range
|
||||
CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
|
||||
var curMode = this.getModeExtAtPos(this.getCursor());
|
||||
if (isComment) { // Comment range
|
||||
var commentedText = this.getRange(from, to);
|
||||
this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd
|
||||
, from, to);
|
||||
if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside
|
||||
this.setCursor(from.line, from.ch + curMode.commentStart.length);
|
||||
}
|
||||
}
|
||||
else { // Uncomment range
|
||||
var selText = this.getRange(from, to);
|
||||
var startIndex = selText.indexOf(curMode.commentStart);
|
||||
var endIndex = selText.lastIndexOf(curMode.commentEnd);
|
||||
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
|
||||
// Take string till comment start
|
||||
selText = selText.substr(0, startIndex)
|
||||
// From comment start till comment end
|
||||
+ selText.substring(startIndex + curMode.commentStart.length, endIndex)
|
||||
// From comment end till string end
|
||||
+ selText.substr(endIndex + curMode.commentEnd.length);
|
||||
}
|
||||
this.replaceRange(selText, from, to);
|
||||
}
|
||||
});
|
||||
|
||||
// Applies automatic mode-aware indentation to the specified range
|
||||
CodeMirror.defineExtension("autoIndentRange", function (from, to) {
|
||||
var cmInstance = this;
|
||||
this.operation(function () {
|
||||
for (var i = from.line; i <= to.line; i++) {
|
||||
cmInstance.indentLine(i, "smart");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Applies automatic formatting to the specified range
|
||||
CodeMirror.defineExtension("autoFormatRange", function (from, to) {
|
||||
var absStart = this.indexFromPos(from);
|
||||
var absEnd = this.indexFromPos(to);
|
||||
// Insert additional line breaks where necessary according to the
|
||||
// mode's syntax
|
||||
var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd);
|
||||
var cmInstance = this;
|
||||
|
||||
// Replace and auto-indent the range
|
||||
this.operation(function () {
|
||||
cmInstance.replaceRange(res, from, to);
|
||||
var startLine = cmInstance.posFromIndex(absStart).line;
|
||||
var endLine = cmInstance.posFromIndex(absStart + res.length).line;
|
||||
for (var i = startLine; i <= endLine; i++) {
|
||||
cmInstance.indentLine(i, "smart");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Define extensions for a few modes
|
||||
|
||||
CodeMirror.modeExtensions["css"] = {
|
||||
commentStart: "/*",
|
||||
commentEnd: "*/",
|
||||
wordWrapChars: [";", "\\{", "\\}"],
|
||||
autoFormatLineBreaks: function (text, startPos, endPos) {
|
||||
text = text.substring(startPos, endPos);
|
||||
return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
|
||||
}
|
||||
};
|
||||
|
||||
CodeMirror.modeExtensions["javascript"] = {
|
||||
commentStart: "/*",
|
||||
commentEnd: "*/",
|
||||
wordWrapChars: [";", "\\{", "\\}"],
|
||||
|
||||
getNonBreakableBlocks: function (text) {
|
||||
var nonBreakableRegexes = [
|
||||
new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"),
|
||||
new RegExp("\\\\\"([\\s\\S]*?)(\\\\\"|$)"),
|
||||
new RegExp("\\\\\'([\\s\\S]*?)(\\\\\'|$)"),
|
||||
new RegExp("'([\\s\\S]*?)('|$)"),
|
||||
new RegExp("\"([\\s\\S]*?)(\"|$)"),
|
||||
new RegExp("//.*([\r\n]|$)")
|
||||
];
|
||||
var nonBreakableBlocks = new Array();
|
||||
for (var i = 0; i < nonBreakableRegexes.length; i++) {
|
||||
var curPos = 0;
|
||||
while (curPos < text.length) {
|
||||
var m = text.substr(curPos).match(nonBreakableRegexes[i]);
|
||||
if (m != null) {
|
||||
nonBreakableBlocks.push({
|
||||
start: curPos + m.index,
|
||||
end: curPos + m.index + m[0].length
|
||||
});
|
||||
curPos += m.index + Math.max(1, m[0].length);
|
||||
}
|
||||
else { // No more matches
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
nonBreakableBlocks.sort(function (a, b) {
|
||||
return a.start - b.start;
|
||||
});
|
||||
|
||||
return nonBreakableBlocks;
|
||||
},
|
||||
|
||||
autoFormatLineBreaks: function (text, startPos, endPos) {
|
||||
text = text.substring(startPos, endPos);
|
||||
var curPos = 0;
|
||||
var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n;])", "g");
|
||||
var nonBreakableBlocks = this.getNonBreakableBlocks(text);
|
||||
if (nonBreakableBlocks != null) {
|
||||
var res = "";
|
||||
for (var i = 0; i < nonBreakableBlocks.length; i++) {
|
||||
if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block
|
||||
res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");
|
||||
curPos = nonBreakableBlocks[i].start;
|
||||
}
|
||||
if (nonBreakableBlocks[i].start <= curPos
|
||||
&& nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block
|
||||
res += text.substring(curPos, nonBreakableBlocks[i].end);
|
||||
curPos = nonBreakableBlocks[i].end;
|
||||
}
|
||||
}
|
||||
if (curPos < text.length - 1) {
|
||||
res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
return text.replace(reLinesSplitter, "$1\n$2");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CodeMirror.modeExtensions["xml"] = {
|
||||
commentStart: "<!--",
|
||||
commentEnd: "-->",
|
||||
wordWrapChars: [">"],
|
||||
|
||||
autoFormatLineBreaks: function (text, startPos, endPos) {
|
||||
text = text.substring(startPos, endPos);
|
||||
var lines = text.split("\n");
|
||||
var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
|
||||
var reOpenBrackets = new RegExp("<", "g");
|
||||
var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var mToProcess = lines[i].match(reProcessedPortion);
|
||||
if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces
|
||||
lines[i] = mToProcess[1]
|
||||
+ mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")
|
||||
+ mToProcess[3];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join("\n");
|
||||
}
|
||||
};
|
||||
|
||||
CodeMirror.modeExtensions["htmlmixed"] = {
|
||||
commentStart: "<!--",
|
||||
commentEnd: "-->",
|
||||
wordWrapChars: [">", ";", "\\{", "\\}"],
|
||||
|
||||
getModeInfos: function (text, absPos) {
|
||||
var modeInfos = new Array();
|
||||
modeInfos[0] =
|
||||
{
|
||||
pos: 0,
|
||||
modeExt: CodeMirror.modeExtensions["xml"],
|
||||
modeName: "xml"
|
||||
};
|
||||
|
||||
var modeMatchers = new Array();
|
||||
modeMatchers[0] =
|
||||
{
|
||||
regex: new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)", "i"),
|
||||
modeExt: CodeMirror.modeExtensions["css"],
|
||||
modeName: "css"
|
||||
};
|
||||
modeMatchers[1] =
|
||||
{
|
||||
regex: new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)", "i"),
|
||||
modeExt: CodeMirror.modeExtensions["javascript"],
|
||||
modeName: "javascript"
|
||||
};
|
||||
|
||||
var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1);
|
||||
// Detect modes for the entire text
|
||||
for (var i = 0; i < modeMatchers.length; i++) {
|
||||
var curPos = 0;
|
||||
while (curPos <= lastCharPos) {
|
||||
var m = text.substr(curPos).match(modeMatchers[i].regex);
|
||||
if (m != null) {
|
||||
if (m.length > 1 && m[1].length > 0) {
|
||||
// Push block begin pos
|
||||
var blockBegin = curPos + m.index + m[0].indexOf(m[1]);
|
||||
modeInfos.push(
|
||||
{
|
||||
pos: blockBegin,
|
||||
modeExt: modeMatchers[i].modeExt,
|
||||
modeName: modeMatchers[i].modeName
|
||||
});
|
||||
// Push block end pos
|
||||
modeInfos.push(
|
||||
{
|
||||
pos: blockBegin + m[1].length,
|
||||
modeExt: modeInfos[0].modeExt,
|
||||
modeName: modeInfos[0].modeName
|
||||
});
|
||||
curPos += m.index + m[0].length;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
curPos += m.index + Math.max(m[0].length, 1);
|
||||
}
|
||||
}
|
||||
else { // No more matches
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sort mode infos
|
||||
modeInfos.sort(function sortModeInfo(a, b) {
|
||||
return a.pos - b.pos;
|
||||
});
|
||||
|
||||
return modeInfos;
|
||||
},
|
||||
|
||||
autoFormatLineBreaks: function (text, startPos, endPos) {
|
||||
var modeInfos = this.getModeInfos(text);
|
||||
var reBlockStartsWithNewline = new RegExp("^\\s*?\n");
|
||||
var reBlockEndsWithNewline = new RegExp("\n\\s*?$");
|
||||
var res = "";
|
||||
// Use modes info to break lines correspondingly
|
||||
if (modeInfos.length > 1) { // Deal with multi-mode text
|
||||
for (var i = 1; i <= modeInfos.length; i++) {
|
||||
var selStart = modeInfos[i - 1].pos;
|
||||
var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos);
|
||||
|
||||
if (selStart >= endPos) { // The block starts later than the needed fragment
|
||||
break;
|
||||
}
|
||||
if (selStart < startPos) {
|
||||
if (selEnd <= startPos) { // The block starts earlier than the needed fragment
|
||||
continue;
|
||||
}
|
||||
selStart = startPos;
|
||||
}
|
||||
if (selEnd > endPos) {
|
||||
selEnd = endPos;
|
||||
}
|
||||
var textPortion = text.substring(selStart, selEnd);
|
||||
if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block
|
||||
if (!reBlockStartsWithNewline.test(textPortion)
|
||||
&& selStart > 0) { // The block does not start with a line break
|
||||
textPortion = "\n" + textPortion;
|
||||
}
|
||||
if (!reBlockEndsWithNewline.test(textPortion)
|
||||
&& selEnd < text.length - 1) { // The block does not end with a line break
|
||||
textPortion += "\n";
|
||||
}
|
||||
}
|
||||
res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion);
|
||||
}
|
||||
}
|
||||
else { // Single-mode text
|
||||
res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
134
applications/admin/static/codemirror/lib/util/javascript-hint.js
vendored
Normal file
134
applications/admin/static/codemirror/lib/util/javascript-hint.js
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
(function () {
|
||||
function forEach(arr, f) {
|
||||
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
||||
}
|
||||
|
||||
function arrayContains(arr, item) {
|
||||
if (!Array.prototype.indexOf) {
|
||||
var i = arr.length;
|
||||
while (i--) {
|
||||
if (arr[i] === item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return arr.indexOf(item) != -1;
|
||||
}
|
||||
|
||||
function scriptHint(editor, keywords, getToken) {
|
||||
// Find the token at the cursor
|
||||
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
|
||||
// If it's not a 'word-style' token, ignore the token.
|
||||
if (!/^[\w$_]*$/.test(token.string)) {
|
||||
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
||||
className: token.string == "." ? "property" : null};
|
||||
}
|
||||
// If it is a property, find out what it is a property of.
|
||||
while (tprop.className == "property") {
|
||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
||||
if (tprop.string != ".") return;
|
||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
||||
if (tprop.string == ')') {
|
||||
var level = 1;
|
||||
do {
|
||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
||||
switch (tprop.string) {
|
||||
case ')': level++; break;
|
||||
case '(': level--; break;
|
||||
default: break;
|
||||
}
|
||||
} while (level > 0);
|
||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
||||
if (tprop.className == 'variable')
|
||||
tprop.className = 'function';
|
||||
else return; // no clue
|
||||
}
|
||||
if (!context) var context = [];
|
||||
context.push(tprop);
|
||||
}
|
||||
return {list: getCompletions(token, context, keywords),
|
||||
from: {line: cur.line, ch: token.start},
|
||||
to: {line: cur.line, ch: token.end}};
|
||||
}
|
||||
|
||||
CodeMirror.javascriptHint = function(editor) {
|
||||
return scriptHint(editor, javascriptKeywords,
|
||||
function (e, cur) {return e.getTokenAt(cur);});
|
||||
};
|
||||
|
||||
function getCoffeeScriptToken(editor, cur) {
|
||||
// This getToken, it is for coffeescript, imitates the behavior of
|
||||
// getTokenAt method in javascript.js, that is, returning "property"
|
||||
// type and treat "." as indepenent token.
|
||||
var token = editor.getTokenAt(cur);
|
||||
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
|
||||
token.end = token.start;
|
||||
token.string = '.';
|
||||
token.className = "property";
|
||||
}
|
||||
else if (/^\.[\w$_]*$/.test(token.string)) {
|
||||
token.className = "property";
|
||||
token.start++;
|
||||
token.string = token.string.replace(/\./, '');
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
CodeMirror.coffeescriptHint = function(editor) {
|
||||
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);
|
||||
};
|
||||
|
||||
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
||||
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
||||
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
||||
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
||||
var funcProps = "prototype apply call bind".split(" ");
|
||||
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
|
||||
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
|
||||
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
|
||||
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
|
||||
|
||||
function getCompletions(token, context, keywords) {
|
||||
var found = [], start = token.string;
|
||||
function maybeAdd(str) {
|
||||
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
|
||||
}
|
||||
function gatherCompletions(obj) {
|
||||
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
||||
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
||||
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
||||
for (var name in obj) maybeAdd(name);
|
||||
}
|
||||
|
||||
if (context) {
|
||||
// If this is a property, see if it belongs to some object we can
|
||||
// find in the current environment.
|
||||
var obj = context.pop(), base;
|
||||
if (obj.className == "variable")
|
||||
base = window[obj.string];
|
||||
else if (obj.className == "string")
|
||||
base = "";
|
||||
else if (obj.className == "atom")
|
||||
base = 1;
|
||||
else if (obj.className == "function") {
|
||||
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
||||
(typeof window.jQuery == 'function'))
|
||||
base = window.jQuery();
|
||||
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
|
||||
base = window._();
|
||||
}
|
||||
while (base != null && context.length)
|
||||
base = base[context.pop().string];
|
||||
if (base != null) gatherCompletions(base);
|
||||
}
|
||||
else {
|
||||
// If not, just look in the window object and any local scope
|
||||
// (reading into JS mode internals to get at the local variables)
|
||||
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
||||
gatherCompletions(window);
|
||||
forEach(keywords, maybeAdd);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
})();
|
||||
51
applications/admin/static/codemirror/lib/util/loadmode.js
vendored
Normal file
51
applications/admin/static/codemirror/lib/util/loadmode.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
(function() {
|
||||
if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
|
||||
|
||||
var loading = {};
|
||||
function splitCallback(cont, n) {
|
||||
var countDown = n;
|
||||
return function() { if (--countDown == 0) cont(); };
|
||||
}
|
||||
function ensureDeps(mode, cont) {
|
||||
var deps = CodeMirror.modes[mode].dependencies;
|
||||
if (!deps) return cont();
|
||||
var missing = [];
|
||||
for (var i = 0; i < deps.length; ++i) {
|
||||
if (!CodeMirror.modes.hasOwnProperty(deps[i]))
|
||||
missing.push(deps[i]);
|
||||
}
|
||||
if (!missing.length) return cont();
|
||||
var split = splitCallback(cont, missing.length);
|
||||
for (var i = 0; i < missing.length; ++i)
|
||||
CodeMirror.requireMode(missing[i], split);
|
||||
}
|
||||
|
||||
CodeMirror.requireMode = function(mode, cont) {
|
||||
if (typeof mode != "string") mode = mode.name;
|
||||
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
|
||||
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
|
||||
|
||||
var script = document.createElement("script");
|
||||
script.src = CodeMirror.modeURL.replace(/%N/g, mode);
|
||||
var others = document.getElementsByTagName("script")[0];
|
||||
others.parentNode.insertBefore(script, others);
|
||||
var list = loading[mode] = [cont];
|
||||
var count = 0, poll = setInterval(function() {
|
||||
if (++count > 100) return clearInterval(poll);
|
||||
if (CodeMirror.modes.hasOwnProperty(mode)) {
|
||||
clearInterval(poll);
|
||||
loading[mode] = null;
|
||||
ensureDeps(mode, function() {
|
||||
for (var i = 0; i < list.length; ++i) list[i]();
|
||||
});
|
||||
}
|
||||
}, 200);
|
||||
};
|
||||
|
||||
CodeMirror.autoLoadMode = function(instance, mode) {
|
||||
if (!CodeMirror.modes.hasOwnProperty(mode))
|
||||
CodeMirror.requireMode(mode, function() {
|
||||
instance.setOption("mode", instance.getOption("mode"));
|
||||
});
|
||||
};
|
||||
}());
|
||||
44
applications/admin/static/codemirror/lib/util/match-highlighter.js
vendored
Normal file
44
applications/admin/static/codemirror/lib/util/match-highlighter.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// Define match-highlighter commands. Depends on searchcursor.js
|
||||
// Use by attaching the following function call to the onCursorActivity event:
|
||||
//myCodeMirror.matchHighlight(minChars);
|
||||
// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
|
||||
|
||||
(function() {
|
||||
var DEFAULT_MIN_CHARS = 2;
|
||||
|
||||
function MatchHighlightState() {
|
||||
this.marked = [];
|
||||
}
|
||||
function getMatchHighlightState(cm) {
|
||||
return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
|
||||
}
|
||||
|
||||
function clearMarks(cm) {
|
||||
var state = getMatchHighlightState(cm);
|
||||
for (var i = 0; i < state.marked.length; ++i)
|
||||
state.marked[i].clear();
|
||||
state.marked = [];
|
||||
}
|
||||
|
||||
function markDocument(cm, className, minChars) {
|
||||
clearMarks(cm);
|
||||
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
|
||||
if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
|
||||
var state = getMatchHighlightState(cm);
|
||||
var query = cm.getSelection();
|
||||
cm.operation(function() {
|
||||
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
|
||||
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
|
||||
//Only apply matchhighlight to the matches other than the one actually selected
|
||||
if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
|
||||
state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
|
||||
markDocument(this, className, minChars);
|
||||
});
|
||||
})();
|
||||
81
applications/admin/static/codemirror/lib/util/multiplex.js
vendored
Normal file
81
applications/admin/static/codemirror/lib/util/multiplex.js
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
CodeMirror.multiplexingMode = function(outer /*, others */) {
|
||||
// Others should be {open, close, mode [, delimStyle]} objects
|
||||
var others = Array.prototype.slice.call(arguments, 1);
|
||||
var n_others = others.length;
|
||||
|
||||
function indexOf(string, pattern, from) {
|
||||
if (typeof pattern == "string") return string.indexOf(pattern, from);
|
||||
var m = pattern.exec(from ? string.slice(from) : string);
|
||||
return m ? m.index + from : -1;
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
outer: CodeMirror.startState(outer),
|
||||
innerActive: null,
|
||||
inner: null
|
||||
};
|
||||
},
|
||||
|
||||
copyState: function(state) {
|
||||
return {
|
||||
outer: CodeMirror.copyState(outer, state.outer),
|
||||
innerActive: state.innerActive,
|
||||
inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (!state.innerActive) {
|
||||
var cutOff = Infinity, oldContent = stream.string;
|
||||
for (var i = 0; i < n_others; ++i) {
|
||||
var other = others[i];
|
||||
var found = indexOf(oldContent, other.open, stream.pos);
|
||||
if (found == stream.pos) {
|
||||
stream.match(other.open);
|
||||
state.innerActive = other;
|
||||
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
|
||||
return other.delimStyle;
|
||||
} else if (found != -1 && found < cutOff) {
|
||||
cutOff = found;
|
||||
}
|
||||
}
|
||||
if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
|
||||
var outerToken = outer.token(stream, state.outer);
|
||||
if (cutOff != Infinity) stream.string = oldContent;
|
||||
return outerToken;
|
||||
} else {
|
||||
var curInner = state.innerActive, oldContent = stream.string;
|
||||
var found = indexOf(oldContent, curInner.close, stream.pos);
|
||||
if (found == stream.pos) {
|
||||
stream.match(curInner.close);
|
||||
state.innerActive = state.inner = null;
|
||||
return curInner.delimStyle;
|
||||
}
|
||||
if (found > -1) stream.string = oldContent.slice(0, found);
|
||||
var innerToken = curInner.mode.token(stream, state.inner);
|
||||
if (found > -1) stream.string = oldContent;
|
||||
var cur = stream.current(), found = cur.indexOf(curInner.close);
|
||||
if (found > -1) stream.backUp(cur.length - found);
|
||||
return innerToken;
|
||||
}
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
var mode = state.innerActive ? state.innerActive.mode : outer;
|
||||
if (!mode.indent) return CodeMirror.Pass;
|
||||
return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);
|
||||
},
|
||||
|
||||
compareStates: function(a, b) {
|
||||
if (a.innerActive != b.innerActive) return false;
|
||||
var mode = a.innerActive || outer;
|
||||
if (!mode.compareStates) return CodeMirror.Pass;
|
||||
return mode.compareStates(a.innerActive ? a.inner : a.outer,
|
||||
b.innerActive ? b.inner : b.outer);
|
||||
},
|
||||
|
||||
electricChars: outer.electricChars
|
||||
};
|
||||
};
|
||||
52
applications/admin/static/codemirror/lib/util/overlay.js
vendored
Normal file
52
applications/admin/static/codemirror/lib/util/overlay.js
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// Utility function that allows modes to be combined. The mode given
|
||||
// as the base argument takes care of most of the normal mode
|
||||
// functionality, but a second (typically simple) mode is used, which
|
||||
// can override the style of text. Both modes get to parse all of the
|
||||
// text, but when both assign a non-null style to a piece of code, the
|
||||
// overlay wins, unless the combine argument was true, in which case
|
||||
// the styles are combined.
|
||||
|
||||
// overlayParser is the old, deprecated name
|
||||
CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
base: CodeMirror.startState(base),
|
||||
overlay: CodeMirror.startState(overlay),
|
||||
basePos: 0, baseCur: null,
|
||||
overlayPos: 0, overlayCur: null
|
||||
};
|
||||
},
|
||||
copyState: function(state) {
|
||||
return {
|
||||
base: CodeMirror.copyState(base, state.base),
|
||||
overlay: CodeMirror.copyState(overlay, state.overlay),
|
||||
basePos: state.basePos, baseCur: null,
|
||||
overlayPos: state.overlayPos, overlayCur: null
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (stream.start == state.basePos) {
|
||||
state.baseCur = base.token(stream, state.base);
|
||||
state.basePos = stream.pos;
|
||||
}
|
||||
if (stream.start == state.overlayPos) {
|
||||
stream.pos = stream.start;
|
||||
state.overlayCur = overlay.token(stream, state.overlay);
|
||||
state.overlayPos = stream.pos;
|
||||
}
|
||||
stream.pos = Math.min(state.basePos, state.overlayPos);
|
||||
if (stream.eol()) state.basePos = state.overlayPos = 0;
|
||||
|
||||
if (state.overlayCur == null) return state.baseCur;
|
||||
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
|
||||
else return state.overlayCur;
|
||||
},
|
||||
|
||||
indent: base.indent && function(state, textAfter) {
|
||||
return base.indent(state.base, textAfter);
|
||||
},
|
||||
electricChars: base.electricChars
|
||||
};
|
||||
};
|
||||
123
applications/admin/static/codemirror/lib/util/pig-hint.js
vendored
Normal file
123
applications/admin/static/codemirror/lib/util/pig-hint.js
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
(function () {
|
||||
function forEach(arr, f) {
|
||||
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
||||
}
|
||||
|
||||
function arrayContains(arr, item) {
|
||||
if (!Array.prototype.indexOf) {
|
||||
var i = arr.length;
|
||||
while (i--) {
|
||||
if (arr[i] === item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return arr.indexOf(item) != -1;
|
||||
}
|
||||
|
||||
function scriptHint(editor, keywords, getToken) {
|
||||
// Find the token at the cursor
|
||||
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
|
||||
// If it's not a 'word-style' token, ignore the token.
|
||||
|
||||
if (!/^[\w$_]*$/.test(token.string)) {
|
||||
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
||||
className: token.string == ":" ? "pig-type" : null};
|
||||
}
|
||||
|
||||
if (!context) var context = [];
|
||||
context.push(tprop);
|
||||
|
||||
var completionList = getCompletions(token, context);
|
||||
completionList = completionList.sort();
|
||||
//prevent autocomplete for last word, instead show dropdown with one word
|
||||
if(completionList.length == 1) {
|
||||
completionList.push(" ");
|
||||
}
|
||||
|
||||
return {list: completionList,
|
||||
from: {line: cur.line, ch: token.start},
|
||||
to: {line: cur.line, ch: token.end}};
|
||||
}
|
||||
|
||||
CodeMirror.pigHint = function(editor) {
|
||||
return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
|
||||
};
|
||||
|
||||
function toTitleCase(str) {
|
||||
return str.replace(/(?:^|\s)\w/g, function(match) {
|
||||
return match.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
|
||||
+ "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
|
||||
+ "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
|
||||
+ "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
|
||||
+ "NEQ MATCHES TRUE FALSE";
|
||||
var pigKeywordsU = pigKeywords.split(" ");
|
||||
var pigKeywordsL = pigKeywords.toLowerCase().split(" ");
|
||||
|
||||
var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP";
|
||||
var pigTypesU = pigTypes.split(" ");
|
||||
var pigTypesL = pigTypes.toLowerCase().split(" ");
|
||||
|
||||
var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
|
||||
+ "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
|
||||
+ "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
|
||||
+ "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
|
||||
+ "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
|
||||
+ "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
|
||||
+ "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
|
||||
+ "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
|
||||
+ "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
|
||||
+ "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER";
|
||||
var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" ");
|
||||
var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" ");
|
||||
var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs "
|
||||
+ "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax "
|
||||
+ "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum "
|
||||
+ "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker "
|
||||
+ "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize "
|
||||
+ "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax "
|
||||
+ "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" ");
|
||||
|
||||
function getCompletions(token, context) {
|
||||
var found = [], start = token.string;
|
||||
function maybeAdd(str) {
|
||||
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
|
||||
}
|
||||
|
||||
function gatherCompletions(obj) {
|
||||
if(obj == ":") {
|
||||
forEach(pigTypesL, maybeAdd);
|
||||
}
|
||||
else {
|
||||
forEach(pigBuiltinsU, maybeAdd);
|
||||
forEach(pigBuiltinsL, maybeAdd);
|
||||
forEach(pigBuiltinsC, maybeAdd);
|
||||
forEach(pigTypesU, maybeAdd);
|
||||
forEach(pigTypesL, maybeAdd);
|
||||
forEach(pigKeywordsU, maybeAdd);
|
||||
forEach(pigKeywordsL, maybeAdd);
|
||||
}
|
||||
}
|
||||
|
||||
if (context) {
|
||||
// If this is a property, see if it belongs to some object we can
|
||||
// find in the current environment.
|
||||
var obj = context.pop(), base;
|
||||
|
||||
if (obj.className == "pig-word")
|
||||
base = obj.string;
|
||||
else if(obj.className == "pig-type")
|
||||
base = ":" + obj.string;
|
||||
|
||||
while (base != null && context.length)
|
||||
base = base[context.pop().string];
|
||||
if (base != null) gatherCompletions(base);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
})();
|
||||
53
applications/admin/static/codemirror/lib/util/runmode.js
vendored
Normal file
53
applications/admin/static/codemirror/lib/util/runmode.js
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
CodeMirror.runMode = function(string, modespec, callback, options) {
|
||||
function esc(str) {
|
||||
return str.replace(/[<&]/, function(ch) { return ch == "<" ? "<" : "&"; });
|
||||
}
|
||||
|
||||
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
|
||||
var isNode = callback.nodeType == 1;
|
||||
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
|
||||
if (isNode) {
|
||||
var node = callback, accum = [], col = 0;
|
||||
callback = function(text, style) {
|
||||
if (text == "\n") {
|
||||
accum.push("<br>");
|
||||
col = 0;
|
||||
return;
|
||||
}
|
||||
var escaped = "";
|
||||
// HTML-escape and replace tabs
|
||||
for (var pos = 0;;) {
|
||||
var idx = text.indexOf("\t", pos);
|
||||
if (idx == -1) {
|
||||
escaped += esc(text.slice(pos));
|
||||
col += text.length - pos;
|
||||
break;
|
||||
} else {
|
||||
col += idx - pos;
|
||||
escaped += esc(text.slice(pos, idx));
|
||||
var size = tabSize - col % tabSize;
|
||||
col += size;
|
||||
for (var i = 0; i < size; ++i) escaped += " ";
|
||||
pos = idx + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (style)
|
||||
accum.push("<span class=\"cm-" + esc(style) + "\">" + escaped + "</span>");
|
||||
else
|
||||
accum.push(escaped);
|
||||
};
|
||||
}
|
||||
var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
|
||||
for (var i = 0, e = lines.length; i < e; ++i) {
|
||||
if (i) callback("\n");
|
||||
var stream = new CodeMirror.StringStream(lines[i]);
|
||||
while (!stream.eol()) {
|
||||
var style = mode.token(stream, state);
|
||||
callback(stream.current(), style, i, stream.start);
|
||||
stream.start = stream.pos;
|
||||
}
|
||||
}
|
||||
if (isNode)
|
||||
node.innerHTML = accum.join("");
|
||||
};
|
||||
118
applications/admin/static/codemirror/lib/util/search.js
vendored
Normal file
118
applications/admin/static/codemirror/lib/util/search.js
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
// Define search commands. Depends on dialog.js or another
|
||||
// implementation of the openDialog method.
|
||||
|
||||
// Replace works a little oddly -- it will do the replace on the next
|
||||
// Ctrl-G (or whatever is bound to findNext) press. You prevent a
|
||||
// replace by making sure the match is no longer selected when hitting
|
||||
// Ctrl-G.
|
||||
|
||||
(function() {
|
||||
function SearchState() {
|
||||
this.posFrom = this.posTo = this.query = null;
|
||||
this.marked = [];
|
||||
}
|
||||
function getSearchState(cm) {
|
||||
return cm._searchState || (cm._searchState = new SearchState());
|
||||
}
|
||||
function getSearchCursor(cm, query, pos) {
|
||||
// Heuristic: if the query string is all lowercase, do a case insensitive search.
|
||||
return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());
|
||||
}
|
||||
function dialog(cm, text, shortText, f) {
|
||||
if (cm.openDialog) cm.openDialog(text, f);
|
||||
else f(prompt(shortText, ""));
|
||||
}
|
||||
function confirmDialog(cm, text, shortText, fs) {
|
||||
if (cm.openConfirm) cm.openConfirm(text, fs);
|
||||
else if (confirm(shortText)) fs[0]();
|
||||
}
|
||||
function parseQuery(query) {
|
||||
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
|
||||
return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;
|
||||
}
|
||||
var queryDialog =
|
||||
'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
|
||||
function doSearch(cm, rev) {
|
||||
var state = getSearchState(cm);
|
||||
if (state.query) return findNext(cm, rev);
|
||||
dialog(cm, queryDialog, "Search for:", function(query) {
|
||||
cm.operation(function() {
|
||||
if (!query || state.query) return;
|
||||
state.query = parseQuery(query);
|
||||
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
|
||||
for (var cursor = getSearchCursor(cm, state.query); cursor.findNext();)
|
||||
state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));
|
||||
}
|
||||
state.posFrom = state.posTo = cm.getCursor();
|
||||
findNext(cm, rev);
|
||||
});
|
||||
});
|
||||
}
|
||||
function findNext(cm, rev) {cm.operation(function() {
|
||||
var state = getSearchState(cm);
|
||||
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
|
||||
if (!cursor.find(rev)) {
|
||||
cursor = getSearchCursor(cm, state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0});
|
||||
if (!cursor.find(rev)) return;
|
||||
}
|
||||
cm.setSelection(cursor.from(), cursor.to());
|
||||
state.posFrom = cursor.from(); state.posTo = cursor.to();
|
||||
});}
|
||||
function clearSearch(cm) {cm.operation(function() {
|
||||
var state = getSearchState(cm);
|
||||
if (!state.query) return;
|
||||
state.query = null;
|
||||
for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear();
|
||||
state.marked.length = 0;
|
||||
});}
|
||||
|
||||
var replaceQueryDialog =
|
||||
'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
|
||||
var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';
|
||||
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
|
||||
function replace(cm, all) {
|
||||
dialog(cm, replaceQueryDialog, "Replace:", function(query) {
|
||||
if (!query) return;
|
||||
query = parseQuery(query);
|
||||
dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
|
||||
if (all) {
|
||||
cm.compoundChange(function() { cm.operation(function() {
|
||||
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
|
||||
if (typeof query != "string") {
|
||||
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
|
||||
cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));
|
||||
} else cursor.replace(text);
|
||||
}
|
||||
});});
|
||||
} else {
|
||||
clearSearch(cm);
|
||||
var cursor = getSearchCursor(cm, query, cm.getCursor());
|
||||
function advance() {
|
||||
var start = cursor.from(), match;
|
||||
if (!(match = cursor.findNext())) {
|
||||
cursor = getSearchCursor(cm, query);
|
||||
if (!(match = cursor.findNext()) ||
|
||||
(start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
|
||||
}
|
||||
cm.setSelection(cursor.from(), cursor.to());
|
||||
confirmDialog(cm, doReplaceConfirm, "Replace?",
|
||||
[function() {doReplace(match);}, advance]);
|
||||
}
|
||||
function doReplace(match) {
|
||||
cursor.replace(typeof query == "string" ? text :
|
||||
text.replace(/\$(\d)/, function(w, i) {return match[i];}));
|
||||
advance();
|
||||
}
|
||||
advance();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
|
||||
CodeMirror.commands.findNext = doSearch;
|
||||
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
|
||||
CodeMirror.commands.clearSearch = clearSearch;
|
||||
CodeMirror.commands.replace = replace;
|
||||
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
|
||||
})();
|
||||
119
applications/admin/static/codemirror/lib/util/searchcursor.js
vendored
Normal file
119
applications/admin/static/codemirror/lib/util/searchcursor.js
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
(function(){
|
||||
function SearchCursor(cm, query, pos, caseFold) {
|
||||
this.atOccurrence = false; this.cm = cm;
|
||||
if (caseFold == null && typeof query == "string") caseFold = false;
|
||||
|
||||
pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};
|
||||
this.pos = {from: pos, to: pos};
|
||||
|
||||
// The matches method is filled in based on the type of query.
|
||||
// It takes a position and a direction, and returns an object
|
||||
// describing the next occurrence of the query, or null if no
|
||||
// more matches were found.
|
||||
if (typeof query != "string") { // Regexp match
|
||||
if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g");
|
||||
this.matches = function(reverse, pos) {
|
||||
if (reverse) {
|
||||
query.lastIndex = 0;
|
||||
var line = cm.getLine(pos.line).slice(0, pos.ch), match = query.exec(line), start = 0;
|
||||
while (match) {
|
||||
start += match.index;
|
||||
line = line.slice(match.index);
|
||||
query.lastIndex = 0;
|
||||
var newmatch = query.exec(line);
|
||||
if (newmatch) match = newmatch;
|
||||
else break;
|
||||
start++;
|
||||
}
|
||||
} else {
|
||||
query.lastIndex = pos.ch;
|
||||
var line = cm.getLine(pos.line), match = query.exec(line),
|
||||
start = match && match.index;
|
||||
}
|
||||
if (match)
|
||||
return {from: {line: pos.line, ch: start},
|
||||
to: {line: pos.line, ch: start + match[0].length},
|
||||
match: match};
|
||||
};
|
||||
} else { // String query
|
||||
if (caseFold) query = query.toLowerCase();
|
||||
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
|
||||
var target = query.split("\n");
|
||||
// Different methods for single-line and multi-line queries
|
||||
if (target.length == 1)
|
||||
this.matches = function(reverse, pos) {
|
||||
var line = fold(cm.getLine(pos.line)), len = query.length, match;
|
||||
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
|
||||
: (match = line.indexOf(query, pos.ch)) != -1)
|
||||
return {from: {line: pos.line, ch: match},
|
||||
to: {line: pos.line, ch: match + len}};
|
||||
};
|
||||
else
|
||||
this.matches = function(reverse, pos) {
|
||||
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
|
||||
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
|
||||
if (reverse ? offsetA >= pos.ch || offsetA != match.length
|
||||
: offsetA <= pos.ch || offsetA != line.length - match.length)
|
||||
return;
|
||||
for (;;) {
|
||||
if (reverse ? !ln : ln == cm.lineCount() - 1) return;
|
||||
line = fold(cm.getLine(ln += reverse ? -1 : 1));
|
||||
match = target[reverse ? --idx : ++idx];
|
||||
if (idx > 0 && idx < target.length - 1) {
|
||||
if (line != match) return;
|
||||
else continue;
|
||||
}
|
||||
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
|
||||
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
|
||||
return;
|
||||
var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
|
||||
return {from: reverse ? end : start, to: reverse ? start : end};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
SearchCursor.prototype = {
|
||||
findNext: function() {return this.find(false);},
|
||||
findPrevious: function() {return this.find(true);},
|
||||
|
||||
find: function(reverse) {
|
||||
var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
|
||||
function savePosAndFail(line) {
|
||||
var pos = {line: line, ch: 0};
|
||||
self.pos = {from: pos, to: pos};
|
||||
self.atOccurrence = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (this.pos = this.matches(reverse, pos)) {
|
||||
this.atOccurrence = true;
|
||||
return this.pos.match || true;
|
||||
}
|
||||
if (reverse) {
|
||||
if (!pos.line) return savePosAndFail(0);
|
||||
pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};
|
||||
}
|
||||
else {
|
||||
var maxLine = this.cm.lineCount();
|
||||
if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
|
||||
pos = {line: pos.line+1, ch: 0};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
from: function() {if (this.atOccurrence) return this.pos.from;},
|
||||
to: function() {if (this.atOccurrence) return this.pos.to;},
|
||||
|
||||
replace: function(newText) {
|
||||
var self = this;
|
||||
if (this.atOccurrence)
|
||||
self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);
|
||||
}
|
||||
};
|
||||
|
||||
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
|
||||
return new SearchCursor(this, query, pos, caseFold);
|
||||
});
|
||||
})();
|
||||
16
applications/admin/static/codemirror/lib/util/simple-hint.css
vendored
Normal file
16
applications/admin/static/codemirror/lib/util/simple-hint.css
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
.CodeMirror-completions {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
overflow: hidden;
|
||||
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
||||
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
||||
}
|
||||
.CodeMirror-completions select {
|
||||
background: #fafafa;
|
||||
outline: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: monospace;
|
||||
}
|
||||
97
applications/admin/static/codemirror/lib/util/simple-hint.js
vendored
Normal file
97
applications/admin/static/codemirror/lib/util/simple-hint.js
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
(function() {
|
||||
CodeMirror.simpleHint = function(editor, getHints, givenOptions) {
|
||||
// Determine effective options based on given values and defaults.
|
||||
var options = {}, defaults = CodeMirror.simpleHint.defaults;
|
||||
for (var opt in defaults)
|
||||
if (defaults.hasOwnProperty(opt))
|
||||
options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
|
||||
|
||||
function collectHints(previousToken) {
|
||||
// We want a single cursor position.
|
||||
if (editor.somethingSelected()) return;
|
||||
|
||||
var tempToken = editor.getTokenAt(editor.getCursor());
|
||||
|
||||
// Don't show completions if token has changed and the option is set.
|
||||
if (options.closeOnTokenChange && previousToken != null &&
|
||||
(tempToken.start != previousToken.start || tempToken.className != previousToken.className)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var result = getHints(editor);
|
||||
if (!result || !result.list.length) return;
|
||||
var completions = result.list;
|
||||
function insert(str) {
|
||||
editor.replaceRange(str, result.from, result.to);
|
||||
}
|
||||
// When there is only one completion, use it directly.
|
||||
if (completions.length == 1) {insert(completions[0]); return true;}
|
||||
|
||||
// Build the select widget
|
||||
var complete = document.createElement("div");
|
||||
complete.className = "CodeMirror-completions";
|
||||
var sel = complete.appendChild(document.createElement("select"));
|
||||
// Opera doesn't move the selection when pressing up/down in a
|
||||
// multi-select, but it does properly support the size property on
|
||||
// single-selects, so no multi-select is necessary.
|
||||
if (!window.opera) sel.multiple = true;
|
||||
for (var i = 0; i < completions.length; ++i) {
|
||||
var opt = sel.appendChild(document.createElement("option"));
|
||||
opt.appendChild(document.createTextNode(completions[i]));
|
||||
}
|
||||
sel.firstChild.selected = true;
|
||||
sel.size = Math.min(10, completions.length);
|
||||
var pos = editor.cursorCoords();
|
||||
complete.style.left = pos.x + "px";
|
||||
complete.style.top = pos.yBot + "px";
|
||||
document.body.appendChild(complete);
|
||||
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
||||
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
|
||||
if(winW - pos.x < sel.clientWidth)
|
||||
complete.style.left = (pos.x - sel.clientWidth) + "px";
|
||||
// Hack to hide the scrollbar.
|
||||
if (completions.length <= 10)
|
||||
complete.style.width = (sel.clientWidth - 1) + "px";
|
||||
|
||||
var done = false;
|
||||
function close() {
|
||||
if (done) return;
|
||||
done = true;
|
||||
complete.parentNode.removeChild(complete);
|
||||
}
|
||||
function pick() {
|
||||
insert(completions[sel.selectedIndex]);
|
||||
close();
|
||||
setTimeout(function(){editor.focus();}, 50);
|
||||
}
|
||||
CodeMirror.connect(sel, "blur", close);
|
||||
CodeMirror.connect(sel, "keydown", function(event) {
|
||||
var code = event.keyCode;
|
||||
// Enter
|
||||
if (code == 13) {CodeMirror.e_stop(event); pick();}
|
||||
// Escape
|
||||
else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
|
||||
else if (code != 38 && code != 40) {
|
||||
close(); editor.focus();
|
||||
// Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
|
||||
editor.triggerOnKeyDown(event);
|
||||
// Don't show completions if the code is backspace and the option is set.
|
||||
if (!options.closeOnBackspace || code != 8) {
|
||||
setTimeout(function(){collectHints(tempToken);}, 50);
|
||||
}
|
||||
}
|
||||
});
|
||||
CodeMirror.connect(sel, "dblclick", pick);
|
||||
|
||||
sel.focus();
|
||||
// Opera sometimes ignores focusing a freshly created node
|
||||
if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
|
||||
return true;
|
||||
}
|
||||
return collectHints();
|
||||
};
|
||||
CodeMirror.simpleHint.defaults = {
|
||||
closeOnBackspace: true,
|
||||
closeOnTokenChange: false
|
||||
};
|
||||
})();
|
||||
137
applications/admin/static/codemirror/lib/util/xml-hint.js
vendored
Normal file
137
applications/admin/static/codemirror/lib/util/xml-hint.js
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
|
||||
(function() {
|
||||
|
||||
CodeMirror.xmlHints = [];
|
||||
|
||||
CodeMirror.xmlHint = function(cm, simbol) {
|
||||
|
||||
if(simbol.length > 0) {
|
||||
var cursor = cm.getCursor();
|
||||
cm.replaceSelection(simbol);
|
||||
cursor = {line: cursor.line, ch: cursor.ch + 1};
|
||||
cm.setCursor(cursor);
|
||||
}
|
||||
|
||||
// dirty hack for simple-hint to receive getHint event on space
|
||||
var getTokenAt = editor.getTokenAt;
|
||||
|
||||
editor.getTokenAt = function() { return 'disabled'; };
|
||||
CodeMirror.simpleHint(cm, getHint);
|
||||
|
||||
editor.getTokenAt = getTokenAt;
|
||||
};
|
||||
|
||||
var getHint = function(cm) {
|
||||
|
||||
var cursor = cm.getCursor();
|
||||
|
||||
if (cursor.ch > 0) {
|
||||
|
||||
var text = cm.getRange({line: 0, ch: 0}, cursor);
|
||||
var typed = '';
|
||||
var simbol = '';
|
||||
for(var i = text.length - 1; i >= 0; i--) {
|
||||
if(text[i] == ' ' || text[i] == '<') {
|
||||
simbol = text[i];
|
||||
break;
|
||||
}
|
||||
else {
|
||||
typed = text[i] + typed;
|
||||
}
|
||||
}
|
||||
|
||||
text = text.slice(0, text.length - typed.length);
|
||||
|
||||
var path = getActiveElement(cm, text) + simbol;
|
||||
var hints = CodeMirror.xmlHints[path];
|
||||
|
||||
if(typeof hints === 'undefined')
|
||||
hints = [''];
|
||||
else {
|
||||
hints = hints.slice(0);
|
||||
for (var i = hints.length - 1; i >= 0; i--) {
|
||||
if(hints[i].indexOf(typed) != 0)
|
||||
hints.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
list: hints,
|
||||
from: { line: cursor.line, ch: cursor.ch - typed.length },
|
||||
to: cursor
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
var getActiveElement = function(codeMirror, text) {
|
||||
|
||||
var element = '';
|
||||
|
||||
if(text.length >= 0) {
|
||||
|
||||
var regex = new RegExp('<([^!?][^\\s/>]*).*?>', 'g');
|
||||
|
||||
var matches = [];
|
||||
var match;
|
||||
while ((match = regex.exec(text)) != null) {
|
||||
matches.push({
|
||||
tag: match[1],
|
||||
selfclose: (match[0].slice(match[0].length - 2) === '/>')
|
||||
});
|
||||
}
|
||||
|
||||
for (var i = matches.length - 1, skip = 0; i >= 0; i--) {
|
||||
|
||||
var item = matches[i];
|
||||
|
||||
if (item.tag[0] == '/')
|
||||
{
|
||||
skip++;
|
||||
}
|
||||
else if (item.selfclose == false)
|
||||
{
|
||||
if (skip > 0)
|
||||
{
|
||||
skip--;
|
||||
}
|
||||
else
|
||||
{
|
||||
element = '<' + item.tag + '>' + element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
element += getOpenTag(text);
|
||||
}
|
||||
|
||||
return element;
|
||||
};
|
||||
|
||||
var getOpenTag = function(text) {
|
||||
|
||||
var open = text.lastIndexOf('<');
|
||||
var close = text.lastIndexOf('>');
|
||||
|
||||
if (close < open)
|
||||
{
|
||||
text = text.slice(open);
|
||||
|
||||
if(text != '<') {
|
||||
|
||||
var space = text.indexOf(' ');
|
||||
if(space < 0)
|
||||
space = text.indexOf('\t');
|
||||
if(space < 0)
|
||||
space = text.indexOf('\n');
|
||||
|
||||
if (space < 0)
|
||||
space = text.length;
|
||||
|
||||
return text.slice(0, space);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
})();
|
||||
284
applications/admin/static/codemirror/mode/clike/clike.js
vendored
Normal file
284
applications/admin/static/codemirror/mode/clike/clike.js
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit,
|
||||
keywords = parserConfig.keywords || {},
|
||||
builtin = parserConfig.builtin || {},
|
||||
blockKeywords = parserConfig.blockKeywords || {},
|
||||
atoms = parserConfig.atoms || {},
|
||||
hooks = parserConfig.hooks || {},
|
||||
multiLineStrings = parserConfig.multiLineStrings;
|
||||
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
||||
|
||||
var curPunc;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (hooks[ch]) {
|
||||
var result = hooks[ch](stream, state);
|
||||
if (result !== false) return result;
|
||||
}
|
||||
if (ch == '"' || ch == "'") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
||||
curPunc = ch;
|
||||
return null;
|
||||
}
|
||||
if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
}
|
||||
if (ch == "/") {
|
||||
if (stream.eat("*")) {
|
||||
state.tokenize = tokenComment;
|
||||
return tokenComment(stream, state);
|
||||
}
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
var cur = stream.current();
|
||||
if (keywords.propertyIsEnumerable(cur)) {
|
||||
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||
return "keyword";
|
||||
}
|
||||
if (builtin.propertyIsEnumerable(cur)) {
|
||||
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||
return "builtin";
|
||||
}
|
||||
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote && !escaped) {end = true; break;}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end || !(escaped || multiLineStrings))
|
||||
state.tokenize = null;
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = null;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.align = align;
|
||||
this.prev = prev;
|
||||
}
|
||||
function pushContext(state, col, type) {
|
||||
return state.context = new Context(state.indented, col, type, null, state.context);
|
||||
}
|
||||
function popContext(state) {
|
||||
var t = state.context.type;
|
||||
if (t == ")" || t == "]" || t == "}")
|
||||
state.indented = state.context.indented;
|
||||
return state.context = state.context.prev;
|
||||
}
|
||||
|
||||
// Interface
|
||||
|
||||
return {
|
||||
startState: function(basecolumn) {
|
||||
return {
|
||||
tokenize: null,
|
||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
||||
indented: 0,
|
||||
startOfLine: true
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
var ctx = state.context;
|
||||
if (stream.sol()) {
|
||||
if (ctx.align == null) ctx.align = false;
|
||||
state.indented = stream.indentation();
|
||||
state.startOfLine = true;
|
||||
}
|
||||
if (stream.eatSpace()) return null;
|
||||
curPunc = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment" || style == "meta") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
||||
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||
else if (curPunc == "}") {
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
if (ctx.type == "}") ctx = popContext(state);
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
}
|
||||
else if (curPunc == ctx.type) popContext(state);
|
||||
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
||||
pushContext(state, stream.column(), "statement");
|
||||
state.startOfLine = false;
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
||||
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
||||
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
||||
var closing = firstChar == ctx.type;
|
||||
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
|
||||
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
||||
else return ctx.indented + (closing ? 0 : indentUnit);
|
||||
},
|
||||
|
||||
electricChars: "{}"
|
||||
};
|
||||
});
|
||||
|
||||
(function() {
|
||||
function words(str) {
|
||||
var obj = {}, words = str.split(" ");
|
||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
|
||||
"double static else struct entry switch extern typedef float union for unsigned " +
|
||||
"goto while enum void const signed volatile";
|
||||
|
||||
function cppHook(stream, state) {
|
||||
if (!state.startOfLine) return false;
|
||||
stream.skipToEnd();
|
||||
return "meta";
|
||||
}
|
||||
|
||||
// C#-style strings where "" escapes a quote.
|
||||
function tokenAtString(stream, state) {
|
||||
var next;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == '"' && !stream.eat('"')) {
|
||||
state.tokenize = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "string";
|
||||
}
|
||||
|
||||
function mimes(ms, mode) {
|
||||
for (var i = 0; i < ms.length; ++i) CodeMirror.defineMIME(ms[i], mode);
|
||||
}
|
||||
|
||||
mimes(["text/x-csrc", "text/x-c", "text/x-chdr"], {
|
||||
name: "clike",
|
||||
keywords: words(cKeywords),
|
||||
blockKeywords: words("case do else for if switch while struct"),
|
||||
atoms: words("null"),
|
||||
hooks: {"#": cppHook}
|
||||
});
|
||||
mimes(["text/x-c++src", "text/x-c++hdr"], {
|
||||
name: "clike",
|
||||
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
||||
"static_cast typeid catch operator template typename class friend private " +
|
||||
"this using const_cast inline public throw virtual delete mutable protected " +
|
||||
"wchar_t"),
|
||||
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
||||
atoms: words("true false null"),
|
||||
hooks: {"#": cppHook}
|
||||
});
|
||||
CodeMirror.defineMIME("text/x-java", {
|
||||
name: "clike",
|
||||
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
||||
"do double else enum extends final finally float for goto if implements import " +
|
||||
"instanceof int interface long native new package private protected public " +
|
||||
"return short static strictfp super switch synchronized this throw throws transient " +
|
||||
"try void volatile while"),
|
||||
blockKeywords: words("catch class do else finally for if switch try while"),
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
"@": function(stream, state) {
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
return "meta";
|
||||
}
|
||||
}
|
||||
});
|
||||
CodeMirror.defineMIME("text/x-csharp", {
|
||||
name: "clike",
|
||||
keywords: words("abstract as base break case catch checked class const continue" +
|
||||
" default delegate do else enum event explicit extern finally fixed for" +
|
||||
" foreach goto if implicit in interface internal is lock namespace new" +
|
||||
" operator out override params private protected public readonly ref return sealed" +
|
||||
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
|
||||
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
|
||||
" global group into join let orderby partial remove select set value var yield"),
|
||||
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
||||
builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" +
|
||||
" Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" +
|
||||
" UInt64 bool byte char decimal double short int long object" +
|
||||
" sbyte float string ushort uint ulong"),
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
"@": function(stream, state) {
|
||||
if (stream.eat('"')) {
|
||||
state.tokenize = tokenAtString;
|
||||
return tokenAtString(stream, state);
|
||||
}
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
return "meta";
|
||||
}
|
||||
}
|
||||
});
|
||||
CodeMirror.defineMIME("text/x-scala", {
|
||||
name: "clike",
|
||||
keywords: words(
|
||||
|
||||
/* scala */
|
||||
"abstract case catch class def do else extends false final finally for forSome if " +
|
||||
"implicit import lazy match new null object override package private protected return " +
|
||||
"sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
|
||||
"<% >: # @ " +
|
||||
|
||||
/* package scala */
|
||||
"assert assume require print println printf readLine readBoolean readByte readShort " +
|
||||
"readChar readInt readLong readFloat readDouble " +
|
||||
|
||||
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
||||
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
|
||||
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
|
||||
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
|
||||
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
|
||||
|
||||
/* package java.lang */
|
||||
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
||||
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
|
||||
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
|
||||
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
||||
|
||||
|
||||
),
|
||||
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
"@": function(stream, state) {
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
return "meta";
|
||||
}
|
||||
}
|
||||
});
|
||||
}());
|
||||
102
applications/admin/static/codemirror/mode/clike/index.html
vendored
Normal file
102
applications/admin/static/codemirror/mode/clike/index.html
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CodeMirror: C-like mode</title>
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="clike.js"></script>
|
||||
<link rel="stylesheet" href="../../doc/docs.css">
|
||||
<style>.CodeMirror {border: 2px inset #dee;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>CodeMirror: C-like mode</h1>
|
||||
|
||||
<form><textarea id="code" name="code">
|
||||
/* C demo code */
|
||||
|
||||
#include <zmq.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
|
||||
typedef struct {
|
||||
void* arg_socket;
|
||||
zmq_msg_t* arg_msg;
|
||||
char* arg_string;
|
||||
unsigned long arg_len;
|
||||
int arg_int, arg_command;
|
||||
|
||||
int signal_fd;
|
||||
int pad;
|
||||
void* context;
|
||||
sem_t sem;
|
||||
} acl_zmq_context;
|
||||
|
||||
#define p(X) (context->arg_##X)
|
||||
|
||||
void* zmq_thread(void* context_pointer) {
|
||||
acl_zmq_context* context = (acl_zmq_context*)context_pointer;
|
||||
char ok = 'K', err = 'X';
|
||||
int res;
|
||||
|
||||
while (1) {
|
||||
while ((res = sem_wait(&context->sem)) == EINTR);
|
||||
if (res) {write(context->signal_fd, &err, 1); goto cleanup;}
|
||||
switch(p(command)) {
|
||||
case 0: goto cleanup;
|
||||
case 1: p(socket) = zmq_socket(context->context, p(int)); break;
|
||||
case 2: p(int) = zmq_close(p(socket)); break;
|
||||
case 3: p(int) = zmq_bind(p(socket), p(string)); break;
|
||||
case 4: p(int) = zmq_connect(p(socket), p(string)); break;
|
||||
case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break;
|
||||
case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
|
||||
case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
|
||||
case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
|
||||
case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
|
||||
}
|
||||
p(command) = errno;
|
||||
write(context->signal_fd, &ok, 1);
|
||||
}
|
||||
cleanup:
|
||||
close(context->signal_fd);
|
||||
free(context_pointer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* zmq_thread_init(void* zmq_context, int signal_fd) {
|
||||
acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
|
||||
pthread_t thread;
|
||||
|
||||
context->context = zmq_context;
|
||||
context->signal_fd = signal_fd;
|
||||
sem_init(&context->sem, 1, 0);
|
||||
pthread_create(&thread, 0, &zmq_thread, context);
|
||||
pthread_detach(thread);
|
||||
return context;
|
||||
}
|
||||
</textarea></form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-csrc"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>Simple mode that tries to handle C-like languages as well as it
|
||||
can. Takes two configuration parameters: <code>keywords</code>, an
|
||||
object whose property names are the keywords in the language,
|
||||
and <code>useCPP</code>, which determines whether C preprocessor
|
||||
directives are recognized.</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
|
||||
(C code), <code>text/x-c++src</code> (C++
|
||||
code), <code>text/x-java</code> (Java
|
||||
code), <code>text/x-csharp</code> (C#).</p>
|
||||
</body>
|
||||
</html>
|
||||
766
applications/admin/static/codemirror/mode/clike/scala.html
vendored
Normal file
766
applications/admin/static/codemirror/mode/clike/scala.html
vendored
Normal file
@@ -0,0 +1,766 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CodeMirror: C-like mode</title>
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<link rel="stylesheet" href="../../theme/ambiance.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="clike.js"></script>
|
||||
<link rel="stylesheet" href="../../doc/docs.css">
|
||||
<style>
|
||||
body
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
max-width:inherit;
|
||||
height: 100%;
|
||||
}
|
||||
html, form, .CodeMirror, .CodeMirror-scroll
|
||||
{
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<textarea id="code" name="code">
|
||||
|
||||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.collection
|
||||
|
||||
import generic._
|
||||
import mutable.{ Builder, ListBuffer }
|
||||
import annotation.{tailrec, migration, bridge}
|
||||
import annotation.unchecked.{ uncheckedVariance => uV }
|
||||
import parallel.ParIterable
|
||||
|
||||
/** A template trait for traversable collections of type `Traversable[A]`.
|
||||
*
|
||||
* $traversableInfo
|
||||
* @define mutability
|
||||
* @define traversableInfo
|
||||
* This is a base trait of all kinds of $mutability Scala collections. It
|
||||
* implements the behavior common to all collections, in terms of a method
|
||||
* `foreach` with signature:
|
||||
* {{{
|
||||
* def foreach[U](f: Elem => U): Unit
|
||||
* }}}
|
||||
* Collection classes mixing in this trait provide a concrete
|
||||
* `foreach` method which traverses all the
|
||||
* elements contained in the collection, applying a given function to each.
|
||||
* They also need to provide a method `newBuilder`
|
||||
* which creates a builder for collections of the same kind.
|
||||
*
|
||||
* A traversable class might or might not have two properties: strictness
|
||||
* and orderedness. Neither is represented as a type.
|
||||
*
|
||||
* The instances of a strict collection class have all their elements
|
||||
* computed before they can be used as values. By contrast, instances of
|
||||
* a non-strict collection class may defer computation of some of their
|
||||
* elements until after the instance is available as a value.
|
||||
* A typical example of a non-strict collection class is a
|
||||
* <a href="../immutable/Stream.html" target="ContentFrame">
|
||||
* `scala.collection.immutable.Stream`</a>.
|
||||
* A more general class of examples are `TraversableViews`.
|
||||
*
|
||||
* If a collection is an instance of an ordered collection class, traversing
|
||||
* its elements with `foreach` will always visit elements in the
|
||||
* same order, even for different runs of the program. If the class is not
|
||||
* ordered, `foreach` can visit elements in different orders for
|
||||
* different runs (but it will keep the same order in the same run).'
|
||||
*
|
||||
* A typical example of a collection class which is not ordered is a
|
||||
* `HashMap` of objects. The traversal order for hash maps will
|
||||
* depend on the hash codes of its elements, and these hash codes might
|
||||
* differ from one run to the next. By contrast, a `LinkedHashMap`
|
||||
* is ordered because it's `foreach` method visits elements in the
|
||||
* order they were inserted into the `HashMap`.
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
* @since 2.8
|
||||
* @tparam A the element type of the collection
|
||||
* @tparam Repr the type of the actual collection containing the elements.
|
||||
*
|
||||
* @define Coll Traversable
|
||||
* @define coll traversable collection
|
||||
*/
|
||||
trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
|
||||
with FilterMonadic[A, Repr]
|
||||
with TraversableOnce[A]
|
||||
with GenTraversableLike[A, Repr]
|
||||
with Parallelizable[A, ParIterable[A]]
|
||||
{
|
||||
self =>
|
||||
|
||||
import Traversable.breaks._
|
||||
|
||||
/** The type implementing this traversable */
|
||||
protected type Self = Repr
|
||||
|
||||
/** The collection of type $coll underlying this `TraversableLike` object.
|
||||
* By default this is implemented as the `TraversableLike` object itself,
|
||||
* but this can be overridden.
|
||||
*/
|
||||
def repr: Repr = this.asInstanceOf[Repr]
|
||||
|
||||
/** The underlying collection seen as an instance of `$Coll`.
|
||||
* By default this is implemented as the current collection object itself,
|
||||
* but this can be overridden.
|
||||
*/
|
||||
protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
|
||||
|
||||
/** A conversion from collections of type `Repr` to `$Coll` objects.
|
||||
* By default this is implemented as just a cast, but this can be overridden.
|
||||
*/
|
||||
protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
|
||||
|
||||
/** Creates a new builder for this collection type.
|
||||
*/
|
||||
protected[this] def newBuilder: Builder[A, Repr]
|
||||
|
||||
protected[this] def parCombiner = ParIterable.newCombiner[A]
|
||||
|
||||
/** Applies a function `f` to all elements of this $coll.
|
||||
*
|
||||
* Note: this method underlies the implementation of most other bulk operations.
|
||||
* It's important to implement this method in an efficient way.
|
||||
*
|
||||
*
|
||||
* @param f the function that is applied for its side-effect to every element.
|
||||
* The result of function `f` is discarded.
|
||||
*
|
||||
* @tparam U the type parameter describing the result of function `f`.
|
||||
* This result will always be ignored. Typically `U` is `Unit`,
|
||||
* but this is not necessary.
|
||||
*
|
||||
* @usecase def foreach(f: A => Unit): Unit
|
||||
*/
|
||||
def foreach[U](f: A => U): Unit
|
||||
|
||||
/** Tests whether this $coll is empty.
|
||||
*
|
||||
* @return `true` if the $coll contain no elements, `false` otherwise.
|
||||
*/
|
||||
def isEmpty: Boolean = {
|
||||
var result = true
|
||||
breakable {
|
||||
for (x <- this) {
|
||||
result = false
|
||||
break
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/** Tests whether this $coll is known to have a finite size.
|
||||
* All strict collections are known to have finite size. For a non-strict collection
|
||||
* such as `Stream`, the predicate returns `true` if all elements have been computed.
|
||||
* It returns `false` if the stream is not yet evaluated to the end.
|
||||
*
|
||||
* Note: many collection methods will not work on collections of infinite sizes.
|
||||
*
|
||||
* @return `true` if this collection is known to have finite size, `false` otherwise.
|
||||
*/
|
||||
def hasDefiniteSize = true
|
||||
|
||||
def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.seq.size)
|
||||
b ++= thisCollection
|
||||
b ++= that.seq
|
||||
b.result
|
||||
}
|
||||
|
||||
@bridge
|
||||
def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
|
||||
++(that: GenTraversableOnce[B])(bf)
|
||||
|
||||
/** Concatenates this $coll with the elements of a traversable collection.
|
||||
* It differs from ++ in that the right operand determines the type of the
|
||||
* resulting collection rather than the left one.
|
||||
*
|
||||
* @param that the traversable to append.
|
||||
* @tparam B the element type of the returned collection.
|
||||
* @tparam That $thatinfo
|
||||
* @param bf $bfinfo
|
||||
* @return a new collection of type `That` which contains all elements
|
||||
* of this $coll followed by all elements of `that`.
|
||||
*
|
||||
* @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B]
|
||||
*
|
||||
* @return a new $coll which contains all elements of this $coll
|
||||
* followed by all elements of `that`.
|
||||
*/
|
||||
def ++:[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.size)
|
||||
b ++= that
|
||||
b ++= thisCollection
|
||||
b.result
|
||||
}
|
||||
|
||||
/** This overload exists because: for the implementation of ++: we should reuse
|
||||
* that of ++ because many collections override it with more efficient versions.
|
||||
* Since TraversableOnce has no '++' method, we have to implement that directly,
|
||||
* but Traversable and down can use the overload.
|
||||
*/
|
||||
def ++:[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
|
||||
(that ++ seq)(breakOut)
|
||||
|
||||
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
b.sizeHint(this)
|
||||
for (x <- this) b += f(x)
|
||||
b.result
|
||||
}
|
||||
|
||||
def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
for (x <- this) b ++= f(x).seq
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Selects all elements of this $coll which satisfy a predicate.
|
||||
*
|
||||
* @param p the predicate used to test elements.
|
||||
* @return a new $coll consisting of all elements of this $coll that satisfy the given
|
||||
* predicate `p`. The order of the elements is preserved.
|
||||
*/
|
||||
def filter(p: A => Boolean): Repr = {
|
||||
val b = newBuilder
|
||||
for (x <- this)
|
||||
if (p(x)) b += x
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Selects all elements of this $coll which do not satisfy a predicate.
|
||||
*
|
||||
* @param p the predicate used to test elements.
|
||||
* @return a new $coll consisting of all elements of this $coll that do not satisfy the given
|
||||
* predicate `p`. The order of the elements is preserved.
|
||||
*/
|
||||
def filterNot(p: A => Boolean): Repr = filter(!p(_))
|
||||
|
||||
def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
for (x <- this) if (pf.isDefinedAt(x)) b += pf(x)
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Builds a new collection by applying an option-valued function to all
|
||||
* elements of this $coll on which the function is defined.
|
||||
*
|
||||
* @param f the option-valued function which filters and maps the $coll.
|
||||
* @tparam B the element type of the returned collection.
|
||||
* @tparam That $thatinfo
|
||||
* @param bf $bfinfo
|
||||
* @return a new collection of type `That` resulting from applying the option-valued function
|
||||
* `f` to each element and collecting all defined results.
|
||||
* The order of the elements is preserved.
|
||||
*
|
||||
* @usecase def filterMap[B](f: A => Option[B]): $Coll[B]
|
||||
*
|
||||
* @param pf the partial function which filters and maps the $coll.
|
||||
* @return a new $coll resulting from applying the given option-valued function
|
||||
* `f` to each element and collecting all defined results.
|
||||
* The order of the elements is preserved.
|
||||
def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
for (x <- this)
|
||||
f(x) match {
|
||||
case Some(y) => b += y
|
||||
case _ =>
|
||||
}
|
||||
b.result
|
||||
}
|
||||
*/
|
||||
|
||||
/** Partitions this $coll in two ${coll}s according to a predicate.
|
||||
*
|
||||
* @param p the predicate on which to partition.
|
||||
* @return a pair of ${coll}s: the first $coll consists of all elements that
|
||||
* satisfy the predicate `p` and the second $coll consists of all elements
|
||||
* that don't. The relative order of the elements in the resulting ${coll}s
|
||||
* is the same as in the original $coll.
|
||||
*/
|
||||
def partition(p: A => Boolean): (Repr, Repr) = {
|
||||
val l, r = newBuilder
|
||||
for (x <- this) (if (p(x)) l else r) += x
|
||||
(l.result, r.result)
|
||||
}
|
||||
|
||||
def groupBy[K](f: A => K): immutable.Map[K, Repr] = {
|
||||
val m = mutable.Map.empty[K, Builder[A, Repr]]
|
||||
for (elem <- this) {
|
||||
val key = f(elem)
|
||||
val bldr = m.getOrElseUpdate(key, newBuilder)
|
||||
bldr += elem
|
||||
}
|
||||
val b = immutable.Map.newBuilder[K, Repr]
|
||||
for ((k, v) <- m)
|
||||
b += ((k, v.result))
|
||||
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Tests whether a predicate holds for all elements of this $coll.
|
||||
*
|
||||
* $mayNotTerminateInf
|
||||
*
|
||||
* @param p the predicate used to test elements.
|
||||
* @return `true` if the given predicate `p` holds for all elements
|
||||
* of this $coll, otherwise `false`.
|
||||
*/
|
||||
def forall(p: A => Boolean): Boolean = {
|
||||
var result = true
|
||||
breakable {
|
||||
for (x <- this)
|
||||
if (!p(x)) { result = false; break }
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/** Tests whether a predicate holds for some of the elements of this $coll.
|
||||
*
|
||||
* $mayNotTerminateInf
|
||||
*
|
||||
* @param p the predicate used to test elements.
|
||||
* @return `true` if the given predicate `p` holds for some of the
|
||||
* elements of this $coll, otherwise `false`.
|
||||
*/
|
||||
def exists(p: A => Boolean): Boolean = {
|
||||
var result = false
|
||||
breakable {
|
||||
for (x <- this)
|
||||
if (p(x)) { result = true; break }
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/** Finds the first element of the $coll satisfying a predicate, if any.
|
||||
*
|
||||
* $mayNotTerminateInf
|
||||
* $orderDependent
|
||||
*
|
||||
* @param p the predicate used to test elements.
|
||||
* @return an option value containing the first element in the $coll
|
||||
* that satisfies `p`, or `None` if none exists.
|
||||
*/
|
||||
def find(p: A => Boolean): Option[A] = {
|
||||
var result: Option[A] = None
|
||||
breakable {
|
||||
for (x <- this)
|
||||
if (p(x)) { result = Some(x); break }
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
def scan[B >: A, That](z: B)(op: (B, B) => B)(implicit cbf: CanBuildFrom[Repr, B, That]): That = scanLeft(z)(op)
|
||||
|
||||
def scanLeft[B, That](z: B)(op: (B, A) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
b.sizeHint(this, 1)
|
||||
var acc = z
|
||||
b += acc
|
||||
for (x <- this) { acc = op(acc, x); b += acc }
|
||||
b.result
|
||||
}
|
||||
|
||||
@migration(2, 9,
|
||||
"This scanRight definition has changed in 2.9.\n" +
|
||||
"The previous behavior can be reproduced with scanRight.reverse."
|
||||
)
|
||||
def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
var scanned = List(z)
|
||||
var acc = z
|
||||
for (x <- reversed) {
|
||||
acc = op(x, acc)
|
||||
scanned ::= acc
|
||||
}
|
||||
val b = bf(repr)
|
||||
for (elem <- scanned) b += elem
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Selects the first element of this $coll.
|
||||
* $orderDependent
|
||||
* @return the first element of this $coll.
|
||||
* @throws `NoSuchElementException` if the $coll is empty.
|
||||
*/
|
||||
def head: A = {
|
||||
var result: () => A = () => throw new NoSuchElementException
|
||||
breakable {
|
||||
for (x <- this) {
|
||||
result = () => x
|
||||
break
|
||||
}
|
||||
}
|
||||
result()
|
||||
}
|
||||
|
||||
/** Optionally selects the first element.
|
||||
* $orderDependent
|
||||
* @return the first element of this $coll if it is nonempty, `None` if it is empty.
|
||||
*/
|
||||
def headOption: Option[A] = if (isEmpty) None else Some(head)
|
||||
|
||||
/** Selects all elements except the first.
|
||||
* $orderDependent
|
||||
* @return a $coll consisting of all elements of this $coll
|
||||
* except the first one.
|
||||
* @throws `UnsupportedOperationException` if the $coll is empty.
|
||||
*/
|
||||
override def tail: Repr = {
|
||||
if (isEmpty) throw new UnsupportedOperationException("empty.tail")
|
||||
drop(1)
|
||||
}
|
||||
|
||||
/** Selects the last element.
|
||||
* $orderDependent
|
||||
* @return The last element of this $coll.
|
||||
* @throws NoSuchElementException If the $coll is empty.
|
||||
*/
|
||||
def last: A = {
|
||||
var lst = head
|
||||
for (x <- this)
|
||||
lst = x
|
||||
lst
|
||||
}
|
||||
|
||||
/** Optionally selects the last element.
|
||||
* $orderDependent
|
||||
* @return the last element of this $coll$ if it is nonempty, `None` if it is empty.
|
||||
*/
|
||||
def lastOption: Option[A] = if (isEmpty) None else Some(last)
|
||||
|
||||
/** Selects all elements except the last.
|
||||
* $orderDependent
|
||||
* @return a $coll consisting of all elements of this $coll
|
||||
* except the last one.
|
||||
* @throws `UnsupportedOperationException` if the $coll is empty.
|
||||
*/
|
||||
def init: Repr = {
|
||||
if (isEmpty) throw new UnsupportedOperationException("empty.init")
|
||||
var lst = head
|
||||
var follow = false
|
||||
val b = newBuilder
|
||||
b.sizeHint(this, -1)
|
||||
for (x <- this.seq) {
|
||||
if (follow) b += lst
|
||||
else follow = true
|
||||
lst = x
|
||||
}
|
||||
b.result
|
||||
}
|
||||
|
||||
def take(n: Int): Repr = slice(0, n)
|
||||
|
||||
def drop(n: Int): Repr =
|
||||
if (n <= 0) {
|
||||
val b = newBuilder
|
||||
b.sizeHint(this)
|
||||
b ++= thisCollection result
|
||||
}
|
||||
else sliceWithKnownDelta(n, Int.MaxValue, -n)
|
||||
|
||||
def slice(from: Int, until: Int): Repr = sliceWithKnownBound(math.max(from, 0), until)
|
||||
|
||||
// Precondition: from >= 0, until > 0, builder already configured for building.
|
||||
private[this] def sliceInternal(from: Int, until: Int, b: Builder[A, Repr]): Repr = {
|
||||
var i = 0
|
||||
breakable {
|
||||
for (x <- this.seq) {
|
||||
if (i >= from) b += x
|
||||
i += 1
|
||||
if (i >= until) break
|
||||
}
|
||||
}
|
||||
b.result
|
||||
}
|
||||
// Precondition: from >= 0
|
||||
private[scala] def sliceWithKnownDelta(from: Int, until: Int, delta: Int): Repr = {
|
||||
val b = newBuilder
|
||||
if (until <= from) b.result
|
||||
else {
|
||||
b.sizeHint(this, delta)
|
||||
sliceInternal(from, until, b)
|
||||
}
|
||||
}
|
||||
// Precondition: from >= 0
|
||||
private[scala] def sliceWithKnownBound(from: Int, until: Int): Repr = {
|
||||
val b = newBuilder
|
||||
if (until <= from) b.result
|
||||
else {
|
||||
b.sizeHintBounded(until - from, this)
|
||||
sliceInternal(from, until, b)
|
||||
}
|
||||
}
|
||||
|
||||
def takeWhile(p: A => Boolean): Repr = {
|
||||
val b = newBuilder
|
||||
breakable {
|
||||
for (x <- this) {
|
||||
if (!p(x)) break
|
||||
b += x
|
||||
}
|
||||
}
|
||||
b.result
|
||||
}
|
||||
|
||||
def dropWhile(p: A => Boolean): Repr = {
|
||||
val b = newBuilder
|
||||
var go = false
|
||||
for (x <- this) {
|
||||
if (!p(x)) go = true
|
||||
if (go) b += x
|
||||
}
|
||||
b.result
|
||||
}
|
||||
|
||||
def span(p: A => Boolean): (Repr, Repr) = {
|
||||
val l, r = newBuilder
|
||||
var toLeft = true
|
||||
for (x <- this) {
|
||||
toLeft = toLeft && p(x)
|
||||
(if (toLeft) l else r) += x
|
||||
}
|
||||
(l.result, r.result)
|
||||
}
|
||||
|
||||
def splitAt(n: Int): (Repr, Repr) = {
|
||||
val l, r = newBuilder
|
||||
l.sizeHintBounded(n, this)
|
||||
if (n >= 0) r.sizeHint(this, -n)
|
||||
var i = 0
|
||||
for (x <- this) {
|
||||
(if (i < n) l else r) += x
|
||||
i += 1
|
||||
}
|
||||
(l.result, r.result)
|
||||
}
|
||||
|
||||
/** Iterates over the tails of this $coll. The first value will be this
|
||||
* $coll and the final one will be an empty $coll, with the intervening
|
||||
* values the results of successive applications of `tail`.
|
||||
*
|
||||
* @return an iterator over all the tails of this $coll
|
||||
* @example `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)`
|
||||
*/
|
||||
def tails: Iterator[Repr] = iterateUntilEmpty(_.tail)
|
||||
|
||||
/** Iterates over the inits of this $coll. The first value will be this
|
||||
* $coll and the final one will be an empty $coll, with the intervening
|
||||
* values the results of successive applications of `init`.
|
||||
*
|
||||
* @return an iterator over all the inits of this $coll
|
||||
* @example `List(1,2,3).inits = Iterator(List(1,2,3), List(1,2), List(1), Nil)`
|
||||
*/
|
||||
def inits: Iterator[Repr] = iterateUntilEmpty(_.init)
|
||||
|
||||
/** Copies elements of this $coll to an array.
|
||||
* Fills the given array `xs` with at most `len` elements of
|
||||
* this $coll, starting at position `start`.
|
||||
* Copying will stop once either the end of the current $coll is reached,
|
||||
* or the end of the array is reached, or `len` elements have been copied.
|
||||
*
|
||||
* $willNotTerminateInf
|
||||
*
|
||||
* @param xs the array to fill.
|
||||
* @param start the starting index.
|
||||
* @param len the maximal number of elements to copy.
|
||||
* @tparam B the type of the elements of the array.
|
||||
*
|
||||
*
|
||||
* @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit
|
||||
*/
|
||||
def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) {
|
||||
var i = start
|
||||
val end = (start + len) min xs.length
|
||||
breakable {
|
||||
for (x <- this) {
|
||||
if (i >= end) break
|
||||
xs(i) = x
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def toTraversable: Traversable[A] = thisCollection
|
||||
def toIterator: Iterator[A] = toStream.iterator
|
||||
def toStream: Stream[A] = toBuffer.toStream
|
||||
|
||||
/** Converts this $coll to a string.
|
||||
*
|
||||
* @return a string representation of this collection. By default this
|
||||
* string consists of the `stringPrefix` of this $coll,
|
||||
* followed by all elements separated by commas and enclosed in parentheses.
|
||||
*/
|
||||
override def toString = mkString(stringPrefix + "(", ", ", ")")
|
||||
|
||||
/** Defines the prefix of this object's `toString` representation.
|
||||
*
|
||||
* @return a string representation which starts the result of `toString`
|
||||
* applied to this $coll. By default the string prefix is the
|
||||
* simple name of the collection class $coll.
|
||||
*/
|
||||
def stringPrefix : String = {
|
||||
var string = repr.asInstanceOf[AnyRef].getClass.getName
|
||||
val idx1 = string.lastIndexOf('.' : Int)
|
||||
if (idx1 != -1) string = string.substring(idx1 + 1)
|
||||
val idx2 = string.indexOf('$')
|
||||
if (idx2 != -1) string = string.substring(0, idx2)
|
||||
string
|
||||
}
|
||||
|
||||
/** Creates a non-strict view of this $coll.
|
||||
*
|
||||
* @return a non-strict view of this $coll.
|
||||
*/
|
||||
def view = new TraversableView[A, Repr] {
|
||||
protected lazy val underlying = self.repr
|
||||
override def foreach[U](f: A => U) = self foreach f
|
||||
}
|
||||
|
||||
/** Creates a non-strict view of a slice of this $coll.
|
||||
*
|
||||
* Note: the difference between `view` and `slice` is that `view` produces
|
||||
* a view of the current $coll, whereas `slice` produces a new $coll.
|
||||
*
|
||||
* Note: `view(from, to)` is equivalent to `view.slice(from, to)`
|
||||
* $orderDependent
|
||||
*
|
||||
* @param from the index of the first element of the view
|
||||
* @param until the index of the element following the view
|
||||
* @return a non-strict view of a slice of this $coll, starting at index `from`
|
||||
* and extending up to (but not including) index `until`.
|
||||
*/
|
||||
def view(from: Int, until: Int): TraversableView[A, Repr] = view.slice(from, until)
|
||||
|
||||
/** Creates a non-strict filter of this $coll.
|
||||
*
|
||||
* Note: the difference between `c filter p` and `c withFilter p` is that
|
||||
* the former creates a new collection, whereas the latter only
|
||||
* restricts the domain of subsequent `map`, `flatMap`, `foreach`,
|
||||
* and `withFilter` operations.
|
||||
* $orderDependent
|
||||
*
|
||||
* @param p the predicate used to test elements.
|
||||
* @return an object of class `WithFilter`, which supports
|
||||
* `map`, `flatMap`, `foreach`, and `withFilter` operations.
|
||||
* All these operations apply to those elements of this $coll which
|
||||
* satisfy the predicate `p`.
|
||||
*/
|
||||
def withFilter(p: A => Boolean): FilterMonadic[A, Repr] = new WithFilter(p)
|
||||
|
||||
/** A class supporting filtered operations. Instances of this class are
|
||||
* returned by method `withFilter`.
|
||||
*/
|
||||
class WithFilter(p: A => Boolean) extends FilterMonadic[A, Repr] {
|
||||
|
||||
/** Builds a new collection by applying a function to all elements of the
|
||||
* outer $coll containing this `WithFilter` instance that satisfy predicate `p`.
|
||||
*
|
||||
* @param f the function to apply to each element.
|
||||
* @tparam B the element type of the returned collection.
|
||||
* @tparam That $thatinfo
|
||||
* @param bf $bfinfo
|
||||
* @return a new collection of type `That` resulting from applying
|
||||
* the given function `f` to each element of the outer $coll
|
||||
* that satisfies predicate `p` and collecting the results.
|
||||
*
|
||||
* @usecase def map[B](f: A => B): $Coll[B]
|
||||
*
|
||||
* @return a new $coll resulting from applying the given function
|
||||
* `f` to each element of the outer $coll that satisfies
|
||||
* predicate `p` and collecting the results.
|
||||
*/
|
||||
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
for (x <- self)
|
||||
if (p(x)) b += f(x)
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Builds a new collection by applying a function to all elements of the
|
||||
* outer $coll containing this `WithFilter` instance that satisfy
|
||||
* predicate `p` and concatenating the results.
|
||||
*
|
||||
* @param f the function to apply to each element.
|
||||
* @tparam B the element type of the returned collection.
|
||||
* @tparam That $thatinfo
|
||||
* @param bf $bfinfo
|
||||
* @return a new collection of type `That` resulting from applying
|
||||
* the given collection-valued function `f` to each element
|
||||
* of the outer $coll that satisfies predicate `p` and
|
||||
* concatenating the results.
|
||||
*
|
||||
* @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B]
|
||||
*
|
||||
* @return a new $coll resulting from applying the given collection-valued function
|
||||
* `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results.
|
||||
*/
|
||||
def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
|
||||
val b = bf(repr)
|
||||
for (x <- self)
|
||||
if (p(x)) b ++= f(x).seq
|
||||
b.result
|
||||
}
|
||||
|
||||
/** Applies a function `f` to all elements of the outer $coll containing
|
||||
* this `WithFilter` instance that satisfy predicate `p`.
|
||||
*
|
||||
* @param f the function that is applied for its side-effect to every element.
|
||||
* The result of function `f` is discarded.
|
||||
*
|
||||
* @tparam U the type parameter describing the result of function `f`.
|
||||
* This result will always be ignored. Typically `U` is `Unit`,
|
||||
* but this is not necessary.
|
||||
*
|
||||
* @usecase def foreach(f: A => Unit): Unit
|
||||
*/
|
||||
def foreach[U](f: A => U): Unit =
|
||||
for (x <- self)
|
||||
if (p(x)) f(x)
|
||||
|
||||
/** Further refines the filter for this $coll.
|
||||
*
|
||||
* @param q the predicate used to test elements.
|
||||
* @return an object of class `WithFilter`, which supports
|
||||
* `map`, `flatMap`, `foreach`, and `withFilter` operations.
|
||||
* All these operations apply to those elements of this $coll which
|
||||
* satisfy the predicate `q` in addition to the predicate `p`.
|
||||
*/
|
||||
def withFilter(q: A => Boolean): WithFilter =
|
||||
new WithFilter(x => p(x) && q(x))
|
||||
}
|
||||
|
||||
// A helper for tails and inits.
|
||||
private def iterateUntilEmpty(f: Traversable[A @uV] => Traversable[A @uV]): Iterator[Repr] = {
|
||||
val it = Iterator.iterate(thisCollection)(f) takeWhile (x => !x.isEmpty)
|
||||
it ++ Iterator(Nil) map (newBuilder ++= _ result)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</textarea>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
theme: "ambiance",
|
||||
mode: "text/x-scala"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
22
applications/admin/static/codemirror/mode/coffeescript/LICENSE
vendored
Normal file
22
applications/admin/static/codemirror/mode/coffeescript/LICENSE
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Jeff Pickhardt
|
||||
Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user