Compare commits
418 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c30ff4d3e | |||
| 3269f02ba7 | |||
| e5c2e3b3eb | |||
| 77f4aee0af | |||
| 868cbdfc7b | |||
| a650c0eab8 | |||
| a7dc8d8c6f | |||
| 355db16d2c | |||
| c54ce41eb7 | |||
| afb7d4c9d1 | |||
| b55cdde9da | |||
| 93cbc6c770 | |||
| 3b1b4a0a96 | |||
| 10b45cb54d | |||
| 9d289e571b | |||
| cce871c30e | |||
| c2b605a90f | |||
| 09149592b5 | |||
| e7410e551b | |||
| 9d77bc4192 | |||
| 537fa0c423 | |||
| c78dbc8bc1 | |||
| 249eed5c2c | |||
| 55eb3b24f7 | |||
| 508c255d0f | |||
| 9f8a90c0ac | |||
| 861dc935cb | |||
| 96ef8cacea | |||
| 5f3ecc8713 | |||
| 8b8ef0eb46 | |||
| 2dbea54c84 | |||
| a776d9fb6f | |||
| 57b7bbff5a | |||
| a832b0ed54 | |||
| 3ec75b84ae | |||
| b932763080 | |||
| 374f8f2f69 | |||
| 226c253d5a | |||
| c78a9f7950 | |||
| 7264510ab2 | |||
| 3458ec6511 | |||
| 2c80db6678 | |||
| 439aa6e4f5 | |||
| adf544dca9 | |||
| 0965269ee9 | |||
| 19d370c4e9 | |||
| cee0f8b652 | |||
| 37664d3487 | |||
| 5a78015d81 | |||
| 7250962ba3 | |||
| 442120bfdb | |||
| de624d1e54 | |||
| 523029cc45 | |||
| 934affe419 | |||
| 55b9af1589 | |||
| 16dd7e46ef | |||
| 851c77d8f2 | |||
| ee55b74898 | |||
| 13fc1e5c66 | |||
| 87112c2942 | |||
| 2664fdca30 | |||
| e05f523145 | |||
| 1148d29439 | |||
| 7ba52978d1 | |||
| 138a9fee43 | |||
| 1d522eaf0d | |||
| b5c5da64c9 | |||
| 8466425836 | |||
| b774ee5cd0 | |||
| 7e2e0e926b | |||
| 30f673c63c | |||
| bb5be728e3 | |||
| 0be5d1c657 | |||
| d143e6be06 | |||
| e65a78a5f5 | |||
| 4f443a3c62 | |||
| ff82ddea97 | |||
| 2e2d3f5e87 | |||
| 491b1041f8 | |||
| ce192d33f7 | |||
| ca1cb64026 | |||
| 71b5f5e469 | |||
| 946567f903 | |||
| 036e739511 | |||
| 87a95b85c5 | |||
| 4f49859bf7 | |||
| 2c53e55533 | |||
| 2ae75978dd | |||
| 452d825e66 | |||
| a7a1c4f81e | |||
| 00740eb9e8 | |||
| d76264c255 | |||
| 2297ce418d | |||
| fec85e6c59 | |||
| 54efa35fb3 | |||
| 988aebf630 | |||
| d2f7766aea | |||
| 25d30aee64 | |||
| 8af92da23c | |||
| 08dd36e1b0 | |||
| 324ff0a17c | |||
| cfb372e5e2 | |||
| 6513c732ba | |||
| c4ea869223 | |||
| 5387267675 | |||
| 8e4c3cc562 | |||
| 8b6b0699e5 | |||
| 229bff1658 | |||
| 7a59d37350 | |||
| d06b1e7883 | |||
| c8a284db9d | |||
| c7d6aceff4 | |||
| 7ea45d5e89 | |||
| 48c4aafb15 | |||
| ff302ed842 | |||
| 20a2424b83 | |||
| de0f34a27a | |||
| d0992cce3f | |||
| 15feeb3614 | |||
| fc0a879e52 | |||
| 9b675146a2 | |||
| 4d0bdcc8c0 | |||
| 0abdb67687 | |||
| d1fb98cf1b | |||
| 5eac24eacb | |||
| 3fd16daeca | |||
| d9b38c3b73 | |||
| 0a5176c1ee | |||
| b836b0e273 | |||
| 9a41e2a65d | |||
| cb1b74ed7b | |||
| e25e5d9768 | |||
| 9f3766952f | |||
| cb4471b07f | |||
| 9fa7eac41f | |||
| 94fa985550 | |||
| 1c498ead35 | |||
| 5abc983172 | |||
| 7a0d4919b0 | |||
| d5e9183877 | |||
| 9b39a51e9f | |||
| bec7eabd1c | |||
| cd3791087f | |||
| 714985e377 | |||
| 76c37dce96 | |||
| 5a9af40058 | |||
| e871ff35b7 | |||
| ecc6c32933 | |||
| 831cf61a08 | |||
| cc1231dece | |||
| bb3d1a165b | |||
| 3da0426c54 | |||
| e01aa25be3 | |||
| ee2f9d8dcb | |||
| 4d8677965c | |||
| 72729d5510 | |||
| 0b57e70c87 | |||
| 033d6489f8 | |||
| 8608007337 | |||
| 665e493570 | |||
| eb1e2f60f3 | |||
| dc637f0a9b | |||
| f81634728d | |||
| 440cd5ebc0 | |||
| 1cd7d0f205 | |||
| a69d62911c | |||
| 395e9bd006 | |||
| 90e20810d5 | |||
| 9c714e7687 | |||
| 6c3523d61c | |||
| 183840b793 | |||
| 4e2856aa64 | |||
| 4627a39165 | |||
| c87cbe83d2 | |||
| f05282badf | |||
| 957879346e | |||
| 87e64f67f3 | |||
| 43840d246d | |||
| 4aeb9af8a7 | |||
| b37acb8bc6 | |||
| 433865e927 | |||
| 5428161e0f | |||
| db0b536b5b | |||
| a4e50908fb | |||
| 96b89fe83d | |||
| adb131f131 | |||
| 757ab87e8a | |||
| f1d1db1159 | |||
| 3942bf60a6 | |||
| e2c0dcc0da | |||
| f63180d8d8 | |||
| 999bbf3d50 | |||
| eab612bdd0 | |||
| 1147186b4c | |||
| a88314e061 | |||
| 9221f5528d | |||
| 520f60cd65 | |||
| 84c85774e8 | |||
| 1f118deed9 | |||
| 55ce07ae73 | |||
| 85677d5e91 | |||
| 04f9be15b8 | |||
| 09cd72a829 | |||
| f5f5ad70e3 | |||
| a0774b320a | |||
| 4feea6051a | |||
| f548ea757b | |||
| abc8ea5280 | |||
| bacd2313fb | |||
| 63295d3f9b | |||
| 9c25eb20cf | |||
| 7f533f33ae | |||
| 352b4e1ed8 | |||
| 9a4252b579 | |||
| ed7011c229 | |||
| 4ddd6a5207 | |||
| 0a74c7cfd2 | |||
| d84fdc7599 | |||
| dac1268266 | |||
| b42db1c7c1 | |||
| 7a7a27c5c7 | |||
| af83186b10 | |||
| a8646f8fe7 | |||
| 01c1e30284 | |||
| b3980f9e39 | |||
| c9fd50d23e | |||
| ea3544f46d | |||
| 4e04f5f540 | |||
| b1021cf233 | |||
| 8fa3529123 | |||
| 3b494c235a | |||
| 1641c3e3e8 | |||
| ccd5d850ac | |||
| b989f160cf | |||
| 54e144564c | |||
| ab8599da6d | |||
| 0885702873 | |||
| 0083bc9302 | |||
| cbc0821928 | |||
| 7a70169d06 | |||
| bf2377ac11 | |||
| 1f79126b27 | |||
| 624e324383 | |||
| 846ebb285e | |||
| e567759935 | |||
| fe706c184e | |||
| 90bbb8e348 | |||
| e21ec540c2 | |||
| 2a4517ced4 | |||
| 8c8d151b3e | |||
| 44a3cf1934 | |||
| 5dcd3c8c8f | |||
| 251bd7cd3d | |||
| 02dfb0a8c1 | |||
| 544d499ab1 | |||
| 8ebc2f7079 | |||
| a31ba16070 | |||
| 60e3baad8a | |||
| f720a84831 | |||
| b74b2c4399 | |||
| 252aa10d75 | |||
| 6f3d362920 | |||
| 9b54e4c79f | |||
| f908d0d170 | |||
| 852ecdd1a9 | |||
| 78f5df5e56 | |||
| 580a61a515 | |||
| 4faf5a0150 | |||
| 1201d2434a | |||
| e1ca392da6 | |||
| 3ee6d22727 | |||
| 28a0329f65 | |||
| 2dc696c940 | |||
| e3acef0e91 | |||
| 62601f1adc | |||
| 982915a22f | |||
| 9f1bbd097f | |||
| 694bd6e74a | |||
| 394cf0bc8e | |||
| 09257deaae | |||
| 21c4b0dd95 | |||
| 3b4662b583 | |||
| 2e2e6457c7 | |||
| 631a7cccd6 | |||
| 2a3d51c7dc | |||
| e7e8a17b61 | |||
| 8fd8a56893 | |||
| 443c453507 | |||
| 0495c89ba1 | |||
| 78e4dfbece | |||
| 1c7a481ed9 | |||
| c3dedcbba5 | |||
| 1c767a0e9f | |||
| f3b0ba49e0 | |||
| 31dfcbaa9e | |||
| 8e11c5f46d | |||
| 70793ff559 | |||
| 6621e71e6c | |||
| 2af164ee9e | |||
| 9227f0a195 | |||
| f18330b494 | |||
| bb32339ab4 | |||
| ddf4378dfe | |||
| 2a607e209b | |||
| a3d85ae8c3 | |||
| fef62b63cb | |||
| 93ec80f773 | |||
| 8e3795c317 | |||
| cb1a633dc5 | |||
| ace4db6938 | |||
| b770062788 | |||
| 4c4dc5398a | |||
| 091945152f | |||
| 4838611273 | |||
| 144f9959c9 | |||
| 291c6a8fa0 | |||
| d5d3581b78 | |||
| 64d90b027c | |||
| a0e9989734 | |||
| b81aa923d6 | |||
| 610925bc5a | |||
| 86eda9bb10 | |||
| ca06aa9a6f | |||
| ca57d9e83d | |||
| 904f975f0c | |||
| 9b9212cf4c | |||
| 404419d1c3 | |||
| 4ee94a6574 | |||
| f929df0419 | |||
| 57587dafbe | |||
| 31a95e81b3 | |||
| 70a4e9551b | |||
| e1a705f975 | |||
| 9057ec82d8 | |||
| 1b53e36666 | |||
| 10fa5c7bd2 | |||
| 06e72a5a60 | |||
| 8fa62fc300 | |||
| 6c345fc508 | |||
| a34eac4ecb | |||
| 10c121e603 | |||
| 2b910167f4 | |||
| 7d5311a075 | |||
| f5581c4b49 | |||
| e09f7cd49c | |||
| 4dab03b61b | |||
| 2b5e017aa1 | |||
| 8b3d944fd2 | |||
| 2d886fd38a | |||
| 80088832b9 | |||
| be1883f317 | |||
| 30119e0c77 | |||
| c90c3b1544 | |||
| 578386f083 | |||
| 3d21ed362e | |||
| 9cf469b035 | |||
| 462c93ae43 | |||
| bda3b7b24d | |||
| d861a22cdd | |||
| 0de1a182da | |||
| b030554348 | |||
| 858bfa9ccd | |||
| ee8ec78da7 | |||
| c8f684895c | |||
| 138a155ba4 | |||
| ad749bf345 | |||
| ff0d59c16b | |||
| df75d2d60c | |||
| 2713aabeaf | |||
| 796d1b44c2 | |||
| 470a7b8f52 | |||
| f699b82a9f | |||
| 44edb8c7da | |||
| bc4fc0edd9 | |||
| 6545fa691b | |||
| 4954553927 | |||
| 9c50ba9eeb | |||
| 9a67da145a | |||
| ca7d82278c | |||
| f6245c53dd | |||
| 6888420cc6 | |||
| c5631f5b7d | |||
| 34e0b49d72 | |||
| bd072264ef | |||
| cfb2d24c71 | |||
| fe0eb72fa3 | |||
| 2783257f06 | |||
| cc11cb866c | |||
| 6a02643bda | |||
| 7f269c8da3 | |||
| ef7f7cebd1 | |||
| 05c24fd5e3 | |||
| b08b97bd28 | |||
| dbb6ce2f71 | |||
| f66f14b593 | |||
| 8a52315dee | |||
| 7c4052906c | |||
| 3a56f39f6a | |||
| 6585ca5dd0 | |||
| 792abae07e | |||
| 74ce648c59 | |||
| 2686e96046 | |||
| 213e2bb432 | |||
| 79bb5c10ab | |||
| 7ea012d786 | |||
| 43591f75de | |||
| 05d82c0569 | |||
| 76c8d3206c | |||
| 00751d05b4 | |||
| b5be5df11a | |||
| 7d159273fc | |||
| 70127922ab | |||
| b95df93775 | |||
| dc06edcf5b | |||
| fdc437dcd5 | |||
| f6873c9612 | |||
| 93754ab32d | |||
| 5759334635 |
@@ -0,0 +1,32 @@
|
||||
# https://help.github.com/articles/dealing-with-line-endings
|
||||
#
|
||||
# For Mac & Linux
|
||||
# git config --global core.autocrlf input
|
||||
#
|
||||
# For windows
|
||||
# git config --global core.autocrlf true
|
||||
#
|
||||
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files we want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.txt text
|
||||
*.md text
|
||||
*.rb text
|
||||
*.js text
|
||||
*.html text
|
||||
*.yml text
|
||||
*.mustache text
|
||||
*.css text
|
||||
Rakefile text
|
||||
Gemfile text
|
||||
LICENSE text
|
||||
COPYRIGHT text
|
||||
gollum text
|
||||
.gitattributes text
|
||||
.gitignore text
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
@@ -5,3 +5,4 @@ pkg
|
||||
Gemfile.lock
|
||||
*.gem
|
||||
*.swp
|
||||
.*
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.3
|
||||
notifications:
|
||||
disabled: true
|
||||
- 2.0.0
|
||||
- 2.1.0
|
||||
- 2.1.1
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y --force-yes asciidoc
|
||||
- sudo apt-get install libicu-dev
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
source 'http://rubygems.org'
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gemspec
|
||||
gem 'rake', '~> 0.9'
|
||||
gem 'rake', '~> 10.4'
|
||||
|
||||
+22
@@ -1,3 +1,25 @@
|
||||
# 3.1.1 /2014-12-04
|
||||
|
||||
* Security fix for [remote code execution issue](https://github.com/gollum/gollum/issues/913). Please update!
|
||||
|
||||
# 3.1 / 2014-11-28
|
||||
|
||||
* New features
|
||||
* Drag-and-drop uploading in the editor [@lucas-clemente](https://github.com/lucas-clemente)
|
||||
* Latest changes view [@etienneCharignon](https://github.com/etienneCharignon) (#707)
|
||||
* Option `--no-edit` to disable editing from the web interface [@bambycha](https://github.com/bambycha) (#879)
|
||||
* Option `--mathjax-config` to specify custom mathjax configuration [@hardywu](https://github.com/hardywu) (#842)
|
||||
* Major enhancements
|
||||
* Made the Gollum theme responsive [@rtrvrtg](https://github.com/rtrvrtg) (#831)
|
||||
* Depends on new [gollum-lib](https://github.com/gollum/gollum-lib) `4.0.0`
|
||||
* Allows specifiying [git adapter](https://github.com/gollum/gollum/wiki/Git-adapters) with `--adapter` [@bartkamphorst](https://github.com/bartkamphorst), [@dometto](https://github.com/dometto)
|
||||
* Numerous bugfixes
|
||||
* **NB**: please pass `--h1-title` if you do not want page titles to default to the page's filepath. See [here](https://github.com/gollum/gollum/wiki/Page-titles).
|
||||
|
||||
# 2.4.11 / 2013-01-08
|
||||
|
||||
* Numerous security issues have been fixed. Please update to `2.4.11`
|
||||
|
||||
# 1.4.0 / 2012-04-10
|
||||
|
||||
* Minor
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
gollum -- A wiki built on top of Git
|
||||
====================================
|
||||
|
||||
[](http://travis-ci.org/github/gollum)
|
||||
[](https://gemnasium.com/github/gollum)
|
||||
[](http://badge.fury.io/rb/gollum)
|
||||
[](https://travis-ci.org/gollum/gollum)
|
||||
[](https://gemnasium.com/gollum/gollum)
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
|
||||
Gollum is a simple wiki system built on top of Git.
|
||||
|
||||
Gollum wikis are simply Git repositories that adhere to a specific format.
|
||||
Gollum pages may be written in a variety of formats and can be edited in a
|
||||
@@ -20,30 +21,41 @@ Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
|
||||
[TomDoc](http://tomdoc.org/) for inline documentation.
|
||||
|
||||
## SYSTEM REQUIREMENTS
|
||||
|
||||
- Python 2.5+ (2.7.3 recommended)
|
||||
- Ruby 1.8.7+ (1.9.3 recommended)
|
||||
- Ruby 1.9.3+ (1.9.3 recommended)
|
||||
- Unix like operating system (OS X, Ubuntu, Debian, and more)
|
||||
- Will not work on Windows (because of [grit](https://github.com/github/grit))
|
||||
|
||||
## SECURITY
|
||||
|
||||
Don't enable `--custom-css`, `--custom-js` or `--mathjax-config` unless you trust every user who has the ability to edit the wiki.
|
||||
A better solution with more security is being tracked in [#665](https://github.com/gollum/gollum/issues/665).
|
||||
|
||||
## INSTALLATION
|
||||
|
||||
The best way to install Gollum is with RubyGems:
|
||||
|
||||
$ [sudo] gem install gollum
|
||||
```bash
|
||||
$ [sudo] gem install gollum
|
||||
```
|
||||
You may first need to install some additional [development packages](https://github.com/gollum/gollum/wiki/Installation) for your OS.
|
||||
|
||||
If you're installing from source, you can use [Bundler][bundler] to pick up all the
|
||||
gems:
|
||||
|
||||
$ bundle install
|
||||
```bash
|
||||
$ bundle install
|
||||
```
|
||||
|
||||
In order to use the various formats that Gollum supports, you will need to
|
||||
separately install the necessary dependencies for each format. You only need
|
||||
to install the dependencies for the formats that you plan to use.
|
||||
|
||||
* [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` on mac or `apt-get install -y asciidoc` on Ubuntu
|
||||
* [AsciiDoc](http://asciidoctor.org) -- `gem install asciidoctor`
|
||||
* [Creole](http://wikicreole.org/) -- `gem install creole`
|
||||
* [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
|
||||
* [GitHub Flavored Markdown](http://github.github.com/github-flavored-markdown/) -- `gem install github-markdown`
|
||||
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `gem install github-markdown`
|
||||
* [Org](http://orgmode.org/) -- `gem install org-ruby`
|
||||
* [Pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
|
||||
* [RDoc](http://rdoc.sourceforge.net/)
|
||||
@@ -53,494 +65,108 @@ to install the dependencies for the formats that you plan to use.
|
||||
|
||||
[bundler]: http://gembundler.com/
|
||||
|
||||
|
||||
## SYNTAX
|
||||
|
||||
Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …).
|
||||
On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
|
||||
|
||||
Check out the [Gollum Wiki](https://github.com/gollum/gollum/wiki) for all of Gollum's formats and syntactic options.
|
||||
|
||||
|
||||
## RUNNING
|
||||
|
||||
To view and edit your Gollum repository locally via the built in web
|
||||
interface, simply install the Gollum gem, navigate to your repository via the
|
||||
command line, and run the executable:
|
||||
|
||||
$ gollum
|
||||
```bash
|
||||
$ gollum
|
||||
```
|
||||
|
||||
This will start up a web server running the Gollum frontend and you can view
|
||||
and edit your wiki at http://localhost:4567. To get help on the command line
|
||||
utility, you can run it like so:
|
||||
|
||||
$ gollum --help
|
||||
```bash
|
||||
$ gollum --help
|
||||
```
|
||||
|
||||
This will show you the options you can pass as arguments to the `gollum` command:
|
||||
|
||||
```bash
|
||||
Options:
|
||||
--port [PORT] Bind port (default 4567).
|
||||
--host [HOST] Hostname or IP address to listen on (default 0.0.0.0).
|
||||
--version Display current version.
|
||||
--config [CONFIG] Path to additional configuration file.
|
||||
--adapter [ADAPTER] Git adapter to use in the backend. Defaults to grit.
|
||||
--irb Start an irb process with gollum loaded for the current wiki.
|
||||
--css Inject custom css. Uses custom.css from root repository.
|
||||
--js Inject custom js. Uses custom.js from root repository.
|
||||
--template-dir [PATH] Specify custom template directory.
|
||||
--page-file-dir [PATH] Specify the sub directory for all page files (default: repository root).
|
||||
--base-path [PATH] Specify the base path for the served pages (default: /) Example: --base-path wiki yields the home page accessible at http://localhost:4567/wiki/.
|
||||
--gollum-path [PATH] Specify the path to the git repository to be served.
|
||||
--ref [REF] Specify the repository ref to use (default: master).
|
||||
--bare Specify that the repository is bare (only necessary when using the grit adapter).
|
||||
--no-edit Restricts editing capability through frontend.
|
||||
--no-live-preview Disables livepreview.
|
||||
--live-preview Enables livepreview.
|
||||
--allow-uploads [MODE] Allows file uploads. Modes: dir (default, store all uploads in the same directory), page (store each upload at the same location as the page).
|
||||
--mathjax Enables mathjax for rendering mathematical equations. Uses the TeX-AMS-MML_HTMLorMML config with the autoload-all extension by default.
|
||||
--mathjax-config [SOURCE] Inject custom mathjax config file. Uses mathjax.config.js from root repository by default.
|
||||
--user-icons [SOURCE] Set the history user icons. Valid values: gravatar, identicon, none. Default: none.
|
||||
--show-all Shows all files in file view. By default only valid pages are shown.
|
||||
--collapse-tree Collapse file view tree. By default, expanded tree is shown.
|
||||
--h1-title Sets page title to value of first h1.
|
||||
```
|
||||
|
||||
Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn (which is used by Grit).
|
||||
|
||||
## REPO STRUCTURE
|
||||
|
||||
A Gollum repository's contents are designed to be human editable. Page content
|
||||
is written in `page files` and may be organized into directories any way you
|
||||
choose. Special footers can be created in `footer files`. Other content
|
||||
(images, PDFs, etc) may also be present and organized in the same way.
|
||||
|
||||
|
||||
## PAGE FILES
|
||||
|
||||
Page files may be written in any format supported by
|
||||
[GitHub-Markup](http://github.com/github/markup) (except roff). The
|
||||
current list of formats and allowed extensions is:
|
||||
|
||||
* ASCIIDoc: .asciidoc
|
||||
* Creole: .creole
|
||||
* Markdown: .markdown, .mdown, .mkdn, .mkd, .md
|
||||
* Org Mode: .org
|
||||
* Pod: .pod
|
||||
* RDoc: .rdoc
|
||||
* ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
|
||||
* Textile: .textile
|
||||
* MediaWiki: .mediawiki, .wiki
|
||||
|
||||
Gollum detects the page file format via the extension, so files must have one
|
||||
of the supported extensions in order to be converted.
|
||||
|
||||
Page file names may contain any printable UTF-8 character except space
|
||||
(U+0020) and forward slash (U+002F). If you commit a page file with any of
|
||||
these characters in the name it will not be accessible via the web interface.
|
||||
|
||||
Even though page files may be placed in any directory, there is still only a
|
||||
single namespace for page names, so all page files should have globally unique
|
||||
names regardless of where they are located in the repository.
|
||||
|
||||
The special page file `Home.ext` (where the extension is one of the supported
|
||||
formats) will be used as the entrance page to your wiki. If it is missing, an
|
||||
automatically generated table of contents will be shown instead.
|
||||
|
||||
## SIDEBAR FILES
|
||||
|
||||
Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
|
||||
are named `_Sidebar.ext` where the extension is one of the supported formats.
|
||||
Sidebars affect all pages in their directory and any subdirectories that do not
|
||||
have a sidebar file of their own.
|
||||
|
||||
## HEADER FILES
|
||||
|
||||
Header files allow you to add a simple header to your wiki. Header files must
|
||||
be named `_Header.ext` where the extension is one of the supported formats.
|
||||
Like sidebars, headers affect all pages in their directory and any
|
||||
subdirectories that do not have a header file of their own.
|
||||
|
||||
## FOOTER FILES
|
||||
|
||||
Footer files allow you to add a simple footer to your wiki. Footer files must
|
||||
be named `_Footer.ext` where the extension is one of the supported formats.
|
||||
Like sidebars, footers affect all pages in their directory and any
|
||||
subdirectories that do not have a footer file of their own.
|
||||
|
||||
## HTML SANITIZATION
|
||||
|
||||
For security and compatibility reasons Gollum wikis may not contain custom CSS
|
||||
or JavaScript. These tags will be stripped from the converted HTML. See
|
||||
`docs/sanitization.md` for more details on what tags and attributes are
|
||||
allowed.
|
||||
|
||||
|
||||
## BRACKET TAGS
|
||||
|
||||
A variety of Gollum tags use a double bracket syntax. For example:
|
||||
|
||||
[[Link]]
|
||||
|
||||
Some tags will accept attributes which are separated by pipe symbols. For
|
||||
example:
|
||||
|
||||
[[Link|Page Title]]
|
||||
|
||||
In all cases, the first thing in the link is what is displayed on the page.
|
||||
So, if the tag is an internal wiki link, the first thing in the tag will be
|
||||
the link text displayed on the page. If the tag is an embedded image, the
|
||||
first thing in the tag will be a path to an image file. Use this trick to
|
||||
easily remember which order things should appear in tags.
|
||||
|
||||
Some formats, such as MediaWiki, support the opposite syntax:
|
||||
|
||||
[[Page Title|Link]]
|
||||
|
||||
## PAGE LINKS
|
||||
|
||||
To link to another Gollum wiki page, use the Gollum Page Link Tag.
|
||||
|
||||
[[Frodo Baggins]]
|
||||
|
||||
The above tag will create a link to the corresponding page file named
|
||||
`Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
|
||||
conversion is as follows:
|
||||
|
||||
1. Replace any spaces (U+0020) with dashes (U+002D)
|
||||
2. Replace any slashes (U+002F) with dashes (U+002D)
|
||||
|
||||
If you'd like the link text to be something that doesn't map directly to the
|
||||
page name, you can specify the actual page name after a pipe:
|
||||
|
||||
[[Frodo|Frodo Baggins]]
|
||||
|
||||
The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
|
||||
|
||||
The page file may exist anywhere in the directory structure of the repository.
|
||||
Gollum does a breadth first search and uses the first match that it finds.
|
||||
|
||||
Here are a few more examples:
|
||||
|
||||
[[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
|
||||
[[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
|
||||
[[モルドール]] -> モルドール.ext
|
||||
|
||||
|
||||
## EXTERNAL LINKS
|
||||
|
||||
As a convenience, simple external links can be placed within brackets and they
|
||||
will be linked to the given URL with the URL as the link text. For example:
|
||||
|
||||
[[http://example.com]]
|
||||
|
||||
External links must begin with either "http://" or "https://". If you need
|
||||
something more flexible, you can resort to the link syntax in the page's
|
||||
underlying markup format.
|
||||
|
||||
|
||||
## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
|
||||
|
||||
For Gollum tags that operate on static files (images, PDFs, etc), the paths
|
||||
may be referenced as either relative, absolute, or external. Relative paths
|
||||
point to a static file relative to the page file within the directory
|
||||
structure of the Gollum repo (even though after conversion, all page files
|
||||
appear to be top level). These paths are NOT prefixed with a slash. For
|
||||
example:
|
||||
|
||||
gollum.pdf
|
||||
docs/diagram.png
|
||||
|
||||
Absolute paths point to a static file relative to the Gollum repo's
|
||||
root, regardless of where the page file is stored within the directory
|
||||
structure. These paths ARE prefixed with a slash. For example:
|
||||
|
||||
/pdfs/gollum.pdf
|
||||
/docs/diagram.png
|
||||
|
||||
External paths are full URLs. An external path must begin with either
|
||||
"http://" or "https://". For example:
|
||||
|
||||
http://example.com/pdfs/gollum.pdf
|
||||
http://example.com/images/diagram.png
|
||||
|
||||
All of the examples in this README use relative paths, but you may use
|
||||
whatever works best in your situation.
|
||||
|
||||
|
||||
## FILE LINKS
|
||||
|
||||
To link to static files that are contained in the Gollum repository you should
|
||||
use the Gollum File Link Tag.
|
||||
|
||||
[[Gollum|gollum.pdf]]
|
||||
|
||||
The first part of the tag is the link text. The path to the file appears after
|
||||
the pipe.
|
||||
|
||||
|
||||
## IMAGES
|
||||
|
||||
To display images that are contained in the Gollum repository you should use
|
||||
the Gollum Image Tag. This will display the actual image on the page.
|
||||
|
||||
[[gollum.png]]
|
||||
|
||||
In addition to the simple format, there are a variety of options that you
|
||||
can specify between pipe delimiters.
|
||||
|
||||
To specify alt text, use the `alt=` option. Default is no alt text.
|
||||
|
||||
[[gollum.png|alt=Gollum and his precious wiki]]
|
||||
|
||||
To place the image in a frame, use the `frame` option. When combined with the
|
||||
`alt=` option, the alt text will be used as a caption as well. Default is no
|
||||
frame.
|
||||
|
||||
[[gollum.png|frame|alt=Gollum and his precious wiki]]
|
||||
|
||||
To specify the alignment of the image on the page, use the `align=` option.
|
||||
Possible values are `left`, `center`, and `right`. Default is `left`.
|
||||
|
||||
[[gollum.png|align=center]]
|
||||
|
||||
To float an image so that text flows around it, use the `float` option. When
|
||||
`float` is specified, only `left` and `right` are valid `align` options.
|
||||
Default is not floating. When floating is activated but no alignment is
|
||||
specified, default alignment is `left`.
|
||||
|
||||
[[gollum.png|float]]
|
||||
|
||||
To specify a max-width, use the `width=` option. Units must be specified in
|
||||
either `px` or `em`.
|
||||
|
||||
[[gollum.png|width=400px]]
|
||||
|
||||
To specify a max-height, use the `height=` option. Units must be specified in
|
||||
either `px` or `em`.
|
||||
|
||||
[[gollum.png|height=300px]]
|
||||
|
||||
Any of these options may be composed together by simply separating them with
|
||||
pipes.
|
||||
|
||||
|
||||
## ESCAPING GOLLUM TAGS
|
||||
|
||||
If you need the literal text of a wiki or static link to show up in your final
|
||||
wiki page, simply preface the link with a single quote (like in LISP):
|
||||
|
||||
'[[Page Link]]
|
||||
'[[File Link|file.pdf]]
|
||||
'[[image.jpg]]
|
||||
|
||||
This is useful for writing about the link syntax in your wiki pages.
|
||||
|
||||
## TABLE OF CONTENTS
|
||||
|
||||
Gollum has a special tag to insert a table of contents (new in v2.1)
|
||||
|
||||
[[_TOC_]]
|
||||
|
||||
This tag is case sensitive, use all upper case. The TOC tag can be inserted
|
||||
into the `_Header`, `_Footer` or `_Sidebar` files too.
|
||||
|
||||
There is also a wiki option `:universal_toc` which will display a
|
||||
table of contents at the top of all your wiki pages if it is enabled.
|
||||
The `:universal_toc` is not enabled by default. To set the option,
|
||||
add the option to the `:wiki_options` hash before starting the
|
||||
frontend app:
|
||||
|
||||
Precious::App.set(:wiki_options, {:universal_toc => true})
|
||||
|
||||
## SYNTAX HIGHLIGHTING
|
||||
|
||||
In page files you can get automatic syntax highlighting for a wide range of
|
||||
languages (courtesy of [Pygments](http://pygments.org/) - must install
|
||||
separately) by using the following syntax:
|
||||
|
||||
```ruby
|
||||
def foo
|
||||
puts 'bar'
|
||||
end
|
||||
```
|
||||
|
||||
The block must start with three backticks, at the beginning of a line or
|
||||
indented with any number of spaces or tabs.
|
||||
After that comes the name of the language that is contained by the
|
||||
block. The language must be one of the `short name` lexer strings supported by
|
||||
Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
|
||||
options.
|
||||
|
||||
The block contents should be indented at the same level than the opening backticks.
|
||||
If the block contents are indented with an additional two spaces or one tab,
|
||||
then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
|
||||
|
||||
The block must end with three backticks indented at the same level than the opening
|
||||
backticks.
|
||||
|
||||
### GITHUB SYNTAX HIGHLIGHTING
|
||||
|
||||
As an extra feature, you can syntax highlight a file from your repository, allowing
|
||||
you keep some of your sample code in the main repository. The code-snippet is
|
||||
updated when the wiki is rebuilt. You include github code like this:
|
||||
|
||||
```html:github/gollum/master/test/file_view/1_file.txt```
|
||||
|
||||
This will make the builder look at the **github user**, in the **gollum project**,
|
||||
in the **master branch**, at path **test/file_view/1_file.txt**. It will be
|
||||
rewritten to:
|
||||
|
||||
```html
|
||||
<ol class="tree">
|
||||
<li class="file"><a href="0">0</a></li>
|
||||
</ol>
|
||||
```
|
||||
|
||||
Which will be parsed as HTML code during the Pygments run, and thereby coloured
|
||||
appropriately.
|
||||
|
||||
## MATHEMATICAL EQUATIONS
|
||||
|
||||
Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
|
||||
|
||||
Inline math:
|
||||
|
||||
- $2^2$
|
||||
- `\\(2^2\\)`
|
||||
|
||||
Display math:
|
||||
|
||||
- $$2^2$$
|
||||
- [2^2]
|
||||
|
||||
## SEQUENCE DIAGRAMS
|
||||
|
||||
You may imbed sequence diagrams into your wiki page (rendered by
|
||||
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
|
||||
following syntax:
|
||||
|
||||
{{{{{{ blue-modern
|
||||
alice->bob: Test
|
||||
bob->alice: Test response
|
||||
}}}}}}
|
||||
|
||||
You can replace the string "blue-modern" with any supported style.
|
||||
|
||||
## API DOCUMENTATION
|
||||
|
||||
The Gollum API allows you to retrieve raw or formatted wiki content from a Git
|
||||
repository, write new content to the repository, and collect various meta data
|
||||
about the wiki as a whole.
|
||||
|
||||
Initialize the Gollum::Repo object:
|
||||
|
||||
# Require rubygems if necessary
|
||||
require 'rubygems'
|
||||
|
||||
# Require the Gollum library
|
||||
require 'gollum'
|
||||
|
||||
# Create a new Gollum::Wiki object by initializing it with the path to the
|
||||
# Git repository.
|
||||
wiki = Gollum::Wiki.new("my-gollum-repo.git")
|
||||
# => <Gollum::Wiki>
|
||||
|
||||
By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
|
||||
|
||||
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
|
||||
|
||||
Note that base_path just modifies the links. To map gollum to a non-root location:
|
||||
|
||||
- Use the gollum binary: `gollum path/to/wiki --base-path mywiki`
|
||||
- Define config.ru with `map`. See [#532](https://github.com/github/gollum/issues/532) for an example.
|
||||
|
||||
> :base_path - String base path for all Wiki links.
|
||||
>
|
||||
> The String base path to prefix to internal links. For example, when set
|
||||
> to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
|
||||
> to "/".
|
||||
|
||||
Get the latest version of the given human or canonical page name:
|
||||
|
||||
page = wiki.page('page-name')
|
||||
# => <Gollum::Page>
|
||||
|
||||
page.raw_data
|
||||
# => "# My wiki page"
|
||||
|
||||
page.formatted_data
|
||||
# => "<h1>My wiki page</h1>"
|
||||
|
||||
page.format
|
||||
# => :markdown
|
||||
|
||||
vsn = page.version
|
||||
# => <Grit::Commit>
|
||||
|
||||
vsn.id
|
||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||
|
||||
Get the footer (if any) for a given page:
|
||||
|
||||
page.footer
|
||||
# => <Gollum::Page>
|
||||
|
||||
Get the header (if any) for a given page:
|
||||
|
||||
page.header
|
||||
# => <Gollum::Page>
|
||||
|
||||
Get a list of versions for a given page:
|
||||
|
||||
vsns = wiki.page('page-name').versions
|
||||
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
|
||||
|
||||
vsns.first.id
|
||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||
|
||||
vsns.first.authored_date
|
||||
# => Sun Mar 28 19:11:21 -0700 2010
|
||||
|
||||
Get a specific version of a given canonical page file:
|
||||
|
||||
wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
|
||||
|
||||
Get the latest version of a given static file:
|
||||
|
||||
file = wiki.file('asset.js')
|
||||
# => <Gollum::File>
|
||||
|
||||
file.raw_data
|
||||
# => "alert('hello');"
|
||||
|
||||
file.version
|
||||
# => <Grit::Commit>
|
||||
|
||||
Get a specific version of a given static file:
|
||||
|
||||
wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
|
||||
|
||||
Get an in-memory Page preview (useful for generating previews for web
|
||||
interfaces):
|
||||
|
||||
preview = wiki.preview_page("My Page", "# Contents", :markdown)
|
||||
preview.formatted_data
|
||||
# => "<h1>Contents</h1>"
|
||||
|
||||
Methods that write to the repository require a Hash of commit data that takes
|
||||
the following form:
|
||||
|
||||
commit = { :message => 'commit message',
|
||||
:name => 'Tom Preston-Werner',
|
||||
:email => 'tom@github.com' }
|
||||
|
||||
Write a new version of a page (the file will be created if it does not already
|
||||
exist) and commit the change. The file will be written at the repo root.
|
||||
|
||||
wiki.write_page('Page Name', :markdown, 'Page contents', commit)
|
||||
|
||||
Update an existing page. If the format is different than the page's current
|
||||
format, the file name will be changed to reflect the new format.
|
||||
|
||||
page = wiki.page('Page Name')
|
||||
wiki.update_page(page, page.name, page.format, 'Page contents', commit)
|
||||
|
||||
To delete a page and commit the change:
|
||||
|
||||
wiki.delete_page(page, commit)
|
||||
|
||||
### RACK
|
||||
|
||||
You can also run gollum with any rack-compatible server by placing this config.ru
|
||||
file inside your wiki repository. This allows you to utilize any Rack middleware
|
||||
like Rack::Auth, OmniAuth, etc.
|
||||
|
||||
#!/usr/bin/env ruby
|
||||
require 'rubygems'
|
||||
require 'gollum/frontend/app'
|
||||
```ruby
|
||||
#!/usr/bin/env ruby
|
||||
require 'rubygems'
|
||||
require 'gollum/app'
|
||||
|
||||
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
|
||||
Precious::App.set(:gollum_path, gollum_path)
|
||||
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
|
||||
Precious::App.set(:wiki_options, {:universal_toc => false})
|
||||
run Precious::App
|
||||
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
|
||||
Precious::App.set(:gollum_path, gollum_path)
|
||||
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
|
||||
Precious::App.set(:wiki_options, {:universal_toc => false})
|
||||
run Precious::App
|
||||
```
|
||||
|
||||
Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
|
||||
|
||||
## WINDOWS FILENAME VALIDATION
|
||||
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
|
||||
## CONFIG FILE
|
||||
|
||||
## LIB.SO ERROR
|
||||
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
|
||||
|
||||
## CUSTOM CSS/JS
|
||||
|
||||
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
|
||||
|
||||
The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page.
|
||||
|
||||
|
||||
## API DOCUMENTATION
|
||||
|
||||
The [Gollum API](https://github.com/gollum/gollum-lib/) allows you to retrieve
|
||||
raw or formatted wiki content from a Git repository, write new content to the
|
||||
repository, and collect various meta data about the wiki as a whole.
|
||||
|
||||
`Could not open library 'lib.so'` may be solved by installing `python-devel` on Fedora or `python-dev` on Ubuntu. Gentoo requires a rubypython [patch](https://gist.github.com/2802480) to use python2.7.
|
||||
|
||||
## CONTRIBUTE
|
||||
|
||||
If you'd like to hack on Gollum, start by forking my repo on GitHub:
|
||||
If you'd like to hack on Gollum, start by forking the repo on GitHub:
|
||||
|
||||
http://github.com/github/gollum
|
||||
http://github.com/gollum/gollum
|
||||
|
||||
To get all of the dependencies, install the gem first. The best way to get
|
||||
your changes merged back into core is as follows:
|
||||
@@ -553,21 +179,57 @@ your changes merged back into core is as follows:
|
||||
1. Do not change the version number, I will do that on my end
|
||||
1. If necessary, rebase your commits into logical chunks, without errors
|
||||
1. Push the branch up to GitHub
|
||||
1. Send a pull request to the github/gollum project.
|
||||
1. Send a pull request to the gollum/gollum project.
|
||||
|
||||
## RELEASING
|
||||
For z releases:
|
||||
$ rake bump
|
||||
$ rake release
|
||||
|
||||
For x.y releases:
|
||||
Update VERSION in lib/gollum.rb
|
||||
$ rake gemspec
|
||||
$ rake release
|
||||
|
||||
Gollum uses [Semantic Versioning](http://semver.org/).
|
||||
|
||||
x.y.z
|
||||
|
||||
For z releases:
|
||||
|
||||
```bash
|
||||
$ rake bump
|
||||
$ rake release
|
||||
```
|
||||
|
||||
For x.y releases:
|
||||
|
||||
```bash
|
||||
Update VERSION in lib/gollum.rb
|
||||
$ rake gemspec
|
||||
$ rake release
|
||||
```
|
||||
|
||||
## BUILDING THE GEM FROM MASTER
|
||||
$ gem uninstall -aIx gollum
|
||||
$ git clone https://github.com/github/gollum.git
|
||||
$ cd gollum
|
||||
gollum$ rake build
|
||||
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
|
||||
|
||||
```bash
|
||||
$ gem uninstall -aIx gollum
|
||||
$ git clone https://github.com/gollum/gollum.git
|
||||
$ cd gollum
|
||||
gollum$ rake build
|
||||
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
|
||||
```
|
||||
|
||||
## RUN THE TESTS
|
||||
|
||||
```bash
|
||||
$ bundle install
|
||||
$ bundle exec rake test
|
||||
```
|
||||
|
||||
## WORK WITH TEST REPOS
|
||||
|
||||
An example of how to add a test file to the bare repository lotr.git.
|
||||
|
||||
```bash
|
||||
$ mkdir tmp; cd tmp
|
||||
$ git clone ../lotr.git/ .
|
||||
Cloning into '.'...
|
||||
done.
|
||||
$ git log
|
||||
$ echo "test" > test.md
|
||||
$ git add . ; git commit -am "Add test"
|
||||
$ git push ../lotr.git/ master
|
||||
```
|
||||
|
||||
@@ -107,20 +107,23 @@ end
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
desc 'Create a release build'
|
||||
desc 'Create a release build and push to rubygems'
|
||||
task :release => :build do
|
||||
unless `git branch` =~ /^\* master$/
|
||||
puts "You must be on the master branch to release!"
|
||||
exit!
|
||||
end
|
||||
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
||||
sh "git pull"
|
||||
sh "git pull --rebase origin master"
|
||||
sh "git tag v#{version}"
|
||||
sh "git push origin master"
|
||||
sh "git push origin v#{version}"
|
||||
sh "gem push pkg/#{name}-#{version}.gem"
|
||||
end
|
||||
|
||||
desc 'Publish to rubygems. Same as release'
|
||||
task :publish => :release
|
||||
|
||||
desc 'Build gem'
|
||||
task :build => :gemspec do
|
||||
sh "mkdir -p pkg"
|
||||
@@ -128,6 +131,11 @@ task :build => :gemspec do
|
||||
sh "mv #{gem_file} pkg"
|
||||
end
|
||||
|
||||
desc "Build and install"
|
||||
task :install => :build do
|
||||
sh "gem install --local --no-ri --no-rdoc pkg/#{name}-#{version}.gem"
|
||||
end
|
||||
|
||||
desc 'Update gemspec'
|
||||
task :gemspec => :validate do
|
||||
# read spec file and split out manifest section
|
||||
@@ -146,7 +154,7 @@ task :gemspec => :validate do
|
||||
split("\n").
|
||||
sort.
|
||||
reject { |file| file =~ /^\./ }.
|
||||
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md)/ }.
|
||||
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
|
||||
map { |file| " #{file}" }.
|
||||
join("\n")
|
||||
|
||||
|
||||
+65
-13
@@ -17,9 +17,13 @@ require 'optparse'
|
||||
require 'rubygems'
|
||||
require 'gollum'
|
||||
|
||||
exec = {}
|
||||
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
|
||||
wiki_options = {}
|
||||
exec = {}
|
||||
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
|
||||
wiki_options = {
|
||||
:live_preview => false,
|
||||
:allow_uploads => false,
|
||||
:allow_editing => true,
|
||||
}
|
||||
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = help
|
||||
@@ -41,19 +45,35 @@ opts = OptionParser.new do |opts|
|
||||
options['config'] = config
|
||||
end
|
||||
|
||||
opts.on("--adapter [ADAPTER]", "Git adapter to use in the backend. Defaults to grit.") do |adapter|
|
||||
Gollum::GIT_ADAPTER = adapter
|
||||
end
|
||||
|
||||
opts.on("--irb", "Start an irb process with gollum loaded for the current wiki.") do
|
||||
options['irb'] = true
|
||||
end
|
||||
|
||||
opts.on("--css", "Inject custom css. Uses custom.css from root repository") do
|
||||
wiki_options[:css] = true
|
||||
end
|
||||
|
||||
opts.on("--js", "Inject custom js. Uses custom.js from root repository") do
|
||||
wiki_options[:js] = true
|
||||
end
|
||||
|
||||
opts.on("--template-dir [PATH]", "Specify custom template directory") do |path|
|
||||
wiki_options[:template_dir] = path
|
||||
end
|
||||
|
||||
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
|
||||
wiki_options[:page_file_dir] = path
|
||||
end
|
||||
|
||||
opts.on("--base-path [PATH]", "Specify the base path.") do |path|
|
||||
opts.on("--base-path [PATH]", "Specify the base path for the served pages (default: /) Example: --base-path wiki yields the home page accessible at http://localhost:4567/wiki/.") do |path|
|
||||
wiki_options[:base_path] = path
|
||||
end
|
||||
|
||||
opts.on("--gollum-path [PATH]", "Specify the gollum path.") do |path|
|
||||
opts.on("--gollum-path [PATH]", "Specify the path to the git repository to be served.") do |path|
|
||||
wiki_options[:gollum_path] = path
|
||||
end
|
||||
|
||||
@@ -61,14 +81,39 @@ opts = OptionParser.new do |opts|
|
||||
wiki_options[:ref] = ref
|
||||
end
|
||||
|
||||
opts.on("--bare", "Specify that the repository is bare (only necessary when using the grit adapter).") do
|
||||
wiki_options[:repo_is_bare] = true
|
||||
end
|
||||
|
||||
opts.on("--no-edit", "Restricts editing capability through frontend.") do
|
||||
wiki_options[:allow_editing] = false
|
||||
end
|
||||
|
||||
opts.on("--no-live-preview", "Disables livepreview.") do
|
||||
wiki_options[:live_preview] = false
|
||||
end
|
||||
|
||||
opts.on("--mathjax", "Enables mathjax.") do
|
||||
opts.on("--live-preview", "Enables livepreview.") do
|
||||
wiki_options[:live_preview] = true
|
||||
end
|
||||
|
||||
opts.on("--allow-uploads [MODE]", [:dir, :page], "Allows file uploads. Modes: dir (default, store all uploads in the same directory), page (store each upload at the same location as the page).") do |mode|
|
||||
wiki_options[:allow_uploads] = true
|
||||
wiki_options[:per_page_uploads] = true if mode == :page
|
||||
end
|
||||
|
||||
opts.on("--mathjax", "Enables mathjax for rendering mathematical equations. Uses the TeX-AMS-MML_HTMLorMML config with the autoload-all extension by default.") do
|
||||
wiki_options[:mathjax] = true
|
||||
end
|
||||
|
||||
opts.on("--mathjax-config [SOURCE]", "Inject custom mathjax config file. Uses mathjax.config.js from root repository by default") do |source|
|
||||
wiki_options[:mathjax_config] = source || 'mathjax.config.js'
|
||||
end
|
||||
|
||||
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
|
||||
wiki_options[:user_icons] = source
|
||||
end
|
||||
|
||||
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
|
||||
wiki_options[:show_all] = true
|
||||
end
|
||||
@@ -76,6 +121,9 @@ opts = OptionParser.new do |opts|
|
||||
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
||||
wiki_options[:collapse_tree] = true
|
||||
end
|
||||
opts.on("--h1-title", "Sets page title to value of first h1") do
|
||||
wiki_options[:h1_title] = true
|
||||
end
|
||||
end
|
||||
|
||||
# Read command line options into `options` hash
|
||||
@@ -89,8 +137,8 @@ end
|
||||
|
||||
# --gollum-path wins over ARGV[0]
|
||||
gollum_path = wiki_options[:gollum_path] ?
|
||||
wiki_options[:gollum_path] :
|
||||
ARGV[0] || Dir.pwd
|
||||
wiki_options[:gollum_path] :
|
||||
ARGV[0] || Dir.pwd
|
||||
|
||||
if options['irb']
|
||||
require 'irb'
|
||||
@@ -118,8 +166,11 @@ if options['irb']
|
||||
end
|
||||
|
||||
begin
|
||||
require 'gollum-lib'
|
||||
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
|
||||
if !wiki.exist? then raise Grit::InvalidGitRepositoryError end
|
||||
if !wiki.exist? then
|
||||
raise Gollum::InvalidGitRepositoryError
|
||||
end
|
||||
puts "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
|
||||
puts
|
||||
puts %( page = wiki.page('page-name'))
|
||||
@@ -133,14 +184,15 @@ if options['irb']
|
||||
puts
|
||||
puts "Check out the Gollum README for more."
|
||||
IRB.start_session(binding)
|
||||
rescue Grit::InvalidGitRepositoryError, Grit::NoSuchPathError
|
||||
rescue Gollum::InvalidGitRepositoryError, Gollum::NoSuchPathError
|
||||
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
|
||||
exit 0
|
||||
end
|
||||
else
|
||||
require 'gollum/frontend/app'
|
||||
require 'gollum/app'
|
||||
Precious::App.set(:gollum_path, gollum_path)
|
||||
Precious::App.set(:wiki_options, wiki_options)
|
||||
Precious::App.settings.mustache[:templates] = wiki_options[:template_dir] if wiki_options[:template_dir]
|
||||
|
||||
if cfg = options['config']
|
||||
# If the path begins with a '/' it will be considered an absolute path,
|
||||
@@ -160,7 +212,7 @@ else
|
||||
def initialize base_path
|
||||
@mg = Rack::Builder.new do
|
||||
map '/' do
|
||||
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
|
||||
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
|
||||
end
|
||||
|
||||
map "/#{base_path}" do
|
||||
@@ -174,6 +226,6 @@ else
|
||||
end
|
||||
end
|
||||
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
|
||||
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port']).start
|
||||
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port'], :Host => options['bind']).start
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Example gollum config
|
||||
# gollum ../wiki --config config.rb
|
||||
#
|
||||
# or run from source with
|
||||
#
|
||||
# bundle exec bin/gollum ../wiki/ --config config.rb
|
||||
|
||||
# Remove const to avoid
|
||||
# warning: already initialized constant FORMAT_NAMES
|
||||
#
|
||||
# only remove if it's defined.
|
||||
# constant Gollum::Page::FORMAT_NAMES not defined (NameError)
|
||||
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
|
||||
# limit to one format
|
||||
Gollum::Page::FORMAT_NAMES = { :markdown => "Markdown" }
|
||||
|
||||
=begin
|
||||
Valid formats are:
|
||||
{ :markdown => "Markdown",
|
||||
:textile => "Textile",
|
||||
:rdoc => "RDoc",
|
||||
:org => "Org-mode",
|
||||
:creole => "Creole",
|
||||
:rest => "reStructuredText",
|
||||
:asciidoc => "AsciiDoc",
|
||||
:mediawiki => "MediaWiki",
|
||||
:pod => "Pod" }
|
||||
=end
|
||||
@@ -0,0 +1,3 @@
|
||||
GOLLUM_USER=gollum
|
||||
GOLLUM_BASE=/home/gollum/wiki
|
||||
GOLLUM_OPTS="--config /home/gollum/config.rb"
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/sbin/runscript
|
||||
# Distributed under the terms of the MIT License
|
||||
|
||||
NAME=gollum
|
||||
PID=/var/run/${NAME}.pid
|
||||
EXEC=/usr/local/bin/gollum
|
||||
LOG=/var/log/gollum.log
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
start() {
|
||||
# Change log file to be owned by GOLLUM_USER
|
||||
touch "${LOG}"
|
||||
chown "${GOLLUM_USER}" "${LOG}"
|
||||
|
||||
ebegin "Starting Gollum"
|
||||
start-stop-daemon --start \
|
||||
--name "${NAME}" \
|
||||
--user "${GOLLUM_USER}" \
|
||||
--pidfile "${PID}" \
|
||||
--make-pidfile --background \
|
||||
--stderr "${LOG}" \
|
||||
--exec "${EXEC}" -- $GOLLUM_OPTS "$GOLLUM_BASE"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping Gollum"
|
||||
start-stop-daemon --stop \
|
||||
--name "${NAME}" \
|
||||
--user "${GOLLUM_USER}" \
|
||||
--pidfile "${PID}"
|
||||
eend $?
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Gollum wiki server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
ExecStart=/usr/bin/gollum
|
||||
Restart=on-abort
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+19
-18
@@ -2,31 +2,32 @@ Sanitization Rules
|
||||
==================
|
||||
|
||||
Gollum uses the [Sanitize](http://wonko.com/post/sanitize) gem for HTML
|
||||
sanitization.
|
||||
sanitization. Below you find the default allowed tags, attributes, and protocols, as well as directions to customize these settings.
|
||||
|
||||
See `lib/gollum.rb` for actual settings.
|
||||
# Default Settings
|
||||
|
||||
## ALLOWED TAGS
|
||||
|
||||
a, abbr, acronym, address, area, b, big, blockquote, br, button, caption,
|
||||
center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em,
|
||||
fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd,
|
||||
label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp,
|
||||
select, small, span, strike, strong, sub, sup, table, tbody, td, textarea,
|
||||
tfoot, th, thead, tr, tt, u, ul, var
|
||||
a, abbr, acronym, address, area, b, big, blockquote, br, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd, label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var
|
||||
|
||||
## ALLOWED ATTRIBUTES
|
||||
|
||||
abbr, accept, accept-charset, accesskey, action, align, alt, axis, border,
|
||||
cellpadding, cellspacing, char, charoff, charset, checked, cite, class, clear,
|
||||
cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for,
|
||||
frame, headers, height, href, hreflang, hspace, id, ismap, label, lang,
|
||||
longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap,
|
||||
prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape,
|
||||
size, span, src, start, summary, tabindex, target, title, type, usemap,
|
||||
valign, value, vspace, width
|
||||
a href, abbr, accept, accept-charset, accesskey, action, align, alt, axis, border, cellpadding, cellspacing, char, charoff, class, charset, checked, cite, clear, cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for, frame, headers, height, hreflang, hspace, id, img src, ismap, label, lang, longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap, prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape, size, span, start, summary, tabindex, target, title, type, usemap, valign, value, vspace, width
|
||||
|
||||
## ALLOWED PROTOCOLS
|
||||
|
||||
a href: http, https, mailto
|
||||
img src: http, https
|
||||
* a href: http, https, mailto, ftp, irc, apt, :relative
|
||||
* img src: http, https, :relative
|
||||
* form action: http, https, :relative
|
||||
|
||||
# Customizing
|
||||
|
||||
To customize these settings, edit your `config.rb` file along the following lines (be sure to run gollum with the `--config` option):
|
||||
|
||||
```ruby
|
||||
sanitizer = Gollum::Sanitization.new
|
||||
sanitizer.protocols['a']['href'].concat ['ssh', 'vnc'] # Protocols
|
||||
sanitizer.elements.concat ['customtag1', 'customtag2'] # Tags
|
||||
sanitizer.attributes['a'].push 'target' # Attributes
|
||||
Precious::App.set(:wiki_options, {:sanitization => sanitizer})
|
||||
```
|
||||
|
||||
+515
-439
@@ -1,49 +1,40 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.specification_version = 2 if s.respond_to? :specification_version=
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
||||
s.rubygems_version = '1.3.5'
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
s.required_ruby_version = '>= 1.9'
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.3.5'
|
||||
s.date = '2012-10-31'
|
||||
s.version = '3.1.2'
|
||||
s.date = '2015-01-23'
|
||||
s.rubyforge_project = 'gollum'
|
||||
s.license = 'MIT'
|
||||
|
||||
s.summary = "A simple, Git-powered wiki."
|
||||
s.description = "A simple, Git-powered wiki with a sweet API and local frontend."
|
||||
s.summary = 'A simple, Git-powered wiki.'
|
||||
s.description = 'A simple, Git-powered wiki with a sweet API and local frontend.'
|
||||
|
||||
s.authors = ["Tom Preston-Werner", "Rick Olson"]
|
||||
s.authors = ['Tom Preston-Werner', 'Rick Olson']
|
||||
s.email = 'tom@github.com'
|
||||
s.homepage = 'http://github.com/github/gollum'
|
||||
s.homepage = 'http://github.com/gollum/gollum'
|
||||
|
||||
s.require_paths = %w[lib]
|
||||
|
||||
s.executables = ["gollum"]
|
||||
s.executables = ['gollum']
|
||||
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
s.rdoc_options = ['--charset=UTF-8']
|
||||
s.extra_rdoc_files = %w[README.md LICENSE]
|
||||
|
||||
s.add_dependency('grit', '~> 2.5.0')
|
||||
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
|
||||
s.add_dependency('github-markdown', '~> 0.5.1')
|
||||
s.add_dependency('pygments.rb', '~> 0.3.2')
|
||||
s.add_dependency('sinatra', '~> 1.3.3')
|
||||
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
|
||||
s.add_dependency('sanitize', '~> 2.0.3')
|
||||
s.add_dependency('nokogiri', '~> 1.5.5')
|
||||
s.add_dependency('useragent', '~> 0.4.12')
|
||||
s.add_dependency('stringex', '~> 1.4.0')
|
||||
s.add_dependency 'gollum-lib', '~> 4.0', '>= 4.0.1'
|
||||
s.add_dependency 'github-markdown', '~> 0.6.5'
|
||||
s.add_dependency 'sinatra', '~> 1.4', '>= 1.4.4'
|
||||
s.add_dependency 'mustache', ['>= 0.99.5', '< 1.0.0']
|
||||
s.add_dependency 'useragent', '~> 0.10.0'
|
||||
|
||||
s.add_development_dependency('RedCloth', '~> 4.2.9')
|
||||
s.add_development_dependency('mocha', '~> 0.12.7')
|
||||
s.add_development_dependency('org-ruby', '~> 0.7.2')
|
||||
s.add_development_dependency('shoulda', '~> 3.3.1')
|
||||
s.add_development_dependency('rack-test', '~> 0.6.2')
|
||||
s.add_development_dependency('wikicloth', '~> 0.8.0')
|
||||
s.add_development_dependency('rake', '~> 0.9')
|
||||
s.add_development_dependency('pry', '~> 0.9.10')
|
||||
# required by pry
|
||||
s.add_development_dependency('rb-readline', '~> 0.4.2')
|
||||
s.add_development_dependency 'rack-test', '~> 0.6.2'
|
||||
s.add_development_dependency 'shoulda', '~> 3.5.0'
|
||||
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
|
||||
s.add_development_dependency 'twitter_cldr', '~> 2.4.2'
|
||||
s.add_development_dependency 'mocha', '~> 1.0.0'
|
||||
|
||||
# = MANIFEST =
|
||||
s.files = %w[
|
||||
@@ -53,421 +44,506 @@ Gem::Specification.new do |s|
|
||||
README.md
|
||||
Rakefile
|
||||
bin/gollum
|
||||
config.rb
|
||||
contrib/openrc/conf.d/gollum
|
||||
contrib/openrc/init.d/gollum
|
||||
contrib/systemd/gollum@.service
|
||||
docs/sanitization.md
|
||||
gollum.gemspec
|
||||
lib/gollum.rb
|
||||
lib/gollum/blob_entry.rb
|
||||
lib/gollum/committer.rb
|
||||
lib/gollum/file.rb
|
||||
lib/gollum/file_view.rb
|
||||
lib/gollum/frontend/app.rb
|
||||
lib/gollum/frontend/helpers.rb
|
||||
lib/gollum/frontend/public/gollum/css/_styles.css
|
||||
lib/gollum/frontend/public/gollum/css/dialog.css
|
||||
lib/gollum/frontend/public/gollum/css/editor.css
|
||||
lib/gollum/frontend/public/gollum/css/gollum.css
|
||||
lib/gollum/frontend/public/gollum/css/ie7.css
|
||||
lib/gollum/frontend/public/gollum/css/template.css
|
||||
lib/gollum/frontend/public/gollum/images/dirty-shade.png
|
||||
lib/gollum/frontend/public/gollum/images/fileview/document.png
|
||||
lib/gollum/frontend/public/gollum/images/fileview/folder-horizontal.png
|
||||
lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png
|
||||
lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png
|
||||
lib/gollum/frontend/public/gollum/images/icon-sprite.png
|
||||
lib/gollum/frontend/public/gollum/images/para.png
|
||||
lib/gollum/frontend/public/gollum/images/pin-16.png
|
||||
lib/gollum/frontend/public/gollum/images/pin-20.png
|
||||
lib/gollum/frontend/public/gollum/images/pin-24.png
|
||||
lib/gollum/frontend/public/gollum/images/pin-32.png
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/rdoc.js
|
||||
lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js
|
||||
lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js
|
||||
lib/gollum/frontend/public/gollum/javascript/gollum.js
|
||||
lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
|
||||
lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js
|
||||
lib/gollum/frontend/public/gollum/javascript/jquery.color.js
|
||||
lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/css/custom.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/images/globe_24.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/images/save_24.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/index.html
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/md_sundown.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/requirejs.min.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/sundown.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/gollum/LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/notepages/LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/requirejs/LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/licenses/templarian_windowsicons/license.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/readme.md
|
||||
lib/gollum/frontend/templates/compare.mustache
|
||||
lib/gollum/frontend/templates/create.mustache
|
||||
lib/gollum/frontend/templates/edit.mustache
|
||||
lib/gollum/frontend/templates/editor.mustache
|
||||
lib/gollum/frontend/templates/error.mustache
|
||||
lib/gollum/frontend/templates/file_view.mustache
|
||||
lib/gollum/frontend/templates/history.mustache
|
||||
lib/gollum/frontend/templates/layout.mustache
|
||||
lib/gollum/frontend/templates/page.mustache
|
||||
lib/gollum/frontend/templates/pages.mustache
|
||||
lib/gollum/frontend/templates/search.mustache
|
||||
lib/gollum/frontend/templates/searchbar.mustache
|
||||
lib/gollum/frontend/uri_encode_component.rb
|
||||
lib/gollum/frontend/views/compare.rb
|
||||
lib/gollum/frontend/views/create.rb
|
||||
lib/gollum/frontend/views/edit.rb
|
||||
lib/gollum/frontend/views/editable.rb
|
||||
lib/gollum/frontend/views/error.rb
|
||||
lib/gollum/frontend/views/file_view.rb
|
||||
lib/gollum/frontend/views/has_page.rb
|
||||
lib/gollum/frontend/views/history.rb
|
||||
lib/gollum/frontend/views/layout.rb
|
||||
lib/gollum/frontend/views/page.rb
|
||||
lib/gollum/frontend/views/pages.rb
|
||||
lib/gollum/frontend/views/search.rb
|
||||
lib/gollum/git_access.rb
|
||||
lib/gollum/gitcode.rb
|
||||
lib/gollum/markup.rb
|
||||
lib/gollum/page.rb
|
||||
lib/gollum/pagination.rb
|
||||
lib/gollum/sanitization.rb
|
||||
lib/gollum/web_sequence_diagram.rb
|
||||
lib/gollum/wiki.rb
|
||||
lib/gollum/app.rb
|
||||
lib/gollum/editing_auth.rb
|
||||
lib/gollum/helpers.rb
|
||||
lib/gollum/public/gollum/css/_styles.css
|
||||
lib/gollum/public/gollum/css/dialog.css
|
||||
lib/gollum/public/gollum/css/editor.css
|
||||
lib/gollum/public/gollum/css/gollum.css
|
||||
lib/gollum/public/gollum/css/ie7.css
|
||||
lib/gollum/public/gollum/css/print.css
|
||||
lib/gollum/public/gollum/css/template.css
|
||||
lib/gollum/public/gollum/fonts/FontAwesome.otf
|
||||
lib/gollum/public/gollum/fonts/fontawesome-webfont.eot
|
||||
lib/gollum/public/gollum/fonts/fontawesome-webfont.svg
|
||||
lib/gollum/public/gollum/fonts/fontawesome-webfont.ttf
|
||||
lib/gollum/public/gollum/fonts/fontawesome-webfont.woff
|
||||
lib/gollum/public/gollum/images/dirty-shade.png
|
||||
lib/gollum/public/gollum/images/fileview/document.png
|
||||
lib/gollum/public/gollum/images/fileview/folder-horizontal.png
|
||||
lib/gollum/public/gollum/images/fileview/toggle-small-expand.png
|
||||
lib/gollum/public/gollum/images/fileview/toggle-small.png
|
||||
lib/gollum/public/gollum/images/icon-sprite.png
|
||||
lib/gollum/public/gollum/images/man_24.png
|
||||
lib/gollum/public/gollum/images/para.png
|
||||
lib/gollum/public/gollum/images/pin-16.png
|
||||
lib/gollum/public/gollum/images/pin-20.png
|
||||
lib/gollum/public/gollum/images/pin-24.png
|
||||
lib/gollum/public/gollum/images/pin-32.png
|
||||
lib/gollum/public/gollum/javascript/editor/gollum.editor.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/asciidoc.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/creole.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/markdown.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/org.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/pod.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/rdoc.js
|
||||
lib/gollum/public/gollum/javascript/editor/langs/textile.js
|
||||
lib/gollum/public/gollum/javascript/gollum.dialog.js
|
||||
lib/gollum/public/gollum/javascript/gollum.js
|
||||
lib/gollum/public/gollum/javascript/gollum.placeholder.js
|
||||
lib/gollum/public/gollum/javascript/identicon_canvas.js
|
||||
lib/gollum/public/gollum/javascript/jquery-1.7.2.min.js
|
||||
lib/gollum/public/gollum/javascript/jquery.color.js
|
||||
lib/gollum/public/gollum/javascript/mousetrap.min.js
|
||||
lib/gollum/public/gollum/livepreview/css/custom.css
|
||||
lib/gollum/public/gollum/livepreview/images/cancel_24.png
|
||||
lib/gollum/public/gollum/livepreview/images/globe_24.png
|
||||
lib/gollum/public/gollum/livepreview/images/lr_24.png
|
||||
lib/gollum/public/gollum/livepreview/images/save_24.png
|
||||
lib/gollum/public/gollum/livepreview/images/savecomment_24.png
|
||||
lib/gollum/public/gollum/livepreview/index.html
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ace.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/anchor.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/config.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/config_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/document.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/document_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/text.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/net.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/package.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/test_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_javascript.txt
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c9search.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c_cpp.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_clojure.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coffee.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coldfusion.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_csharp.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_css.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_diff.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_glsl.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_golang.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_groovy.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haxe.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_java.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_javascript.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_json.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsx.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_latex.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_less.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_liquid.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lua.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_luapage.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_markdown.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ocaml.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_perl.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pgsql.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_php.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_powershell.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_python.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ruby.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scad.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scala.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scss.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sh.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sql.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_svg.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tcl.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_text.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_textile.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xml.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xquery.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_yaml.json
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abap.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abap_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dart.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dart_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/asciidoc.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/latex.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/lua.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/markdown.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/glsl.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/glsl_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haml_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jade.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jade_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/java.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript/jshint.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsp.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsp_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/less.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lisp.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lisp_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/makefile.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/makefile_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/r.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/r_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/stylus.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/stylus_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tcl.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tcl_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tex.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tex_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/typescript.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/typescript_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/JSONParseTreeHandler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/visitors/SyntaxHighlighter.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/model/editor.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/multi_select.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/placeholder.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_list.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/renderloop.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/selection.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/selection_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/split.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/all.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/tests.html
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/github.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/github.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.css
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer_dev.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/undomanager.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/unicode.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js
|
||||
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js
|
||||
lib/gollum/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js
|
||||
lib/gollum/public/gollum/livepreview/js/livepreview.js
|
||||
lib/gollum/public/gollum/livepreview/js/md_sundown.js
|
||||
lib/gollum/public/gollum/livepreview/js/requirejs.min.js
|
||||
lib/gollum/public/gollum/livepreview/js/sundown.js
|
||||
lib/gollum/public/gollum/livepreview/licenses/ace/LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/gollum/LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/licenses.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/notepages/LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/requirejs/LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/sizzle/LICENSE.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/sundown/sundown.txt
|
||||
lib/gollum/public/gollum/livepreview/licenses/templarian_windowsicons/license.txt
|
||||
lib/gollum/public/gollum/livepreview/readme.md
|
||||
lib/gollum/templates/compare.mustache
|
||||
lib/gollum/templates/create.mustache
|
||||
lib/gollum/templates/edit.mustache
|
||||
lib/gollum/templates/editor.mustache
|
||||
lib/gollum/templates/error.mustache
|
||||
lib/gollum/templates/file_view.mustache
|
||||
lib/gollum/templates/history.mustache
|
||||
lib/gollum/templates/history_authors/gravatar.mustache
|
||||
lib/gollum/templates/history_authors/identicon.mustache
|
||||
lib/gollum/templates/history_authors/none.mustache
|
||||
lib/gollum/templates/latest_changes.mustache
|
||||
lib/gollum/templates/layout.mustache
|
||||
lib/gollum/templates/page.mustache
|
||||
lib/gollum/templates/pages.mustache
|
||||
lib/gollum/templates/search.mustache
|
||||
lib/gollum/templates/searchbar.mustache
|
||||
lib/gollum/uri_encode_component.rb
|
||||
lib/gollum/views/compare.rb
|
||||
lib/gollum/views/create.rb
|
||||
lib/gollum/views/edit.rb
|
||||
lib/gollum/views/editable.rb
|
||||
lib/gollum/views/error.rb
|
||||
lib/gollum/views/file_view.rb
|
||||
lib/gollum/views/has_page.rb
|
||||
lib/gollum/views/history.rb
|
||||
lib/gollum/views/latest_changes.rb
|
||||
lib/gollum/views/layout.rb
|
||||
lib/gollum/views/page.rb
|
||||
lib/gollum/views/pages.rb
|
||||
lib/gollum/views/search.rb
|
||||
licenses/css_tree_menu_thecssninja/license.txt
|
||||
licenses/licenses.txt
|
||||
licenses/unity_asset_pool/COPYRIGHT
|
||||
templates/formatting.html
|
||||
templates/helper_wiki.rb
|
||||
]
|
||||
# = MANIFEST =
|
||||
|
||||
|
||||
+10
-16
@@ -1,35 +1,29 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
# stdlib
|
||||
require 'digest/md5'
|
||||
require 'digest/sha1'
|
||||
require 'ostruct'
|
||||
|
||||
# external
|
||||
require 'grit'
|
||||
require 'github/markup'
|
||||
require 'sanitize'
|
||||
|
||||
# internal
|
||||
require File.expand_path('../gollum/git_access', __FILE__)
|
||||
require File.expand_path('../gollum/committer', __FILE__)
|
||||
require File.expand_path('../gollum/pagination', __FILE__)
|
||||
require File.expand_path('../gollum/blob_entry', __FILE__)
|
||||
require File.expand_path('../gollum/wiki', __FILE__)
|
||||
require File.expand_path('../gollum/page', __FILE__)
|
||||
require File.expand_path('../gollum/file', __FILE__)
|
||||
require File.expand_path('../gollum/file_view', __FILE__)
|
||||
require File.expand_path('../gollum/markup', __FILE__)
|
||||
require File.expand_path('../gollum/sanitization', __FILE__)
|
||||
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
||||
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||
require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
||||
|
||||
# Set ruby to UTF-8 mode
|
||||
# This is required for Ruby 1.8.7 which gollum still supports.
|
||||
$KCODE = 'U' if RUBY_VERSION[0, 3] == '1.8'
|
||||
|
||||
module Gollum
|
||||
VERSION = '2.3.5'
|
||||
VERSION = '3.1.2'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||
end
|
||||
|
||||
class Error < StandardError; end
|
||||
class Error < StandardError;
|
||||
end
|
||||
|
||||
class DuplicatePageError < Error
|
||||
attr_accessor :dir
|
||||
|
||||
@@ -0,0 +1,550 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
require 'cgi'
|
||||
require 'sinatra'
|
||||
require 'gollum-lib'
|
||||
require 'mustache/sinatra'
|
||||
require 'useragent'
|
||||
require 'stringex'
|
||||
|
||||
require 'gollum'
|
||||
require 'gollum/views/layout'
|
||||
require 'gollum/views/editable'
|
||||
require 'gollum/views/has_page'
|
||||
|
||||
require File.expand_path '../helpers', __FILE__
|
||||
|
||||
require 'gollum/editing_auth'
|
||||
|
||||
#required to upload bigger binary files
|
||||
Gollum::set_git_timeout(120)
|
||||
Gollum::set_git_max_filesize(190 * 10**6)
|
||||
|
||||
# Fix to_url
|
||||
class String
|
||||
alias :upstream_to_url :to_url
|
||||
|
||||
if defined?(Gollum::GIT_ADAPTER) && Gollum::GIT_ADAPTER != 'grit'
|
||||
def to_ascii
|
||||
self # Do not transliterate utf-8 url's unless using Grit
|
||||
end
|
||||
end
|
||||
|
||||
# _Header => header which causes errors
|
||||
def to_url
|
||||
return nil if self.nil?
|
||||
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar'], :force_downcase => false
|
||||
end
|
||||
end
|
||||
|
||||
# Run the frontend, based on Sinatra
|
||||
#
|
||||
# There are a number of wiki options that can be set for the frontend
|
||||
#
|
||||
# Example
|
||||
# require 'gollum/app'
|
||||
# Precious::App.set(:wiki_options, {
|
||||
# :universal_toc => false,
|
||||
# }
|
||||
#
|
||||
# See the wiki.rb file for more details on wiki options
|
||||
module Precious
|
||||
class App < Sinatra::Base
|
||||
register Mustache::Sinatra
|
||||
include Precious::Helpers
|
||||
use Precious::EditingAuth
|
||||
|
||||
dir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
# Detect unsupported browsers.
|
||||
Browser = Struct.new(:browser, :version)
|
||||
|
||||
@@min_ua = [
|
||||
Browser.new('Internet Explorer', '10.0'),
|
||||
Browser.new('Chrome', '7.0'),
|
||||
Browser.new('Firefox', '4.0'),
|
||||
]
|
||||
|
||||
def supported_useragent?(user_agent)
|
||||
ua = UserAgent.parse(user_agent)
|
||||
@@min_ua.detect { |min| ua >= min }
|
||||
end
|
||||
|
||||
# We want to serve public assets for now
|
||||
set :public_folder, "#{dir}/public/gollum"
|
||||
set :static, true
|
||||
set :default_markup, :markdown
|
||||
|
||||
set :mustache, {
|
||||
# Tell mustache where the Views constant lives
|
||||
:namespace => Precious,
|
||||
|
||||
# Mustache templates live here
|
||||
:templates => "#{dir}/templates",
|
||||
|
||||
# Tell mustache where the views are
|
||||
:views => "#{dir}/views"
|
||||
}
|
||||
|
||||
# Sinatra error handling
|
||||
configure :development, :staging do
|
||||
enable :show_exceptions, :dump_errors
|
||||
disable :raise_errors, :clean_trace
|
||||
end
|
||||
|
||||
configure :test do
|
||||
enable :logging, :raise_errors, :dump_errors
|
||||
end
|
||||
|
||||
before do
|
||||
@base_url = url('/', false).chomp('/')
|
||||
# above will detect base_path when it's used with map in a config.ru
|
||||
settings.wiki_options.merge!({ :base_path => @base_url })
|
||||
@css = settings.wiki_options[:css]
|
||||
@js = settings.wiki_options[:js]
|
||||
@mathjax_config = settings.wiki_options[:mathjax_config]
|
||||
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
|
||||
@allow_editing = settings.wiki_options[:allow_editing]
|
||||
end
|
||||
|
||||
get '/' do
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect clean_url(::File.join(@base_url, page_dir, wiki_new.index_page))
|
||||
end
|
||||
|
||||
# path is set to name if path is nil.
|
||||
# if path is 'a/b' and a and b are dirs, then
|
||||
# path must have a trailing slash 'a/b/' or
|
||||
# extract_path will trim path to 'a'
|
||||
# name, path, version
|
||||
def wiki_page(name, path = nil, version = nil, exact = true)
|
||||
wiki = wiki_new
|
||||
path = name if path.nil?
|
||||
name = extract_name(name) || wiki.index_page
|
||||
path = extract_path(path)
|
||||
path = '/' if exact && path.nil?
|
||||
|
||||
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
|
||||
:name => name, :path => path)
|
||||
end
|
||||
|
||||
def wiki_new
|
||||
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
end
|
||||
|
||||
get '/data/*' do
|
||||
if page = wiki_page(params[:splat].first).page
|
||||
page.raw_data
|
||||
end
|
||||
end
|
||||
|
||||
get '/edit/*' do
|
||||
forbid unless @allow_editing
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
@name = wikip.name
|
||||
@path = wikip.path
|
||||
@upload_dest = find_upload_dest(@path)
|
||||
|
||||
wiki = wikip.wiki
|
||||
@allow_uploads = wiki.allow_uploads
|
||||
if page = wikip.page
|
||||
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
|
||||
live_preview_url = '/livepreview/index.html?page=' + encodeURIComponent(@name)
|
||||
if @path
|
||||
live_preview_url << '&path=' + encodeURIComponent(@path)
|
||||
end
|
||||
redirect to(live_preview_url)
|
||||
else
|
||||
@page = page
|
||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||
@content = page.text_data
|
||||
mustache :edit
|
||||
end
|
||||
else
|
||||
redirect to("/create/#{encodeURIComponent(@name)}")
|
||||
end
|
||||
end
|
||||
|
||||
post '/uploadFile' do
|
||||
wiki = wiki_new
|
||||
|
||||
unless wiki.allow_uploads
|
||||
@message = "File uploads are disabled"
|
||||
mustache :error
|
||||
return
|
||||
end
|
||||
|
||||
if params[:file]
|
||||
fullname = params[:file][:filename]
|
||||
tempfile = params[:file][:tempfile]
|
||||
end
|
||||
|
||||
dir = wiki.per_page_uploads ? params[:upload_dest] : 'uploads'
|
||||
ext = ::File.extname(fullname)
|
||||
format = ext.split('.').last || 'txt'
|
||||
filename = ::File.basename(fullname, ext)
|
||||
contents = ::File.read(tempfile)
|
||||
reponame = filename + '.' + format
|
||||
|
||||
head = wiki.repo.head
|
||||
|
||||
options = {
|
||||
:message => "Uploaded file to #{dir}/#{reponame}",
|
||||
:parent => wiki.repo.head.commit,
|
||||
}
|
||||
author = session['gollum.author']
|
||||
unless author.nil?
|
||||
options.merge! author
|
||||
end
|
||||
|
||||
begin
|
||||
committer = Gollum::Committer.new(wiki, options)
|
||||
committer.add_to_index(dir, filename, format, contents)
|
||||
committer.after_commit do |committer, sha|
|
||||
wiki.clear_cache
|
||||
committer.update_working_dir(dir, filename, format)
|
||||
end
|
||||
committer.commit
|
||||
redirect to(request.referer)
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
end
|
||||
end
|
||||
|
||||
post '/rename/*' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
halt 500 if wikip.nil?
|
||||
wiki = wikip.wiki
|
||||
page = wiki.paged(wikip.name, wikip.path, exact = true)
|
||||
rename = params[:rename]
|
||||
halt 500 if page.nil?
|
||||
halt 500 if rename.nil? or rename.empty?
|
||||
|
||||
# Fixup the rename if it is a relative path
|
||||
# In 1.8.7 rename[0] != rename[0..0]
|
||||
if rename[0..0] != '/'
|
||||
source_dir = ::File.dirname(page.path)
|
||||
source_dir = '' if source_dir == '.'
|
||||
(target_dir, target_name) = ::File.split(rename)
|
||||
target_dir = target_dir == '' ? source_dir : "#{source_dir}/#{target_dir}"
|
||||
rename = "#{target_dir}/#{target_name}"
|
||||
end
|
||||
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = { :committer => committer }
|
||||
|
||||
success = wiki.rename_page(page, rename, commit)
|
||||
if !success
|
||||
# This occurs on NOOPs, for example renaming A => A
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
return
|
||||
end
|
||||
committer.commit
|
||||
|
||||
wikip = wiki_page(rename)
|
||||
page = wiki.paged(wikip.name, wikip.path, exact = true)
|
||||
return if page.nil?
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
end
|
||||
|
||||
post '/edit/*' do
|
||||
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
||||
page_name = CGI.unescape(params[:page])
|
||||
wiki = wiki_new
|
||||
page = wiki.paged(page_name, path, exact = true)
|
||||
return if page.nil?
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = { :committer => committer }
|
||||
|
||||
update_wiki_page(wiki, page, params[:content], commit, page.name, params[:format])
|
||||
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
|
||||
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
|
||||
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
|
||||
committer.commit
|
||||
|
||||
redirect to("/#{page.escaped_url_path}") unless page.nil?
|
||||
end
|
||||
|
||||
get '/delete/*' do
|
||||
forbid unless @allow_editing
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
name = wikip.name
|
||||
wiki = wikip.wiki
|
||||
page = wikip.page
|
||||
unless page.nil?
|
||||
commit = commit_message
|
||||
commit[:message] = "Destroyed #{name} (#{page.format})"
|
||||
wiki.delete_page(page, commit)
|
||||
end
|
||||
|
||||
redirect to('/')
|
||||
end
|
||||
|
||||
get '/create/*' do
|
||||
forbid unless @allow_editing
|
||||
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
|
||||
@name = wikip.name.to_url
|
||||
@path = wikip.path
|
||||
@allow_uploads = wikip.wiki.allow_uploads
|
||||
@upload_dest = find_upload_dest(@path)
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
unless page_dir.empty?
|
||||
# --page-file-dir docs
|
||||
# /docs/Home should be created in /Home
|
||||
# not /docs/Home because write_page will append /docs
|
||||
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
|
||||
end
|
||||
@path = clean_path(@path)
|
||||
|
||||
page = wikip.page
|
||||
if page
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
end
|
||||
|
||||
post '/create' do
|
||||
name = params[:page].to_url
|
||||
path = sanitize_empty_params(params[:path]) || ''
|
||||
format = params[:format].intern
|
||||
wiki = wiki_new
|
||||
|
||||
path.gsub!(/^\//, '')
|
||||
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message, path)
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, path, encodeURIComponent(name)))}")
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
end
|
||||
end
|
||||
|
||||
post '/revert/*/:sha1/:sha2' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
@path = wikip.path
|
||||
@name = wikip.name
|
||||
wiki = wikip.wiki
|
||||
@page = wiki.paged(@name, @path)
|
||||
sha1 = params[:sha1]
|
||||
sha2 = params[:sha2]
|
||||
|
||||
commit = commit_message
|
||||
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
|
||||
if wiki.revert_page(@page, sha1, sha2, commit)
|
||||
redirect to("/#{@page.escaped_url_path}")
|
||||
else
|
||||
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||
@versions = [sha1, sha2]
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
@message = "The patch does not apply."
|
||||
mustache :compare
|
||||
end
|
||||
end
|
||||
|
||||
post '/preview' do
|
||||
wiki = wiki_new
|
||||
@name = params[:page] || "Preview"
|
||||
@page = wiki.preview_page(@name, params[:content], params[:format])
|
||||
@content = @page.formatted_data
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@h1_title = wiki.h1_title
|
||||
@editable = false
|
||||
@allow_uploads = wiki.allow_uploads
|
||||
mustache :page
|
||||
end
|
||||
|
||||
get '/history/*' do
|
||||
@page = wiki_page(params[:splat].first).page
|
||||
@page_num = [params[:page].to_i, 1].max
|
||||
unless @page.nil?
|
||||
@versions = @page.versions :page => @page_num
|
||||
mustache :history
|
||||
else
|
||||
redirect to("/")
|
||||
end
|
||||
end
|
||||
|
||||
get '/latest_changes' do
|
||||
@wiki = wiki_new
|
||||
max_count = settings.wiki_options.fetch(:latest_changes_count, 10)
|
||||
@versions = @wiki.latest_changes({:max_count => max_count})
|
||||
mustache :latest_changes
|
||||
end
|
||||
|
||||
post '/compare/*' do
|
||||
@file = encodeURIComponent(params[:splat].first)
|
||||
@versions = params[:versions] || []
|
||||
if @versions.size < 2
|
||||
redirect to("/history/#{@file}")
|
||||
else
|
||||
redirect to("/compare/%s/%s...%s" % [
|
||||
@file,
|
||||
@versions.last,
|
||||
@versions.first]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
get %r{
|
||||
/compare/ # match any URL beginning with /compare/
|
||||
(.+) # extract the full path (including any directories)
|
||||
/ # match the final slash
|
||||
([^.]+) # match the first SHA1
|
||||
\.{2,3} # match .. or ...
|
||||
(.+) # match the second SHA1
|
||||
}x do |path, start_version, end_version|
|
||||
wikip = wiki_page(path)
|
||||
@path = wikip.path
|
||||
@name = wikip.name
|
||||
@versions = [start_version, end_version]
|
||||
wiki = wikip.wiki
|
||||
@page = wikip.page
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
mustache :compare
|
||||
end
|
||||
|
||||
get %r{/(.+?)/([0-9a-f]{40})} do
|
||||
file_path = params[:captures][0]
|
||||
version = params[:captures][1]
|
||||
wikip = wiki_page(file_path, file_path, version)
|
||||
name = wikip.name
|
||||
path = wikip.path
|
||||
if page = wikip.page
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
@version = version
|
||||
mustache :page
|
||||
elsif file = wikip.wiki.file("#{file_path}", version, true)
|
||||
show_file(file)
|
||||
else
|
||||
halt 404
|
||||
end
|
||||
end
|
||||
|
||||
get '/search' do
|
||||
@query = params[:q]
|
||||
wiki = wiki_new
|
||||
# Sort wiki search results by count (desc) and then by name (asc)
|
||||
@results = wiki.search(@query).sort { |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
|
||||
@name = @query
|
||||
mustache :search
|
||||
end
|
||||
|
||||
get %r{
|
||||
/pages # match any URL beginning with /pages
|
||||
(?: # begin an optional non-capturing group
|
||||
/(.+) # capture any path after the "/pages" excluding the leading slash
|
||||
)? # end the optional non-capturing group
|
||||
}x do |path|
|
||||
@path = extract_path(path) if path
|
||||
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
||||
@results = wiki.pages
|
||||
@results += wiki.files if settings.wiki_options[:show_all]
|
||||
@results = @results.sort_by { |p| p.name.downcase } # Sort Results alphabetically, fixes 922
|
||||
@ref = wiki.ref
|
||||
mustache :pages
|
||||
end
|
||||
|
||||
get '/fileview' do
|
||||
wiki = wiki_new
|
||||
options = settings.wiki_options
|
||||
content = wiki.pages
|
||||
# if showing all files include wiki.files
|
||||
content += wiki.files if options[:show_all]
|
||||
|
||||
# must pass wiki_options to FileView
|
||||
# --show-all and --collapse-tree can be set.
|
||||
@results = Gollum::FileView.new(content, options).render_files
|
||||
@ref = wiki.ref
|
||||
mustache :file_view, { :layout => false }
|
||||
end
|
||||
|
||||
get '/*' do
|
||||
show_page_or_file(params[:splat].first)
|
||||
end
|
||||
|
||||
def show_page_or_file(fullpath)
|
||||
wiki = wiki_new
|
||||
|
||||
name = extract_name(fullpath) || wiki.index_page
|
||||
path = extract_path(fullpath) || '/'
|
||||
|
||||
if page = wiki.paged(name, path, exact = true)
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
@upload_dest = find_upload_dest(path)
|
||||
|
||||
# Extensions and layout data
|
||||
@editable = true
|
||||
@page_exists = !page.versions.empty?
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@h1_title = wiki.h1_title
|
||||
@bar_side = wiki.bar_side
|
||||
@allow_uploads = wiki.allow_uploads
|
||||
|
||||
mustache :page
|
||||
elsif file = wiki.file(fullpath, wiki.ref, true)
|
||||
show_file(file)
|
||||
else
|
||||
not_found unless @allow_editing
|
||||
page_path = [path, name].compact.join('/')
|
||||
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
|
||||
end
|
||||
end
|
||||
|
||||
def show_file(file)
|
||||
return unless file
|
||||
if file.on_disk?
|
||||
send_file file.on_disk_path, :disposition => 'inline'
|
||||
else
|
||||
content_type file.mime_type
|
||||
file.raw_data
|
||||
end
|
||||
end
|
||||
|
||||
def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
|
||||
return if !page ||
|
||||
((!content || page.raw_data == content) && page.format == format)
|
||||
name ||= page.name
|
||||
format = (format || page.format).to_sym
|
||||
content ||= page.raw_data
|
||||
wiki.update_page(page, name, format, content.to_s, commit)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Options parameter to Gollum::Committer#initialize
|
||||
# :message - The String commit message.
|
||||
# :name - The String author full name.
|
||||
# :email - The String email address.
|
||||
# message is sourced from the incoming request parameters
|
||||
# author details are sourced from the session, to be populated by rack middleware ahead of us
|
||||
def commit_message
|
||||
msg = (params[:message].nil? or params[:message].empty?) ? "[no message]" : params[:message]
|
||||
commit_message = { :message => msg }
|
||||
author_parameters = session['gollum.author']
|
||||
commit_message.merge! author_parameters unless author_parameters.nil?
|
||||
commit_message
|
||||
end
|
||||
|
||||
def find_upload_dest(path)
|
||||
settings.wiki_options[:allow_uploads] ?
|
||||
(settings.wiki_options[:per_page_uploads] ?
|
||||
"#{path}/#{@name}".sub(/^\/\//, '') : 'uploads'
|
||||
) : ''
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,91 +0,0 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
module Gollum
|
||||
class BlobEntry
|
||||
# Gets the String SHA for this blob.
|
||||
attr_reader :sha
|
||||
|
||||
# Gets the full path String for this blob.
|
||||
attr_reader :path
|
||||
|
||||
# Gets the Fixnum size of this blob.
|
||||
attr_reader :size
|
||||
|
||||
def initialize(sha, path, size = nil)
|
||||
@sha = sha
|
||||
@path = path
|
||||
@size = size
|
||||
@dir = @name = @blob = nil
|
||||
end
|
||||
|
||||
# Gets the normalized directory path String for this blob.
|
||||
def dir
|
||||
@dir ||= self.class.normalize_dir(::File.dirname(@path))
|
||||
end
|
||||
|
||||
# Gets the file base name String for this blob.
|
||||
def name
|
||||
@name ||= ::File.basename(@path)
|
||||
end
|
||||
|
||||
# Gets a Grit::Blob instance for this blob.
|
||||
#
|
||||
# repo - Grit::Repo instance for the Grit::Blob.
|
||||
#
|
||||
# Returns an unbaked Grit::Blob instance.
|
||||
def blob(repo)
|
||||
@blob ||= Grit::Blob.create(repo,
|
||||
:id => @sha, :name => name, :size => @size)
|
||||
end
|
||||
|
||||
# Gets a Page instance for this blob.
|
||||
#
|
||||
# wiki - Gollum::Wiki instance for the Gollum::Page
|
||||
#
|
||||
# Returns a Gollum::Page instance.
|
||||
def page(wiki, commit)
|
||||
blob = self.blob(wiki.repo)
|
||||
page = wiki.page_class.new(wiki).populate(blob, self.dir)
|
||||
page.version = commit
|
||||
page
|
||||
end
|
||||
|
||||
# Gets a File instance for this blob.
|
||||
#
|
||||
# wiki - Gollum::Wiki instance for the Gollum::File
|
||||
#
|
||||
# Returns a Gollum::File instance.
|
||||
def file(wiki, commit)
|
||||
blob = self.blob(wiki.repo)
|
||||
file = wiki.file_class.new(wiki).populate(blob, self.dir)
|
||||
file.version = commit
|
||||
file
|
||||
end
|
||||
|
||||
def inspect
|
||||
%(#<Gollum::BlobEntry #{@sha} #{@path}>)
|
||||
end
|
||||
|
||||
# Normalizes a given directory name for searching through tree paths.
|
||||
# Ensures that a directory begins with a slash, or
|
||||
#
|
||||
# normalize_dir("") # => ""
|
||||
# normalize_dir(".") # => ""
|
||||
# normalize_dir("foo") # => "/foo"
|
||||
# normalize_dir("/foo/") # => "/foo"
|
||||
# normalize_dir("/") # => ""
|
||||
# normalize_dir("c:/") # => ""
|
||||
#
|
||||
# dir - String directory name.
|
||||
#
|
||||
# Returns a normalized String directory name, or nil if no directory
|
||||
# is given.
|
||||
def self.normalize_dir(dir)
|
||||
return '' if dir =~ /^.:\/$/
|
||||
if dir
|
||||
dir = ::File.expand_path(dir, '/')
|
||||
dir = '' if dir == '/'
|
||||
end
|
||||
dir
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,232 +0,0 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
module Gollum
|
||||
# Responsible for handling the commit process for a Wiki. It sets up the
|
||||
# Git index, provides methods for modifying the tree, and stores callbacks
|
||||
# to be fired after the commit has been made. This is specifically
|
||||
# designed to handle multiple updated pages in a single commit.
|
||||
class Committer
|
||||
# Gets the instance of the Gollum::Wiki that is being updated.
|
||||
attr_reader :wiki
|
||||
|
||||
# Gets a Hash of commit options.
|
||||
attr_reader :options
|
||||
|
||||
# Initializes the Committer.
|
||||
#
|
||||
# wiki - The Gollum::Wiki instance that is being updated.
|
||||
# options - The commit Hash details:
|
||||
# :message - The String commit message.
|
||||
# :name - The String author full name.
|
||||
# :email - The String email address.
|
||||
# :parent - Optional Grit::Commit parent to this update.
|
||||
# :tree - Optional String SHA of the tree to create the
|
||||
# index from.
|
||||
# :committer - Optional Gollum::Committer instance. If provided,
|
||||
# assume that this operation is part of batch of
|
||||
# updates and the commit happens later.
|
||||
#
|
||||
# Returns the Committer instance.
|
||||
def initialize(wiki, options = {})
|
||||
@wiki = wiki
|
||||
@options = options
|
||||
@callbacks = []
|
||||
end
|
||||
|
||||
# Public: References the Git index for this commit.
|
||||
#
|
||||
# Returns a Grit::Index.
|
||||
def index
|
||||
@index ||= begin
|
||||
idx = @wiki.repo.index
|
||||
if tree = options[:tree]
|
||||
idx.read_tree(tree)
|
||||
elsif parent = parents.first
|
||||
idx.read_tree(parent.tree.id)
|
||||
end
|
||||
idx
|
||||
end
|
||||
end
|
||||
|
||||
# Public: The committer for this commit.
|
||||
#
|
||||
# Returns a Grit::Actor.
|
||||
def actor
|
||||
@actor ||= begin
|
||||
@options[:name] = @wiki.default_committer_name if @options[:name].to_s.empty?
|
||||
@options[:email] = @wiki.default_committer_email if @options[:email].to_s.empty?
|
||||
Grit::Actor.new(@options[:name], @options[:email])
|
||||
end
|
||||
end
|
||||
|
||||
# Public: The parent commits to this pending commit.
|
||||
#
|
||||
# Returns an array of Grit::Commit instances.
|
||||
def parents
|
||||
@parents ||= begin
|
||||
arr = [@options[:parent] || @wiki.repo.commit(@wiki.ref)]
|
||||
arr.flatten!
|
||||
arr.compact!
|
||||
arr
|
||||
end
|
||||
end
|
||||
|
||||
# Adds a page to the given Index.
|
||||
#
|
||||
# dir - The String subdirectory of the Gollum::Page without any
|
||||
# prefix or suffix slashes (e.g. "foo/bar").
|
||||
# name - The String Gollum::Page filename_stripped.
|
||||
# format - The Symbol Gollum::Page format.
|
||||
# data - The String wiki data to store in the tree map.
|
||||
# allow_same_ext - A Boolean determining if the tree map allows the same
|
||||
# filename with the same extension.
|
||||
#
|
||||
# Raises Gollum::DuplicatePageError if a matching filename already exists.
|
||||
# This way, pages are not inadvertently overwritten.
|
||||
#
|
||||
# Returns nothing (modifies the Index in place).
|
||||
def add_to_index(dir, name, format, data, allow_same_ext = false)
|
||||
path = @wiki.page_file_name(name, format)
|
||||
|
||||
dir = '/' if dir.strip.empty?
|
||||
|
||||
fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
|
||||
fullpath = fullpath[1..-1] if fullpath =~ /^\//
|
||||
|
||||
if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/')
|
||||
tree = tree / dir unless tree.nil?
|
||||
end
|
||||
|
||||
if tree
|
||||
downpath = path.downcase.sub(/\.\w+$/, '')
|
||||
|
||||
tree.blobs.each do |blob|
|
||||
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
|
||||
|
||||
existing_file = blob.name.downcase.sub(/\.\w+$/, '')
|
||||
existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
|
||||
|
||||
new_file_ext = ::File.extname(path).sub(/^\./, '')
|
||||
|
||||
if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext)
|
||||
raise DuplicatePageError.new(dir, blob.name, path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fullpath = fullpath.force_encoding('ascii-8bit') if fullpath.respond_to?(:force_encoding)
|
||||
|
||||
index.add(fullpath, @wiki.normalize(data))
|
||||
end
|
||||
|
||||
# Update the given file in the repository's working directory if there
|
||||
# is a working directory present.
|
||||
#
|
||||
# dir - The String directory in which the file lives.
|
||||
# name - The String name of the page or the stripped filename
|
||||
# (should be pre-canonicalized if required).
|
||||
# format - The Symbol format of the page.
|
||||
#
|
||||
# Returns nothing.
|
||||
def update_working_dir(dir, name, format)
|
||||
unless @wiki.repo.bare
|
||||
if @wiki.page_file_dir
|
||||
dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(dir, @wiki.page_file_dir)
|
||||
end
|
||||
|
||||
path =
|
||||
if dir == ''
|
||||
@wiki.page_file_name(name, format)
|
||||
else
|
||||
::File.join(dir, @wiki.page_file_name(name, format))
|
||||
end
|
||||
|
||||
path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)
|
||||
|
||||
Dir.chdir(::File.join(@wiki.repo.path, '..')) do
|
||||
if file_path_scheduled_for_deletion?(index.tree, path)
|
||||
@wiki.repo.git.rm({'f' => true}, '--', path)
|
||||
else
|
||||
@wiki.repo.git.checkout({}, 'HEAD', '--', path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Writes the commit to Git and runs the after_commit callbacks.
|
||||
#
|
||||
# Returns the String SHA1 of the new commit.
|
||||
def commit
|
||||
sha1 = index.commit(@options[:message], parents, actor, nil, @wiki.ref)
|
||||
@callbacks.each do |cb|
|
||||
cb.call(self, sha1)
|
||||
end
|
||||
sha1
|
||||
end
|
||||
|
||||
# Adds a callback to be fired after a commit.
|
||||
#
|
||||
# block - A block that expects this Committer instance and the created
|
||||
# commit's SHA1 as the arguments.
|
||||
#
|
||||
# Returns nothing.
|
||||
def after_commit(&block)
|
||||
@callbacks << block
|
||||
end
|
||||
|
||||
# Determine if a given page (regardless of format) is scheduled to be
|
||||
# deleted in the next commit for the given Index.
|
||||
#
|
||||
# map - The Hash map:
|
||||
# key - The String directory or filename.
|
||||
# val - The Hash submap or the String contents of the file.
|
||||
# path - The String path of the page file. This may include the format
|
||||
# extension in which case it will be ignored.
|
||||
#
|
||||
# Returns the Boolean response.
|
||||
def page_path_scheduled_for_deletion?(map, path)
|
||||
parts = path.split('/')
|
||||
if parts.size == 1
|
||||
deletions = map.keys.select { |k| !map[k] }
|
||||
downfile = parts.first.downcase.sub(/\.\w+$/, '')
|
||||
deletions.any? { |d| d.downcase.sub(/\.\w+$/, '') == downfile }
|
||||
else
|
||||
part = parts.shift
|
||||
if rest = map[part]
|
||||
page_path_scheduled_for_deletion?(rest, parts.join('/'))
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Determine if a given file is scheduled to be deleted in the next commit
|
||||
# for the given Index.
|
||||
#
|
||||
# map - The Hash map:
|
||||
# key - The String directory or filename.
|
||||
# val - The Hash submap or the String contents of the file.
|
||||
# path - The String path of the file including extension.
|
||||
#
|
||||
# Returns the Boolean response.
|
||||
def file_path_scheduled_for_deletion?(map, path)
|
||||
parts = path.split('/')
|
||||
if parts.size == 1
|
||||
deletions = map.keys.select { |k| !map[k] }
|
||||
deletions.any? { |d| d == parts.first }
|
||||
else
|
||||
part = parts.shift
|
||||
if rest = map[part]
|
||||
file_path_scheduled_for_deletion?(rest, parts.join('/'))
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Proxies methods t
|
||||
def method_missing(name, *args)
|
||||
args.map! { |item| item.respond_to?(:force_encoding) ? item.force_encoding('ascii-8bit') : item }
|
||||
index.send(name, *args)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
module Precious
|
||||
class EditingAuth < Sinatra::Base
|
||||
def initialize(app)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
@env = env
|
||||
# Blocks all potentially editable pages. Use EditingAuth::whitelist_pages to unblock pages.
|
||||
unless (env["REQUEST_METHOD"] == "GET") || @app.settings.wiki_options[:allow_editing]
|
||||
return block unless excluded_page?
|
||||
end
|
||||
@app.call(env)
|
||||
end
|
||||
|
||||
def block
|
||||
[403, {'Content-Type' => 'text/html', 'Content-Length' => '9'}, ['Forbidden']]
|
||||
end
|
||||
|
||||
def excluded_page?
|
||||
return false if env["REQUEST_PATH"].nil?
|
||||
whitelist_pages.any? do |whitelisted_page|
|
||||
env["REQUEST_PATH"].include? whitelisted_page
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# List pages paths as str that you want to whitelist.
|
||||
# Pages will be compared with env["REQUEST_PATH"] using String::include? method.
|
||||
def whitelist_pages
|
||||
return ["/compare/"]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,94 +0,0 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
module Gollum
|
||||
class File
|
||||
Wiki.file_class = self
|
||||
|
||||
# Public: Initialize a file.
|
||||
#
|
||||
# wiki - The Gollum::Wiki in question.
|
||||
#
|
||||
# Returns a newly initialized Gollum::File.
|
||||
def initialize(wiki)
|
||||
@wiki = wiki
|
||||
@blob = nil
|
||||
@path = nil
|
||||
end
|
||||
|
||||
# Public: The url path required to reach this page within the repo.
|
||||
#
|
||||
# Returns the String url_path
|
||||
def url_path
|
||||
path = self.path
|
||||
path = path.sub(/\/[^\/]+$/, '/') if path.include?('/')
|
||||
path
|
||||
end
|
||||
|
||||
# Public: The url_path, but CGI escaped.
|
||||
#
|
||||
# Returns the String url_path
|
||||
def escaped_url_path
|
||||
CGI.escape(self.url_path).gsub('%2F','/')
|
||||
end
|
||||
|
||||
# Public: The on-disk filename of the file.
|
||||
#
|
||||
# Returns the String name.
|
||||
def name
|
||||
@blob && @blob.name
|
||||
end
|
||||
alias filename name
|
||||
|
||||
# Public: The raw contents of the page.
|
||||
#
|
||||
# Returns the String data.
|
||||
def raw_data
|
||||
@blob && @blob.data
|
||||
end
|
||||
|
||||
# Public: The Grit::Commit version of the file.
|
||||
attr_accessor :version
|
||||
|
||||
# Public: The String path of the file.
|
||||
attr_reader :path
|
||||
|
||||
# Public: The String mime type of the file.
|
||||
def mime_type
|
||||
@blob.mime_type
|
||||
end
|
||||
|
||||
# Populate the File with information from the Blob.
|
||||
#
|
||||
# blob - The Grit::Blob that contains the info.
|
||||
# path - The String directory path of the file.
|
||||
#
|
||||
# Returns the populated Gollum::File.
|
||||
def populate(blob, path=nil)
|
||||
@blob = blob
|
||||
@path = "#{path}/#{blob.name}"[1..-1]
|
||||
self
|
||||
end
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
# Internal Methods
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
# Find a file in the given Gollum repo.
|
||||
#
|
||||
# name - The full String path.
|
||||
# version - The String version ID to find.
|
||||
#
|
||||
# Returns a Gollum::File or nil if the file could not be found.
|
||||
def find(name, version)
|
||||
checked = name.downcase
|
||||
map = @wiki.tree_map_for(version)
|
||||
if entry = map.detect { |entry| entry.path.downcase == checked }
|
||||
@path = name
|
||||
@blob = entry.blob(@wiki.repo)
|
||||
@version = version.is_a?(Grit::Commit) ? version : @wiki.commit_for(version)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,160 +0,0 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
module Gollum
|
||||
=begin
|
||||
FileView requires that:
|
||||
- All files in root dir are processed first
|
||||
- Then all the folders are sorted and processed
|
||||
=end
|
||||
class FileView
|
||||
# common use cases:
|
||||
# set pages to wiki.pages and show_all to false
|
||||
# set pages to wiki.pages + wiki.files and show_all to true
|
||||
def initialize pages, options = {}
|
||||
@pages = pages
|
||||
@show_all = options[:show_all] || false
|
||||
@checked = options[:collapse_tree] ? '' : "checked"
|
||||
end
|
||||
|
||||
def enclose_tree string
|
||||
%Q(<ol class="tree">\n) + string + %Q(</ol>)
|
||||
end
|
||||
|
||||
def new_page page
|
||||
name = page.name
|
||||
url = url_for_page page
|
||||
%Q( <li class="file"><a href="#{url}">#{name}</a></li>\n)
|
||||
end
|
||||
|
||||
def new_folder folder_path
|
||||
new_sub_folder folder_path
|
||||
end
|
||||
|
||||
def new_sub_folder path
|
||||
<<-HTML
|
||||
<li>
|
||||
<label>#{path}</label> <input type="checkbox" #{@checked} />
|
||||
<ol>
|
||||
HTML
|
||||
end
|
||||
|
||||
def end_folder
|
||||
<<-HTML
|
||||
</ol>
|
||||
</li>
|
||||
HTML
|
||||
end
|
||||
|
||||
def url_for_page page
|
||||
url = ''
|
||||
if @show_all
|
||||
# Remove ext for valid pages.
|
||||
filename = page.filename
|
||||
filename = Page::valid_page_name?(filename) ? filename.chomp(::File.extname(filename)) : filename
|
||||
|
||||
url = ::File.join(::File.dirname(page.path), filename)
|
||||
else
|
||||
url = ::File.join(::File.dirname(page.path), page.filename_stripped)
|
||||
end
|
||||
url = url[2..-1] if url[0,2] == './'
|
||||
url
|
||||
end
|
||||
|
||||
def render_files
|
||||
html = ''
|
||||
count = @pages.size
|
||||
folder_start = -1
|
||||
|
||||
# Process all pages until folders start
|
||||
count.times do | index |
|
||||
page = @pages[ index ]
|
||||
path = page.path
|
||||
|
||||
unless path.include? '/'
|
||||
# Page processed (not contained in a folder)
|
||||
html += new_page page
|
||||
else
|
||||
# Folders start at the next index
|
||||
folder_start = index
|
||||
break # Pages finished, move on to folders
|
||||
end
|
||||
end
|
||||
|
||||
# If there are no folders, then we're done.
|
||||
return enclose_tree(html) if folder_start <= -1
|
||||
|
||||
# Handle special case of only one folder.
|
||||
if (count - folder_start == 1)
|
||||
page = @pages[ folder_start ]
|
||||
name = page.name
|
||||
url = url_for_page page
|
||||
html += <<-HTML
|
||||
<li>
|
||||
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
|
||||
<ol>
|
||||
<li class="file"><a href="#{url}">#{name}</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
HTML
|
||||
|
||||
return enclose_tree html
|
||||
end
|
||||
|
||||
sorted_folders = []
|
||||
(folder_start).upto count - 1 do | index |
|
||||
sorted_folders += [[ @pages[ index ].path, index ]]
|
||||
end
|
||||
|
||||
# http://stackoverflow.com/questions/3482814/sorting-list-of-string-paths-in-vb-net
|
||||
sorted_folders.sort! do |first,second|
|
||||
a = first[0]
|
||||
b = second[0]
|
||||
|
||||
# use :: operator because gollum defines its own conflicting File class
|
||||
dir_compare = ::File.dirname(a) <=> ::File.dirname(b)
|
||||
|
||||
# Sort based on directory name unless they're equal (0) in
|
||||
# which case sort based on file name.
|
||||
if dir_compare == 0
|
||||
::File.basename(a) <=> ::File.basename(b)
|
||||
else
|
||||
dir_compare
|
||||
end
|
||||
end
|
||||
|
||||
# keep track of folder depth, 0 = at root.
|
||||
cwd_array = []
|
||||
changed = false
|
||||
|
||||
# process rest of folders
|
||||
(0...sorted_folders.size).each do | index |
|
||||
page = @pages[ sorted_folders[ index ][ 1 ] ]
|
||||
path = page.path
|
||||
folder = ::File.dirname path
|
||||
|
||||
tmp_array = folder.split '/'
|
||||
|
||||
(0...tmp_array.size).each do | index |
|
||||
if cwd_array[ index ].nil? || changed
|
||||
html += new_sub_folder tmp_array[ index ]
|
||||
next
|
||||
end
|
||||
|
||||
if cwd_array[ index ] != tmp_array[ index ]
|
||||
changed = true
|
||||
(cwd_array.size - index).times do
|
||||
html += end_folder
|
||||
end
|
||||
html += new_sub_folder tmp_array[ index ]
|
||||
end
|
||||
end
|
||||
|
||||
html += new_page page
|
||||
cwd_array = tmp_array
|
||||
changed = false
|
||||
end
|
||||
|
||||
# return the completed html
|
||||
enclose_tree html
|
||||
end # end render_files
|
||||
end # end FileView class
|
||||
end # end Gollum module
|
||||
@@ -1,396 +0,0 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
require 'cgi'
|
||||
require 'sinatra'
|
||||
require 'gollum'
|
||||
require 'mustache/sinatra'
|
||||
require 'useragent'
|
||||
require 'stringex'
|
||||
|
||||
require 'gollum/frontend/views/layout'
|
||||
require 'gollum/frontend/views/editable'
|
||||
require 'gollum/frontend/views/has_page'
|
||||
|
||||
require File.expand_path '../helpers', __FILE__
|
||||
|
||||
# Fix to_url
|
||||
class String
|
||||
alias :upstream_to_url :to_url
|
||||
# _Header => header which causes errors
|
||||
def to_url
|
||||
return nil if self.nil?
|
||||
return self if ['_Header', '_Footer', '_Sidebar'].include? self
|
||||
upstream_to_url
|
||||
end
|
||||
end
|
||||
|
||||
# Run the frontend, based on Sinatra
|
||||
#
|
||||
# There are a number of wiki options that can be set for the frontend
|
||||
#
|
||||
# Example
|
||||
# require 'gollum/frontend/app'
|
||||
# Precious::App.set(:wiki_options, {
|
||||
# :universal_toc => false,
|
||||
# }
|
||||
#
|
||||
# See the wiki.rb file for more details on wiki options
|
||||
module Precious
|
||||
class App < Sinatra::Base
|
||||
register Mustache::Sinatra
|
||||
include Precious::Helpers
|
||||
|
||||
dir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
# Detect unsupported browsers.
|
||||
Browser = Struct.new(:browser, :version)
|
||||
|
||||
@@min_ua = [
|
||||
Browser.new('Internet Explorer', '10.0'),
|
||||
Browser.new('Chrome', '7.0'),
|
||||
Browser.new('Firefox', '4.0'),
|
||||
]
|
||||
|
||||
def supported_useragent?(user_agent)
|
||||
ua = UserAgent.parse(user_agent)
|
||||
@@min_ua.detect {|min| ua >= min }
|
||||
end
|
||||
|
||||
# We want to serve public assets for now
|
||||
set :public_folder, "#{dir}/public/gollum"
|
||||
set :static, true
|
||||
set :default_markup, :markdown
|
||||
|
||||
set :mustache, {
|
||||
# Tell mustache where the Views constant lives
|
||||
:namespace => Precious,
|
||||
|
||||
# Mustache templates live here
|
||||
:templates => "#{dir}/templates",
|
||||
|
||||
# Tell mustache where the views are
|
||||
:views => "#{dir}/views"
|
||||
}
|
||||
|
||||
# Sinatra error handling
|
||||
configure :development, :staging do
|
||||
enable :show_exceptions, :dump_errors
|
||||
disable :raise_errors, :clean_trace
|
||||
end
|
||||
|
||||
configure :test do
|
||||
enable :logging, :raise_errors, :dump_errors
|
||||
end
|
||||
|
||||
before do
|
||||
@base_url = url('/', false).chomp('/')
|
||||
# above will detect base_path when it's used with map in a config.ru
|
||||
settings.wiki_options.merge!({ :base_path => @base_url })
|
||||
end
|
||||
|
||||
get '/' do
|
||||
redirect ::File.join(@base_url, 'Home')
|
||||
end
|
||||
|
||||
# path is set to name if path is nil.
|
||||
# if path is 'a/b' and a and b are dirs, then
|
||||
# path must have a trailing slash 'a/b/' or
|
||||
# extract_path will trim path to 'a'
|
||||
# name, path, version
|
||||
def wiki_page(name, path = nil, version = nil, exact = true)
|
||||
path = name if path.nil?
|
||||
name = extract_name(name)
|
||||
path = extract_path(path)
|
||||
path = '/' if exact && path.nil?
|
||||
|
||||
wiki = wiki_new
|
||||
|
||||
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
|
||||
:name => name, :path => path)
|
||||
end
|
||||
|
||||
def wiki_new
|
||||
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
end
|
||||
|
||||
get '/data/*' do
|
||||
if page = wiki_page(params[:splat].first).page
|
||||
page.raw_data
|
||||
end
|
||||
end
|
||||
|
||||
get '/edit/*' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
@name = wikip.name
|
||||
@path = wikip.path
|
||||
wiki = wikip.wiki
|
||||
if page = wikip.page
|
||||
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
|
||||
live_preview_url = '/livepreview/index.html?page=' + encodeURIComponent(@name)
|
||||
if @path
|
||||
live_preview_url << '&path=' + encodeURIComponent(@path)
|
||||
end
|
||||
redirect to(live_preview_url)
|
||||
else
|
||||
@page = page
|
||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||
raw_data = page.raw_data
|
||||
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
|
||||
mustache :edit
|
||||
end
|
||||
else
|
||||
redirect to("/create/#{encodeURIComponent(@name)}")
|
||||
end
|
||||
end
|
||||
|
||||
post '/edit/*' do
|
||||
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
||||
page_name = CGI.unescape(params[:page])
|
||||
wiki = wiki_new
|
||||
page = wiki.paged(page_name, path, exact = true)
|
||||
return if page.nil?
|
||||
rename = params[:rename].to_url if params[:rename]
|
||||
name = rename || page.name
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = {:committer => committer}
|
||||
|
||||
update_wiki_page(wiki, page, params[:content], commit, name, params[:format])
|
||||
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
|
||||
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
|
||||
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
|
||||
committer.commit
|
||||
|
||||
page = wiki.page(rename) if rename
|
||||
|
||||
redirect to("/#{page.escaped_url_path}") unless page.nil?
|
||||
end
|
||||
|
||||
get '/delete/*' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
name = wikip.name
|
||||
wiki = wikip.wiki
|
||||
page = wikip.page
|
||||
wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
|
||||
|
||||
redirect to('/')
|
||||
end
|
||||
|
||||
get '/create/*' do
|
||||
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
|
||||
@name = wikip.name.to_url
|
||||
@path = wikip.path
|
||||
|
||||
page = wikip.page
|
||||
if page
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
end
|
||||
|
||||
post '/create' do
|
||||
name = params[:page].to_url
|
||||
path = sanitize_empty_params(params[:path]) || ''
|
||||
format = params[:format].intern
|
||||
|
||||
# ensure pages are created in page_file_dir
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
path = clean_url(::File.join(page_dir, path)) unless path.start_with?(page_dir)
|
||||
|
||||
# write_page is not directory aware so use wiki_options to emulate dir support.
|
||||
wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
||||
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message)
|
||||
redirect to("/#{clean_url(::File.join(path,name))}")
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
end
|
||||
end
|
||||
|
||||
post '/revert/:page/*' do
|
||||
wikip = wiki_page(params[:page])
|
||||
@path = wikip.path
|
||||
@name = wikip.name
|
||||
wiki = wikip.wiki
|
||||
@page = wiki.paged(@name,@path)
|
||||
shas = params[:splat].first.split("/")
|
||||
sha1 = shas.shift
|
||||
sha2 = shas.shift
|
||||
|
||||
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
||||
redirect to("/#{@page.escaped_url_path}")
|
||||
else
|
||||
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||
@versions = [sha1, sha2]
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
@message = "The patch does not apply."
|
||||
mustache :compare
|
||||
end
|
||||
end
|
||||
|
||||
post '/preview' do
|
||||
wiki = wiki_new
|
||||
@name = params[:page] || "Preview"
|
||||
@page = wiki.preview_page(@name, params[:content], params[:format])
|
||||
@content = @page.formatted_data
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@editable = false
|
||||
mustache :page
|
||||
end
|
||||
|
||||
get '/history/*' do
|
||||
@page = wiki_page(params[:splat].first).page
|
||||
@page_num = [params[:page].to_i, 1].max
|
||||
@versions = @page.versions :page => @page_num
|
||||
mustache :history
|
||||
end
|
||||
|
||||
post '/compare/*' do
|
||||
@file = params[:splat].first
|
||||
@versions = params[:versions] || []
|
||||
if @versions.size < 2
|
||||
redirect to("/history/#{@file}")
|
||||
else
|
||||
redirect to("/compare/%s/%s...%s" % [
|
||||
@file,
|
||||
@versions.last,
|
||||
@versions.first]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
get %r{
|
||||
/compare/ # match any URL beginning with /compare/
|
||||
(.+) # extract the full path (including any directories)
|
||||
/ # match the final slash
|
||||
([^.]+) # match the first SHA1
|
||||
\.{2,3} # match .. or ...
|
||||
(.+) # match the second SHA1
|
||||
}x do |path, start_version, end_version|
|
||||
wikip = wiki_page(path)
|
||||
@path = wikip.path
|
||||
@name = wikip.name
|
||||
@versions = [start_version, end_version]
|
||||
wiki = wikip.wiki
|
||||
@page = wikip.page
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
mustache :compare
|
||||
end
|
||||
|
||||
get %r{^/(javascript|css|images)} do
|
||||
halt 404
|
||||
end
|
||||
|
||||
get %r{/(.+?)/([0-9a-f]{40})} do
|
||||
file_path = params[:captures][0]
|
||||
version = params[:captures][1]
|
||||
wikip = wiki_page(file_path, file_path, version)
|
||||
name = wikip.name
|
||||
path = wikip.path
|
||||
if page = wikip.page
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
@editable = true
|
||||
mustache :page
|
||||
else
|
||||
halt 404
|
||||
end
|
||||
end
|
||||
|
||||
get '/search' do
|
||||
@query = params[:q]
|
||||
wiki = wiki_new
|
||||
@results = wiki.search @query
|
||||
@name = @query
|
||||
mustache :search
|
||||
end
|
||||
|
||||
get %r{
|
||||
/pages # match any URL beginning with /pages
|
||||
(?: # begin an optional non-capturing group
|
||||
/(.+) # capture any path after the "/pages" excluding the leading slash
|
||||
)? # end the optional non-capturing group
|
||||
}x do |path|
|
||||
@path = extract_path(path) if path
|
||||
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
||||
@results = wiki.pages
|
||||
@results += wiki.files if settings.wiki_options[:show_all]
|
||||
@ref = wiki.ref
|
||||
mustache :pages
|
||||
end
|
||||
|
||||
get '/fileview' do
|
||||
wiki = wiki_new
|
||||
options = settings.wiki_options
|
||||
content = wiki.pages
|
||||
# if showing all files include wiki.files
|
||||
content += wiki.files if options[:show_all]
|
||||
|
||||
# must pass wiki_options to FileView
|
||||
# --show-all and --collapse-tree can be set.
|
||||
@results = Gollum::FileView.new(content, options).render_files
|
||||
@ref = wiki.ref
|
||||
mustache :file_view, { :layout => false }
|
||||
end
|
||||
|
||||
get '/*' do
|
||||
show_page_or_file(params[:splat].first)
|
||||
end
|
||||
|
||||
def show_page_or_file(fullpath)
|
||||
name = extract_name(fullpath)
|
||||
path = extract_path(fullpath) || '/'
|
||||
wiki = wiki_new
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
path = ::File.join(page_dir, path) unless path.start_with?(page_dir)
|
||||
|
||||
if page = wiki.paged(name, path, exact = true)
|
||||
@page = page
|
||||
@name = name
|
||||
@editable = true
|
||||
@content = page.formatted_data
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
mustache :page
|
||||
elsif file = wiki.file(fullpath)
|
||||
content_type file.mime_type
|
||||
file.raw_data
|
||||
else
|
||||
page_path = [path, name].compact.join('/')
|
||||
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
|
||||
end
|
||||
end
|
||||
|
||||
def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
|
||||
return if !page ||
|
||||
((!content || page.raw_data == content) && page.format == format)
|
||||
name ||= page.name
|
||||
format = (format || page.format).to_sym
|
||||
content ||= page.raw_data
|
||||
wiki.update_page(page, name, format, content.to_s, commit)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Options parameter to Gollum::Committer#initialize
|
||||
# :message - The String commit message.
|
||||
# :name - The String author full name.
|
||||
# :email - The String email address.
|
||||
# message is sourced from the incoming request parameters
|
||||
# author details are sourced from the session, to be populated by rack middleware ahead of us
|
||||
def commit_message
|
||||
commit_message = { :message => params[:message] }
|
||||
author_parameters = session['gollum.author']
|
||||
commit_message.merge! author_parameters unless author_parameters.nil?
|
||||
commit_message
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,36 +0,0 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
module Precious
|
||||
module Helpers
|
||||
# Extract the path string that Gollum::Wiki expects
|
||||
def extract_path(file_path)
|
||||
return nil if file_path.nil?
|
||||
last_slash = file_path.rindex("/")
|
||||
if last_slash
|
||||
file_path[0, last_slash]
|
||||
end
|
||||
end
|
||||
|
||||
# Extract the 'page' name from the file_path
|
||||
def extract_name(file_path)
|
||||
::File.basename(file_path)
|
||||
end
|
||||
|
||||
def sanitize_empty_params(param)
|
||||
[nil,''].include?(param) ? nil : CGI.unescape(param)
|
||||
end
|
||||
|
||||
# Remove all slashes from the start of string.
|
||||
# Remove all double slashes
|
||||
def clean_url url
|
||||
return url if url.nil?
|
||||
url.gsub('%2F','/').gsub(/^\/+/,'').gsub('//','/')
|
||||
end
|
||||
|
||||
def trim_leading_slash url
|
||||
return url if url.nil?
|
||||
url.gsub!('%2F','/')
|
||||
return '/' + url.gsub(/^\/+/,'') if url[0,1] == '/'
|
||||
url
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,103 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kevin Dangoor (kdangoor@mozilla.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* class Ace
|
||||
*
|
||||
* The main class required to set up an Ace instance in the browser.
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
var Dom = require("./lib/dom");
|
||||
var Event = require("./lib/event");
|
||||
|
||||
var Editor = require("./editor").Editor;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var UndoManager = require("./undomanager").UndoManager;
|
||||
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||
var MultiSelect = require("./multi_select").MultiSelect;
|
||||
|
||||
// The following require()s are for inclusion in the built ace file
|
||||
require("./worker/worker_client");
|
||||
require("./keyboard/hash_handler");
|
||||
require("./keyboard/state_handler");
|
||||
require("./placeholder");
|
||||
exports.config = require("./config");
|
||||
/**
|
||||
* Ace.edit(el) -> Editor
|
||||
* - el (String | DOMElement): Either the id of an element, or the element itself
|
||||
*
|
||||
* This method embeds the Ace editor into the DOM, at the element provided by `el`.
|
||||
*
|
||||
**/
|
||||
exports.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
if (el.env && el.env.editor instanceof Editor)
|
||||
return el.env.editor;
|
||||
|
||||
var doc = new EditSession(Dom.getInnerText(el));
|
||||
doc.setUndoManager(new UndoManager());
|
||||
el.innerHTML = '';
|
||||
|
||||
var editor = new Editor(new Renderer(el, require("./theme/textmate")));
|
||||
new MultiSelect(editor);
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = {};
|
||||
env.document = doc;
|
||||
env.editor = editor;
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
});
|
||||
el.env = env;
|
||||
// Store env on editor such that it can be accessed later on from
|
||||
// the returned object.
|
||||
editor.env = env;
|
||||
return editor;
|
||||
};
|
||||
|
||||
});
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Harutyun Amirjanyan <harutyun@c9.io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var JavaScriptMode = require("./mode/javascript").Mode;
|
||||
var Range = require("./range").Range;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
function forceTokenize(session){
|
||||
for (var i = 0, l = session.getLength(); i < l; i++)
|
||||
session.getTokens(i)
|
||||
}
|
||||
|
||||
function testStates(session, states) {
|
||||
for (var i = 0, l = session.getLength(); i < l; i++)
|
||||
assert.equal(session.bgTokenizer.states[i], states[i])
|
||||
assert.ok(l == states.length)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test background tokenizer update on session change" : function() {
|
||||
var doc = new EditSession([
|
||||
"/*",
|
||||
"*/",
|
||||
"var juhu"
|
||||
]);
|
||||
doc.setMode("./mode/javascript")
|
||||
|
||||
forceTokenize(doc)
|
||||
testStates(doc, ["comment", "start", "start"])
|
||||
|
||||
doc.remove(new Range(0,2,1,2))
|
||||
testStates(doc, [null, "start"])
|
||||
|
||||
forceTokenize(doc)
|
||||
testStates(doc, ["comment", "comment"])
|
||||
|
||||
doc.insert({row:0, column:2}, "\n*/")
|
||||
testStates(doc, [undefined, undefined, "comment"])
|
||||
|
||||
forceTokenize(doc)
|
||||
testStates(doc, ["comment", "start", "start"])
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"no use strict";
|
||||
|
||||
var lang = require("./lib/lang");
|
||||
|
||||
var global = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
var options = {
|
||||
packaged: false,
|
||||
workerPath: "",
|
||||
modePath: "",
|
||||
themePath: "",
|
||||
suffix: ".js"
|
||||
};
|
||||
|
||||
exports.get = function(key) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
return options[key];
|
||||
};
|
||||
|
||||
exports.set = function(key, value) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
options[key] = value;
|
||||
};
|
||||
|
||||
exports.all = function() {
|
||||
return lang.copyObject(options);
|
||||
};
|
||||
|
||||
exports.init = function() {
|
||||
options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
|
||||
|
||||
if (!global.document)
|
||||
return "";
|
||||
|
||||
var scriptOptions = {};
|
||||
var scriptUrl = "";
|
||||
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i=0; i<scripts.length; i++) {
|
||||
var script = scripts[i];
|
||||
|
||||
var src = script.src || script.getAttribute("src");
|
||||
if (!src) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var attributes = script.attributes;
|
||||
for (var j=0, l=attributes.length; j < l; j++) {
|
||||
var attr = attributes[j];
|
||||
if (attr.name.indexOf("data-ace-") === 0) {
|
||||
scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
|
||||
}
|
||||
}
|
||||
|
||||
var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
|
||||
if (m)
|
||||
scriptUrl = m[1];
|
||||
}
|
||||
|
||||
if (scriptUrl) {
|
||||
scriptOptions.base = scriptOptions.base || scriptUrl;
|
||||
scriptOptions.packaged = true;
|
||||
}
|
||||
|
||||
scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
|
||||
scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
|
||||
scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
|
||||
delete scriptOptions.base;
|
||||
|
||||
for (var key in scriptOptions)
|
||||
if (typeof scriptOptions[key] !== "undefined")
|
||||
exports.set(key, scriptOptions[key]);
|
||||
};
|
||||
|
||||
function deHyphenate(str) {
|
||||
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,98 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jan Jongboom <fabian AT ajax DOT org>
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var TextLayer = require("../layer/text").Text;
|
||||
var baseStyles = require("../requirejs/text!./static.css");
|
||||
|
||||
/* Transforms a given input code snippet into HTML using the given mode
|
||||
*
|
||||
* @param {string} input Code snippet
|
||||
* @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
|
||||
* @param {string} r Code snippet
|
||||
* @returns {object} An object containing: html, css
|
||||
*/
|
||||
|
||||
exports.render = function(input, mode, theme, lineStart, disableGutter) {
|
||||
lineStart = parseInt(lineStart || 1, 10);
|
||||
|
||||
var session = new EditSession("");
|
||||
session.setMode(mode);
|
||||
session.setUseWorker(false);
|
||||
|
||||
var textLayer = new TextLayer(document.createElement("div"));
|
||||
textLayer.setSession(session);
|
||||
textLayer.config = {
|
||||
characterWidth: 10,
|
||||
lineHeight: 20
|
||||
};
|
||||
|
||||
session.setValue(input);
|
||||
|
||||
var stringBuilder = [];
|
||||
var length = session.getLength();
|
||||
|
||||
for(var ix = 0; ix < length; ix++) {
|
||||
var lineTokens = session.getTokens(ix);
|
||||
stringBuilder.push("<div class='ace_line'>");
|
||||
if (!disableGutter)
|
||||
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
|
||||
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
|
||||
stringBuilder.push("</div>");
|
||||
}
|
||||
|
||||
// let's prepare the whole html
|
||||
var html = "<div class=':cssClass'>\
|
||||
<div class='ace_editor ace_scroller ace_text-layer'>\
|
||||
:code\
|
||||
</div>\
|
||||
</div>".replace(/:cssClass/, theme.cssClass).replace(/:code/, stringBuilder.join(""));
|
||||
|
||||
textLayer.destroy();
|
||||
|
||||
return {
|
||||
css: baseStyles + theme.cssText,
|
||||
html: html
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
require("../test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var assert = require("assert");
|
||||
var highlighter = require("./static_highlight");
|
||||
var JavaScriptMode = require("../mode/javascript").Mode;
|
||||
|
||||
// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
|
||||
module.exports = {
|
||||
timeout: 10000,
|
||||
|
||||
"test simple snippet": function(next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
function hello (a, b, c) {\n\
|
||||
console.log(a * b + c + 'sup?');\n\
|
||||
}";
|
||||
var mode = new JavaScriptMode();
|
||||
|
||||
var isError = false, result;
|
||||
try {
|
||||
result = highlighter.render(snippet, mode, theme);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
isError = true;
|
||||
}
|
||||
// todo: write something more meaningful
|
||||
assert.equal(isError, false);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
"test css from theme is used": function(next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
function hello (a, b, c) {\n\
|
||||
console.log(a * b + c + 'sup?');\n\
|
||||
}";
|
||||
var mode = new JavaScriptMode();
|
||||
|
||||
var isError = false, result;
|
||||
result = highlighter.render(snippet, mode, theme);
|
||||
|
||||
assert.ok(result.css.indexOf(theme.cssText) !== -1);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
"test theme classname should be in output html": function (next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
function hello (a, b, c) {\n\
|
||||
console.log(a * b + c + 'sup?');\n\
|
||||
}";
|
||||
var mode = new JavaScriptMode();
|
||||
|
||||
var isError = false, result;
|
||||
result = highlighter.render(snippet, mode, theme);
|
||||
assert.equal(!!result.html.match(/<div class='ace-tomorrow'>/), true);
|
||||
|
||||
next();
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,315 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var event = require("../lib/event");
|
||||
var useragent = require("../lib/useragent");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
var TextInput = function(parentNode, host) {
|
||||
var text = dom.createElement("textarea");
|
||||
/*/ debug
|
||||
text.style.opacity = 1
|
||||
text.style.background = "rgba(0, 250, 0, 0.3)"
|
||||
text.style.outline = "rgba(0, 250, 0, 0.8) solid 1px"
|
||||
text.style.outlineOffset = "3px"
|
||||
/**/
|
||||
if (useragent.isTouchPad)
|
||||
text.setAttribute("x-palm-disable-auto-cap", true);
|
||||
|
||||
text.setAttribute("wrap", "off");
|
||||
|
||||
text.style.top = "-2em";
|
||||
parentNode.insertBefore(text, parentNode.firstChild);
|
||||
|
||||
var PLACEHOLDER = useragent.isIE ? "\x01" : "\x01";
|
||||
sendText();
|
||||
|
||||
var inCompostion = false;
|
||||
var copied = false;
|
||||
var pasted = false;
|
||||
var tempStyle = '';
|
||||
|
||||
function reset(full) {
|
||||
try {
|
||||
if (full) {
|
||||
text.value = PLACEHOLDER;
|
||||
text.selectionStart = 0;
|
||||
text.selectionEnd = 1;
|
||||
} else
|
||||
text.select();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function sendText(valueToSend) {
|
||||
if (!copied) {
|
||||
var value = valueToSend || text.value;
|
||||
if (value) {
|
||||
if (value.length > 1) {
|
||||
if (value.charAt(0) == PLACEHOLDER)
|
||||
value = value.substr(1);
|
||||
else if (value.charAt(value.length - 1) == PLACEHOLDER)
|
||||
value = value.slice(0, -1);
|
||||
}
|
||||
|
||||
if (value && value != PLACEHOLDER) {
|
||||
if (pasted)
|
||||
host.onPaste(value);
|
||||
else
|
||||
host.onTextInput(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copied = false;
|
||||
pasted = false;
|
||||
|
||||
// Safari doesn't fire copy events if no text is selected
|
||||
reset(true);
|
||||
}
|
||||
|
||||
var onTextInput = function(e) {
|
||||
if (!inCompostion)
|
||||
sendText(e.data);
|
||||
setTimeout(function () {
|
||||
if (!inCompostion)
|
||||
reset(true);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
var onPropertyChange = function(e) {
|
||||
setTimeout(function() {
|
||||
if (!inCompostion)
|
||||
sendText();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
var onCompositionStart = function(e) {
|
||||
inCompostion = true;
|
||||
host.onCompositionStart();
|
||||
setTimeout(onCompositionUpdate, 0);
|
||||
};
|
||||
|
||||
var onCompositionUpdate = function() {
|
||||
if (!inCompostion) return;
|
||||
host.onCompositionUpdate(text.value);
|
||||
};
|
||||
|
||||
var onCompositionEnd = function(e) {
|
||||
inCompostion = false;
|
||||
host.onCompositionEnd();
|
||||
};
|
||||
|
||||
var onCopy = function(e) {
|
||||
copied = true;
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText)
|
||||
text.value = copyText;
|
||||
else
|
||||
e.preventDefault();
|
||||
reset();
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
var onCut = function(e) {
|
||||
copied = true;
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText) {
|
||||
text.value = copyText;
|
||||
host.onCut();
|
||||
} else
|
||||
e.preventDefault();
|
||||
reset();
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
|
||||
|
||||
event.addListener(text, "paste", function(e) {
|
||||
// Mark that the next input text comes from past.
|
||||
pasted = true;
|
||||
// Some browsers support the event.clipboardData API. Use this to get
|
||||
// the pasted content which increases speed if pasting a lot of lines.
|
||||
if (e.clipboardData && e.clipboardData.getData) {
|
||||
sendText(e.clipboardData.getData("text/plain"));
|
||||
e.preventDefault();
|
||||
}
|
||||
else {
|
||||
// If a browser doesn't support any of the things above, use the regular
|
||||
// method to detect the pasted input.
|
||||
onPropertyChange();
|
||||
}
|
||||
});
|
||||
|
||||
if ("onbeforecopy" in text && typeof clipboardData !== "undefined") {
|
||||
event.addListener(text, "beforecopy", function(e) {
|
||||
if (tempStyle)
|
||||
return; // without this text is copied when contextmenu is shown
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText)
|
||||
clipboardData.setData("Text", copyText);
|
||||
else
|
||||
e.preventDefault();
|
||||
});
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if (e.ctrlKey && e.keyCode == 88) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
clipboardData.setData("Text", copyText);
|
||||
host.onCut();
|
||||
}
|
||||
event.preventDefault(e);
|
||||
}
|
||||
});
|
||||
event.addListener(text, "cut", onCut); // for ie9 context menu
|
||||
}
|
||||
else if (useragent.isOpera) {
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
|
||||
return;
|
||||
|
||||
if ((e.keyCode == 88 || e.keyCode == 67)) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
text.value = copyText;
|
||||
text.select();
|
||||
if (e.keyCode == 88)
|
||||
host.onCut();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
}
|
||||
|
||||
event.addListener(text, "compositionstart", onCompositionStart);
|
||||
if (useragent.isGecko) {
|
||||
event.addListener(text, "text", onCompositionUpdate);
|
||||
}
|
||||
if (useragent.isWebKit) {
|
||||
event.addListener(text, "keyup", onCompositionUpdate);
|
||||
}
|
||||
event.addListener(text, "compositionend", onCompositionEnd);
|
||||
|
||||
event.addListener(text, "blur", function() {
|
||||
host.onBlur();
|
||||
});
|
||||
|
||||
event.addListener(text, "focus", function() {
|
||||
host.onFocus();
|
||||
reset();
|
||||
});
|
||||
|
||||
this.focus = function() {
|
||||
reset();
|
||||
text.focus();
|
||||
};
|
||||
|
||||
this.blur = function() {
|
||||
text.blur();
|
||||
};
|
||||
|
||||
function isFocused() {
|
||||
return document.activeElement === text;
|
||||
}
|
||||
this.isFocused = isFocused;
|
||||
|
||||
this.getElement = function() {
|
||||
return text;
|
||||
};
|
||||
|
||||
this.onContextMenu = function(e) {
|
||||
if (!tempStyle)
|
||||
tempStyle = text.style.cssText;
|
||||
|
||||
text.style.cssText =
|
||||
"position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
|
||||
|
||||
if (host.selection.isEmpty())
|
||||
text.value = "";
|
||||
|
||||
if (e.type != "mousedown")
|
||||
return;
|
||||
|
||||
if (host.renderer.$keepTextAreaAtCursor)
|
||||
host.renderer.$keepTextAreaAtCursor = null;
|
||||
|
||||
// on windows context menu is opened after mouseup
|
||||
if (useragent.isGecko && useragent.isWin)
|
||||
event.capture(host.container, function(e) {
|
||||
text.style.left = e.clientX - 2 + "px";
|
||||
text.style.top = e.clientY - 2 + "px";
|
||||
}, onContextMenuClose);
|
||||
};
|
||||
|
||||
function onContextMenuClose() {
|
||||
setTimeout(function () {
|
||||
if (tempStyle) {
|
||||
text.style.cssText = tempStyle;
|
||||
tempStyle = '';
|
||||
}
|
||||
sendText();
|
||||
if (host.renderer.$keepTextAreaAtCursor == null) {
|
||||
host.renderer.$keepTextAreaAtCursor = true;
|
||||
host.renderer.$moveTextAreaToCursor();
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
this.onContextMenuClose = onContextMenuClose;
|
||||
|
||||
// firefox fires contextmenu event after opening it
|
||||
if (!useragent.isGecko)
|
||||
event.addListener(text, "contextmenu", function(e) {
|
||||
host.textInput.onContextMenu(e);
|
||||
onContextMenuClose()
|
||||
});
|
||||
};
|
||||
|
||||
exports.TextInput = TextInput;
|
||||
});
|
||||
@@ -1,122 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
* Harutyun Amirjanyan <harutyun AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var keyUtil = require("../lib/keys");
|
||||
var cmds = require("./vim/commands");
|
||||
var coreCommands = cmds.coreCommands;
|
||||
var util = require("./vim/maps/util");
|
||||
|
||||
var startCommands = {
|
||||
"i": {
|
||||
command: coreCommands.start
|
||||
},
|
||||
"I": {
|
||||
command: coreCommands.startBeginning
|
||||
},
|
||||
"a": {
|
||||
command: coreCommands.append
|
||||
},
|
||||
"A": {
|
||||
command: coreCommands.appendEnd
|
||||
},
|
||||
"ctrl-f": {
|
||||
command: "gotopagedown"
|
||||
},
|
||||
"ctrl-b": {
|
||||
command: "gotopageup"
|
||||
},
|
||||
};
|
||||
|
||||
exports.handler = {
|
||||
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
||||
// ignore command keys (shift, ctrl etc.)
|
||||
if (hashId != 0 && (key == "" || key == "\x00"))
|
||||
return null;
|
||||
|
||||
if (hashId == 1)
|
||||
key = "ctrl-" + key;
|
||||
|
||||
if (data.state == "start") {
|
||||
if (hashId == -1 || hashId == 1) {
|
||||
if (cmds.inputBuffer.idle && startCommands[key])
|
||||
return startCommands[key];
|
||||
|
||||
return { command: {
|
||||
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
|
||||
} };
|
||||
} // wait for input
|
||||
else if (key.length == 1 && (hashId == 0 || hashId == 4)) { //no modifier || shift
|
||||
return {command: "null", passEvent: true};
|
||||
} else if (key == "esc") {
|
||||
return {command: coreCommands.stop};
|
||||
}
|
||||
} else {
|
||||
if (key == "esc" || key == "ctrl-[") {
|
||||
data.state = "start";
|
||||
return {command: coreCommands.stop};
|
||||
} else if (key == "ctrl-w") {
|
||||
return {command: "removewordleft"};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
attach: function(editor) {
|
||||
editor.on("click", exports.onCursorMove);
|
||||
if (util.currentMode !== "insert")
|
||||
cmds.coreCommands.stop.exec(editor);
|
||||
},
|
||||
|
||||
detach: function(editor) {
|
||||
editor.removeListener("click", exports.onCursorMove);
|
||||
util.noMode(editor);
|
||||
util.currentMode = "normal";
|
||||
},
|
||||
|
||||
actions: cmds.actions
|
||||
};
|
||||
|
||||
|
||||
exports.onCursorMove = function(e) {
|
||||
cmds.onCursorMove(e.editor, e);
|
||||
exports.onCursorMove.scheduled = false;
|
||||
};
|
||||
|
||||
});
|
||||
-101
@@ -1,101 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict"
|
||||
|
||||
define(function(require, exports, module) {
|
||||
module.exports = {
|
||||
"x": {
|
||||
operator: {
|
||||
char: "d",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "l",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"X": {
|
||||
operator: {
|
||||
char: "d",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "h",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"D": {
|
||||
operator: {
|
||||
char: "d",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "$",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"C": {
|
||||
operator: {
|
||||
char: "c",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "$",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"s": {
|
||||
operator: {
|
||||
char: "c",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "l",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"S": {
|
||||
operator: {
|
||||
char: "c",
|
||||
count: 1
|
||||
},
|
||||
param: "c"
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
"never use strict";
|
||||
|
||||
module.exports = {
|
||||
_default: {
|
||||
text: "",
|
||||
isLine: false
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,202 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
var Cursor = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
this.element.className = "ace_layer ace_cursor-layer";
|
||||
parentEl.appendChild(this.element);
|
||||
|
||||
this.isVisible = false;
|
||||
|
||||
this.cursors = [];
|
||||
this.cursor = this.addCursor();
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.$padding = 0;
|
||||
this.setPadding = function(padding) {
|
||||
this.$padding = padding;
|
||||
};
|
||||
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
};
|
||||
|
||||
this.addCursor = function() {
|
||||
var el = dom.createElement("div");
|
||||
var className = "ace_cursor";
|
||||
if (!this.isVisible)
|
||||
className += " ace_hidden";
|
||||
if (this.overwrite)
|
||||
className += " ace_overwrite";
|
||||
|
||||
el.className = className;
|
||||
this.element.appendChild(el);
|
||||
this.cursors.push(el);
|
||||
return el;
|
||||
};
|
||||
|
||||
this.removeCursor = function() {
|
||||
if (this.cursors.length > 1) {
|
||||
var el = this.cursors.pop();
|
||||
el.parentNode.removeChild(el);
|
||||
return el;
|
||||
}
|
||||
};
|
||||
|
||||
this.hideCursor = function() {
|
||||
this.isVisible = false;
|
||||
for (var i = this.cursors.length; i--; )
|
||||
dom.addCssClass(this.cursors[i], "ace_hidden");
|
||||
clearInterval(this.blinkId);
|
||||
};
|
||||
|
||||
this.showCursor = function() {
|
||||
this.isVisible = true;
|
||||
for (var i = this.cursors.length; i--; )
|
||||
dom.removeCssClass(this.cursors[i], "ace_hidden");
|
||||
|
||||
this.element.style.visibility = "";
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
this.restartTimer = function() {
|
||||
clearInterval(this.blinkId);
|
||||
if (!this.isVisible)
|
||||
return;
|
||||
|
||||
var element = this.cursors.length == 1 ? this.cursor : this.element;
|
||||
this.blinkId = setInterval(function() {
|
||||
element.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
element.style.visibility = "";
|
||||
}, 400);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
this.getPixelPosition = function(position, onScreen) {
|
||||
if (!this.config || !this.session) {
|
||||
return {
|
||||
left : 0,
|
||||
top : 0
|
||||
};
|
||||
}
|
||||
|
||||
if (!position)
|
||||
position = this.session.selection.getCursor();
|
||||
var pos = this.session.documentToScreenPosition(position);
|
||||
var cursorLeft = Math.round(this.$padding +
|
||||
pos.column * this.config.characterWidth);
|
||||
var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
|
||||
this.config.lineHeight;
|
||||
|
||||
return {
|
||||
left : cursorLeft,
|
||||
top : cursorTop
|
||||
};
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.config = config;
|
||||
|
||||
if (this.session.selectionMarkerCount > 0) {
|
||||
var selections = this.session.$selectionMarkers;
|
||||
var i = 0, sel, cursorIndex = 0;
|
||||
|
||||
for (var i = selections.length; i--; ) {
|
||||
sel = selections[i];
|
||||
var pixelPos = this.getPixelPosition(sel.cursor, true);
|
||||
|
||||
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
|
||||
|
||||
style.left = pixelPos.left + "px";
|
||||
style.top = pixelPos.top + "px";
|
||||
style.width = config.characterWidth + "px";
|
||||
style.height = config.lineHeight + "px";
|
||||
}
|
||||
if (cursorIndex > 1)
|
||||
while (this.cursors.length > cursorIndex)
|
||||
this.removeCursor();
|
||||
} else {
|
||||
var pixelPos = this.getPixelPosition(null, true);
|
||||
var style = this.cursor.style;
|
||||
style.left = pixelPos.left + "px";
|
||||
style.top = pixelPos.top + "px";
|
||||
style.width = config.characterWidth + "px";
|
||||
style.height = config.lineHeight + "px";
|
||||
|
||||
while (this.cursors.length > 1)
|
||||
this.removeCursor();
|
||||
}
|
||||
|
||||
var overwrite = this.session.getOverwrite();
|
||||
if (overwrite != this.overwrite)
|
||||
this.$setOverite(overwrite);
|
||||
|
||||
// cache for textarea and gutter highlight
|
||||
this.$pixelPos = pixelPos;
|
||||
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
this.$setOverite = function(overwrite) {
|
||||
this.overwrite = overwrite;
|
||||
for (var i = this.cursors.length; i--; ) {
|
||||
if (overwrite)
|
||||
dom.addCssClass(this.cursors[i], "ace_overwrite");
|
||||
else
|
||||
dom.removeCssClass(this.cursors[i], "ace_overwrite");
|
||||
}
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
clearInterval(this.blinkId);
|
||||
}
|
||||
|
||||
}).call(Cursor.prototype);
|
||||
|
||||
exports.Cursor = Cursor;
|
||||
|
||||
});
|
||||
@@ -1,187 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
var oop = require("../lib/oop");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
|
||||
var Gutter = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
this.element.className = "ace_layer ace_gutter-layer";
|
||||
parentEl.appendChild(this.element);
|
||||
this.setShowFoldWidgets(this.$showFoldWidgets);
|
||||
|
||||
this.gutterWidth = 0;
|
||||
|
||||
this.$breakpoints = [];
|
||||
this.$annotations = [];
|
||||
this.$decorations = [];
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
};
|
||||
|
||||
this.addGutterDecoration = function(row, className){
|
||||
if (!this.$decorations[row])
|
||||
this.$decorations[row] = "";
|
||||
this.$decorations[row] += " " + className;
|
||||
};
|
||||
|
||||
this.removeGutterDecoration = function(row, className){
|
||||
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
||||
};
|
||||
|
||||
this.setAnnotations = function(annotations) {
|
||||
// iterate over sparse array
|
||||
this.$annotations = [];
|
||||
for (var row in annotations) if (annotations.hasOwnProperty(row)) {
|
||||
var rowAnnotations = annotations[row];
|
||||
if (!rowAnnotations)
|
||||
continue;
|
||||
|
||||
var rowInfo = this.$annotations[row] = {
|
||||
text: []
|
||||
};
|
||||
for (var i=0; i<rowAnnotations.length; i++) {
|
||||
var annotation = rowAnnotations[i];
|
||||
var annoText = annotation.text.replace(/"/g, """).replace(/'/g, "’").replace(/</, "<");
|
||||
if (rowInfo.text.indexOf(annoText) === -1)
|
||||
rowInfo.text.push(annoText);
|
||||
var type = annotation.type;
|
||||
if (type == "error")
|
||||
rowInfo.className = "ace_error";
|
||||
else if (type == "warning" && rowInfo.className != "ace_error")
|
||||
rowInfo.className = "ace_warning";
|
||||
else if (type == "info" && (!rowInfo.className))
|
||||
rowInfo.className = "ace_info";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.$config = config;
|
||||
|
||||
var emptyAnno = {className: "", text: []};
|
||||
var html = [];
|
||||
var i = config.firstRow;
|
||||
var lastRow = config.lastRow;
|
||||
var fold = this.session.getNextFoldLine(i);
|
||||
var foldStart = fold ? fold.start.row : Infinity;
|
||||
var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
|
||||
var breakpoints = this.session.$breakpoints;
|
||||
|
||||
while (true) {
|
||||
if(i > foldStart) {
|
||||
i = fold.end.row + 1;
|
||||
fold = this.session.getNextFoldLine(i, fold);
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
if(i > lastRow)
|
||||
break;
|
||||
|
||||
var annotation = this.$annotations[i] || emptyAnno;
|
||||
html.push("<div class='ace_gutter-cell",
|
||||
this.$decorations[i] || "",
|
||||
breakpoints[i] ? " ace_breakpoint " : " ",
|
||||
annotation.className,
|
||||
"' title='", annotation.text.join("\n"),
|
||||
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
|
||||
|
||||
if (foldWidgets) {
|
||||
var c = foldWidgets[i];
|
||||
// check if cached value is invalidated and we need to recompute
|
||||
if (c == null)
|
||||
c = foldWidgets[i] = this.session.getFoldWidget(i);
|
||||
if (c)
|
||||
html.push(
|
||||
"<span class='ace_fold-widget ", c,
|
||||
c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open",
|
||||
"'></span>"
|
||||
);
|
||||
}
|
||||
|
||||
html.push("</div>");
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (this.session.$useWrapMode)
|
||||
html.push(
|
||||
"<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
|
||||
this.session.getLength() - 1,
|
||||
"</div>"
|
||||
);
|
||||
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
this.element.style.height = config.minHeight + "px";
|
||||
|
||||
var gutterWidth = this.element.offsetWidth;
|
||||
if (gutterWidth !== this.gutterWidth) {
|
||||
this.gutterWidth = gutterWidth;
|
||||
this._emit("changeGutterWidth", gutterWidth);
|
||||
}
|
||||
};
|
||||
|
||||
this.$showFoldWidgets = true;
|
||||
this.setShowFoldWidgets = function(show) {
|
||||
if (show)
|
||||
dom.addCssClass(this.element, "ace_folding-enabled");
|
||||
else
|
||||
dom.removeCssClass(this.element, "ace_folding-enabled");
|
||||
|
||||
this.$showFoldWidgets = show;
|
||||
};
|
||||
|
||||
this.getShowFoldWidgets = function() {
|
||||
return this.$showFoldWidgets;
|
||||
};
|
||||
|
||||
}).call(Gutter.prototype);
|
||||
|
||||
exports.Gutter = Gutter;
|
||||
|
||||
});
|
||||
@@ -1,106 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
require("../test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var assert = require("../test/assertions");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var TextLayer = require("./text").Text;
|
||||
var JavaScriptMode = require("../mode/javascript").Mode;
|
||||
|
||||
module.exports = {
|
||||
|
||||
setUp: function(next) {
|
||||
this.session = new EditSession("");
|
||||
this.session.setMode(new JavaScriptMode());
|
||||
this.textLayer = new TextLayer(document.createElement("div"));
|
||||
this.textLayer.setSession(this.session);
|
||||
this.textLayer.config = {
|
||||
characterWidth: 10,
|
||||
lineHeight: 20
|
||||
};
|
||||
next()
|
||||
},
|
||||
|
||||
"test: render line with hard tabs should render the same as lines with soft tabs" : function() {
|
||||
this.session.setValue("a\ta\ta\t\na a a \n");
|
||||
this.textLayer.$computeTabString();
|
||||
|
||||
// row with hard tabs
|
||||
var row = 0;
|
||||
var tokens = this.session.getTokens(row);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, row, tokens);
|
||||
|
||||
// row with soft tabs
|
||||
row = 1;
|
||||
tokens = this.session.getTokens(row);
|
||||
var stringBuilder2 = [];
|
||||
this.textLayer.$renderLine(stringBuilder2, row, tokens);
|
||||
assert.equal(stringBuilder.join(""), stringBuilder2.join(""));
|
||||
},
|
||||
|
||||
"test rendering width of ideographic space (U+3000)" : function() {
|
||||
this.session.setValue("\u3000");
|
||||
|
||||
var tokens = this.session.getTokens(0);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
|
||||
assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>");
|
||||
|
||||
this.textLayer.setShowInvisibles(true);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
|
||||
assert.equal(
|
||||
stringBuilder.join(""),
|
||||
"<span class='ace_cjk ace_invisible' style='width:20px'>" + this.textLayer.SPACE_CHAR + "</span>"
|
||||
+ "<span class='ace_invisible'>\xB6</span>"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("./oop");
|
||||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
/*
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
*/
|
||||
var BrowserFocus = function(win) {
|
||||
win = win || window;
|
||||
|
||||
this.lastFocus = new Date().getTime();
|
||||
this._isFocused = true;
|
||||
|
||||
var _self = this;
|
||||
|
||||
// IE < 9 supports focusin and focusout events
|
||||
if ("onfocusin" in win.document) {
|
||||
event.addListener(win.document, "focusin", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
|
||||
event.addListener(win.document, "focusout", function(e) {
|
||||
_self._setFocused(!!e.toElement);
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(win, "blur", function(e) {
|
||||
_self._setFocused(false);
|
||||
});
|
||||
|
||||
event.addListener(win, "focus", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isFocused = function() {
|
||||
return this._isFocused;
|
||||
};
|
||||
|
||||
this._setFocused = function(isFocused) {
|
||||
if (this._isFocused == isFocused)
|
||||
return;
|
||||
|
||||
if (isFocused)
|
||||
this.lastFocus = new Date().getTime();
|
||||
|
||||
this._isFocused = isFocused;
|
||||
this._emit("changeFocus");
|
||||
};
|
||||
|
||||
}).call(BrowserFocus.prototype);
|
||||
|
||||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
var Emitter = function() {};
|
||||
|
||||
oop.implement(Emitter.prototype, EventEmitter);
|
||||
|
||||
module.exports = {
|
||||
"test: dispatch event with no data" : function() {
|
||||
var emitter = new Emitter();
|
||||
|
||||
var called = false;
|
||||
emitter.addEventListener("juhu", function(e) {
|
||||
called = true;
|
||||
assert.equal(e.type, "juhu");
|
||||
});
|
||||
|
||||
emitter._emit("juhu");
|
||||
assert.ok(called);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.inherits = (function() {
|
||||
var tempCtor = function() {};
|
||||
return function(ctor, superCtor) {
|
||||
tempCtor.prototype = superCtor.prototype;
|
||||
ctor.super_ = superCtor.prototype;
|
||||
ctor.prototype = new tempCtor();
|
||||
ctor.prototype.constructor = ctor;
|
||||
};
|
||||
}());
|
||||
|
||||
exports.mixin = function(obj, mixin) {
|
||||
for (var key in mixin) {
|
||||
obj[key] = mixin[key];
|
||||
}
|
||||
};
|
||||
|
||||
exports.implement = function(proto, mixin) {
|
||||
exports.mixin(proto, mixin);
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,98 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Behaviour = function() {
|
||||
this.$behaviours = {};
|
||||
};
|
||||
|
||||
(function () {
|
||||
|
||||
this.add = function (name, action, callback) {
|
||||
switch (undefined) {
|
||||
case this.$behaviours:
|
||||
this.$behaviours = {};
|
||||
case this.$behaviours[name]:
|
||||
this.$behaviours[name] = {};
|
||||
}
|
||||
this.$behaviours[name][action] = callback;
|
||||
}
|
||||
|
||||
this.addBehaviours = function (behaviours) {
|
||||
for (var key in behaviours) {
|
||||
for (var action in behaviours[key]) {
|
||||
this.add(key, action, behaviours[key][action]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.remove = function (name) {
|
||||
if (this.$behaviours && this.$behaviours[name]) {
|
||||
delete this.$behaviours[name];
|
||||
}
|
||||
}
|
||||
|
||||
this.inherit = function (mode, filter) {
|
||||
if (typeof mode === "function") {
|
||||
var behaviours = new mode().getBehaviours(filter);
|
||||
} else {
|
||||
var behaviours = mode.getBehaviours(filter);
|
||||
}
|
||||
this.addBehaviours(behaviours);
|
||||
}
|
||||
|
||||
this.getBehaviours = function (filter) {
|
||||
if (!filter) {
|
||||
return this.$behaviours;
|
||||
} else {
|
||||
var ret = {}
|
||||
for (var i = 0; i < filter.length; i++) {
|
||||
if (this.$behaviours[filter[i]]) {
|
||||
ret[filter[i]] = this.$behaviours[filter[i]];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
}).call(Behaviour.prototype);
|
||||
|
||||
exports.Behaviour = Behaviour;
|
||||
});
|
||||
-225
@@ -1,225 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require("../behaviour").Behaviour;
|
||||
|
||||
var CstyleBehaviour = function () {
|
||||
|
||||
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '{') {
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "") {
|
||||
return {
|
||||
text: '{' + selected + '}',
|
||||
selection: false
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
text: '{}',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
} else if (text == '}') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == '}') {
|
||||
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||
if (matching !== null) {
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
} else if (text == "\n") {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == '}') {
|
||||
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
|
||||
if (!openBracePos)
|
||||
return null;
|
||||
|
||||
var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
|
||||
var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
|
||||
|
||||
return {
|
||||
text: '\n' + indent + '\n' + next_indent,
|
||||
selection: [1, indent.length, 1, indent.length]
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("braces", "deletion", function (state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '{') {
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||
if (rightChar == '}') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("parens", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '(') {
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "") {
|
||||
return {
|
||||
text: '(' + selected + ')',
|
||||
selection: false
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
text: '()',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
} else if (text == ')') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == ')') {
|
||||
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||
if (matching !== null) {
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("parens", "deletion", function (state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '(') {
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == ')') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '"' || text == "'") {
|
||||
var quote = text;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "") {
|
||||
return {
|
||||
text: quote + selected + quote,
|
||||
selection: false
|
||||
};
|
||||
} else {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||
|
||||
// We're escaped.
|
||||
if (leftChar == '\\') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find what token we're inside.
|
||||
var tokens = session.getTokens(selection.start.row);
|
||||
var col = 0, token;
|
||||
var quotepos = -1; // Track whether we're inside an open quote.
|
||||
|
||||
for (var x = 0; x < tokens.length; x++) {
|
||||
token = tokens[x];
|
||||
if (token.type == "string") {
|
||||
quotepos = -1;
|
||||
} else if (quotepos < 0) {
|
||||
quotepos = token.value.indexOf(quote);
|
||||
}
|
||||
if ((token.value.length + col) > selection.start.column) {
|
||||
break;
|
||||
}
|
||||
col += tokens[x].value.length;
|
||||
}
|
||||
|
||||
// Try and be smart about when we auto insert.
|
||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||
return {
|
||||
text: quote + quote,
|
||||
selection: [1,1]
|
||||
};
|
||||
} else if (token && token.type === "string") {
|
||||
// Ignore input and move right one if we're typing over the closing quote.
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == quote) {
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == '"') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
oop.inherits(CstyleBehaviour, Behaviour);
|
||||
|
||||
exports.CstyleBehaviour = CstyleBehaviour;
|
||||
});
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* eXide - web-based XQuery IDE
|
||||
*
|
||||
* Copyright (C) 2011 Wolfgang Meier
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require('../behaviour').Behaviour;
|
||||
var CstyleBehaviour = require('./cstyle').CstyleBehaviour;
|
||||
|
||||
var XQueryBehaviour = function (parent) {
|
||||
|
||||
this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
|
||||
this.parent = parent;
|
||||
|
||||
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == "\n") {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChars = line.substring(cursor.column, cursor.column + 2);
|
||||
if (rightChars == '</') {
|
||||
var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
|
||||
var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
|
||||
|
||||
return {
|
||||
text: '\n' + indent + '\n' + next_indent,
|
||||
selection: [1, indent.length, 1, indent.length]
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Check for open tag if user enters / and auto-close it.
|
||||
this.add("slash", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == "/") {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
if (cursor.column > 0 && line.charAt(cursor.column - 1) == "<") {
|
||||
line = line.substring(0, cursor.column) + "/" + line.substring(cursor.column);
|
||||
var lines = session.doc.getAllLines();
|
||||
lines[cursor.row] = line;
|
||||
// call mode helper to close the tag if possible
|
||||
parent.exec("closeTag", lines.join(session.doc.getNewLineCharacter()), cursor.row);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
oop.inherits(XQueryBehaviour, Behaviour);
|
||||
|
||||
exports.XQueryBehaviour = XQueryBehaviour;
|
||||
});
|
||||
@@ -1,74 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garen J. Torikian <gjtorikian AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var C9StyleFoldMode = require("./folding/c9search").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new C9SearchHighlightRules().getRules(), "i");
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new C9StyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garen J. Torikian <gjtorikian AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var C9SearchHighlightRules = function() {
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text"],
|
||||
regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
|
||||
},
|
||||
{
|
||||
token : ["string", "text"], // single line
|
||||
regex : "(.+)(:$)"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(C9SearchHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.C9SearchHighlightRules = C9SearchHighlightRules;
|
||||
|
||||
});
|
||||
-180
@@ -1,180 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Gastón Kleiman <gaston.kleiman AT gmail DOT com>
|
||||
*
|
||||
* Based on Bespin's C/C++ Syntax Plugin by Marc McIntyre.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var c_cppHighlightRules = function() {
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" +
|
||||
"asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|" +
|
||||
"typeid|bitor|extern|protected|typename|bool|false|public|union|" +
|
||||
"break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|" +
|
||||
"friend|return|virtual|char|goto|short|void|class|if|signed|volatile|" +
|
||||
"compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|" +
|
||||
"static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|" +
|
||||
"switch|delete|new|template|do|not|this|for").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("NULL").split("|")
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant", // <CONSTANT>
|
||||
regex : "<[a-zA-Z0-9.]+>"
|
||||
}, {
|
||||
token : "keyword", // pre-compiler directivs
|
||||
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (value == "this")
|
||||
return "variable.language";
|
||||
else if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\;|\\."
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.c_cppHighlightRules = c_cppHighlightRules;
|
||||
});
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Shlomo Zalman Heigh <shlomozalmanheigh AT gmail DOT com>
|
||||
* Carin Meier
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
|
||||
|
||||
var ClojureHighlightRules = function() {
|
||||
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
('* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
|
||||
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
|
||||
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
|
||||
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
|
||||
'*read-eval* *source-path* *use-context-classloader* ' +
|
||||
'*warn-on-reflection* + - -> -> ->> ->> .. / < < <= <= = ' +
|
||||
'== > > >= >= accessor aclone ' +
|
||||
'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
|
||||
'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
|
||||
'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
|
||||
'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
|
||||
'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
|
||||
'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
|
||||
'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
|
||||
'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
|
||||
'char-escape-string char-name-string char? chars chunk chunk-append ' +
|
||||
'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
|
||||
'class class? clear-agent-errors clojure-version coll? comment commute ' +
|
||||
'comp comparator compare compare-and-set! compile complement concat cond ' +
|
||||
'condp conj conj! cons constantly construct-proxy contains? count ' +
|
||||
'counted? create-ns create-struct cycle dec decimal? declare definline ' +
|
||||
'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
|
||||
'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
|
||||
'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
|
||||
'double-array doubles drop drop-last drop-while empty empty? ensure ' +
|
||||
'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
|
||||
'find-doc find-ns find-var first float float-array float? floats flush ' +
|
||||
'fn fn? fnext for force format future future-call future-cancel ' +
|
||||
'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
|
||||
'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
|
||||
'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
|
||||
'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
|
||||
'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
|
||||
'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
|
||||
'list* list? load load-file load-reader load-string loaded-libs locking ' +
|
||||
'long long-array longs loop macroexpand macroexpand-1 make-array ' +
|
||||
'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
|
||||
'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
|
||||
'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
|
||||
'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
|
||||
'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
|
||||
'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
|
||||
'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
|
||||
'primitives-classnames print print-ctor print-doc print-dup print-method ' +
|
||||
'print-namespace-doc print-simple print-special-doc print-str printf ' +
|
||||
'println println-str prn prn-str promise proxy proxy-call-with-super ' +
|
||||
'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
|
||||
'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
|
||||
're-matcher re-matches re-pattern re-seq read read-line read-string ' +
|
||||
'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
|
||||
'refer refer-clojure release-pending-sends rem remove remove-method ' +
|
||||
'remove-ns remove-watch repeat repeatedly replace replicate require ' +
|
||||
'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
|
||||
'rsubseq second select-keys send send-off seq seq? seque sequence ' +
|
||||
'sequential? set set-validator! set? short short-array shorts ' +
|
||||
'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
|
||||
'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
|
||||
'split-at split-with str stream? string? struct struct-map subs subseq ' +
|
||||
'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
|
||||
'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
|
||||
'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
|
||||
'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
|
||||
'unchecked-remainder unchecked-subtract underive unquote ' +
|
||||
'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
|
||||
'var? vary-meta vec vector vector? when when-first when-let when-not ' +
|
||||
'while with-bindings with-bindings* with-in-str with-loading-context ' +
|
||||
'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
|
||||
'zero? zipmap ').split(" ")
|
||||
);
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
('def do fn if let loop monitor-enter monitor-exit new quote recur set! ' +
|
||||
'throw try var').split(" ")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("true false nil").split(" ")
|
||||
);
|
||||
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : ";.*$"
|
||||
}, {
|
||||
token : "comment", // multi line comment
|
||||
regex : "^=begin$",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "keyword", //parens
|
||||
regex : "[\\(|\\)]"
|
||||
}, {
|
||||
token : "keyword", //lists
|
||||
regex : "[\\'\\(]"
|
||||
}, {
|
||||
token : "keyword", //vectors
|
||||
regex : "[\\[|\\]]"
|
||||
}, {
|
||||
token : "keyword", //sets and maps
|
||||
regex : "[\\{|\\}|\\#\\{|\\#\\}]"
|
||||
}, {
|
||||
token : "keyword", // ampersands
|
||||
regex : '[\\&]'
|
||||
}, {
|
||||
token : "keyword", // metadata
|
||||
regex : '[\\#\\^\\{]'
|
||||
}, {
|
||||
token : "keyword", // anonymous fn syntactic sugar
|
||||
regex : '[\\%]'
|
||||
}, {
|
||||
token : "keyword", // deref reader macro
|
||||
regex : '[@]'
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant.language",
|
||||
regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else if (builtinFunctions.hasOwnProperty(value))
|
||||
return "support.function";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
// TODO: Unicode escape sequences
|
||||
// TODO: Unicode identifiers
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?$',
|
||||
next: "string"
|
||||
}, {
|
||||
token : "string", // symbol
|
||||
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||
}, {
|
||||
token : "string.regexp", //Regular Expressions
|
||||
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||
}
|
||||
|
||||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : "^=end$",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"string" : [
|
||||
{
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : "\\\\."
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]*?"',
|
||||
next : "start"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(ClojureHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.ClojureHighlightRules = ClojureHighlightRules;
|
||||
});
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Lexer = require("./lexer").Lexer;
|
||||
var parser = require("./parser");
|
||||
|
||||
var lexer = new Lexer();
|
||||
parser.lexer = {
|
||||
lex: function() {
|
||||
var tag, _ref2;
|
||||
_ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2];
|
||||
return tag;
|
||||
},
|
||||
setInput: function(tokens) {
|
||||
this.tokens = tokens;
|
||||
return this.pos = 0;
|
||||
},
|
||||
upcomingInput: function() {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
parser.yy = require('./nodes');
|
||||
|
||||
exports.parse = function(code) {
|
||||
return parser.parse(lexer.tokenize(code));
|
||||
};
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
-68
@@ -1,68 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var assert = require("../../test/assertions");
|
||||
var coffee = require("../coffee/coffee-script");
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test parse valid coffee script": function() {
|
||||
coffee.parse("square = (x) -> x * x");
|
||||
},
|
||||
|
||||
"test parse invalid coffee script": function() {
|
||||
try {
|
||||
coffee.parse("a = 12 f");
|
||||
} catch (e) {
|
||||
assert.ok((e + "").indexOf("Parse error on line 1: Unexpected 'IDENTIFIER'") >= 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
-227
@@ -1,227 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Satoshi Murakami <murky.satyr AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var lang = require("../lib/lang");
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
oop.inherits(CoffeeHighlightRules, TextHighlightRules);
|
||||
|
||||
function CoffeeHighlightRules() {
|
||||
var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
|
||||
var stringfill = {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
};
|
||||
|
||||
var keywords = lang.arrayToMap((
|
||||
"this|throw|then|try|typeof|super|switch|return|break|by)|continue|" +
|
||||
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
|
||||
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
|
||||
"or|on|unless|until|and|yes").split("|")
|
||||
);
|
||||
|
||||
var langConstant = lang.arrayToMap((
|
||||
"true|false|null|undefined").split("|")
|
||||
);
|
||||
|
||||
var illegal = lang.arrayToMap((
|
||||
"case|const|default|function|var|void|with|enum|export|implements|" +
|
||||
"interface|let|package|private|protected|public|static|yield|" +
|
||||
"__hasProp|extends|slice|bind|indexOf").split("|")
|
||||
);
|
||||
|
||||
var supportClass = lang.arrayToMap((
|
||||
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|" +
|
||||
"RangeError|String|SyntaxError|Error|EvalError|TypeError|URIError").split("|")
|
||||
);
|
||||
|
||||
var supportFunction = lang.arrayToMap((
|
||||
"Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
|
||||
"encodeURIComponent|decodeURI|decodeURIComponent|RangeError|String|" +
|
||||
"SyntaxError|Error|EvalError|TypeError|URIError").split("|")
|
||||
);
|
||||
|
||||
this.$rules = {
|
||||
start : [
|
||||
{
|
||||
token : "identifier",
|
||||
regex : "(?:(?:\\.|::)\\s*)" + identifier
|
||||
}, {
|
||||
token : "variable",
|
||||
regex : "@(?:" + identifier + ")?"
|
||||
}, {
|
||||
token: function(value) {
|
||||
if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (langConstant.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else if (illegal.hasOwnProperty(value))
|
||||
return "invalid.illegal";
|
||||
else if (supportClass.hasOwnProperty(value))
|
||||
return "language.support.class";
|
||||
else if (supportFunction.hasOwnProperty(value))
|
||||
return "language.support.function";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : identifier
|
||||
}, {
|
||||
token : "constant.numeric",
|
||||
regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : "'''",
|
||||
next : "qdoc"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '"""',
|
||||
next : "qqdoc"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : "'",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '"',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : "`",
|
||||
next : "js"
|
||||
}, {
|
||||
token : "string.regex",
|
||||
merge : true,
|
||||
regex : "///",
|
||||
next : "heregex"
|
||||
}, {
|
||||
token : "string.regex",
|
||||
regex : "/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"
|
||||
}, {
|
||||
token : "comment",
|
||||
merge : true,
|
||||
regex : "###(?!#)",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "#.*"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\."
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "(?:[\\-=]>|[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[({[]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\]})]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}],
|
||||
|
||||
qdoc : [{
|
||||
token : "string",
|
||||
regex : ".*?'''",
|
||||
next : "start"
|
||||
}, stringfill],
|
||||
|
||||
qqdoc : [{
|
||||
token : "string",
|
||||
regex : '.*?"""',
|
||||
next : "start"
|
||||
}, stringfill],
|
||||
|
||||
qstring : [{
|
||||
token : "string",
|
||||
regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
|
||||
merge : true,
|
||||
next : "start"
|
||||
}, stringfill],
|
||||
|
||||
qqstring : [{
|
||||
token : "string",
|
||||
regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
|
||||
merge : true,
|
||||
next : "start"
|
||||
}, stringfill],
|
||||
|
||||
js : [{
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : "[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",
|
||||
next : "start"
|
||||
}, stringfill],
|
||||
|
||||
heregex : [{
|
||||
token : "string.regex",
|
||||
regex : '.*?///[imgy]{0,4}',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment.regex",
|
||||
regex : "\\s+(?:#.*)?"
|
||||
}, {
|
||||
token : "string.regex",
|
||||
merge : true,
|
||||
regex : "\\S+"
|
||||
}],
|
||||
|
||||
comment : [{
|
||||
token : "comment",
|
||||
regex : '.*?###',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment",
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
exports.CoffeeHighlightRules = CoffeeHighlightRules;
|
||||
});
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Mode = require("./coffee").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.tokenizer = new Mode().getTokenizer();
|
||||
},
|
||||
|
||||
"test: tokenize keyword": function() {
|
||||
var tokens = this.tokenizer.getLineTokens("for", "start").tokens;
|
||||
assert.equal(tokens.length, 1);
|
||||
assert.equal(tokens[0].type, "keyword");
|
||||
},
|
||||
|
||||
// TODO: disable. not yet implemented
|
||||
"!test tokenize string with interpolation": function() {
|
||||
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens;
|
||||
console.log(tokens);
|
||||
assert.equal(tokens.length, 12);
|
||||
//assert.equal(tokens[0].type, "keyword");
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var coffee = require("../mode/coffee/coffee-script");
|
||||
|
||||
window.addEventListener = function() {};
|
||||
|
||||
|
||||
var Worker = exports.Worker = function(sender) {
|
||||
Mirror.call(this, sender);
|
||||
this.setTimeout(200);
|
||||
};
|
||||
|
||||
oop.inherits(Worker, Mirror);
|
||||
|
||||
(function() {
|
||||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
|
||||
try {
|
||||
coffee.parse(value);
|
||||
} catch(e) {
|
||||
var m = e.message.match(/Parse error on line (\d+): (.*)/);
|
||||
if (m) {
|
||||
this.sender.emit("error", {
|
||||
row: parseInt(m[1], 10) - 1,
|
||||
column: null,
|
||||
text: m[2],
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (e instanceof SyntaxError) {
|
||||
var m = e.message.match(/ on line (\d+)/);
|
||||
if (m) {
|
||||
this.sender.emit("error", {
|
||||
row: parseInt(m[1], 10) - 1,
|
||||
column: null,
|
||||
text: e.message.replace(m[0], ""),
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.sender.emit("ok");
|
||||
};
|
||||
|
||||
}).call(Worker.prototype);
|
||||
|
||||
});
|
||||
@@ -1,71 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var XmlMode = require("./xml").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var CssMode = require("./css").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
XmlMode.call(this);
|
||||
|
||||
var highlighter = new ColdfusionHighlightRules();
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
|
||||
this.$embeds = highlighter.getEmbeds();
|
||||
this.createModeDelegates({
|
||||
"js-": JavaScriptMode,
|
||||
"css-": CssMode
|
||||
});
|
||||
};
|
||||
oop.inherits(Mode, XmlMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
return this.$getIndent(line);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
@@ -1,74 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var Range = require("../range").Range;
|
||||
var ColdfusionMode = require("./coldfusion").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.mode = new ColdfusionMode();
|
||||
},
|
||||
|
||||
"test: toggle comment lines should not do anything" : function() {
|
||||
var session = new EditSession([" abc", "cde", "fg"]);
|
||||
|
||||
var range = new Range(0, 3, 1, 1);
|
||||
var comment = this.mode.toggleCommentLines("start", session, 0, 1);
|
||||
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
|
||||
},
|
||||
|
||||
"test: next line indent should be the same as the current line indent" : function() {
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " abc"));
|
||||
assert.equal("", this.mode.getNextLineIndent("start", "abc"));
|
||||
assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc"));
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules(), "i");
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingRules = "cStyle";
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
// ignore braces in comments
|
||||
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
var match = line.match(/^.*\{\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace"], "worker-css.js", "ace/mode/css_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("csslint", function(e) {
|
||||
var errors = [];
|
||||
e.data.forEach(function(message) {
|
||||
errors.push({
|
||||
row: message.line - 1,
|
||||
column: message.col - 1,
|
||||
text: message.message,
|
||||
type: message.type,
|
||||
lint: message
|
||||
});
|
||||
});
|
||||
|
||||
session.setAnnotations(errors);
|
||||
});
|
||||
return worker;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-242
@@ -1,242 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var CssHighlightRules = function() {
|
||||
|
||||
var properties = lang.arrayToMap(
|
||||
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||
);
|
||||
|
||||
var functions = lang.arrayToMap(
|
||||
("rgb|rgba|url|attr|counter|counters").split("|")
|
||||
);
|
||||
|
||||
var constants = lang.arrayToMap(
|
||||
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||
);
|
||||
|
||||
var colors = lang.arrayToMap(
|
||||
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
|
||||
"purple|red|silver|teal|white|yellow").split("|")
|
||||
);
|
||||
|
||||
var fonts = lang.arrayToMap(
|
||||
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
|
||||
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
|
||||
"serif|monospace").split("|")
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||
|
||||
var base_ruleset = [
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "ruleset_comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : ["constant.numeric", "keyword"],
|
||||
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||
}, {
|
||||
token : ["constant.numeric"],
|
||||
regex : "([0-9]+)"
|
||||
}, {
|
||||
token : "constant.numeric", // hex6 color
|
||||
regex : "#[a-f0-9]{6}"
|
||||
}, {
|
||||
token : "constant.numeric", // hex3 color
|
||||
regex : "#[a-f0-9]{3}"
|
||||
}, {
|
||||
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||
regex : pseudoElements
|
||||
}, {
|
||||
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||
regex : pseudoClasses
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||
return "support.type";
|
||||
}
|
||||
else if (functions.hasOwnProperty(value.toLowerCase())) {
|
||||
return "support.function";
|
||||
}
|
||||
else if (constants.hasOwnProperty(value.toLowerCase())) {
|
||||
return "support.constant";
|
||||
}
|
||||
else if (colors.hasOwnProperty(value.toLowerCase())) {
|
||||
return "support.constant.color";
|
||||
}
|
||||
else if (fonts.hasOwnProperty(value.toLowerCase())) {
|
||||
return "support.constant.fonts";
|
||||
}
|
||||
else {
|
||||
return "text";
|
||||
}
|
||||
},
|
||||
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
||||
}
|
||||
];
|
||||
|
||||
var ruleset = lang.copyArray(base_ruleset);
|
||||
ruleset.unshift({
|
||||
token : "paren.rparen",
|
||||
regex : "\\}",
|
||||
next: "start"
|
||||
});
|
||||
|
||||
var media_ruleset = lang.copyArray( base_ruleset );
|
||||
media_ruleset.unshift({
|
||||
token : "paren.rparen",
|
||||
regex : "\\}",
|
||||
next: "media"
|
||||
});
|
||||
|
||||
var base_comment = [{
|
||||
token : "comment", // comment spanning whole line
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}];
|
||||
|
||||
var comment = lang.copyArray(base_comment);
|
||||
comment.unshift({
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "start"
|
||||
});
|
||||
|
||||
var media_comment = lang.copyArray(base_comment);
|
||||
media_comment.unshift({
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "media"
|
||||
});
|
||||
|
||||
var ruleset_comment = lang.copyArray(base_comment);
|
||||
ruleset_comment.unshift({
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "ruleset"
|
||||
});
|
||||
|
||||
this.$rules = {
|
||||
"start" : [{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token: "paren.lparen",
|
||||
regex: "\\{",
|
||||
next: "ruleset"
|
||||
}, {
|
||||
token: "string",
|
||||
regex: "@.*?{",
|
||||
next: "media"
|
||||
},{
|
||||
token: "keyword",
|
||||
regex: "#[a-z0-9-_]+"
|
||||
},{
|
||||
token: "variable",
|
||||
regex: "\\.[a-z0-9-_]+"
|
||||
},{
|
||||
token: "string",
|
||||
regex: ":[a-z0-9-_]+"
|
||||
},{
|
||||
token: "constant",
|
||||
regex: "[a-z0-9-_]+"
|
||||
}],
|
||||
|
||||
"media" : [ {
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "media_comment"
|
||||
}, {
|
||||
token: "paren.lparen",
|
||||
regex: "\\{",
|
||||
next: "media_ruleset"
|
||||
},{
|
||||
token: "string",
|
||||
regex: "\\}",
|
||||
next: "start"
|
||||
},{
|
||||
token: "keyword",
|
||||
regex: "#[a-z0-9-_]+"
|
||||
},{
|
||||
token: "variable",
|
||||
regex: "\\.[a-z0-9-_]+"
|
||||
},{
|
||||
token: "string",
|
||||
regex: ":[a-z0-9-_]+"
|
||||
},{
|
||||
token: "constant",
|
||||
regex: "[a-z0-9-_]+"
|
||||
}],
|
||||
|
||||
"comment" : comment,
|
||||
|
||||
"ruleset" : ruleset,
|
||||
"ruleset_comment" : ruleset_comment,
|
||||
|
||||
"media_ruleset" : media_ruleset,
|
||||
"media_comment" : media_comment
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(CssHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.CssHighlightRules = CssHighlightRules;
|
||||
|
||||
});
|
||||
@@ -1,85 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var CssMode = require("./css").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: "CSS",
|
||||
|
||||
setUp : function() {
|
||||
this.mode = new CssMode();
|
||||
},
|
||||
|
||||
"test: toggle comment lines should not do anything" : function() {
|
||||
var session = new EditSession([" abc", "cde", "fg"].join("\n"));
|
||||
|
||||
var comment = this.mode.toggleCommentLines("start", session, 0, 1);
|
||||
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
|
||||
},
|
||||
|
||||
|
||||
"test: lines should keep indentation" : function() {
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " abc", " "));
|
||||
assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc", " "));
|
||||
},
|
||||
|
||||
"test: new line after { should increase indent" : function() {
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " abc{", " "));
|
||||
assert.equal("\t ", this.mode.getNextLineIndent("start", "\tabc { ", " "));
|
||||
},
|
||||
|
||||
"test: no indent increase after { in a comment" : function() {
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " /*{", " "));
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " /*{ ", " "));
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var CSSLint = require("./css/csslint").CSSLint;
|
||||
|
||||
var Worker = exports.Worker = function(sender) {
|
||||
Mirror.call(this, sender);
|
||||
this.setTimeout(200);
|
||||
};
|
||||
|
||||
oop.inherits(Worker, Mirror);
|
||||
|
||||
(function() {
|
||||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
|
||||
var result = CSSLint.verify(value);
|
||||
this.sender.emit("csslint", result.messages.map(function(msg) {
|
||||
delete msg.rule;
|
||||
return msg;
|
||||
}));
|
||||
};
|
||||
|
||||
}).call(Worker.prototype);
|
||||
|
||||
});
|
||||
@@ -1,75 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var assert = require("../test/assertions");
|
||||
var Worker = require("./css_worker").Worker;
|
||||
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.sender = {
|
||||
on: function() {},
|
||||
callback: function(data, id) {
|
||||
this.data = data;
|
||||
},
|
||||
events: [],
|
||||
emit: function(type, e) {
|
||||
this.events.push([type, e]);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
"test check for syntax error": function() {
|
||||
var worker = new Worker(this.sender);
|
||||
worker.setValue("Juhu Kinners");
|
||||
worker.deferredUpdate.call();
|
||||
assert.equal(this.sender.events[0][1][0].type, "error");
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
|
||||
var FoldMode = require("./folding/diff").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new HighlightRules().getRules(), "i");
|
||||
this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment.doc.tag",
|
||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "TODO"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "[^@\\*]+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "."
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
});
|
||||
@@ -1,83 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garen J. Torikian <gjtorikian AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function() {};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /^(\w.*\:|Searching for.*)$/;
|
||||
this.foldingStopMarker = /^(\s+|Found.*)$/;
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
var level1 = /^(Found.*|Searching for.*)$/;
|
||||
var level2 = /^(\w.*\:|\s*)$/;
|
||||
var re = level1.test(line) ? level1 : level2;
|
||||
|
||||
if (this.foldingStartMarker.test(line)) {
|
||||
for (var i = row + 1, l = session.getLength(); i < l; i++) {
|
||||
if (re.test(session.getLine(i)))
|
||||
break;
|
||||
}
|
||||
|
||||
return new Range(row, line.length, i, 0);
|
||||
}
|
||||
|
||||
if (this.foldingStopMarker.test(line)) {
|
||||
for (var i = row - 1; i >= 0; i--) {
|
||||
line = session.getLine(i);
|
||||
if (re.test(line))
|
||||
break;
|
||||
}
|
||||
|
||||
return new Range(i, line.length, row, 0);
|
||||
}
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function() {};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
var i = match.index;
|
||||
|
||||
if (match[1])
|
||||
return this.openingBracketBlock(session, match[1], row, i);
|
||||
|
||||
var range = session.getCommentFoldRange(row, i + match[0].length);
|
||||
range.end.column -= 2;
|
||||
return range;
|
||||
}
|
||||
|
||||
if (foldStyle !== "markbeginend")
|
||||
return;
|
||||
|
||||
var match = line.match(this.foldingStopMarker);
|
||||
if (match) {
|
||||
var i = match.index + match[0].length;
|
||||
|
||||
if (match[2]) {
|
||||
var range = session.getCommentFoldRange(row, i);
|
||||
range.end.column -= 2;
|
||||
return range;
|
||||
}
|
||||
|
||||
var end = {row: row, column: i};
|
||||
var start = session.$findOpeningBracket(match[1], end);
|
||||
|
||||
if (!start)
|
||||
return;
|
||||
|
||||
start.column++;
|
||||
end.column--;
|
||||
|
||||
return Range.fromPoints(start, end);
|
||||
}
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
@@ -1,76 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
var Range = require("../../range").Range;
|
||||
|
||||
var FoldMode = exports.FoldMode = function(levels, flag) {
|
||||
this.regExpList = levels;
|
||||
this.flag = flag;
|
||||
this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
var start = {row: row, column: line.length};
|
||||
|
||||
var regList = this.regExpList;
|
||||
for (var i = 1; i <= regList.length; i++) {
|
||||
var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
|
||||
if (re.test(line))
|
||||
break;
|
||||
}
|
||||
|
||||
for (var l = session.getLength(); ++row < l; ) {
|
||||
line = session.getLine(row);
|
||||
if (re.test(line))
|
||||
break
|
||||
}
|
||||
if (row == start.row + 1)
|
||||
return;
|
||||
return Range.fromPoints(start, {row: row - 1, column: line.length});
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
@@ -1,86 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var MixedFoldMode = require("./mixed").FoldMode;
|
||||
var XmlFoldMode = require("./xml").FoldMode;
|
||||
var CStyleFoldMode = require("./cstyle").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function() {
|
||||
MixedFoldMode.call(this, new XmlFoldMode({
|
||||
// void elements
|
||||
"area": 1,
|
||||
"base": 1,
|
||||
"br": 1,
|
||||
"col": 1,
|
||||
"command": 1,
|
||||
"embed": 1,
|
||||
"hr": 1,
|
||||
"img": 1,
|
||||
"input": 1,
|
||||
"keygen": 1,
|
||||
"link": 1,
|
||||
"meta": 1,
|
||||
"param": 1,
|
||||
"source": 1,
|
||||
"track": 1,
|
||||
"wbr": 1,
|
||||
|
||||
// optional tags
|
||||
"li": 1,
|
||||
"dt": 1,
|
||||
"dd": 1,
|
||||
"p": 1,
|
||||
"rt": 1,
|
||||
"rp": 1,
|
||||
"optgroup": 1,
|
||||
"option": 1,
|
||||
"colgroup": 1,
|
||||
"td": 1,
|
||||
"th": 1
|
||||
}), {
|
||||
"js-": new CStyleFoldMode(),
|
||||
"css-": new CStyleFoldMode()
|
||||
});
|
||||
};
|
||||
|
||||
oop.inherits(FoldMode, MixedFoldMode);
|
||||
|
||||
});
|
||||
@@ -1,88 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
|
||||
this.defaultMode = defaultMode;
|
||||
this.subModes = subModes;
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
this.$getMode = function(state) {
|
||||
for (var key in this.subModes) {
|
||||
if (state.indexOf(key) === 0)
|
||||
return this.subModes[key];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.$tryMode = function(state, session, foldStyle, row) {
|
||||
var mode = this.$getMode(state);
|
||||
return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
|
||||
};
|
||||
|
||||
this.getFoldWidget = function(session, foldStyle, row) {
|
||||
return (
|
||||
this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
|
||||
this.$tryMode(session.getState(row), session, foldStyle, row) ||
|
||||
this.defaultMode.getFoldWidget(session, foldStyle, row)
|
||||
);
|
||||
};
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var mode = this.$getMode(session.getState(row-1));
|
||||
|
||||
if (!mode || !mode.getFoldWidget(session, foldStyle, row))
|
||||
mode = this.$getMode(session.getState(row));
|
||||
|
||||
if (!mode || !mode.getFoldWidget(session, foldStyle, row))
|
||||
mode = this.defaultMode;
|
||||
|
||||
return mode.getFoldWidgetRange(session, foldStyle, row);
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function(markers) {
|
||||
this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
if (match[1])
|
||||
return this.openingBracketBlock(session, match[1], row, match.index);
|
||||
if (match[2])
|
||||
return this.indentationBlock(session, row, match.index + match[2].length);
|
||||
return this.indentationBlock(session, row);
|
||||
}
|
||||
}
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
@@ -1,58 +0,0 @@
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new HaxeHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
|
||||
this.createWorker = function(session) {
|
||||
return null;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
@@ -1,83 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var CssMode = require("./css").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
|
||||
var HtmlFoldMode = require("./folding/html").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new HtmlHighlightRules();
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$behaviour = new HtmlBehaviour();
|
||||
|
||||
this.$embeds = highlighter.getEmbeds();
|
||||
this.createModeDelegates({
|
||||
"js-": JavaScriptMode,
|
||||
"css-": CssMode
|
||||
});
|
||||
|
||||
this.foldingRules = new HtmlFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
return this.$getIndent(line);
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return false;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.tokenizer = new HtmlMode().getTokenizer();
|
||||
},
|
||||
|
||||
"test: tokenize embedded script" : function() {
|
||||
var line = "<script a='a'>var</script>'123'";
|
||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||
|
||||
assert.equal(12, tokens.length);
|
||||
assert.equal("meta.tag", tokens[0].type);
|
||||
assert.equal("meta.tag.script", tokens[1].type);
|
||||
assert.equal("text", tokens[2].type);
|
||||
assert.equal("entity.other.attribute-name", tokens[3].type);
|
||||
assert.equal("keyword.operator", tokens[4].type);
|
||||
assert.equal("string", tokens[5].type);
|
||||
assert.equal("meta.tag", tokens[6].type);
|
||||
assert.equal("storage.type", tokens[7].type);
|
||||
assert.equal("meta.tag", tokens[8].type);
|
||||
assert.equal("meta.tag.script", tokens[9].type);
|
||||
assert.equal("meta.tag", tokens[10].type);
|
||||
assert.equal("text", tokens[11].type);
|
||||
},
|
||||
|
||||
"test: tokenize multiline attribute value with double quotes": function() {
|
||||
var line1 = this.tokenizer.getLineTokens('<a href="abc', "start");
|
||||
var t1 = line1.tokens;
|
||||
var t2 = this.tokenizer.getLineTokens('def">', line1.state).tokens;
|
||||
assert.equal(t1[t1.length-1].type, "string");
|
||||
assert.equal(t2[0].type, "string");
|
||||
},
|
||||
|
||||
"test: tokenize multiline attribute value with single quotes": function() {
|
||||
var line1 = this.tokenizer.getLineTokens("<a href='abc", "start");
|
||||
var t1 = line1.tokens;
|
||||
var t2 = this.tokenizer.getLineTokens('def\'>', line1.state).tokens;
|
||||
assert.equal(t1[t1.length-1].type, "string");
|
||||
assert.equal(t2[0].type, "string");
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var Range = require("../range").Range;
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.mode = new HtmlMode();
|
||||
},
|
||||
|
||||
"test: toggle comment lines should not do anything" : function() {
|
||||
var session = new EditSession([" abc", "cde", "fg"]);
|
||||
|
||||
var range = new Range(0, 3, 1, 1);
|
||||
var comment = this.mode.toggleCommentLines("start", session, 0, 1);
|
||||
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
|
||||
},
|
||||
|
||||
"test: next line indent should be the same as the current line indent" : function() {
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " abc"));
|
||||
assert.equal("", this.mode.getNextLineIndent("start", "abc"));
|
||||
assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc"));
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
-88
@@ -1,88 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var lint = require("../worker/jshint").JSHINT;
|
||||
var parser = require("../narcissus/parser");
|
||||
|
||||
var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
|
||||
Mirror.call(this, sender);
|
||||
this.setTimeout(500);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptWorker, Mirror);
|
||||
|
||||
(function() {
|
||||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
value = value.replace(/^#!.*\n/, "\n");
|
||||
|
||||
// var start = new Date();
|
||||
try {
|
||||
parser.parse(value);
|
||||
} catch(e) {
|
||||
// console.log("narcissus")
|
||||
// console.log(e);
|
||||
var chunks = e.message.split(":")
|
||||
var message = chunks.pop().trim();
|
||||
var lineNumber = parseInt(chunks.pop().trim()) - 1;
|
||||
this.sender.emit("narcissus", {
|
||||
row: lineNumber,
|
||||
column: null, // TODO convert e.cursor
|
||||
text: message,
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
} finally {
|
||||
// console.log("parse time: " + (new Date() - start));
|
||||
}
|
||||
|
||||
// var start = new Date();
|
||||
// console.log("jslint")
|
||||
lint(value, {undef: false, onevar: false, passfail: false});
|
||||
this.sender.emit("jslint", lint.errors);
|
||||
// console.log("lint time: " + (new Date() - start));
|
||||
}
|
||||
|
||||
}).call(JavaScriptWorker.prototype);
|
||||
|
||||
});
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var assert = require("../test/assertions");
|
||||
var JavaScriptWorker = require("./javascript_worker").JavaScriptWorker;
|
||||
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.sender = {
|
||||
on: function() {},
|
||||
callback: function(data, id) {
|
||||
this.data = data;
|
||||
},
|
||||
events: [],
|
||||
emit: function(type, e) {
|
||||
this.events.push([type, e]);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
"test check for syntax error": function() {
|
||||
var worker = new JavaScriptWorker(this.sender);
|
||||
worker.setValue("Juhu Kinners");
|
||||
worker.deferredUpdate.call();
|
||||
|
||||
var error = this.sender.events[0][1];
|
||||
assert.equal(error.text, "missing ; before statement");
|
||||
assert.equal(error.type, "error");
|
||||
assert.equal(error.row, 0);
|
||||
assert.equal(error.column, null);
|
||||
},
|
||||
|
||||
"test invalid multi line string": function() {
|
||||
var worker = new JavaScriptWorker(this.sender);
|
||||
worker.setValue('"a\n\\nn"');
|
||||
worker.deferredUpdate.call();
|
||||
|
||||
var error = this.sender.events[0][1];
|
||||
assert.equal(error.text, "Unterminated string literal");
|
||||
assert.equal(error.type, "error");
|
||||
assert.equal(error.row, 0);
|
||||
assert.equal(error.column, null);
|
||||
},
|
||||
|
||||
"test check for narcissus bug": function() {
|
||||
var worker = new JavaScriptWorker(this.sender);
|
||||
worker.setValue("if('");
|
||||
worker.deferredUpdate.call();
|
||||
assert.equal(this.sender.events[0][1].type, "error");
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var parse = require("./json/json_parse");
|
||||
|
||||
var JsonWorker = exports.JsonWorker = function(sender) {
|
||||
Mirror.call(this, sender);
|
||||
this.setTimeout(200);
|
||||
};
|
||||
|
||||
oop.inherits(JsonWorker, Mirror);
|
||||
|
||||
(function() {
|
||||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
|
||||
try {
|
||||
var result = parse(value);
|
||||
} catch (e) {
|
||||
var pos = this.charToDocumentPosition(e.at-1);
|
||||
this.sender.emit("error", {
|
||||
row: pos.row,
|
||||
column: pos.column,
|
||||
text: e.message,
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.sender.emit("ok");
|
||||
};
|
||||
|
||||
this.charToDocumentPosition = function(charPos) {
|
||||
var i = 0;
|
||||
var len = this.doc.getLength();
|
||||
var nl = this.doc.getNewLineCharacter().length;
|
||||
|
||||
if (!len) {
|
||||
return { row: 0, column: 0};
|
||||
}
|
||||
|
||||
var lineStart = 0;
|
||||
while (i < len) {
|
||||
var line = this.doc.getLine(i);
|
||||
var lineLength = line.length + nl;
|
||||
if (lineStart + lineLength > charPos)
|
||||
return {
|
||||
row: i,
|
||||
column: charPos - lineStart
|
||||
};
|
||||
|
||||
lineStart += lineLength;
|
||||
i += 1;
|
||||
}
|
||||
|
||||
return {
|
||||
row: i-1,
|
||||
column: line.length
|
||||
};
|
||||
};
|
||||
|
||||
}).call(JsonWorker.prototype);
|
||||
|
||||
});
|
||||
@@ -1,87 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* John Roepke <john AT justjohn DOT us>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules(), "i");
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
// ignore braces in comments
|
||||
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
var match = line.match(/^.*\{\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-220
@@ -1,220 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var lang = require("../lib/lang");
|
||||
var xmlUtil = require("./xml_util");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var LiquidHighlightRules = function() {
|
||||
|
||||
// see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects
|
||||
var functions = lang.arrayToMap(
|
||||
// Standard Filters
|
||||
("date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
|
||||
"escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
|
||||
"truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
|
||||
).split("|")
|
||||
);
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
// Standard Tags
|
||||
("capture|endcapture|case|endcase|when|comment|endcomment|" +
|
||||
"cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
|
||||
// Commonly used tags
|
||||
"style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow").split("|")
|
||||
);
|
||||
|
||||
var builtinVariables = lang.arrayToMap(
|
||||
['forloop']
|
||||
// ("forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" +
|
||||
// "tablerowloop\\.(length|index|index0|rindex|rindex0|first|last|col|col0|"+
|
||||
// "col_first|col_last)").split("|")
|
||||
);
|
||||
|
||||
var definitions = lang.arrayToMap(("assign").split("|"));
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
start : [{
|
||||
token : "variable",
|
||||
regex : "{%",
|
||||
next : "liquid_start"
|
||||
}, {
|
||||
token : "variable",
|
||||
regex : "{{",
|
||||
next : "liquid_start"
|
||||
}, {
|
||||
token : "meta.tag",
|
||||
merge : true,
|
||||
regex : "<\\!\\[CDATA\\[",
|
||||
next : "cdata"
|
||||
}, {
|
||||
token : "xml_pe",
|
||||
regex : "<\\?.*?\\?>"
|
||||
}, {
|
||||
token : "comment",
|
||||
merge : true,
|
||||
regex : "<\\!--",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "meta.tag",
|
||||
regex : "<(?=\\s*script\\b)",
|
||||
next : "script"
|
||||
}, {
|
||||
token : "meta.tag",
|
||||
regex : "<(?=\\s*style\\b)",
|
||||
next : "style"
|
||||
}, {
|
||||
token : "meta.tag", // opening tag
|
||||
regex : "<\\/?",
|
||||
next : "tag"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "[^<]+"
|
||||
} ],
|
||||
|
||||
cdata : [ {
|
||||
token : "text",
|
||||
regex : "\\]\\]>",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "text",
|
||||
merge : true,
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "text",
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
} ],
|
||||
|
||||
comment : [ {
|
||||
token : "comment",
|
||||
regex : ".*?-->",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment",
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
} ] ,
|
||||
|
||||
liquid_start : [{
|
||||
token: "variable",
|
||||
regex: "}}",
|
||||
next: "start"
|
||||
}, {
|
||||
token: "variable",
|
||||
regex: "%}",
|
||||
next: "start"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : "(?:true|false)\\b"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (functions.hasOwnProperty(value))
|
||||
return "support.function";
|
||||
else if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (builtinVariables.hasOwnProperty(value))
|
||||
return "variable.language";
|
||||
else if (definitions.hasOwnProperty(value))
|
||||
return "keyword.definition";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : /[\[\({]/
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}]
|
||||
};
|
||||
|
||||
xmlUtil.tag(this.$rules, "tag", "start");
|
||||
xmlUtil.tag(this.$rules, "style", "css-start");
|
||||
xmlUtil.tag(this.$rules, "script", "js-start");
|
||||
|
||||
this.embedRules(JavaScriptHighlightRules, "js-", [{
|
||||
token: "comment",
|
||||
regex: "\\/\\/.*(?=<\\/script>)",
|
||||
next: "tag"
|
||||
}, {
|
||||
token: "meta.tag",
|
||||
regex: "<\\/(?=script)",
|
||||
next: "tag"
|
||||
}]);
|
||||
|
||||
this.embedRules(CssHighlightRules, "css-", [{
|
||||
token: "meta.tag",
|
||||
regex: "<\\/(?=style)",
|
||||
next: "tag"
|
||||
}]);
|
||||
};
|
||||
oop.inherits(LiquidHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.LiquidHighlightRules = LiquidHighlightRules;
|
||||
});
|
||||
@@ -1,87 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Colin Gourlay <colin DOT j DOT gourlay AT gmail DOT com>
|
||||
* Lee Gao
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new LuaHighlightRules().getRules());
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
|
||||
var chunks = ["function", "then", "do", "repeat"];
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
} else {
|
||||
for (var i in tokens){
|
||||
var token = tokens[i];
|
||||
if (token.type != "keyword") continue;
|
||||
var chunk_i = chunks.indexOf(token.value);
|
||||
if (chunk_i != -1){
|
||||
indent += tab;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
|
||||
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var XmlMode = require("./xml").Mode;
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new MarkdownHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$embeds = highlighter.getEmbeds();
|
||||
this.createModeDelegates({
|
||||
"js-": JavaScriptMode,
|
||||
"xml-": XmlMode,
|
||||
"html-": HtmlMode
|
||||
});
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
if (state == "listblock") {
|
||||
var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
|
||||
if (match) {
|
||||
return new Array(match[1].length + 1).join(" ") + match[2];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return this.$getIndent(line);
|
||||
}
|
||||
};
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
var match = line.match(/^(\s+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingParensOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\)/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\))/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
var match = line.match(/^(\s+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(MatchingParensOutdent.prototype);
|
||||
|
||||
exports.MatchingParensOutdent = MatchingParensOutdent;
|
||||
});
|
||||
@@ -1,78 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Camile <jonathan.camile AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("ace/lib/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var PgsqlHighlightRules = require("ace/mode/pgsql_highlight_rules").PgsqlHighlightRules;
|
||||
var Range = require("ace/range").Range;
|
||||
// var EditSession = require("ace/edit_session").EditSession;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new PgsqlHighlightRules().getRules());
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
// var outentedRows = [];
|
||||
var re = /^(\s*)--/;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc.indentRows(startRow, endRow, "--");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
if (state == "start" || state == "keyword.statementEnd") {
|
||||
return "";
|
||||
} else {
|
||||
return this.$getIndent(line); // Keep whatever indent the previous line has
|
||||
}
|
||||
}
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
@@ -1,86 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new ScssHighlightRules().getRules(), "i");
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
// ignore braces in comments
|
||||
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
var match = line.match(/^.*\{\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-145
@@ -1,145 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rich Healey <richo AT psych0tik DOT net>
|
||||
* Javier Perez-Griffo <javier AT besol DOT es>
|
||||
* James Tan <jamestyj AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var ShHighlightRules = function() {
|
||||
|
||||
var reservedKeywords = lang.arrayToMap(
|
||||
('!|{|}|case|do|done|elif|else|'+
|
||||
'esac|fi|for|if|in|then|until|while|'+
|
||||
'&|;|export|local|read|typeset|unset|'+
|
||||
'elif|select|set'
|
||||
).split('|')
|
||||
);
|
||||
|
||||
var languageConstructs = lang.arrayToMap(
|
||||
('[|]|alias|bg|bind|break|builtin|'+
|
||||
'cd|command|compgen|complete|continue|'+
|
||||
'dirs|disown|echo|enable|eval|exec|'+
|
||||
'exit|fc|fg|getopts|hash|help|history|'+
|
||||
'jobs|kill|let|logout|popd|printf|pushd|'+
|
||||
'pwd|return|set|shift|shopt|source|'+
|
||||
'suspend|test|times|trap|type|ulimit|'+
|
||||
'umask|unalias|wait'
|
||||
).split('|')
|
||||
);
|
||||
|
||||
var integer = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||
// var integer = "(?:" + decimalInteger + ")";
|
||||
|
||||
var fraction = "(?:\\.\\d+)";
|
||||
var intPart = "(?:\\d+)";
|
||||
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
|
||||
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||
var fileDescriptor = "(?:&" + intPart + ")";
|
||||
|
||||
var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
|
||||
var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
|
||||
|
||||
var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
|
||||
|
||||
var func = "(?:" + variableName + "\\s*\\(\\))";
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : '"(?:[^\\\\]|\\\\.)*?"'
|
||||
}, {
|
||||
token : "variable.language",
|
||||
regex : builtinVariable
|
||||
}, {
|
||||
token : "variable",
|
||||
regex : variable
|
||||
}, {
|
||||
token : "support.function",
|
||||
regex : func,
|
||||
}, {
|
||||
token : "support.function",
|
||||
regex : fileDescriptor
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : "'(?:[^\\\\]|\\\\.)*?'"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : floatNumber
|
||||
}, {
|
||||
token : "constant.numeric", // integer
|
||||
regex : integer + "\\b"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (reservedKeywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (languageConstructs.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else if (value == "debugger")
|
||||
return "invalid.deprecated";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\[\\(\\{]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\]\\)\\}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(ShHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.ShHighlightRules = ShHighlightRules;
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Camile <jonathan.camile AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new SqlHighlightRules().getRules());
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
var outentedRows = [];
|
||||
var re = /^(\s*)--/;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc.indentRows(startRow, endRow, "--");
|
||||
}
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Camile <jonathan.camile AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var SqlHighlightRules = function() {
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("select|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
|
||||
"when|else|end|type|left|right|join|on|outer|desc|asc").split("|")
|
||||
);
|
||||
|
||||
var builtinConstants = lang.arrayToMap(
|
||||
("true|false|null").split("|")
|
||||
);
|
||||
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
("count|min|max|avg|sum|rank|now|coalesce").split("|")
|
||||
);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : "--.*$"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : '".*"'
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : "'.*'"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : function(value) {
|
||||
value = value.toLowerCase();
|
||||
if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (builtinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else if (builtinFunctions.hasOwnProperty(value))
|
||||
return "support.function";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\(]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\)]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(SqlHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.SqlHighlightRules = SqlHighlightRules;
|
||||
});
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var XmlMode = require("./xml").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules;
|
||||
var MixedFoldMode = require("./folding/mixed").FoldMode;
|
||||
var XmlFoldMode = require("./folding/xml").FoldMode;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
XmlMode.call(this);
|
||||
|
||||
this.highlighter = new SvgHighlightRules();
|
||||
this.$tokenizer = new Tokenizer(this.highlighter.getRules());
|
||||
|
||||
this.$embeds = this.highlighter.getEmbeds();
|
||||
this.createModeDelegates({
|
||||
"js-": JavaScriptMode
|
||||
});
|
||||
|
||||
this.foldingRules = new MixedFoldMode(new XmlFoldMode({}), {
|
||||
"js-": new CStyleFoldMode()
|
||||
});
|
||||
};
|
||||
|
||||
oop.inherits(Mode, XmlMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
return this.$getIndent(line);
|
||||
};
|
||||
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
|
||||
var xmlUtil = require("./xml_util");
|
||||
|
||||
var SvgHighlightRules = function() {
|
||||
XmlHighlightRules.call(this);
|
||||
|
||||
this.$rules.start.splice(3, 0, {
|
||||
token : "meta.tag",
|
||||
regex : "<(?=\s*script)",
|
||||
next : "script"
|
||||
});
|
||||
|
||||
xmlUtil.tag(this.$rules, "script", "js-start");
|
||||
|
||||
this.embedRules(JavaScriptHighlightRules, "js-", [{
|
||||
token: "comment",
|
||||
regex: "\\/\\/.*(?=<\\/script>)",
|
||||
next: "tag"
|
||||
}, {
|
||||
token: "meta.tag",
|
||||
regex: "<\\/(?=script)",
|
||||
next: "tag"
|
||||
}]);
|
||||
};
|
||||
|
||||
oop.inherits(SvgHighlightRules, XmlHighlightRules);
|
||||
|
||||
exports.SvgHighlightRules = SvgHighlightRules;
|
||||
});
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var lang = require("../lib/lang");
|
||||
|
||||
var TextHighlightRules = function() {
|
||||
|
||||
// regexp must not have capturing parentheses
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [{
|
||||
token : "empty_line",
|
||||
regex : '^$'
|
||||
}, {
|
||||
token : "text",
|
||||
regex : ".+"
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.addRules = function(rules, prefix) {
|
||||
for (var key in rules) {
|
||||
var state = rules[key];
|
||||
for (var i=0; i<state.length; i++) {
|
||||
var rule = state[i];
|
||||
if (rule.next) {
|
||||
rule.next = prefix + rule.next;
|
||||
}
|
||||
}
|
||||
this.$rules[prefix + key] = state;
|
||||
}
|
||||
};
|
||||
|
||||
this.getRules = function() {
|
||||
return this.$rules;
|
||||
};
|
||||
|
||||
this.embedRules = function (HighlightRules, prefix, escapeRules, states) {
|
||||
var embedRules = new HighlightRules().getRules();
|
||||
if (states) {
|
||||
for (var i = 0; i < states.length; i++) {
|
||||
states[i] = prefix + states[i];
|
||||
}
|
||||
} else {
|
||||
states = [];
|
||||
for (var key in embedRules) {
|
||||
states.push(prefix + key);
|
||||
}
|
||||
}
|
||||
this.addRules(embedRules, prefix);
|
||||
|
||||
for (var i = 0; i < states.length; i++) {
|
||||
Array.prototype.unshift.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
|
||||
}
|
||||
|
||||
if (!this.$embeds) {
|
||||
this.$embeds = [];
|
||||
}
|
||||
this.$embeds.push(prefix);
|
||||
}
|
||||
|
||||
this.getEmbeds = function() {
|
||||
return this.$embeds;
|
||||
}
|
||||
|
||||
}).call(TextHighlightRules.prototype);
|
||||
|
||||
exports.TextHighlightRules = TextHighlightRules;
|
||||
});
|
||||
@@ -1,71 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var TextMode = require("./text").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.mode = new TextMode();
|
||||
},
|
||||
|
||||
"test: toggle comment lines should not do anything" : function() {
|
||||
var session = new EditSession([" abc", "cde", "fg"]);
|
||||
|
||||
this.mode.toggleCommentLines("start", session, 0, 1);
|
||||
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
|
||||
},
|
||||
|
||||
|
||||
"text: lines should not be indented" : function() {
|
||||
assert.equal("", this.mode.getNextLineIndent("start", " abc", " "));
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kelley van Evert <kelley.vanevert@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new TextileHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
if (state == "intag")
|
||||
return tab;
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kelley van Evert <kelley.vanevert@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var TextileHighlightRules = function() {
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : function(value) {
|
||||
if (value.match(/^h\d$/))
|
||||
return "markup.heading." + value.charAt(1);
|
||||
else
|
||||
return "markup.heading";
|
||||
},
|
||||
regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre",
|
||||
next : "blocktag"
|
||||
},
|
||||
{
|
||||
token : "keyword",
|
||||
regex : "[\\*]+|[#]+"
|
||||
},
|
||||
{
|
||||
token : "text",
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"blocktag" : [
|
||||
{
|
||||
token : "keyword",
|
||||
regex : "\\. ",
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
token : "keyword",
|
||||
regex : "\\(",
|
||||
next : "blocktagproperties"
|
||||
}
|
||||
],
|
||||
"blocktagproperties" : [
|
||||
{
|
||||
token : "keyword",
|
||||
regex : "\\)",
|
||||
next : "blocktag"
|
||||
},
|
||||
{
|
||||
token : "string",
|
||||
regex : "[a-zA-Z0-9\\-_]+"
|
||||
},
|
||||
{
|
||||
token : "keyword",
|
||||
regex : "#"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(TextileHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.TextileHighlightRules = TextileHighlightRules;
|
||||
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
|
||||
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
|
||||
var XmlFoldMode = require("./folding/xml").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
|
||||
this.$behaviour = new XmlBehaviour();
|
||||
this.foldingRules = new XmlFoldMode();
|
||||
};
|
||||
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
return this.$getIndent(line);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var XmlMode = require("./xml").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: "XML Tokenizer",
|
||||
|
||||
setUp : function() {
|
||||
this.tokenizer = new XmlMode().getTokenizer();
|
||||
},
|
||||
|
||||
"test: tokenize1" : function() {
|
||||
var line = "<Juhu>//Juhu Kinners</Kinners>";
|
||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||
|
||||
assert.equal(3, tokens.length);
|
||||
assert.equal("meta.tag", tokens[0].type);
|
||||
assert.equal("text", tokens[1].type);
|
||||
assert.equal("meta.tag", tokens[2].type);
|
||||
},
|
||||
|
||||
"test: two tags in the same lines should be in separate tokens" : function() {
|
||||
var line = "<Juhu><Kinners>";
|
||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||
|
||||
assert.equal(2, tokens.length);
|
||||
assert.equal("meta.tag", tokens[0].type);
|
||||
assert.equal("meta.tag", tokens[1].type);
|
||||
|
||||
assert.equal("<Juhu>", tokens[0].value);
|
||||
assert.equal("<Kinners>", tokens[1].value);
|
||||
},
|
||||
|
||||
"test: multiline attributes": function() {
|
||||
var multiLine = ['<copy set="{', '}" undo="{', '}"/>'];
|
||||
|
||||
var state = "start";
|
||||
var multiLineTokens = multiLine.map(function(line) {
|
||||
var tokens = this.tokenizer.getLineTokens(line, state);
|
||||
state = tokens.state;
|
||||
return tokens.tokens;
|
||||
}, this);
|
||||
|
||||
assert.equal(multiLineTokens[0].length, 5);
|
||||
assert.equal(multiLineTokens[1].length, 5);
|
||||
assert.equal(multiLineTokens[2].length, 2);
|
||||
|
||||
assert.equal(multiLineTokens[0][4].type, "string");
|
||||
assert.equal(multiLineTokens[1][0].type, "string");
|
||||
assert.equal(multiLineTokens[1][4].type, "string");
|
||||
assert.equal(multiLineTokens[2][0].type, "string");
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var XmlMode = require("./xml").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
this.mode = new XmlMode();
|
||||
},
|
||||
|
||||
"test: getTokenizer() (smoke test)" : function() {
|
||||
var tokenizer = this.mode.getTokenizer();
|
||||
|
||||
assert.ok(tokenizer instanceof Tokenizer);
|
||||
|
||||
var tokens = tokenizer.getLineTokens("<juhu>", "start").tokens;
|
||||
assert.equal("meta.tag", tokens[0].type);
|
||||
},
|
||||
|
||||
"test: toggle comment lines should not do anything" : function() {
|
||||
var session = new EditSession([" abc", "cde", "fg"]);
|
||||
|
||||
this.mode.toggleCommentLines("start", session, 0, 1);
|
||||
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
|
||||
},
|
||||
|
||||
"test: next line indent should be the same as the current line indent" : function() {
|
||||
assert.equal(" ", this.mode.getNextLineIndent("start", " abc"));
|
||||
assert.equal("", this.mode.getNextLineIndent("start", "abc"));
|
||||
assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc"));
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* William Candillon <wcandillon AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL. *
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
define(function(require, exports, module){
|
||||
var Position = exports.Position = function(line, offset, length)
|
||||
{
|
||||
this.line = line;
|
||||
this.offset = offset;
|
||||
this.length = length;
|
||||
|
||||
this.getLine = function()
|
||||
{
|
||||
return this.line;
|
||||
};
|
||||
|
||||
this.getOffset = function()
|
||||
{
|
||||
return this.offset;
|
||||
};
|
||||
|
||||
this.getLength = function()
|
||||
{
|
||||
return this.length;
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
-1686
File diff suppressed because it is too large
Load Diff
-2993
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* William Candillon <wcandillon AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL. *
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
define(function(require, exports, module){
|
||||
|
||||
var org = require("./antlr3-all").org;
|
||||
|
||||
var XQDTLexer = exports.XQDTLexer = function(input, state)
|
||||
{
|
||||
XQDTLexer.superclass.constructor.call(this, input, state);
|
||||
};
|
||||
|
||||
org.antlr.lang.extend(XQDTLexer, org.antlr.runtime.Lexer, {
|
||||
|
||||
comments: [],
|
||||
|
||||
addComment: function(start, stop){ this.comments.push({ start: start, stop: stop }); },
|
||||
|
||||
isWsExplicit: false,
|
||||
|
||||
setIsWsExplicit: function (wsExplicit) {
|
||||
//console.log("A WS: " + wsExplicit);
|
||||
this.isWsExplicit = wsExplicit;
|
||||
//console.log("B WS: " + wsExplicit);
|
||||
},
|
||||
|
||||
addToStack: function (stack) {
|
||||
stack.push(this);
|
||||
},
|
||||
|
||||
rewindToIndex: function(index) {
|
||||
var stream = this.input;
|
||||
stream.seek(index);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* William Candillon <wcandillon AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL. *
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
define(function(require, exports, module){
|
||||
|
||||
var org = require("./antlr3-all").org;
|
||||
var XQuerySemanticHighlighter = require("./XQuerySemanticHighlighter").XQuerySemanticHighlighter;
|
||||
|
||||
var XQDTParser = exports.XQDTParser = function(input, state)
|
||||
{
|
||||
this.highlighter = new XQuerySemanticHighlighter();
|
||||
var that = this;
|
||||
|
||||
input.getTokenSource().addComment = function(start, stop) {
|
||||
var comments = input.getTokenSource().comments;
|
||||
for(var i in comments)
|
||||
{
|
||||
var c = comments[i];
|
||||
that.highlighter.addToken(c.start, c.stop, "comment");
|
||||
}
|
||||
input.getTokenSource().comments = [];
|
||||
that.highlighter.addToken(start, stop, "comment")
|
||||
};
|
||||
XQDTParser.superclass.constructor.call(this, input, state);
|
||||
};
|
||||
|
||||
org.antlr.lang.extend(XQDTParser, org.antlr.runtime.Parser, {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
-10363
File diff suppressed because it is too large
Load Diff
-42525
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user