diff --git a/Readme.md b/Readme.md index b21bdc0e..2b4a77a1 100644 --- a/Readme.md +++ b/Readme.md @@ -16,6 +16,10 @@ Features * Highlight matching parentheses * Toggle between soft tabs and real tabs * Displays hidden characters +* Drap and drop text using the mouse +* Line wrapping +* Unstructured / user code folding +* Live syntax checker (currently JavaScript/CoffeeScript) Take Ace for a spin! -------------------- @@ -35,6 +39,7 @@ Getting the code Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings! git clone git://github.com/ajaxorg/ace.git + cd ace git submodule update --init --recursive Embedding Ace @@ -54,30 +59,39 @@ The easiest version is simply: With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g. - #editor { + #editor { position: absolute; width: 500px; height: 400px; } - + To change the theme simply include the Theme's JavaScript file - + and configure the editor to use the theme: editor.setTheme("ace/theme/twilight"); - + By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file: - + Then the mode can be used like this: var JavaScriptMode = require("ace/mode/javascript").Mode; editor.getSession().setMode(new JavaScriptMode()); +Documentation +------------- + +You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js). + +There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki). + +If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss). + Running Ace ----------- @@ -85,7 +99,11 @@ After the checkout Ace works out of the box. No build step is required. Open 'ed ./static.py -The editor can then be opened at http://localhost:9999/editor.html. +Or using Node.JS + + ./static.js + +The editor can then be opened at http://localhost:8888/index.html. Package Ace ----------- @@ -96,10 +114,14 @@ To package Ace we use the dryice build tool developed by the Mozilla Skywriter t Afterwards Ace can be built by calling - ./Makefile.dryice.js + ./Makefile.dryice.js normal The packaged Ace will be put in the 'build' folder. +To build the bookmarklet version execute + + ./Makefile.dryice.js bm + Running the Unit Tests ---------------------- @@ -111,6 +133,14 @@ To run the tests call: node lib/ace/test/all.js +You can also run the tests in your browser by serving: + + http://localhost:8888/lib/ace/test/tests.html + +This makes debugging failing tests way more easier. + +_Note_: Currently (2011-05-21) the tests seem to run on Chrome only. + Contributing ------------ diff --git a/static.py b/static.py index 801a70d7..eb864596 100755 --- a/static.py +++ b/static.py @@ -18,8 +18,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to: -The Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, +The Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Luke Arno can be found at http://lukearno.com/ @@ -49,14 +49,14 @@ class MagicError(Exception): pass class StatusApp: """Used by WSGI apps to return some HTTP status.""" - + def __init__(self, status, message=None): self.status = status if message is None: self.message = status else: self.message = message - + def __call__(self, environ, start_response, headers=[]): if self.message: Headers(headers).add_header('Content-type', 'text/plain') @@ -69,9 +69,9 @@ class StatusApp: class Cling(object): """A stupidly simple way to serve static content via WSGI. - + Serve the file of the same path as PATH_INFO in self.datadir. - + Look up the Content-type in self.content_types by extension or use 'text/plain' if the extension is not found. @@ -173,17 +173,17 @@ def iter_and_close(file_like, block_size): else: raise StopIteration except StopIteration, si: file_like.close() - return + return def cling_wrap(package_name, dir_name, **kw): """Return a Cling that serves from the given package and dir_name. - + This uses pkg_resources.resource_filename which is not the - recommended way, since it extracts the files. - - I think this works fine unless you have some _very_ serious - requirements for static content, in which case you probably + recommended way, since it extracts the files. + + I think this works fine unless you have some _very_ serious + requirements for static content, in which case you probably shouldn't be serving it through a WSGI app, IMHO. YMMV. """ resource = Requirement.parse(package_name) @@ -191,7 +191,7 @@ def cling_wrap(package_name, dir_name, **kw): def command(): - parser = OptionParser(usage="%prog DIR [HOST][:][PORT]", + parser = OptionParser(usage="%prog DIR [HOST][:][PORT]", version="static 0.3.6") options, args = parser.parse_args() if len(args) in (1, 2): @@ -209,7 +209,7 @@ def command(): if not host: host = '0.0.0.0' if not port: - port = 9999 + port = 8888 try: port = int(port) except: @@ -230,8 +230,8 @@ def test(): from wsgiref.validate import validator app = Cling(getcwd()) try: - print "Serving " + getcwd() + " to http://localhost:9999" - make_server('0.0.0.0', 9999, validator(app)).serve_forever() + print "Serving " + getcwd() + " to http://localhost:8888" + make_server('0.0.0.0', 8888, validator(app)).serve_forever() except KeyboardInterrupt, ki: print "" print "Ciao, baby!"