diff --git a/.gitignore b/.gitignore
index ba2a97b57..26eca7a67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
node_modules
coverage
+bower_components
diff --git a/CHANGELOG b/CHANGELOG
index 820f5a422..e0422341a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,9 +1,22 @@
+v0.3.0
+------
+ * A shiny new datepicker using pickadate.js
+ * Cleaned up documentation and added small installation instructions.
+
+v0.2.0
+------
+ * postProcess function in schemaForm provider
+ * New form option: Inline feedback icons in fields.
+ * New form option: onChange a function or expression that triggers in the same
+ way as ng-change.
+ * Removed dependencies on jQuery (thanks @zackbloom and @tsing!)
+
v0.1.0
------
We're celebrating actual useful functionality by bumping minor version, yay!
* ```radios``` and ```radiobuttons``` supports, works the same but looks different.
* Added ```conditional``` type to hide/show parts of a form.
- * Bugfixes
+ * Bugfixes
v0.0.4
diff --git a/README.md b/README.md
index 42c9d304a..52a9c2c33 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ Angular Schema Form
Generate forms from a JSON schema, with AngularJS!
-### [Try out the example page](http://textalk.github.io/angular-schema-form/src/bootstrap-example.html)
+### [Try out the example page](http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html)
...where you can edit the schema or the form definition and see what comes out!
@@ -21,9 +21,6 @@ aims to be deeply integrated with AngularJS, i.e. to use the standard AngularJS
[tv4](https://github.com/geraintluff/tv4) for validation which means its compatible with version 4 of the json schema
standard. Schema Form, as a default, generates bootstrap 3 friendly HTML.
-Another thing that sets Schema Form apart is that it, at the moment, doesn't implement half of what JSON Form
-does, nor have any documentation! Which of course we hope to remedy soon.
-
Basic Usage
-----------
@@ -57,374 +54,39 @@ function FormController($scope) {
}
```
+Documentation
+-------------
+Documentation covering defaults and form types [can be found here.](docs/index.md)
-Contributing
-------------
-
-All contributions are welcome! We're trying to use [git flow](http://danielkummer.github.io/git-flow-cheatsheet/)
-so please base any merge request on the **development** branch instead of **master**.
-
-
-
-Form types
-----------
-Schema Form currently supports the following form field types:
-
-| Type | Becomes |
-|:--------------|:------------------------|
-| fieldset | a fieldset with legend |
-| section | just a div |
-| conditional | a section with a ```ng-if``` |
-| actions | horizontal button list, can only submit and buttons as items |
-| text | input with type text |
-| textarea | a textarea |
-| number | input type number |
-| checkbox | a checkbox |
-| checkboxes | list of checkboxes |
-| select | a select (single value)|
-| submit | a submit button |
-| button | a button |
-| radios | radio buttons |
-| radiobuttons | radio buttons with bootstrap buttons |
-
-
-Default form types
-------------------
-
-| Schema | Form type |
-|:-------------------|:------------:|
-| "type": "string" | text |
-| "type": "number" | number |
-| "type": "integer" | number |
-| "type": "boolean" | checkbox |
-| "type": "object" | fieldset |
-| "type": "string" and a "enum" | select |
-| "type": "array" and a "enum" in array type | checkboxes |
-
-
-
-Form definition and "*"
-----------------------
-If you don't supply a form definition, it will default to rendering the after the defaults taken
-from the schema.
-
-A form definition is a list where the items can be
- * A star, ```"*"```
- * A string with the dot notated name/path to a property, ```"name"```
- * An object with that defines the options for a form field., ```{ key: "name" }```
-
-The star, ```"*"``` means "use the default for the entire schema" and is useful when you want the
-defaults plus an additional button.
-
-ex.
-```javascript
-[
- "*",
- { type: 'submit', title: 'Save' }
-]
-```
-
-The string notation, ```"name"```, is just a shortcut for the object notation ```{ key: "name" }```
-where key denotes what part of the schema we're creating a form field for.
-
-
-Overriding field types and order
---------------------------------
-The order of the fields is technically undefined since the order of attributes on an javascript
-object (which the schema ends up being) is undefined. In practice it kind of works though.
-If you need to override the order of the forms, or just want to be sure, specify a form definition.
-
-ex.
-```javascript
-var schema = {
- "type": "object",
- "properties": {
- "surname": { "type": "string" },
- "firstname": { "type": "string" },
- }
-}
-
-[
- "firstname",
- "surname"
-]
-```
-
-You can also override fields to force the type and supply other options:
-ex.
-
-```javascript
-var schema = {
- "type": "object",
- "properties": {
- "surname": { "type": "string" },
- "firstname": { "type": "string" },
- }
-}
-
-[
- "firstname",
- {
- key: "surname",
- type: "select",
- titleMap: {
- "Andersson": "Andersson",
- "Johansson": "Johansson",
- "other": "Something else..."
- }
- }
-]
-```
-
-Options
--------
-
-General options most field types can handle:
-```javascript
-{
- key: "address.street", //The dot notatin to the attribute on the model
- type: "text", //Type of field
- title: "Street", //Title of field, taken from schema if available
- notitle: false, //Set to true to hide title
- description: "Street name", //A description, taken from schema if available
- validationMessage: "Oh noes, please write a proper address", //A custom validation error message
- onChange: "valueChanged(form.key,modelValue)", //onChange event handler, expression or function
- feedback: false //inline feedback icons
-}
-```
-
-### onChange
-The ```onChange``` option can be used with most fields and its value should be
-either an angular expression, as a string, or a function. If its an expression
-it will be evaluated in the parent scope of the ```sf-schema``` directive with
-the special locals ```modelValue``` and ```form```. If its a function that will
-be called with ```modelValue``` and ```form``` as first and second arguments.
-
-ex.
-```javascript
-$scope.form = [
- {
- key: "name",
- onChange: "updated(modelValue,form)"
- },
- {
- key: "password",
- onChange: function(modelValue,form) {
- console.log("Password is",modelValue);
- }
- }
-];
-```
-
-### Validation Messages
-
-Per default all error messages but "Required" comes from the schema validator
-[tv4](https://github.com/geraintluff/tv4), this might or might not work for you.
-If you supply a ```validationMessage``` property in the form definition, and if its value is a
-string that will be used instead on any validation error.
-
-If you need more fine grained control you can supply an object instead with keys matching the error
-codes of [tv4](https://github.com/geraintluff/tv4). See ```tv4.errorCodes```
-
-Ex.
-```javascript
-{
- key: "address.street",
- validationMessage: {
- tv4.errorCodes.STRING_LENGTH_SHORT: "Address is too short, man.",
- "default": "Just write a proper address, will you?", //Special catch all error message
- "required": "I needz an address plz" //Used for required if specified
- }
-}
-```
-
-### Inline feedback icons
-*input* and *textarea* based fields get inline status icons by default. A check
-when everything is valid and a cross when there are validation errors.
-
-This can be turned off or configured to other icons. To turn off just
-set ```feedback``` to false. If set to a string that string is evaluated by
-a ```ngClass``` in the decorators scope. If not set att all the default value
-is ```{ 'glyphicon': true, 'glyphicon-ok': hasSuccess(), 'glyphicon-remove': hasError() }```
-
-ex. displaying an asterisk on required fields
-```javascript
- $sope.form = [
- {
- key: "name",
- feedback: "{ 'glyphicon': true, 'glyphicon-asterisk': form.requires && !hasSuccess && !hassError() ,'glyphicon-ok': hasSuccess(), 'glyphicon-remove': hasError() }"
- }
-```
-
-Useful things in the decorators scope are
-
-| Name | Description|
-|:---------------|:----------:|
-| hasSuccess() | *true* if field is valid and not pristine |
-| hasError() | *true* if field is invalid and not pristine |
-| ngModel | The controller of the ngModel directive, ex. ngModel.$valid |
-| form | The form definition for this field |
-
-
-
-Specific options per type
--------------------------
-
-### fieldset and section
-
-*fieldset* and *section* doesn't need a key. You can create generic groups with them.
-They do need a list of ```items``` to have as children.
-```javascript
-{
- type: "fieldset",
- items: [
- "name",
- { key: "surname", notitle: true }
- ]
-}
-```
-
-### conditional
-
-A *conditional* is exactly the same as a *section*, i.e. a ```
``` with other form elements in
-it, hence they need an ```items``` property. They also need a ```condition``` which is
-a string with an angular expression. If that expression evaluates as thruthy the *conditional*
-will be rendered into the DOM otherwise not. The expression is evaluated in the parent scope of
-the ```sf-schema``` directive (the same as onClick on buttons) but with access to the current model
-under the name ```model```. This is useful for hiding/showing
-parts of a form depending on another form control.
-
-ex. A checkbox that shows an input field for a code when checked
-
-```javascript
-function FormCtrl($scope) {
- $scope.person = {}
-
- $scope.schema = {
- "type": "object",
- "properties": {
- "name": {
- "type": "string",
- "title": "Name"
- },
- "eligible": {
- "type": "boolean",
- "title": "Eligible for awesome things"
- },
- "code": {
- "type":"string"
- "title": "The Code"
- }
- }
- }
-
- $scope.form = [
- "name",
- "eligible",
- {
- type: "conditional",
- condition: "person.eligible", //or "model.eligable"
- items: [
- "code"
- ]
- }
- ]
-}
-```
-Note that angulars two-way binding automatically will update the conditional block, no need for
-event handlers and such. The condition need not reference a model value it could be anything in
-scope.
-
-
-### select and checkboxes
-
-*select* and *checkboxes* can take an object, ```titleMap```, where key is the value to be saved on the model
-and the value is the title of the option.
-```javascript
-{
- type: "select",
- titleMap: {
- "yes": "Yes I do",
- "no": "Hell no"
- }
-}
-```
-### actions
-
-*actions* behaves the same as fieldset, but can only handle buttons as chidren.
-```javascript
-{
- type: "actions",
- items: [
- { type: 'submit', title: 'Ok' }
- { type: 'button', title: 'Cancel', onClick: "cancel()" }
- ]
-}
-```
-
-### button
-
-*button* can have a ```onClick``` attribute that either, as in JSON Form, is a function *or* a
-string with an angular expression, as with ng-click. The expression is evaluated in the parent scope of
-the ```sf-schema``` directive.
+Installation
+------------
+Simplest way is by using [bower](http://bower.io/) since it will also download
+any dependencies.
-```javascript
-[
- { type: 'button', title: 'Ok', onClick: function(){ ... } }
- { type: 'button', title: 'Cancel', onClick: "cancel()" }
-[
+```bash
+bower install angular-schema-form
```
-### radios and radiobuttons
-Both type *radios* and *radiobuttons* work the same way, they take a titleMap
-and renders ordinary radio buttons or bootstrap 3 buttons inline. It's a
-cosmetic choice.
-
-Ex.
-```javascript
-function FormCtrl($scope) {
- $scope.schema = {
- type: "object",
- properties: {
- choice: {
- type: "string",
- enum: ["one","two"]
- }
- }
- };
+(or just download the contents of the ```dist/``` folder and add dependencies
+manually)
- $scope.form = [
- {
- key: "choice",
- type: "radiobuttons",
- titleMap: {
- one: "One",
- two: "More..."
- }
- }
- ];
-}
-```
+It depends on AngularJS (duh!), [tv4](https://github.com/geraintluff/tv4), and
+if you like to use the date picker you also need jQuery and
+[pickadate.js](http://amsul.ca/pickadate.js/)
+The minified files also includes all templates so they are all you need.
-Post process function
----------------------
+Addons
+------
+Currently there is only one addon, a date picker using
+the excellent [pickadate.js](http://amsul.ca/pickadate.js/).
-If you like to use ```["*"]``` as a form, or aren't in control of the form definitions
-but really need to change or add something you can register a *post process*
-function with the ```schemaForm``` service provider. The post process function
-gets one argument, the final form merged with the defaults from the schema just
-before it's rendered, and should return a form.
+See the [docs](docs/datepicker.md) for usage.
-Ex. Reverse all forms
-```javascript
-angular.module('myModule').config(function(schemaFormProvider){
- schemaForm.postProcess(function(form){
- form.reverse();
- return form;
- })
+Contributing
+------------
-});
-```
+All contributions are welcome! We're trying to use [git flow](http://danielkummer.github.io/git-flow-cheatsheet/)
+so please base any merge request on the **development** branch instead of **master**.
diff --git a/bower.json b/bower.json
index f5e4635ea..69a5907e2 100644
--- a/bower.json
+++ b/bower.json
@@ -2,9 +2,10 @@
"name": "angular-schema-form",
"main": [
"dist/schema-form.min.js",
- "dist/bootstrap-decorator.min.js"
+ "dist/bootstrap-decorator.min.js",
+ "dist/bootstrap-datepicker.min.js"
],
- "version": "0.1.0",
+ "version": "0.3.0",
"authors": [
"Textalk",
"David Jensen "
@@ -21,7 +22,9 @@
"coverage"
],
"dependencies": {
- "tv4": "~1.0.15"
+ "angular": "~1.2.18",
+ "tv4": "~1.0.15",
+ "pickadate": "~3.5.2"
},
"devDependencies": {
"angular-ui-ace": "bower"
diff --git a/bower_components/ace-builds/.bower.json b/bower_components/ace-builds/.bower.json
deleted file mode 100644
index 1650cdcd9..000000000
--- a/bower_components/ace-builds/.bower.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "ace-builds",
- "homepage": "https://github.com/ajaxorg/ace-builds",
- "version": "1.1.3",
- "_release": "1.1.3",
- "_resolution": {
- "type": "version",
- "tag": "v1.1.3",
- "commit": "fc9d2cae9fe8e6e95e74c86a31d21caadd8f9f39"
- },
- "_source": "git://github.com/ajaxorg/ace-builds.git",
- "_target": "~1.1.1",
- "_originalSource": "ace-builds"
-}
\ No newline at end of file
diff --git a/bower_components/ace-builds/ChangeLog.txt b/bower_components/ace-builds/ChangeLog.txt
deleted file mode 100644
index 2b1f88bb1..000000000
--- a/bower_components/ace-builds/ChangeLog.txt
+++ /dev/null
@@ -1,275 +0,0 @@
-2014.03.08 Version 1.1.3
-
-* New Features
- - Allow syntax checkers to be loaded from CDN (Derk-Jan Hartman)
- - Add ColdFusion behavior (Abram Adams)
- - add showLineNumbers option
- - Add html syntax checker (danyaPostfactum)
-
-* new language modes
- - Gherkin (Patrick Nevels)
- - Smarty
-
-2013.12.02 Version 1.1.2
-
-* New Features
- - Accessibility Theme for Ace (Peter Xiao)
- - use snipetManager for expanding emmet snippets
- - update jshint to 2.1.4
- - improve php syntax checker (jdalegonzalez)
- - add option for autoresizing
- - add option for autohiding vertical scrollbar
- - improvements to highlighting of xml like languages (danyaPostfactum)
- - add support for autocompletion and snippets (gjtorikyan danyaPostfactum and others)
- - add option to merge similar changes in undo history
- - add scrollPastEnd option
- - use html5 dragndrop for text dragging (danyaPostfactum)
-
-* API Changes
- - fixed typo in HashHandler commmandManager
-
-* new language modes
- - Nix (Zef Hemel)
- - Protobuf (Zef Hemel)
- - Soy
- - Handlebars
-
-2013.06.04 Version 1.1.1
-
- - Improved emacs keybindings (Robert Krahn)
- - Added markClean, isClean methods to UndoManager (Joonsoo Jeon)
- - Do not allow `Toggle comments` command to remove spaces from indentation
- - Softer colors for indent guides in dark themes
-
-* new language modes
- - Ada
- - Assembly_x86
- - Cobol
- - D
- - ejs
- - MATLAB
- - MySQL
- - Twig
- - Verilog
-
-2013.05.01, Version 1.1.0
-
-* API Changes
- - Default position of the editor container is changed to relative. Add `.ace_editor {position: absolute}` css rule to restore old behavior
- - Changed default line-height to `normal` to not conflict with bootstrap. Use `line-height: inherit` for old behavior.
- - Changed marker types accepted by session.addMarker. It now accepts "text"|"line"|"fullLine"|"screenLine"
- - Internal classnames used by editor were made more consistent
- - Introduced `editor.setOption/getOption/setOptions/getOptions` methods
- - Introduced positionToIndex, indexToPosition methods
-
-* New Features
- - Improved emacs mode (chetstone)
- with Incremental search and Occur modes (Robert Krahn)
-
- - Improved ime handling
- - Searchbox (Vlad Zinculescu)
-
- - Added elastic tabstops lite extension (Garen Torikian)
- - Added extension for whitespace manipulation
- - Added extension for enabling spellchecking from contextmenu
- - Added extension for displaying available keyboard shortcuts (Matthew Christopher Kastor-Inare III)
- - Added extension for displaying options panel (Matthew Christopher Kastor-Inare III)
- - Added modelist extension (Matthew Christopher Kastor-Inare III)
-
- - Improved toggleCommentLines and added ToggleCommentBlock command
- - `:;` pairing in CSS mode (danyaPostfactum)
-
- - Added suppoert for Delete and SelectAll from context menu (danyaPostfactum)
-
- - Make wrapping behavior optional
- - Selective bracket insertion/skipping
-
- - Added commands for increase/decrease numbers, sort lines (Vlad Zinculescu)
- - Folding for Markdown, Lua, LaTeX
- - Selective bracket insertion/skipping for C-like languages
-
-* Many new languages
- - Scheme (Mu Lei)
- - Dot (edwardsp)
- - FreeMarker (nguillaumin)
- - Tiny Mushcode (h3rb)
- - Velocity (Ryan Griffith)
- - TOML (Garen Torikian)
- - LSL (Nemurimasu Neiro, Builders Brewery)
- - Curly (Libo Cannici)
- - vbScript (Jan Jongboom)
- - R (RStudio)
- - ABAP
- - Lucene (Graham Scott)
- - Haml (Garen Torikian)
- - Objective-C (Garen Torikian)
- - Makefile (Garen Torikian)
- - TypeScript (Garen Torikian)
- - Lisp (Garen Torikian)
- - Stylus (Garen Torikian)
- - Dart (Garen Torikian)
-
-* Live syntax checks
- - PHP (danyaPostfactum)
- - Lua
-
-* New Themes
- - Chaos
- - Terminal
-
-2012.09.17, Version 1.0.0
-
-* New Features
- - Multiple cursors and selections (https://c9.io/site/blog/2012/08/be-an-armenian-warrior-with-block-selection-on-steroids/)
- - Fold buttons displayed in the gutter
- - Indent Guides
- - Completely reworked vim mode (Sergi Mansilla)
- - Improved emacs keybindings
- - Autoclosing of html tags (danyaPostfactum)
-
-* 20 New language modes
- - Coldfusion (Russ)
- - Diff
- - GLSL (Ed Mackey)
- - Go (Davide Saurino)
- - Haxe (Jason O'Neil)
- - Jade (Garen Torikian)
- - jsx (Syu Kato)
- - LaTeX (James Allen)
- - Less (John Roepke)
- - Liquid (Bernie Telles)
- - Lua (Lee Gao)
- - LuaPage (Choonster)
- - Markdown (Chris Spencer)
- - PostgreSQL (John DeSoi)
- - Powershell (John Kane)
- - Sh (Richo Healey)
- - SQL (Jonathan Camile)
- - Tcl (Cristoph Hochreiner)
- - XQuery (William Candillion)
- - Yaml (Meg Sharkey)
-
- * Live syntax checks
- - for XQuery and JSON
-
-* New Themes
- - Ambiance (Irakli Gozalishvili)
- - Dreamweaver (Adam Jimenez)
- - Github (bootstraponline)
- - Tommorrow themes (https://github.com/chriskempson/tomorrow-theme)
- - XCode
-
-* Many Small Enhancements and Bugfixes
-
-2011.08.02, Version 0.2.0
-
-* Split view (Julian Viereck)
- - split editor area horizontally or vertivally to show two files at the same
- time
-
-* Code Folding (Julian Viereck)
- - Unstructured code folding
- - Will be the basis for language aware folding
-
-* Mode behaviours (Chris Spencer)
- - Adds mode specific hooks which allow transformations of entered text
- - Autoclosing of braces, paranthesis and quotation marks in C style modes
- - Autoclosing of angular brackets in XML style modes
-
-* New language modes
- - Clojure (Carin Meier)
- - C# (Rob Conery)
- - Groovy (Ben Tilford)
- - Scala (Ben Tilford)
- - JSON
- - OCaml (Sergi Mansilla)
- - Perl (Panagiotis Astithas)
- - SCSS/SASS (Andreas Madsen)
- - SVG
- - Textile (Kelley van Evert)
- - SCAD (Jacob Hansson)
-
-* Live syntax checks
- - Lint for CSS using CSS Lint
- - CoffeeScript
-
-* New Themes
- - Crimson Editor (iebuggy)
- - Merbivore (Michael Schwartz)
- - Merbivore soft (Michael Schwartz)
- - Solarized dark/light (David Alan Hjelle)
- - Vibrant Ink (Michael Schwartz)
-
-* Small Features/Enhancements
- - Lots of render performance optimizations (Harutyun Amirjanyan)
- - Improved Ruby highlighting (Chris Wanstrath, Trent Ogren)
- - Improved PHP highlighting (Thomas Hruska)
- - Improved CSS highlighting (Sean Kellogg)
- - Clicks which cause the editor to be focused don't reset the selection
- - Make padding text layer specific so that print margin and active line
- highlight are not affected (Irakli Gozalishvili)
- - Added setFontSize method
- - Improved vi keybindings (Trent Ogren)
- - When unfocused make cursor transparent instead of removing it (Harutyun Amirjanyan)
- - Support for matching groups in tokenizer with arrays of tokens (Chris Spencer)
-
-* Bug fixes
- - Add support for the new OSX scroll bars
- - Properly highlight JavaScript regexp literals
- - Proper handling of unicode characters in JavaScript identifiers
- - Fix remove lines command on last line (Harutyun Amirjanyan)
- - Fix scroll wheel sluggishness in Safari
- - Make keyboard infrastructure route keys like []^$ the right way (Julian Viereck)
-
-2011.02.14, Version 0.1.6
-
-* Floating Anchors
- - An Anchor is a floating pointer in the document.
- - Whenever text is inserted or deleted before the cursor, the position of
- the cursor is updated
- - Usesd for the cursor and selection
- - Basis for bookmarks, multiple cursors and snippets in the future
-* Extensive support for Cocoa style keybindings on the Mac
-* New commands:
- - center selection in viewport
- - remove to end/start of line
- - split line
- - transpose letters
-* Refator markers
- - Custom code can be used to render markers
- - Markers can be in front or behind the text
- - Markers are now stored in the session (was in the renderer)
-* Lots of IE8 fixes including copy, cut and selections
-* Unit tests can also be run in the browser
-
-* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
-* Add minimal node server server.js to run the Ace demo in Chrome
-* The top level editor.html demo has been renamed to index.html
-* Bug fixes
- - Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
- - Fixed isues when the editor was scrolled in the web page (Eric Allam)
- - Highlighting of Python string literals
- - Syntax rule for PHP comments
-
-2011.02.08, Version 0.1.5
-
-* Add Coffeescript Mode (Satoshi Murakami)
-* Fix word wrap bug (Julian Viereck)
-* Fix packaged version of the Eclipse mode
-* Loading of workers is more robust
-* Fix "click selection"
-* Allow tokizing empty lines (Daniel Krech)
-* Make PageUp/Down behavior more consistent with native OS (Joe Cheng)
-
-2011.02.04, Version 0.1.4
-
-* Add C/C++ mode contributed by Gastón Kleiman
-* Fix exception in key input
-
-2011.02.04, Version 0.1.3
-
-* Let the packaged version play nice with requireJS
-* Add Ruby mode contributed by Shlomo Zalman Heigh
-* Add Java mode contributed by Tom Tasche
-* Fix annotation bug
-* Changing a document added a new empty line at the end
diff --git a/bower_components/ace-builds/LICENSE b/bower_components/ace-builds/LICENSE
deleted file mode 100644
index 4760be2a6..000000000
--- a/bower_components/ace-builds/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2010, Ajax.org B.V.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Ajax.org B.V. nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/bower_components/ace-builds/README.md b/bower_components/ace-builds/README.md
deleted file mode 100644
index e1e0c3b47..000000000
--- a/bower_components/ace-builds/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-Ace (Ajax.org Cloud9 Editor)
-============================
-
-Ace is a code editor written in JavaScript.
-
-This repository has only generated files.
-If you want to work on ace please go to https://github.com/ajaxorg/ace instead.
-
-
-here you can find pre-built files for convenience of embedding.
-it contains 4 versions
- * [src](https://github.com/ajaxorg/ace-builds/tree/master/src) concatenated but not minified
- * [src-min](https://github.com/ajaxorg/ace-builds/tree/master/src-min) concatenated and minified with uglify.js
- * [src-noconflict](https://github.com/ajaxorg/ace-builds/tree/master/src-noconflict) uses ace.require instead of require
- * [src-min-noconflict](https://github.com/ajaxorg/ace-builds/tree/master/src-min-noconflict) -
-
-
-For a simple way of embedding ace into webpage see https://github.com/ajaxorg/ace-builds/blob/master/editor.html
-To see ace in action go to [kitchen-sink-demo](http://ajaxorg.github.com/ace-builds/kitchen-sink.html), [scrollable-page-demo](http://ajaxorg.github.com/ace-builds/scrollable-page.html), or [minimal demo](http://ajaxorg.github.com/ace-builds/editor.html)
-
-
diff --git a/bower_components/ace-builds/demo/kitchen-sink/logo.png b/bower_components/ace-builds/demo/kitchen-sink/logo.png
deleted file mode 100644
index a722472f1..000000000
Binary files a/bower_components/ace-builds/demo/kitchen-sink/logo.png and /dev/null differ
diff --git a/bower_components/ace-builds/demo/kitchen-sink/styles.css b/bower_components/ace-builds/demo/kitchen-sink/styles.css
deleted file mode 100644
index e59097875..000000000
--- a/bower_components/ace-builds/demo/kitchen-sink/styles.css
+++ /dev/null
@@ -1,47 +0,0 @@
-/*PACKAGE
-@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);
- PACKAGE*/
-
-html {
- height: 100%;
- width: 100%;
- overflow: hidden;
-}
-
-body {
- overflow: hidden;
- margin: 0;
- padding: 0;
- height: 100%;
- width: 100%;
- font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif;
- font-size: 12px;
- background: rgb(14, 98, 165);
- color: white;
-}
-
-#logo {
- padding: 15px;
- margin-left: 70px;
-}
-
-#editor {
- position: absolute;
- top: 0px;
- left: 280px;
- bottom: 0px;
- right: 0px;
- background: white;
-}
-
-#controls {
- padding: 5px;
-}
-
-#controls td {
- text-align: right;
-}
-
-#controls td + td {
- text-align: left;
-}
\ No newline at end of file
diff --git a/bower_components/ace-builds/editor.html b/bower_components/ace-builds/editor.html
deleted file mode 100644
index 06a4651b6..000000000
--- a/bower_components/ace-builds/editor.html
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
- Editor
-
-
-
-
-
function foo(items) {
- var i;
- for (i = 0; i < items.length; i++) {
- alert("Ace Rocks " + items[i]);
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bower_components/ace-builds/kitchen-sink/demo.js b/bower_components/ace-builds/kitchen-sink/demo.js
deleted file mode 100644
index 811510274..000000000
--- a/bower_components/ace-builds/kitchen-sink/demo.js
+++ /dev/null
@@ -1,6643 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/multi_select', 'ace/ext/spellcheck', 'kitchen-sink/inline_editor', 'kitchen-sink/dev_util', 'kitchen-sink/file_drop', 'ace/config', 'ace/lib/dom', 'ace/lib/net', 'ace/lib/lang', 'ace/lib/useragent', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/hash_handler', 'ace/virtual_renderer', 'ace/editor', 'ace/ext/whitespace', 'kitchen-sink/doclist', 'ace/ext/modelist', 'ace/ext/themelist', 'kitchen-sink/layout', 'kitchen-sink/token_tooltip', 'kitchen-sink/util', 'ace/ext/elastic_tabstops_lite', 'ace/incremental_search', 'ace/worker/worker_client', 'ace/split', 'ace/keyboard/vim', 'ace/ext/statusbar', 'ace/ext/emmet', 'ace/snippets', 'ace/ext/language_tools'], function(require, exports, module) {
-
-
-require("ace/lib/fixoldbrowsers");
-
-require("ace/multi_select");
-require("ace/ext/spellcheck");
-require("./inline_editor");
-require("./dev_util");
-require("./file_drop");
-
-var config = require("ace/config");
-config.init();
-var env = {};
-
-var dom = require("ace/lib/dom");
-var net = require("ace/lib/net");
-var lang = require("ace/lib/lang");
-var useragent = require("ace/lib/useragent");
-
-var event = require("ace/lib/event");
-var theme = require("ace/theme/textmate");
-var EditSession = require("ace/edit_session").EditSession;
-var UndoManager = require("ace/undomanager").UndoManager;
-
-var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
-
-var Renderer = require("ace/virtual_renderer").VirtualRenderer;
-var Editor = require("ace/editor").Editor;
-
-var whitespace = require("ace/ext/whitespace");
-
-
-
-var doclist = require("./doclist");
-var modelist = require("ace/ext/modelist");
-var themelist = require("ace/ext/themelist");
-var layout = require("./layout");
-var TokenTooltip = require("./token_tooltip").TokenTooltip;
-var util = require("./util");
-var saveOption = util.saveOption;
-var fillDropdown = util.fillDropdown;
-var bindCheckbox = util.bindCheckbox;
-var bindDropdown = util.bindDropdown;
-
-var ElasticTabstopsLite = require("ace/ext/elastic_tabstops_lite").ElasticTabstopsLite;
-
-var IncrementalSearch = require("ace/incremental_search").IncrementalSearch;
-
-
-var workerModule = require("ace/worker/worker_client");
-if (location.href.indexOf("noworker") !== -1) {
- workerModule.WorkerClient = workerModule.UIWorkerClient;
-}
-var container = document.getElementById("editor-container");
-var Split = require("ace/split").Split;
-var split = new Split(container, theme, 1);
-env.editor = split.getEditor(0);
-split.on("focus", function(editor) {
- env.editor = editor;
- updateUIEditorOptions();
-});
-env.split = split;
-window.env = env;
-
-
-var consoleEl = dom.createElement("div");
-container.parentNode.appendChild(consoleEl);
-consoleEl.style.cssText = "position:fixed; bottom:1px; right:0;\
-border:1px solid #baf; z-index:100";
-
-var cmdLine = new layout.singleLineEditor(consoleEl);
-cmdLine.editor = env.editor;
-env.editor.cmdLine = cmdLine;
-
-env.editor.showCommandLine = function(val) {
- this.cmdLine.focus();
- if (typeof val == "string")
- this.cmdLine.setValue(val, 1);
-};
-env.editor.commands.addCommands([{
- name: "gotoline",
- bindKey: {win: "Ctrl-L", mac: "Command-L"},
- exec: function(editor, line) {
- if (typeof line == "object") {
- var arg = this.name + " " + editor.getCursorPosition().row;
- editor.cmdLine.setValue(arg, 1);
- editor.cmdLine.focus();
- return;
- }
- line = parseInt(line, 10);
- if (!isNaN(line))
- editor.gotoLine(line);
- },
- readOnly: true
-}, {
- name: "snippet",
- bindKey: {win: "Alt-C", mac: "Command-Alt-C"},
- exec: function(editor, needle) {
- if (typeof needle == "object") {
- editor.cmdLine.setValue("snippet ", 1);
- editor.cmdLine.focus();
- return;
- }
- var s = snippetManager.getSnippetByName(needle, editor);
- if (s)
- snippetManager.insertSnippet(editor, s.content);
- },
- readOnly: true
-}, {
- name: "focusCommandLine",
- bindKey: "shift-esc|ctrl-`",
- exec: function(editor, needle) { editor.cmdLine.focus(); },
- readOnly: true
-}, {
- name: "nextFile",
- bindKey: "Ctrl-tab",
- exec: function(editor) { doclist.cycleOpen(editor, 1); },
- readOnly: true
-}, {
- name: "previousFile",
- bindKey: "Ctrl-shift-tab",
- exec: function(editor) { doclist.cycleOpen(editor, -1); },
- readOnly: true
-}, {
- name: "execute",
- bindKey: "ctrl+enter",
- exec: function(editor) {
- try {
- var r = window.eval(editor.getCopyText() || editor.getValue());
- } catch(e) {
- r = e;
- }
- editor.cmdLine.setValue(r + "");
- },
- readOnly: true
-}, {
- name: "showKeyboardShortcuts",
- bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
- exec: function(editor) {
- config.loadModule("ace/ext/keybinding_menu", function(module) {
- module.init(editor);
- editor.showKeyboardShortcuts();
- });
- }
-}, {
- name: "increaseFontSize",
- bindKey: "Ctrl-+",
- exec: function(editor) {
- var size = parseInt(editor.getFontSize(), 10) || 12;
- editor.setFontSize(size + 1);
- }
-}, {
- name: "decreaseFontSize",
- bindKey: "Ctrl+-",
- exec: function(editor) {
- var size = parseInt(editor.getFontSize(), 10) || 12;
- editor.setFontSize(Math.max(size - 1 || 1));
- }
-}, {
- name: "resetFontSize",
- bindKey: "Ctrl+0",
- exec: function(editor) {
- editor.setFontSize(12);
- }
-}]);
-
-
-env.editor.commands.addCommands(whitespace.commands);
-
-cmdLine.commands.bindKeys({
- "Shift-Return|Ctrl-Return|Alt-Return": function(cmdLine) { cmdLine.insert("\n"); },
- "Esc|Shift-Esc": function(cmdLine){ cmdLine.editor.focus(); },
- "Return": function(cmdLine){
- var command = cmdLine.getValue().split(/\s+/);
- var editor = cmdLine.editor;
- editor.commands.exec(command[0], editor, command[1]);
- editor.focus();
- }
-});
-
-cmdLine.commands.removeCommands(["find", "gotoline", "findall", "replace", "replaceall"]);
-
-var commands = env.editor.commands;
-commands.addCommand({
- name: "save",
- bindKey: {win: "Ctrl-S", mac: "Command-S"},
- exec: function(arg) {
- var session = env.editor.session;
- var name = session.name.match(/[^\/]+$/);
- localStorage.setItem(
- "saved_file:" + name,
- session.getValue()
- );
- env.editor.cmdLine.setValue("saved "+ name);
- }
-});
-
-commands.addCommand({
- name: "load",
- bindKey: {win: "Ctrl-O", mac: "Command-O"},
- exec: function(arg) {
- var session = env.editor.session;
- var name = session.name.match(/[^\/]+$/);
- var value = localStorage.getItem("saved_file:" + name);
- if (typeof value == "string") {
- session.setValue(value);
- env.editor.cmdLine.setValue("loaded "+ name);
- } else {
- env.editor.cmdLine.setValue("no previuos value saved for "+ name);
- }
- }
-});
-
-var keybindings = {
- ace: null, // Null = use "default" keymapping
- vim: require("ace/keyboard/vim").handler,
- emacs: "ace/keyboard/emacs",
- custom: new HashHandler({
- "gotoright": "Tab",
- "indent": "]",
- "outdent": "[",
- "gotolinestart": "^",
- "gotolineend": "$"
- })
-};
-var consoleHeight = 20;
-function onResize() {
- var left = env.split.$container.offsetLeft;
- var width = document.documentElement.clientWidth - left;
- container.style.width = width + "px";
- container.style.height = document.documentElement.clientHeight - consoleHeight + "px";
- env.split.resize();
-
- consoleEl.style.width = width + "px";
- cmdLine.resize();
-}
-
-window.onresize = onResize;
-onResize();
-var docEl = document.getElementById("doc");
-var modeEl = document.getElementById("mode");
-var wrapModeEl = document.getElementById("soft_wrap");
-var themeEl = document.getElementById("theme");
-var foldingEl = document.getElementById("folding");
-var selectStyleEl = document.getElementById("select_style");
-var highlightActiveEl = document.getElementById("highlight_active");
-var showHiddenEl = document.getElementById("show_hidden");
-var showGutterEl = document.getElementById("show_gutter");
-var showPrintMarginEl = document.getElementById("show_print_margin");
-var highlightSelectedWordE = document.getElementById("highlight_selected_word");
-var showHScrollEl = document.getElementById("show_hscroll");
-var showVScrollEl = document.getElementById("show_vscroll");
-var animateScrollEl = document.getElementById("animate_scroll");
-var softTabEl = document.getElementById("soft_tab");
-var behavioursEl = document.getElementById("enable_behaviours");
-
-fillDropdown(docEl, doclist.all);
-
-fillDropdown(modeEl, modelist.modes);
-var modesByName = modelist.modesByName;
-bindDropdown("mode", function(value) {
- env.editor.session.setMode(modesByName[value].mode || modesByName.text.mode);
- env.editor.session.modeName = value;
-});
-
-doclist.history = doclist.docs.map(function(doc) {
- return doc.name;
-});
-doclist.history.index = 0;
-doclist.cycleOpen = function(editor, dir) {
- var h = this.history;
- h.index += dir;
- if (h.index >= h.length)
- h.index = 0;
- else if (h.index <= 0)
- h.index = h.length - 1;
- var s = h[h.index];
- docEl.value = s;
- docEl.onchange();
-};
-doclist.addToHistory = function(name) {
- var h = this.history;
- var i = h.indexOf(name);
- if (i != h.index) {
- if (i != -1)
- h.splice(i, 1);
- h.index = h.push(name);
- }
-};
-
-bindDropdown("doc", function(name) {
- doclist.loadDoc(name, function(session) {
- if (!session)
- return;
- doclist.addToHistory(session.name);
- session = env.split.setSession(session);
- whitespace.detectIndentation(session);
- updateUIEditorOptions();
- env.editor.focus();
- });
-});
-
-
-function updateUIEditorOptions() {
- var editor = env.editor;
- var session = editor.session;
-
- session.setFoldStyle(foldingEl.value);
-
- saveOption(docEl, session.name);
- saveOption(modeEl, session.modeName || "text");
- saveOption(wrapModeEl, session.getUseWrapMode() ? session.getWrapLimitRange().min || "free" : "off");
-
- saveOption(selectStyleEl, editor.getSelectionStyle() == "line");
- saveOption(themeEl, editor.getTheme());
- saveOption(highlightActiveEl, editor.getHighlightActiveLine());
- saveOption(showHiddenEl, editor.getShowInvisibles());
- saveOption(showGutterEl, editor.renderer.getShowGutter());
- saveOption(showPrintMarginEl, editor.renderer.getShowPrintMargin());
- saveOption(highlightSelectedWordE, editor.getHighlightSelectedWord());
- saveOption(showHScrollEl, editor.renderer.getHScrollBarAlwaysVisible());
- saveOption(animateScrollEl, editor.getAnimatedScroll());
- saveOption(softTabEl, session.getUseSoftTabs());
- saveOption(behavioursEl, editor.getBehavioursEnabled());
-}
-
-themelist.themes.forEach(function(x){ x.value = x.theme });
-fillDropdown(themeEl, {
- Bright: themelist.themes.filter(function(x){return !x.isDark}),
- Dark: themelist.themes.filter(function(x){return x.isDark}),
-});
-
-event.addListener(themeEl, "mouseover", function(e){
- themeEl.desiredValue = e.target.value;
- if (!themeEl.$timer)
- themeEl.$timer = setTimeout(themeEl.updateTheme);
-});
-
-event.addListener(themeEl, "mouseout", function(e){
- themeEl.desiredValue = null;
- if (!themeEl.$timer)
- themeEl.$timer = setTimeout(themeEl.updateTheme, 20);
-});
-
-themeEl.updateTheme = function(){
- env.split.setTheme((themeEl.desiredValue || themeEl.selectedValue));
- themeEl.$timer = null;
-};
-
-bindDropdown("theme", function(value) {
- if (!value)
- return;
- env.editor.setTheme(value);
- themeEl.selectedValue = value;
-});
-
-bindDropdown("keybinding", function(value) {
- env.editor.setKeyboardHandler(keybindings[value]);
-});
-
-bindDropdown("fontsize", function(value) {
- env.split.setFontSize(value);
-});
-
-bindDropdown("folding", function(value) {
- env.editor.session.setFoldStyle(value);
- env.editor.setShowFoldWidgets(value !== "manual");
-});
-
-bindDropdown("soft_wrap", function(value) {
- var session = env.editor.session;
- var renderer = env.editor.renderer;
- switch (value) {
- case "off":
- session.setUseWrapMode(false);
- renderer.setPrintMarginColumn(80);
- break;
- case "free":
- session.setUseWrapMode(true);
- session.setWrapLimitRange(null, null);
- renderer.setPrintMarginColumn(80);
- break;
- default:
- session.setUseWrapMode(true);
- var col = parseInt(value, 10);
- session.setWrapLimitRange(col, col);
- renderer.setPrintMarginColumn(col);
- }
-});
-
-bindCheckbox("select_style", function(checked) {
- env.editor.setSelectionStyle(checked ? "line" : "text");
-});
-
-bindCheckbox("highlight_active", function(checked) {
- env.editor.setHighlightActiveLine(checked);
-});
-
-bindCheckbox("show_hidden", function(checked) {
- env.editor.setShowInvisibles(checked);
-});
-
-bindCheckbox("display_indent_guides", function(checked) {
- env.editor.setDisplayIndentGuides(checked);
-});
-
-bindCheckbox("show_gutter", function(checked) {
- env.editor.renderer.setShowGutter(checked);
-});
-
-bindCheckbox("show_print_margin", function(checked) {
- env.editor.renderer.setShowPrintMargin(checked);
-});
-
-bindCheckbox("highlight_selected_word", function(checked) {
- env.editor.setHighlightSelectedWord(checked);
-});
-
-bindCheckbox("show_hscroll", function(checked) {
- env.editor.setOption("hScrollBarAlwaysVisible", checked);
-});
-
-bindCheckbox("show_vscroll", function(checked) {
- env.editor.setOption("vScrollBarAlwaysVisible", checked);
-});
-
-bindCheckbox("animate_scroll", function(checked) {
- env.editor.setAnimatedScroll(checked);
-});
-
-bindCheckbox("soft_tab", function(checked) {
- env.editor.session.setUseSoftTabs(checked);
-});
-
-bindCheckbox("enable_behaviours", function(checked) {
- env.editor.setBehavioursEnabled(checked);
-});
-
-bindCheckbox("fade_fold_widgets", function(checked) {
- env.editor.setFadeFoldWidgets(checked);
-});
-bindCheckbox("read_only", function(checked) {
- env.editor.setReadOnly(checked);
-});
-bindCheckbox("scrollPastEnd", function(checked) {
- env.editor.setOption("scrollPastEnd", checked);
-});
-
-bindDropdown("split", function(value) {
- var sp = env.split;
- if (value == "none") {
- sp.setSplits(1);
- } else {
- var newEditor = (sp.getSplits() == 1);
- sp.setOrientation(value == "below" ? sp.BELOW : sp.BESIDE);
- sp.setSplits(2);
-
- if (newEditor) {
- var session = sp.getEditor(0).session;
- var newSession = sp.setSession(session, 1);
- newSession.name = session.name;
- }
- }
-});
-
-
-bindCheckbox("elastic_tabstops", function(checked) {
- env.editor.setOption("useElasticTabstops", checked);
-});
-
-var iSearchCheckbox = bindCheckbox("isearch", function(checked) {
- env.editor.setOption("useIncrementalSearch", checked);
-});
-
-env.editor.addEventListener('incrementalSearchSettingChanged', function(event) {
- iSearchCheckbox.checked = event.isEnabled;
-});
-
-
-function synchroniseScrolling() {
- var s1 = env.split.$editors[0].session;
- var s2 = env.split.$editors[1].session;
- s1.on('changeScrollTop', function(pos) {s2.setScrollTop(pos)});
- s2.on('changeScrollTop', function(pos) {s1.setScrollTop(pos)});
- s1.on('changeScrollLeft', function(pos) {s2.setScrollLeft(pos)});
- s2.on('changeScrollLeft', function(pos) {s1.setScrollLeft(pos)});
-}
-
-bindCheckbox("highlight_token", function(checked) {
- var editor = env.editor;
- if (editor.tokenTooltip && !checked) {
- editor.tokenTooltip.destroy();
- delete editor.tokenTooltip;
- } else if (checked) {
- editor.tokenTooltip = new TokenTooltip(editor);
- }
-});
-
-var StatusBar = require("ace/ext/statusbar").StatusBar;
-new StatusBar(env.editor, cmdLine.container);
-
-
-var Emmet = require("ace/ext/emmet");
-net.loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
- Emmet.setCore(window.emmet);
- env.editor.setOption("enableEmmet", true);
-});
-
-var snippetManager = require("ace/snippets").snippetManager;
-
-env.editSnippets = function() {
- var sp = env.split;
- if (sp.getSplits() == 2) {
- sp.setSplits(1);
- return;
- }
- sp.setSplits(1);
- sp.setSplits(2);
- sp.setOrientation(sp.BESIDE);
- var editor = sp.$editors[1];
- var id = sp.$editors[0].session.$mode.$id || "";
- var m = snippetManager.files[id];
- if (!doclist["snippets/" + id]) {
- var text = m.snippetText;
- var s = doclist.initDoc(text, "", {});
- s.setMode("ace/mode/snippets");
- doclist["snippets/" + id] = s;
- }
- editor.on("blur", function() {
- m.snippetText = editor.getValue();
- snippetManager.unregister(m.snippets);
- m.snippets = snippetManager.parseSnippetFile(m.snippetText, m.scope);
- snippetManager.register(m.snippets);
- });
- sp.$editors[0].once("changeMode", function() {
- sp.setSplits(1);
- });
- editor.setSession(doclist["snippets/" + id], 1);
- editor.focus();
-};
-
-require("ace/ext/language_tools");
-env.editor.setOptions({
- enableBasicAutocompletion: true,
- enableSnippets: true
-});
-
-});
-
-define('ace/ext/elastic_tabstops_lite', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) {
-
-
-var ElasticTabstopsLite = function(editor) {
- this.$editor = editor;
- var self = this;
- var changedRows = [];
- var recordChanges = false;
- this.onAfterExec = function() {
- recordChanges = false;
- self.processRows(changedRows);
- changedRows = [];
- };
- this.onExec = function() {
- recordChanges = true;
- };
- this.onChange = function(e) {
- var range = e.data.range
- if (recordChanges) {
- if (changedRows.indexOf(range.start.row) == -1)
- changedRows.push(range.start.row);
- if (range.end.row != range.start.row)
- changedRows.push(range.end.row);
- }
- };
-};
-
-(function() {
- this.processRows = function(rows) {
- this.$inChange = true;
- var checkedRows = [];
-
- for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
- var row = rows[r];
-
- if (checkedRows.indexOf(row) > -1)
- continue;
-
- var cellWidthObj = this.$findCellWidthsForBlock(row);
- var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
- var rowIndex = cellWidthObj.firstRow;
-
- for (var w = 0, l = cellWidths.length; w < l; w++) {
- var widths = cellWidths[w];
- checkedRows.push(rowIndex);
- this.$adjustRow(rowIndex, widths);
- rowIndex++;
- }
- }
- this.$inChange = false;
- };
-
- this.$findCellWidthsForBlock = function(row) {
- var cellWidths = [], widths;
- var rowIter = row;
- while (rowIter >= 0) {
- widths = this.$cellWidthsForRow(rowIter);
- if (widths.length == 0)
- break;
-
- cellWidths.unshift(widths);
- rowIter--;
- }
- var firstRow = rowIter + 1;
- rowIter = row;
- var numRows = this.$editor.session.getLength();
-
- while (rowIter < numRows - 1) {
- rowIter++;
-
- widths = this.$cellWidthsForRow(rowIter);
- if (widths.length == 0)
- break;
-
- cellWidths.push(widths);
- }
-
- return { cellWidths: cellWidths, firstRow: firstRow };
- };
-
- this.$cellWidthsForRow = function(row) {
- var selectionColumns = this.$selectionColumnsForRow(row);
-
- var tabs = [-1].concat(this.$tabsForRow(row));
- var widths = tabs.map(function(el) { return 0; } ).slice(1);
- var line = this.$editor.session.getLine(row);
-
- for (var i = 0, len = tabs.length - 1; i < len; i++) {
- var leftEdge = tabs[i]+1;
- var rightEdge = tabs[i+1];
-
- var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);
- var cell = line.substring(leftEdge, rightEdge);
- widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge);
- }
-
- return widths;
- };
-
- this.$selectionColumnsForRow = function(row) {
- var selections = [], cursor = this.$editor.getCursorPosition();
- if (this.$editor.session.getSelection().isEmpty()) {
- if (row == cursor.row)
- selections.push(cursor.column);
- }
-
- return selections;
- };
-
- this.$setBlockCellWidthsToMax = function(cellWidths) {
- var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;
- var columnInfo = this.$izip_longest(cellWidths);
-
- for (var c = 0, l = columnInfo.length; c < l; c++) {
- var column = columnInfo[c];
- if (!column.push) {
- console.error(column);
- continue;
- }
- column.push(NaN);
-
- for (var r = 0, s = column.length; r < s; r++) {
- var width = column[r];
- if (startingNewBlock) {
- blockStartRow = r;
- maxWidth = 0;
- startingNewBlock = false;
- }
- if (isNaN(width)) {
- blockEndRow = r;
-
- for (var j = blockStartRow; j < blockEndRow; j++) {
- cellWidths[j][c] = maxWidth;
- }
- startingNewBlock = true;
- }
-
- maxWidth = Math.max(maxWidth, width);
- }
- }
-
- return cellWidths;
- };
-
- this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) {
- var rightmost = 0;
-
- if (selectionColumns.length) {
- var lengths = [];
- for (var s = 0, length = selectionColumns.length; s < length; s++) {
- if (selectionColumns[s] <= cellRightEdge)
- lengths.push(s);
- else
- lengths.push(0);
- }
- rightmost = Math.max.apply(Math, lengths);
- }
-
- return rightmost;
- };
-
- this.$tabsForRow = function(row) {
- var rowTabs = [], line = this.$editor.session.getLine(row),
- re = /\t/g, match;
-
- while ((match = re.exec(line)) != null) {
- rowTabs.push(match.index);
- }
-
- return rowTabs;
- };
-
- this.$adjustRow = function(row, widths) {
- var rowTabs = this.$tabsForRow(row);
-
- if (rowTabs.length == 0)
- return;
-
- var bias = 0, location = -1;
- var expandedSet = this.$izip(widths, rowTabs);
-
- for (var i = 0, l = expandedSet.length; i < l; i++) {
- var w = expandedSet[i][0], it = expandedSet[i][1];
- location += 1 + w;
- it += bias;
- var difference = location - it;
-
- if (difference == 0)
- continue;
-
- var partialLine = this.$editor.session.getLine(row).substr(0, it );
- var strippedPartialLine = partialLine.replace(/\s*$/g, "");
- var ispaces = partialLine.length - strippedPartialLine.length;
-
- if (difference > 0) {
- this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t");
- this.$editor.session.getDocument().removeInLine(row, it, it + 1);
-
- bias += difference;
- }
-
- if (difference < 0 && ispaces >= -difference) {
- this.$editor.session.getDocument().removeInLine(row, it + difference, it);
- bias += difference;
- }
- }
- };
- this.$izip_longest = function(iterables) {
- if (!iterables[0])
- return [];
- var longest = iterables[0].length;
- var iterablesLength = iterables.length;
-
- for (var i = 1; i < iterablesLength; i++) {
- var iLength = iterables[i].length;
- if (iLength > longest)
- longest = iLength;
- }
-
- var expandedSet = [];
-
- for (var l = 0; l < longest; l++) {
- var set = [];
- for (var i = 0; i < iterablesLength; i++) {
- if (iterables[i][l] === "")
- set.push(NaN);
- else
- set.push(iterables[i][l]);
- }
-
- expandedSet.push(set);
- }
-
-
- return expandedSet;
- };
- this.$izip = function(widths, tabs) {
- var size = widths.length >= tabs.length ? tabs.length : widths.length;
-
- var expandedSet = [];
- for (var i = 0; i < size; i++) {
- var set = [ widths[i], tabs[i] ];
- expandedSet.push(set);
- }
- return expandedSet;
- };
-
-}).call(ElasticTabstopsLite.prototype);
-
-exports.ElasticTabstopsLite = ElasticTabstopsLite;
-
-var Editor = require("../editor").Editor;
-require("../config").defineOptions(Editor.prototype, "editor", {
- useElasticTabstops: {
- set: function(val) {
- if (val) {
- if (!this.elasticTabstops)
- this.elasticTabstops = new ElasticTabstopsLite(this);
- this.commands.on("afterExec", this.elasticTabstops.onAfterExec);
- this.commands.on("exec", this.elasticTabstops.onExec);
- this.on("change", this.elasticTabstops.onChange);
- } else if (this.elasticTabstops) {
- this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec);
- this.commands.removeListener("exec", this.elasticTabstops.onExec);
- this.removeListener("change", this.elasticTabstops.onChange);
- }
- }
- }
-});
-
-});
-
-define('ace/incremental_search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/search', 'ace/search_highlight', 'ace/commands/incremental_search_commands', 'ace/lib/dom', 'ace/commands/command_manager', 'ace/editor', 'ace/config'], function(require, exports, module) {
-
-
-var oop = require("./lib/oop");
-var Range = require("./range").Range;
-var Search = require("./search").Search;
-var SearchHighlight = require("./search_highlight").SearchHighlight;
-var iSearchCommandModule = require("./commands/incremental_search_commands");
-var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler;
-function IncrementalSearch() {
- this.$options = {wrap: false, skipCurrent: false};
- this.$keyboardHandler = new ISearchKbd(this);
-}
-
-oop.inherits(IncrementalSearch, Search);
-
-;(function() {
-
- this.activate = function(ed, backwards) {
- this.$editor = ed;
- this.$startPos = this.$currentPos = ed.getCursorPosition();
- this.$options.needle = '';
- this.$options.backwards = backwards;
- ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);
- this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
- this.selectionFix(ed);
- this.statusMessage(true);
- }
-
- this.deactivate = function(reset) {
- this.cancelSearch(reset);
- this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
- if (this.$mousedownHandler) {
- this.$editor.removeEventListener('mousedown', this.$mousedownHandler);
- delete this.$mousedownHandler;
- }
- this.message('');
- }
-
- this.selectionFix = function(editor) {
- if (editor.selection.isEmpty() && !editor.session.$emacsMark) {
- editor.clearSelection();
- }
- }
-
- this.highlight = function(regexp) {
- var sess = this.$editor.session,
- hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker(
- new SearchHighlight(null, "ace_isearch-result", "text"));
- hl.setRegexp(regexp);
- sess._emit("changeBackMarker"); // force highlight layer redraw
- }
-
- this.cancelSearch = function(reset) {
- var e = this.$editor;
- this.$prevNeedle = this.$options.needle;
- this.$options.needle = '';
- if (reset) {
- e.moveCursorToPosition(this.$startPos);
- this.$currentPos = this.$startPos;
- } else {
- e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false);
- }
- this.highlight(null);
- return Range.fromPoints(this.$currentPos, this.$currentPos);
- }
-
- this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) {
- if (!this.$editor) return null;
- var options = this.$options;
- if (needleUpdateFunc) {
- options.needle = needleUpdateFunc.call(this, options.needle || '') || '';
- }
- if (options.needle.length === 0) {
- this.statusMessage(true);
- return this.cancelSearch(true);
- };
- options.start = this.$currentPos;
- var session = this.$editor.session,
- found = this.find(session);
- if (found) {
- if (options.backwards) found = Range.fromPoints(found.end, found.start);
- this.$editor.moveCursorToPosition(found.end);
- if (moveToNext) this.$currentPos = found.end;
- this.highlight(options.re)
- }
-
- this.statusMessage(found);
-
- return found;
- }
-
- this.addChar = function(c) {
- return this.highlightAndFindWithNeedle(false, function(needle) {
- return needle + c;
- });
- }
-
- this.removeChar = function(c) {
- return this.highlightAndFindWithNeedle(false, function(needle) {
- return needle.length > 0 ? needle.substring(0, needle.length-1) : needle;
- });
- }
-
- this.next = function(options) {
- options = options || {};
- this.$options.backwards = !!options.backwards;
- this.$currentPos = this.$editor.getCursorPosition();
- return this.highlightAndFindWithNeedle(true, function(needle) {
- return options.useCurrentOrPrevSearch && needle.length === 0 ?
- this.$prevNeedle || '' : needle;
- });
- }
-
- this.onMouseDown = function(evt) {
- this.deactivate();
- return true;
- }
-
- this.statusMessage = function(found) {
- var options = this.$options, msg = '';
- msg += options.backwards ? 'reverse-' : '';
- msg += 'isearch: ' + options.needle;
- msg += found ? '' : ' (not found)';
- this.message(msg);
- }
-
- this.message = function(msg) {
- if (this.$editor.showCommandLine) {
- this.$editor.showCommandLine(msg);
- this.$editor.focus();
- } else {
- console.log(msg);
- }
- }
-
-}).call(IncrementalSearch.prototype);
-
-
-exports.IncrementalSearch = IncrementalSearch;
-
-var dom = require('./lib/dom');
-dom.importCssString && dom.importCssString("\
-.ace_marker-layer .ace_isearch-result {\
- position: absolute;\
- z-index: 6;\
- -moz-box-sizing: border-box;\
- -webkit-box-sizing: border-box;\
- box-sizing: border-box;\
-}\
-div.ace_isearch-result {\
- border-radius: 4px;\
- background-color: rgba(255, 200, 0, 0.5);\
- box-shadow: 0 0 4px rgb(255, 200, 0);\
-}\
-.ace_dark div.ace_isearch-result {\
- background-color: rgb(100, 110, 160);\
- box-shadow: 0 0 4px rgb(80, 90, 140);\
-}", "incremental-search-highlighting");
-var commands = require("./commands/command_manager");
-(function() {
- this.setupIncrementalSearch = function(editor, val) {
- if (this.usesIncrementalSearch == val) return;
- this.usesIncrementalSearch = val;
- var iSearchCommands = iSearchCommandModule.iSearchStartCommands;
- var method = val ? 'addCommands' : 'removeCommands';
- this[method](iSearchCommands);
- };
-}).call(commands.CommandManager.prototype);
-var Editor = require("./editor").Editor;
-require("./config").defineOptions(Editor.prototype, "editor", {
- useIncrementalSearch: {
- set: function(val) {
- this.keyBinding.$handlers.forEach(function(handler) {
- if (handler.setupIncrementalSearch) {
- handler.setupIncrementalSearch(this, val);
- }
- });
- this._emit('incrementalSearchSettingChanged', {isEnabled: val});
- }
- }
-});
-
-});
-
-define('ace/commands/incremental_search_commands', ['require', 'exports', 'module' , 'ace/config', 'ace/lib/oop', 'ace/keyboard/hash_handler', 'ace/commands/occur_commands'], function(require, exports, module) {
-
-var config = require("../config");
-var oop = require("../lib/oop");
-var HashHandler = require("../keyboard/hash_handler").HashHandler;
-var occurStartCommand = require("./occur_commands").occurStartCommand;
-exports.iSearchStartCommands = [{
- name: "iSearch",
- bindKey: {win: "Ctrl-F", mac: "Command-F"},
- exec: function(editor, options) {
- config.loadModule(["core", "ace/incremental_search"], function(e) {
- var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
- iSearch.activate(editor, options.backwards);
- if (options.jumpToFirstMatch) iSearch.next(options);
- });
- },
- readOnly: true
-}, {
- name: "iSearchBackwards",
- exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },
- readOnly: true
-}, {
- name: "iSearchAndGo",
- bindKey: {win: "Ctrl-K", mac: "Command-G"},
- exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },
- readOnly: true
-}, {
- name: "iSearchBackwardsAndGo",
- bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"},
- exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },
- readOnly: true
-}];
-exports.iSearchCommands = [{
- name: "restartSearch",
- bindKey: {win: "Ctrl-F", mac: "Command-F"},
- exec: function(iSearch) {
- iSearch.cancelSearch(true);
- },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: "searchForward",
- bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
- exec: function(iSearch, options) {
- options.useCurrentOrPrevSearch = true;
- iSearch.next(options);
- },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: "searchBackward",
- bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
- exec: function(iSearch, options) {
- options.useCurrentOrPrevSearch = true;
- options.backwards = true;
- iSearch.next(options);
- },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: "extendSearchTerm",
- exec: function(iSearch, string) {
- iSearch.addChar(string);
- },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: "extendSearchTermSpace",
- bindKey: "space",
- exec: function(iSearch) { iSearch.addChar(' '); },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: "shrinkSearchTerm",
- bindKey: "backspace",
- exec: function(iSearch) {
- iSearch.removeChar();
- },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: 'confirmSearch',
- bindKey: 'return',
- exec: function(iSearch) { iSearch.deactivate(); },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: 'cancelSearch',
- bindKey: 'esc|Ctrl-G',
- exec: function(iSearch) { iSearch.deactivate(true); },
- readOnly: true,
- isIncrementalSearchCommand: true
-}, {
- name: 'occurisearch',
- bindKey: 'Ctrl-O',
- exec: function(iSearch) {
- var options = oop.mixin({}, iSearch.$options);
- iSearch.deactivate();
- occurStartCommand.exec(iSearch.$editor, options);
- },
- readOnly: true,
- isIncrementalSearchCommand: true
-}];
-
-function IncrementalSearchKeyboardHandler(iSearch) {
- this.$iSearch = iSearch;
-}
-
-oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
-
-;(function() {
-
- this.attach = function(editor) {
- var iSearch = this.$iSearch;
- HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
- this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
- if (!e.command.isIncrementalSearchCommand) return undefined;
- e.stopPropagation();
- e.preventDefault();
- return e.command.exec(iSearch, e.args || {});
- });
- }
-
- this.detach = function(editor) {
- if (!this.$commandExecHandler) return;
- editor.commands.removeEventListener('exec', this.$commandExecHandler);
- delete this.$commandExecHandler;
- }
-
- var handleKeyboard$super = this.handleKeyboard;
- this.handleKeyboard = function(data, hashId, key, keyCode) {
- var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
- if (cmd.command) { return cmd; }
- if (hashId == -1) {
- var extendCmd = this.commands.extendSearchTerm;
- if (extendCmd) { return {command: extendCmd, args: key}; }
- }
- return {command: "null", passEvent: hashId == 0 || hashId == 4};
- }
-
-}).call(IncrementalSearchKeyboardHandler.prototype);
-
-
-exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;
-
-});
-
-define('kitchen-sink/util', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/event', 'ace/edit_session', 'ace/undomanager', 'ace/virtual_renderer', 'ace/editor', 'ace/multi_select'], function(require, exports, module) {
-
-
-var dom = require("ace/lib/dom");
-var event = require("ace/lib/event");
-
-var EditSession = require("ace/edit_session").EditSession;
-var UndoManager = require("ace/undomanager").UndoManager;
-var Renderer = require("ace/virtual_renderer").VirtualRenderer;
-var Editor = require("ace/editor").Editor;
-var MultiSelect = require("ace/multi_select").MultiSelect;
-
-exports.createEditor = function(el) {
- return new Editor(new Renderer(el));
-};
-
-exports.createSplitEditor = function(el) {
- if (typeof(el) == "string")
- el = document.getElementById(el);
-
- var e0 = document.createElement("div");
- var s = document.createElement("splitter");
- var e1 = document.createElement("div");
- el.appendChild(e0);
- el.appendChild(e1);
- el.appendChild(s);
- e0.style.position = e1.style.position = s.style.position = "absolute";
- el.style.position = "relative";
- var split = {$container: el};
-
- split.editor0 = split[0] = new Editor(new Renderer(e0));
- split.editor1 = split[1] = new Editor(new Renderer(e1));
- split.splitter = s;
-
- s.ratio = 0.5;
-
- split.resize = function resize(){
- var height = el.parentNode.clientHeight - el.offsetTop;
- var total = el.clientWidth;
- var w1 = total * s.ratio;
- var w2 = total * (1- s.ratio);
- s.style.left = w1 - 1 + "px";
- s.style.height = el.style.height = height + "px";
-
- var st0 = split[0].container.style;
- var st1 = split[1].container.style;
- st0.width = w1 + "px";
- st1.width = w2 + "px";
- st0.left = 0 + "px";
- st1.left = w1 + "px";
-
- st0.top = st1.top = "0px";
- st0.height = st1.height = height + "px";
-
- split[0].resize();
- split[1].resize();
- };
-
- split.onMouseDown = function(e) {
- var rect = el.getBoundingClientRect();
- var x = e.clientX;
- var y = e.clientY;
-
- var button = e.button;
- if (button !== 0) {
- return;
- }
-
- var onMouseMove = function(e) {
- x = e.clientX;
- y = e.clientY;
- };
- var onResizeEnd = function(e) {
- clearInterval(timerId);
- };
-
- var onResizeInterval = function() {
- s.ratio = (x - rect.left) / rect.width;
- split.resize();
- };
-
- event.capture(s, onMouseMove, onResizeEnd);
- var timerId = setInterval(onResizeInterval, 40);
-
- return e.preventDefault();
- };
-
-
-
- event.addListener(s, "mousedown", split.onMouseDown);
- event.addListener(window, "resize", split.resize);
- split.resize();
- return split;
-};
-exports.stripLeadingComments = function(str) {
- if(str.slice(0,2)=='/*') {
- var j = str.indexOf('*/')+2;
- str = str.substr(j);
- }
- return str.trim() + "\n";
-};
-exports.saveOption = function(el, val) {
- if (!el.onchange && !el.onclick)
- return;
-
- if ("checked" in el) {
- if (val !== undefined)
- el.checked = val;
-
- localStorage && localStorage.setItem(el.id, el.checked ? 1 : 0);
- }
- else {
- if (val !== undefined)
- el.value = val;
-
- localStorage && localStorage.setItem(el.id, el.value);
- }
-};
-
-exports.bindCheckbox = function(id, callback, noInit) {
- if (typeof id == "string")
- var el = document.getElementById(id);
- else {
- var el = id;
- id = el.id;
- }
- var el = document.getElementById(id);
- if (localStorage && localStorage.getItem(id))
- el.checked = localStorage.getItem(id) == "1";
-
- var onCheck = function() {
- callback(!!el.checked);
- exports.saveOption(el);
- };
- el.onclick = onCheck;
- noInit || onCheck();
- return el;
-};
-
-exports.bindDropdown = function(id, callback, noInit) {
- if (typeof id == "string")
- var el = document.getElementById(id);
- else {
- var el = id;
- id = el.id;
- }
- if (localStorage && localStorage.getItem(id))
- el.value = localStorage.getItem(id);
-
- var onChange = function() {
- callback(el.value);
- exports.saveOption(el);
- };
-
- el.onchange = onChange;
- noInit || onChange();
-};
-
-exports.fillDropdown = function(el, values) {
- if (typeof el == "string")
- el = document.getElementById(el);
-
- dropdown(values).forEach(function(e) {
- el.appendChild(e);
- });
-};
-
-function elt(tag, attributes, content) {
- var el = dom.createElement(tag);
- if (typeof content == "string") {
- el.appendChild(document.createTextNode(content));
- } else if (content) {
- content.forEach(function(ch) {
- el.appendChild(ch);
- });
- }
-
- for (var i in attributes)
- el.setAttribute(i, attributes[i]);
- return el;
-}
-
-function optgroup(values) {
- return values.map(function(item) {
- if (typeof item == "string")
- item = {name: item, caption: item};
- return elt("option", {value: item.value || item.name}, item.caption || item.desc);
- });
-}
-
-function dropdown(values) {
- if (Array.isArray(values))
- return optgroup(values);
-
- return Object.keys(values).map(function(i) {
- return elt("optgroup", {"label": i}, optgroup(values[i]));
- });
-}
-
-
-});
-
-define('ace/occur', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/search', 'ace/edit_session', 'ace/search_highlight', 'ace/lib/dom'], function(require, exports, module) {
-
-
-var oop = require("./lib/oop");
-var Range = require("./range").Range;
-var Search = require("./search").Search;
-var EditSession = require("./edit_session").EditSession;
-var SearchHighlight = require("./search_highlight").SearchHighlight;
-function Occur() {}
-
-oop.inherits(Occur, Search);
-
-(function() {
- this.enter = function(editor, options) {
- if (!options.needle) return false;
- var pos = editor.getCursorPosition();
- this.displayOccurContent(editor, options);
- var translatedPos = this.originalToOccurPosition(editor.session, pos);
- editor.moveCursorToPosition(translatedPos);
- return true;
- }
- this.exit = function(editor, options) {
- var pos = options.translatePosition && editor.getCursorPosition();
- var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
- this.displayOriginalContent(editor);
- if (translatedPos)
- editor.moveCursorToPosition(translatedPos);
- return true;
- }
-
- this.highlight = function(sess, regexp) {
- var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(
- new SearchHighlight(null, "ace_occur-highlight", "text"));
- hl.setRegexp(regexp);
- sess._emit("changeBackMarker"); // force highlight layer redraw
- }
-
- this.displayOccurContent = function(editor, options) {
- this.$originalSession = editor.session;
- var found = this.matchingLines(editor.session, options);
- var lines = found.map(function(foundLine) { return foundLine.content; });
- var occurSession = new EditSession(lines.join('\n'));
- occurSession.$occur = this;
- occurSession.$occurMatchingLines = found;
- editor.setSession(occurSession);
- this.highlight(occurSession, options.re);
- occurSession._emit('changeBackMarker');
- }
-
- this.displayOriginalContent = function(editor) {
- editor.setSession(this.$originalSession);
- }
- this.originalToOccurPosition = function(session, pos) {
- var lines = session.$occurMatchingLines;
- var nullPos = {row: 0, column: 0};
- if (!lines) return nullPos;
- for (var i = 0; i < lines.length; i++) {
- if (lines[i].row === pos.row)
- return {row: i, column: pos.column};
- }
- return nullPos;
- }
- this.occurToOriginalPosition = function(session, pos) {
- var lines = session.$occurMatchingLines;
- if (!lines || !lines[pos.row])
- return pos;
- return {row: lines[pos.row].row, column: pos.column};
- }
-
- this.matchingLines = function(session, options) {
- options = oop.mixin({}, options);
- if (!session || !options.needle) return [];
- var search = new Search();
- search.set(options);
- return search.findAll(session).reduce(function(lines, range) {
- var row = range.start.row;
- var last = lines[lines.length-1];
- return last && last.row === row ?
- lines :
- lines.concat({row: row, content: session.getLine(row)});
- }, []);
- }
-
-}).call(Occur.prototype);
-
-var dom = require('./lib/dom');
-dom.importCssString(".ace_occur-highlight {\n\
- border-radius: 4px;\n\
- background-color: rgba(87, 255, 8, 0.25);\n\
- position: absolute;\n\
- z-index: 4;\n\
- -moz-box-sizing: border-box;\n\
- -webkit-box-sizing: border-box;\n\
- box-sizing: border-box;\n\
- box-shadow: 0 0 4px rgb(91, 255, 50);\n\
-}\n\
-.ace_dark .ace_occur-highlight {\n\
- background-color: rgb(80, 140, 85);\n\
- box-shadow: 0 0 4px rgb(60, 120, 70);\n\
-}\n", "incremental-occur-highlighting");
-
-exports.Occur = Occur;
-
-});
-
-define('ace/split', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter', 'ace/editor', 'ace/virtual_renderer', 'ace/edit_session'], function(require, exports, module) {
-
-
-var oop = require("./lib/oop");
-var lang = require("./lib/lang");
-var EventEmitter = require("./lib/event_emitter").EventEmitter;
-
-var Editor = require("./editor").Editor;
-var Renderer = require("./virtual_renderer").VirtualRenderer;
-var EditSession = require("./edit_session").EditSession;
-
-
-var Split = function(container, theme, splits) {
- this.BELOW = 1;
- this.BESIDE = 0;
-
- this.$container = container;
- this.$theme = theme;
- this.$splits = 0;
- this.$editorCSS = "";
- this.$editors = [];
- this.$orientation = this.BESIDE;
-
- this.setSplits(splits || 1);
- this.$cEditor = this.$editors[0];
-
-
- this.on("focus", function(editor) {
- this.$cEditor = editor;
- }.bind(this));
-};
-
-(function(){
-
- oop.implement(this, EventEmitter);
-
- this.$createEditor = function() {
- var el = document.createElement("div");
- el.className = this.$editorCSS;
- el.style.cssText = "position: absolute; top:0px; bottom:0px";
- this.$container.appendChild(el);
- var editor = new Editor(new Renderer(el, this.$theme));
-
- editor.on("focus", function() {
- this._emit("focus", editor);
- }.bind(this));
-
- this.$editors.push(editor);
- editor.setFontSize(this.$fontSize);
- return editor;
- };
-
- this.setSplits = function(splits) {
- var editor;
- if (splits < 1) {
- throw "The number of splits have to be > 0!";
- }
-
- if (splits == this.$splits) {
- return;
- } else if (splits > this.$splits) {
- while (this.$splits < this.$editors.length && this.$splits < splits) {
- editor = this.$editors[this.$splits];
- this.$container.appendChild(editor.container);
- editor.setFontSize(this.$fontSize);
- this.$splits ++;
- }
- while (this.$splits < splits) {
- this.$createEditor();
- this.$splits ++;
- }
- } else {
- while (this.$splits > splits) {
- editor = this.$editors[this.$splits - 1];
- this.$container.removeChild(editor.container);
- this.$splits --;
- }
- }
- this.resize();
- };
- this.getSplits = function() {
- return this.$splits;
- };
- this.getEditor = function(idx) {
- return this.$editors[idx];
- };
- this.getCurrentEditor = function() {
- return this.$cEditor;
- };
- this.focus = function() {
- this.$cEditor.focus();
- };
- this.blur = function() {
- this.$cEditor.blur();
- };
- this.setTheme = function(theme) {
- this.$editors.forEach(function(editor) {
- editor.setTheme(theme);
- });
- };
- this.setKeyboardHandler = function(keybinding) {
- this.$editors.forEach(function(editor) {
- editor.setKeyboardHandler(keybinding);
- });
- };
- this.forEach = function(callback, scope) {
- this.$editors.forEach(callback, scope);
- };
-
-
- this.$fontSize = "";
- this.setFontSize = function(size) {
- this.$fontSize = size;
- this.forEach(function(editor) {
- editor.setFontSize(size);
- });
- };
-
- this.$cloneSession = function(session) {
- var s = new EditSession(session.getDocument(), session.getMode());
-
- var undoManager = session.getUndoManager();
- if (undoManager) {
- var undoManagerProxy = new UndoManagerProxy(undoManager, s);
- s.setUndoManager(undoManagerProxy);
- }
- s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
- s.setTabSize(session.getTabSize());
- s.setUseSoftTabs(session.getUseSoftTabs());
- s.setOverwrite(session.getOverwrite());
- s.setBreakpoints(session.getBreakpoints());
- s.setUseWrapMode(session.getUseWrapMode());
- s.setUseWorker(session.getUseWorker());
- s.setWrapLimitRange(session.$wrapLimitRange.min,
- session.$wrapLimitRange.max);
- s.$foldData = session.$cloneFoldData();
-
- return s;
- };
- this.setSession = function(session, idx) {
- var editor;
- if (idx == null) {
- editor = this.$cEditor;
- } else {
- editor = this.$editors[idx];
- }
- var isUsed = this.$editors.some(function(editor) {
- return editor.session === session;
- });
-
- if (isUsed) {
- session = this.$cloneSession(session);
- }
- editor.setSession(session);
- return session;
- };
- this.getOrientation = function() {
- return this.$orientation;
- };
- this.setOrientation = function(orientation) {
- if (this.$orientation == orientation) {
- return;
- }
- this.$orientation = orientation;
- this.resize();
- };
- this.resize = function() {
- var width = this.$container.clientWidth;
- var height = this.$container.clientHeight;
- var editor;
-
- if (this.$orientation == this.BESIDE) {
- var editorWidth = width / this.$splits;
- for (var i = 0; i < this.$splits; i++) {
- editor = this.$editors[i];
- editor.container.style.width = editorWidth + "px";
- editor.container.style.top = "0px";
- editor.container.style.left = i * editorWidth + "px";
- editor.container.style.height = height + "px";
- editor.resize();
- }
- } else {
- var editorHeight = height / this.$splits;
- for (var i = 0; i < this.$splits; i++) {
- editor = this.$editors[i];
- editor.container.style.width = width + "px";
- editor.container.style.top = i * editorHeight + "px";
- editor.container.style.left = "0px";
- editor.container.style.height = editorHeight + "px";
- editor.resize();
- }
- }
- };
-
-}).call(Split.prototype);
-
-
-function UndoManagerProxy(undoManager, session) {
- this.$u = undoManager;
- this.$doc = session;
-}
-
-(function() {
- this.execute = function(options) {
- this.$u.execute(options);
- };
-
- this.undo = function() {
- var selectionRange = this.$u.undo(true);
- if (selectionRange) {
- this.$doc.selection.setSelectionRange(selectionRange);
- }
- };
-
- this.redo = function() {
- var selectionRange = this.$u.redo(true);
- if (selectionRange) {
- this.$doc.selection.setSelectionRange(selectionRange);
- }
- };
-
- this.reset = function() {
- this.$u.reset();
- };
-
- this.hasUndo = function() {
- return this.$u.hasUndo();
- };
-
- this.hasRedo = function() {
- return this.$u.hasRedo();
- };
-}).call(UndoManagerProxy.prototype);
-
-exports.Split = Split;
-});
-
-define('ace/keyboard/vim', ['require', 'exports', 'module' , 'ace/keyboard/vim/commands', 'ace/keyboard/vim/maps/util', 'ace/lib/useragent'], function(require, exports, module) {
-
-
-var cmds = require("./vim/commands");
-var coreCommands = cmds.coreCommands;
-var util = require("./vim/maps/util");
-var useragent = require("../lib/useragent");
-
-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 = {
- $id: "ace/keyboard/vim",
- handleMacRepeat: function(data, hashId, key) {
- if (hashId == -1) {
- data.inputChar = key;
- data.lastEvent = "input";
- } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
- if (data.lastEvent == "input") {
- data.lastEvent = "input1";
- } else if (data.lastEvent == "input1") {
- return true;
- }
- } else {
- data.$lastHash = hashId;
- data.$lastKey = key;
- data.lastEvent = "keypress";
- }
- },
- updateMacCompositionHandlers: function(editor, enable) {
- var onCompositionUpdateOverride = function(text) {
- if (util.currentMode !== "insert") {
- var el = this.textInput.getElement();
- el.blur();
- el.focus();
- el.value = text;
- } else {
- this.onCompositionUpdateOrig(text);
- }
- };
- var onCompositionStartOverride = function(text) {
- if (util.currentMode === "insert") {
- this.onCompositionStartOrig(text);
- }
- };
- if (enable) {
- if (!editor.onCompositionUpdateOrig) {
- editor.onCompositionUpdateOrig = editor.onCompositionUpdate;
- editor.onCompositionUpdate = onCompositionUpdateOverride;
- editor.onCompositionStartOrig = editor.onCompositionStart;
- editor.onCompositionStart = onCompositionStartOverride;
- }
- } else {
- if (editor.onCompositionUpdateOrig) {
- editor.onCompositionUpdate = editor.onCompositionUpdateOrig;
- editor.onCompositionUpdateOrig = null;
- editor.onCompositionStart = editor.onCompositionStartOrig;
- editor.onCompositionStartOrig = null;
- }
- }
- },
-
- handleKeyboard: function(data, hashId, key, keyCode, e) {
- if (hashId !== 0 && (!key || keyCode == -1))
- return null;
-
- var editor = data.editor;
-
- if (hashId == 1)
- key = "ctrl-" + key;
- if (key == "ctrl-c") {
- if (!useragent.isMac && editor.getCopyText()) {
- editor.once("copy", function() {
- if (data.state == "start")
- coreCommands.stop.exec(editor);
- else
- editor.selection.clearSelection();
- });
- return {command: "null", passEvent: true};
- }
- return {command: coreCommands.stop};
- } else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
- return {command: coreCommands.stop};
- } else if (data.state == "start") {
- if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
- hashId = -1;
- key = data.inputChar;
- }
-
- if (hashId == -1 || hashId == 1 || hashId === 0 && key.length > 1) {
- if (cmds.inputBuffer.idle && startCommands[key])
- return startCommands[key];
- var isHandled = cmds.inputBuffer.push(editor, key);
- return {command: "null", passEvent: !isHandled};
- } // if no modifier || shift: wait for input.
- else if (key.length == 1 && (hashId === 0 || hashId == 4)) {
- return {command: "null", passEvent: true};
- } else if (key == "esc" && hashId === 0) {
- 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);
- editor.$vimModeHandler = this;
-
- this.updateMacCompositionHandlers(editor, true);
- },
-
- detach: function(editor) {
- editor.removeListener("click", exports.onCursorMove);
- util.noMode(editor);
- util.currentMode = "normal";
- this.updateMacCompositionHandlers(editor, false);
- },
-
- actions: cmds.actions,
- getStatusText: function() {
- if (util.currentMode == "insert")
- return "INSERT";
- if (util.onVisualMode)
- return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
- return cmds.inputBuffer.status;
- }
-};
-
-
-exports.onCursorMove = function(e) {
- cmds.onCursorMove(e.editor, e);
- exports.onCursorMove.scheduled = false;
-};
-
-});
-
-define('ace/keyboard/vim/commands', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/maps/motions', 'ace/keyboard/vim/maps/operators', 'ace/keyboard/vim/maps/aliases', 'ace/keyboard/vim/registers'], function(require, exports, module) {
-
-"never use strict";
-
-var lang = require("../../lib/lang");
-var util = require("./maps/util");
-var motions = require("./maps/motions");
-var operators = require("./maps/operators");
-var alias = require("./maps/aliases");
-var registers = require("./registers");
-
-var NUMBER = 1;
-var OPERATOR = 2;
-var MOTION = 3;
-var ACTION = 4;
-var HMARGIN = 8; // Minimum amount of line separation between margins;
-
-var repeat = function repeat(fn, count, args) {
- while (0 < count--)
- fn.apply(this, args);
-};
-
-var ensureScrollMargin = function(editor) {
- var renderer = editor.renderer;
- var pos = renderer.$cursorLayer.getPixelPosition();
-
- var top = pos.top;
-
- var margin = HMARGIN * renderer.layerConfig.lineHeight;
- if (2 * margin > renderer.$size.scrollerHeight)
- margin = renderer.$size.scrollerHeight / 2;
-
- if (renderer.scrollTop > top - margin) {
- renderer.session.setScrollTop(top - margin);
- }
-
- if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) {
- renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight);
- }
-};
-
-var actions = exports.actions = {
- "z": {
- param: true,
- fn: function(editor, range, count, param) {
- switch (param) {
- case "z":
- editor.renderer.alignCursor(null, 0.5);
- break;
- case "t":
- editor.renderer.alignCursor(null, 0);
- break;
- case "b":
- editor.renderer.alignCursor(null, 1);
- break;
- case "c":
- editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}});
- break;
- case "o":
- editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}});
- break;
- case "C":
- editor.session.foldAll();
- break;
- case "O":
- editor.session.unfold();
- break;
- }
- }
- },
- "r": {
- param: true,
- fn: function(editor, range, count, param) {
- if (param && param.length) {
- if (param.length > 1)
- param = param == "return" ? "\n" : param == "tab" ? "\t" : param;
- repeat(function() { editor.insert(param); }, count || 1);
- editor.navigateLeft();
- }
- }
- },
- "R": {
- fn: function(editor, range, count, param) {
- util.insertMode(editor);
- editor.setOverwrite(true);
- }
- },
- "~": {
- fn: function(editor, range, count) {
- repeat(function() {
- var range = editor.selection.getRange();
- if (range.isEmpty())
- range.end.column++;
- var text = editor.session.getTextRange(range);
- var toggled = text.toUpperCase();
- if (toggled == text)
- editor.navigateRight();
- else
- editor.session.replace(range, toggled);
- }, count || 1);
- }
- },
- "*": {
- fn: function(editor, range, count, param) {
- editor.selection.selectWord();
- editor.findNext();
- ensureScrollMargin(editor);
- var r = editor.selection.getRange();
- editor.selection.setSelectionRange(r, true);
- }
- },
- "#": {
- fn: function(editor, range, count, param) {
- editor.selection.selectWord();
- editor.findPrevious();
- ensureScrollMargin(editor);
- var r = editor.selection.getRange();
- editor.selection.setSelectionRange(r, true);
- }
- },
- "m": {
- param: true,
- fn: function(editor, range, count, param) {
- var s = editor.session;
- var markers = s.vimMarkers || (s.vimMarkers = {});
- var c = editor.getCursorPosition();
- if (!markers[param]) {
- markers[param] = editor.session.doc.createAnchor(c);
- }
- markers[param].setPosition(c.row, c.column, true);
- }
- },
- "n": {
- fn: function(editor, range, count, param) {
- var options = editor.getLastSearchOptions();
- options.backwards = false;
-
- editor.selection.moveCursorRight();
- editor.selection.clearSelection();
- editor.findNext(options);
-
- ensureScrollMargin(editor);
- var r = editor.selection.getRange();
- r.end.row = r.start.row;
- r.end.column = r.start.column;
- editor.selection.setSelectionRange(r, true);
- }
- },
- "N": {
- fn: function(editor, range, count, param) {
- var options = editor.getLastSearchOptions();
- options.backwards = true;
-
- editor.findPrevious(options);
- ensureScrollMargin(editor);
- var r = editor.selection.getRange();
- r.end.row = r.start.row;
- r.end.column = r.start.column;
- editor.selection.setSelectionRange(r, true);
- }
- },
- "v": {
- fn: function(editor, range, count, param) {
- editor.selection.selectRight();
- util.visualMode(editor, false);
- },
- acceptsMotion: true
- },
- "V": {
- fn: function(editor, range, count, param) {
- var row = editor.getCursorPosition().row;
- editor.selection.moveTo(row, 0);
- editor.selection.selectLineEnd();
- editor.selection.visualLineStart = row;
-
- util.visualMode(editor, true);
- },
- acceptsMotion: true
- },
- "Y": {
- fn: function(editor, range, count, param) {
- util.copyLine(editor);
- }
- },
- "p": {
- fn: function(editor, range, count, param) {
- var defaultReg = registers._default;
-
- editor.setOverwrite(false);
- if (defaultReg.isLine) {
- var pos = editor.getCursorPosition();
- pos.column = editor.session.getLine(pos.row).length;
- var text = lang.stringRepeat("\n" + defaultReg.text, count || 1);
- editor.session.insert(pos, text);
- editor.moveCursorTo(pos.row + 1, 0);
- }
- else {
- editor.navigateRight();
- editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
- editor.navigateLeft();
- }
- editor.setOverwrite(true);
- editor.selection.clearSelection();
- }
- },
- "P": {
- fn: function(editor, range, count, param) {
- var defaultReg = registers._default;
- editor.setOverwrite(false);
-
- if (defaultReg.isLine) {
- var pos = editor.getCursorPosition();
- pos.column = 0;
- var text = lang.stringRepeat(defaultReg.text + "\n", count || 1);
- editor.session.insert(pos, text);
- editor.moveCursorToPosition(pos);
- }
- else {
- editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
- }
- editor.setOverwrite(true);
- editor.selection.clearSelection();
- }
- },
- "J": {
- fn: function(editor, range, count, param) {
- var session = editor.session;
- range = editor.getSelectionRange();
- var pos = {row: range.start.row, column: range.start.column};
- count = count || range.end.row - range.start.row;
- var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1);
-
- range.start.column = session.getLine(pos.row).length;
- range.end.column = session.getLine(maxRow).length;
- range.end.row = maxRow;
-
- var text = "";
- for (var i = pos.row; i < maxRow; i++) {
- var nextLine = session.getLine(i + 1);
- text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
- }
-
- session.replace(range, text);
- editor.moveCursorTo(pos.row, pos.column);
- }
- },
- "u": {
- fn: function(editor, range, count, param) {
- count = parseInt(count || 1, 10);
- for (var i = 0; i < count; i++) {
- editor.undo();
- }
- editor.selection.clearSelection();
- }
- },
- "ctrl-r": {
- fn: function(editor, range, count, param) {
- count = parseInt(count || 1, 10);
- for (var i = 0; i < count; i++) {
- editor.redo();
- }
- editor.selection.clearSelection();
- }
- },
- ":": {
- fn: function(editor, range, count, param) {
- var val = ":";
- if (count > 1)
- val = ".,.+" + count + val;
- if (editor.showCommandLine)
- editor.showCommandLine(val);
- }
- },
- "/": {
- fn: function(editor, range, count, param) {
- if (editor.showCommandLine)
- editor.showCommandLine("/");
- }
- },
- "?": {
- fn: function(editor, range, count, param) {
- if (editor.showCommandLine)
- editor.showCommandLine("?");
- }
- },
- ".": {
- fn: function(editor, range, count, param) {
- util.onInsertReplaySequence = inputBuffer.lastInsertCommands;
- var previous = inputBuffer.previous;
- if (previous) // If there is a previous action
- inputBuffer.exec(editor, previous.action, previous.param);
- }
- },
- "ctrl-x": {
- fn: function(editor, range, count, param) {
- editor.modifyNumber(-(count || 1));
- }
- },
- "ctrl-a": {
- fn: function(editor, range, count, param) {
- editor.modifyNumber(count || 1);
- }
- }
-};
-
-var inputBuffer = exports.inputBuffer = {
- accepting: [NUMBER, OPERATOR, MOTION, ACTION],
- currentCmd: null,
- currentCount: "",
- status: "",
- operator: null,
- motion: null,
-
- lastInsertCommands: [],
-
- push: function(editor, ch, keyId) {
- var status = this.status;
- var isKeyHandled = true;
- this.idle = false;
- var wObj = this.waitingForParam;
- if (/^numpad\d+$/i.test(ch))
- ch = ch.substr(6);
-
- if (wObj) {
- this.exec(editor, wObj, ch);
- }
- else if (!(ch === "0" && !this.currentCount.length) &&
- (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) {
- this.currentCount += ch;
- this.currentCmd = NUMBER;
- this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
- }
- else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
- this.operator = {
- ch: ch,
- count: this.getCount()
- };
- this.currentCmd = OPERATOR;
- this.accepting = [NUMBER, MOTION, ACTION];
- this.exec(editor, { operator: this.operator });
- }
- else if (motions[ch] && this.isAccepting(MOTION)) {
- this.currentCmd = MOTION;
-
- var ctx = {
- operator: this.operator,
- motion: {
- ch: ch,
- count: this.getCount()
- }
- };
-
- if (motions[ch].param)
- this.waitForParam(ctx);
- else
- this.exec(editor, ctx);
- }
- else if (alias[ch] && this.isAccepting(MOTION)) {
- alias[ch].operator.count = this.getCount();
- this.exec(editor, alias[ch]);
- }
- else if (actions[ch] && this.isAccepting(ACTION)) {
- var actionObj = {
- action: {
- fn: actions[ch].fn,
- count: this.getCount()
- }
- };
-
- if (actions[ch].param) {
- this.waitForParam(actionObj);
- }
- else {
- this.exec(editor, actionObj);
- }
-
- if (actions[ch].acceptsMotion)
- this.idle = false;
- }
- else if (this.operator) {
- this.operator.count = this.getCount();
- this.exec(editor, { operator: this.operator }, ch);
- }
- else {
- isKeyHandled = ch.length == 1;
- this.reset();
- }
-
- if (this.waitingForParam || this.motion || this.operator) {
- this.status += ch;
- } else if (this.currentCount) {
- this.status = this.currentCount;
- } else if (this.status) {
- this.status = "";
- }
- if (this.status != status)
- editor._emit("changeStatus");
- return isKeyHandled;
- },
-
- waitForParam: function(cmd) {
- this.waitingForParam = cmd;
- },
-
- getCount: function() {
- var count = this.currentCount;
- this.currentCount = "";
- return count && parseInt(count, 10);
- },
-
- exec: function(editor, action, param) {
- var m = action.motion;
- var o = action.operator;
- var a = action.action;
-
- if (!param)
- param = action.param;
-
- if (o) {
- this.previous = {
- action: action,
- param: param
- };
- }
-
- if (o && !editor.selection.isEmpty()) {
- if (operators[o.ch].selFn) {
- operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
- this.reset();
- }
- return;
- }
- else if (!m && !a && o && param) {
- operators[o.ch].fn(editor, null, o.count, param);
- this.reset();
- }
- else if (m) {
- var run = function(fn) {
- if (fn && typeof fn === "function") { // There should always be a motion
- if (m.count && !motionObj.handlesCount)
- repeat(fn, m.count, [editor, null, m.count, param]);
- else
- fn(editor, null, m.count, param);
- }
- };
-
- var motionObj = motions[m.ch];
- var selectable = motionObj.sel;
-
- if (!o) {
- if ((util.onVisualMode || util.onVisualLineMode) && selectable)
- run(motionObj.sel);
- else
- run(motionObj.nav);
- }
- else if (selectable) {
- repeat(function() {
- run(motionObj.sel);
- operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
- }, o.count || 1);
- }
- this.reset();
- }
- else if (a) {
- a.fn(editor, editor.getSelectionRange(), a.count, param);
- this.reset();
- }
- handleCursorMove(editor);
- },
-
- isAccepting: function(type) {
- return this.accepting.indexOf(type) !== -1;
- },
-
- reset: function() {
- this.operator = null;
- this.motion = null;
- this.currentCount = "";
- this.status = "";
- this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
- this.idle = true;
- this.waitingForParam = null;
- }
-};
-
-function setPreviousCommand(fn) {
- inputBuffer.previous = { action: { action: { fn: fn } } };
-}
-
-exports.coreCommands = {
- start: {
- exec: function start(editor) {
- util.insertMode(editor);
- setPreviousCommand(start);
- }
- },
- startBeginning: {
- exec: function startBeginning(editor) {
- editor.navigateLineStart();
- util.insertMode(editor);
- setPreviousCommand(startBeginning);
- }
- },
- stop: {
- exec: function stop(editor) {
- inputBuffer.reset();
- util.onVisualMode = false;
- util.onVisualLineMode = false;
- inputBuffer.lastInsertCommands = util.normalMode(editor);
- }
- },
- append: {
- exec: function append(editor) {
- var pos = editor.getCursorPosition();
- var lineLen = editor.session.getLine(pos.row).length;
- if (lineLen)
- editor.navigateRight();
- util.insertMode(editor);
- setPreviousCommand(append);
- }
- },
- appendEnd: {
- exec: function appendEnd(editor) {
- editor.navigateLineEnd();
- util.insertMode(editor);
- setPreviousCommand(appendEnd);
- }
- }
-};
-
-var handleCursorMove = exports.onCursorMove = function(editor, e) {
- if (util.currentMode === 'insert' || handleCursorMove.running)
- return;
- else if(!editor.selection.isEmpty()) {
- handleCursorMove.running = true;
- if (util.onVisualLineMode) {
- var originRow = editor.selection.visualLineStart;
- var cursorRow = editor.getCursorPosition().row;
- if(originRow <= cursorRow) {
- var endLine = editor.session.getLine(cursorRow);
- editor.selection.moveTo(originRow, 0);
- editor.selection.selectTo(cursorRow, endLine.length);
- } else {
- var endLine = editor.session.getLine(originRow);
- editor.selection.moveTo(originRow, endLine.length);
- editor.selection.selectTo(cursorRow, 0);
- }
- }
- handleCursorMove.running = false;
- return;
- }
- else {
- if (e && (util.onVisualLineMode || util.onVisualMode)) {
- editor.selection.clearSelection();
- util.normalMode(editor);
- }
-
- handleCursorMove.running = true;
- var pos = editor.getCursorPosition();
- var lineLen = editor.session.getLine(pos.row).length;
-
- if (lineLen && pos.column === lineLen)
- editor.navigateLeft();
- handleCursorMove.running = false;
- }
-};
-});
-define('ace/keyboard/vim/maps/util', ['require', 'exports', 'module' , 'ace/keyboard/vim/registers', 'ace/lib/dom'], function(require, exports, module) {
-var registers = require("../registers");
-
-var dom = require("../../../lib/dom");
-dom.importCssString('.insert-mode .ace_cursor{\
- border-left: 2px solid #333333;\
-}\
-.ace_dark.insert-mode .ace_cursor{\
- border-left: 2px solid #eeeeee;\
-}\
-.normal-mode .ace_cursor{\
- border: 0!important;\
- background-color: red;\
- opacity: 0.5;\
-}', 'vimMode');
-
-module.exports = {
- onVisualMode: false,
- onVisualLineMode: false,
- currentMode: 'normal',
- noMode: function(editor) {
- editor.unsetStyle('insert-mode');
- editor.unsetStyle('normal-mode');
- if (editor.commands.recording)
- editor.commands.toggleRecording(editor);
- editor.setOverwrite(false);
- },
- insertMode: function(editor) {
- this.currentMode = 'insert';
- editor.setStyle('insert-mode');
- editor.unsetStyle('normal-mode');
-
- editor.setOverwrite(false);
- editor.keyBinding.$data.buffer = "";
- editor.keyBinding.$data.state = "insertMode";
- this.onVisualMode = false;
- this.onVisualLineMode = false;
- if(this.onInsertReplaySequence) {
- editor.commands.macro = this.onInsertReplaySequence;
- editor.commands.replay(editor);
- this.onInsertReplaySequence = null;
- this.normalMode(editor);
- } else {
- editor._emit("changeStatus");
- if(!editor.commands.recording)
- editor.commands.toggleRecording(editor);
- }
- },
- normalMode: function(editor) {
- this.currentMode = 'normal';
-
- editor.unsetStyle('insert-mode');
- editor.setStyle('normal-mode');
- editor.clearSelection();
-
- var pos;
- if (!editor.getOverwrite()) {
- pos = editor.getCursorPosition();
- if (pos.column > 0)
- editor.navigateLeft();
- }
-
- editor.setOverwrite(true);
- editor.keyBinding.$data.buffer = "";
- editor.keyBinding.$data.state = "start";
- this.onVisualMode = false;
- this.onVisualLineMode = false;
- editor._emit("changeStatus");
- if (editor.commands.recording) {
- editor.commands.toggleRecording(editor);
- return editor.commands.macro;
- }
- else {
- return [];
- }
- },
- visualMode: function(editor, lineMode) {
- if (
- (this.onVisualLineMode && lineMode)
- || (this.onVisualMode && !lineMode)
- ) {
- this.normalMode(editor);
- return;
- }
-
- editor.setStyle('insert-mode');
- editor.unsetStyle('normal-mode');
-
- editor._emit("changeStatus");
- if (lineMode) {
- this.onVisualLineMode = true;
- } else {
- this.onVisualMode = true;
- this.onVisualLineMode = false;
- }
- },
- getRightNthChar: function(editor, cursor, ch, n) {
- var line = editor.getSession().getLine(cursor.row);
- var matches = line.substr(cursor.column + 1).split(ch);
-
- return n < matches.length ? matches.slice(0, n).join(ch).length : null;
- },
- getLeftNthChar: function(editor, cursor, ch, n) {
- var line = editor.getSession().getLine(cursor.row);
- var matches = line.substr(0, cursor.column).split(ch);
-
- return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
- },
- toRealChar: function(ch) {
- if (ch.length === 1)
- return ch;
-
- if (/^shift-./.test(ch))
- return ch[ch.length - 1].toUpperCase();
- else
- return "";
- },
- copyLine: function(editor) {
- var pos = editor.getCursorPosition();
- editor.selection.moveTo(pos.row, pos.column);
- editor.selection.selectLine();
- registers._default.isLine = true;
- registers._default.text = editor.getCopyText().replace(/\n$/, "");
- editor.selection.moveTo(pos.row, pos.column);
- }
-};
-});
-
-define('kitchen-sink/token_tooltip', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/oop', 'ace/lib/event', 'ace/range', 'ace/tooltip'], function(require, exports, module) {
-
-
-var dom = require("ace/lib/dom");
-var oop = require("ace/lib/oop");
-var event = require("ace/lib/event");
-var Range = require("ace/range").Range;
-var Tooltip = require("ace/tooltip").Tooltip;
-
-function TokenTooltip (editor) {
- if (editor.tokenTooltip)
- return;
- Tooltip.call(this, editor.container);
- editor.tokenTooltip = this;
- this.editor = editor;
-
- this.update = this.update.bind(this);
- this.onMouseMove = this.onMouseMove.bind(this);
- this.onMouseOut = this.onMouseOut.bind(this);
- event.addListener(editor.renderer.scroller, "mousemove", this.onMouseMove);
- event.addListener(editor.renderer.content, "mouseout", this.onMouseOut);
-}
-
-oop.inherits(TokenTooltip, Tooltip);
-
-(function(){
- this.token = {};
- this.range = new Range();
-
- this.update = function() {
- this.$timer = null;
-
- var r = this.editor.renderer;
- if (this.lastT - (r.timeStamp || 0) > 1000) {
- r.rect = null;
- r.timeStamp = this.lastT;
- this.maxHeight = window.innerHeight;
- this.maxWidth = window.innerWidth;
- }
-
- var canvasPos = r.rect || (r.rect = r.scroller.getBoundingClientRect());
- var offset = (this.x + r.scrollLeft - canvasPos.left - r.$padding) / r.characterWidth;
- var row = Math.floor((this.y + r.scrollTop - canvasPos.top) / r.lineHeight);
- var col = Math.round(offset);
-
- var screenPos = {row: row, column: col, side: offset - col > 0 ? 1 : -1};
- var session = this.editor.session;
- var docPos = session.screenToDocumentPosition(screenPos.row, screenPos.column);
- var token = session.getTokenAt(docPos.row, docPos.column);
-
- if (!token && !session.getLine(docPos.row)) {
- token = {
- type: "",
- value: "",
- state: session.bgTokenizer.getState(0)
- };
- }
- if (!token) {
- session.removeMarker(this.marker);
- this.hide();
- return;
- }
-
- var tokenText = token.type;
- if (token.state)
- tokenText += "|" + token.state;
- if (token.merge)
- tokenText += "\n merge";
- if (token.stateTransitions)
- tokenText += "\n " + token.stateTransitions.join("\n ");
-
- if (this.tokenText != tokenText) {
- this.setText(tokenText);
- this.width = this.getWidth();
- this.height = this.getHeight();
- this.tokenText = tokenText;
- }
-
- this.show(null, this.x, this.y);
-
- this.token = token;
- session.removeMarker(this.marker);
- this.range = new Range(docPos.row, token.start, docPos.row, token.start + token.value.length);
- this.marker = session.addMarker(this.range, "ace_bracket", "text");
- };
-
- this.onMouseMove = function(e) {
- this.x = e.clientX;
- this.y = e.clientY;
- if (this.isOpen) {
- this.lastT = e.timeStamp;
- this.setPosition(this.x, this.y);
- }
- if (!this.$timer)
- this.$timer = setTimeout(this.update, 100);
- };
-
- this.onMouseOut = function(e) {
- if (e && e.currentTarget.contains(e.relatedTarget))
- return;
- this.hide();
- this.editor.session.removeMarker(this.marker);
- this.$timer = clearTimeout(this.$timer);
- };
-
- this.setPosition = function(x, y) {
- if (x + 10 + this.width > this.maxWidth)
- x = window.innerWidth - this.width - 10;
- if (y > window.innerHeight * 0.75 || y + 20 + this.height > this.maxHeight)
- y = y - this.height - 30;
-
- Tooltip.prototype.setPosition.call(this, x + 10, y + 20);
- };
-
- this.destroy = function() {
- this.onMouseOut();
- event.removeListener(this.editor.renderer.scroller, "mousemove", this.onMouseMove);
- event.removeListener(this.editor.renderer.content, "mouseout", this.onMouseOut);
- delete this.editor.tokenTooltip;
- };
-
-}).call(TokenTooltip.prototype);
-
-exports.TokenTooltip = TokenTooltip;
-
-});
-
-define('ace/keyboard/vim/registers', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-"never use strict";
-
-module.exports = {
- _default: {
- text: "",
- isLine: false
- }
-};
-
-});
-
-define('kitchen-sink/layout', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/event', 'ace/edit_session', 'ace/undomanager', 'ace/virtual_renderer', 'ace/editor', 'ace/multi_select', 'ace/theme/textmate'], function(require, exports, module) {
-
-
-var dom = require("ace/lib/dom");
-var event = require("ace/lib/event");
-
-var EditSession = require("ace/edit_session").EditSession;
-var UndoManager = require("ace/undomanager").UndoManager;
-var Renderer = require("ace/virtual_renderer").VirtualRenderer;
-var Editor = require("ace/editor").Editor;
-var MultiSelect = require("ace/multi_select").MultiSelect;
-
-dom.importCssString("\
-splitter {\
- border: 1px solid #C6C6D2;\
- width: 0px;\
- cursor: ew-resize;\
- z-index:10}\
-splitter:hover {\
- margin-left: -2px;\
- width:3px;\
- border-color: #B5B4E0;\
-}\
-", "splitEditor");
-
-exports.edit = function(el) {
- if (typeof(el) == "string")
- el = document.getElementById(el);
-
- var editor = new Editor(new Renderer(el, require("ace/theme/textmate")));
-
- editor.resize();
- event.addListener(window, "resize", function() {
- editor.resize();
- });
- return editor;
-};
-
-
-var SplitRoot = function(el, theme, position, getSize) {
- el.style.position = position || "relative";
- this.container = el;
- this.getSize = getSize || this.getSize;
- this.resize = this.$resize.bind(this);
-
- event.addListener(el.ownerDocument.defaultView, "resize", this.resize);
- this.editor = this.createEditor();
-};
-
-(function(){
- this.createEditor = function() {
- var el = document.createElement("div");
- el.className = this.$editorCSS;
- el.style.cssText = "position: absolute; top:0px; bottom:0px";
- this.$container.appendChild(el);
- var session = new EditSession("");
- var editor = new Editor(new Renderer(el, this.$theme));
-
- this.$editors.push(editor);
- editor.setFontSize(this.$fontSize);
- return editor;
- };
- this.$resize = function() {
- var size = this.getSize(this.container);
- this.rect = {
- x: size.left,
- y: size.top,
- w: size.width,
- h: size.height
- };
- this.item.resize(this.rect);
- };
- this.getSize = function(el) {
- return el.getBoundingClientRect();
- };
- this.destroy = function() {
- var win = this.container.ownerDocument.defaultView;
- event.removeListener(win, "resize", this.resize);
- };
-
-
-}).call(SplitRoot.prototype);
-
-
-
-var Split = function(){
-
-};
-(function(){
- this.execute = function(options) {
- this.$u.execute(options);
- };
-
-}).call(Split.prototype);
-
-
-
-exports.singleLineEditor = function(el) {
- var renderer = new Renderer(el);
- el.style.overflow = "hidden";
-
- renderer.screenToTextCoordinates = function(x, y) {
- var pos = this.pixelToScreenCoordinates(x, y);
- return this.session.screenToDocumentPosition(
- Math.min(this.session.getScreenLength() - 1, Math.max(pos.row, 0)),
- Math.max(pos.column, 0)
- );
- };
-
- renderer.$maxLines = 4;
-
- renderer.setStyle("ace_one-line");
- var editor = new Editor(renderer);
- new MultiSelect(editor);
- editor.session.setUndoManager(new UndoManager());
-
- editor.setShowPrintMargin(false);
- editor.renderer.setShowGutter(false);
- editor.renderer.setHighlightGutterLine(false);
- editor.$mouseHandler.$focusWaitTimout = 0;
-
- return editor;
-};
-
-
-
-});
-
-
-define('ace/keyboard/vim/maps/motions', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/search', 'ace/range'], function(require, exports, module) {
-
-
-var util = require("./util");
-
-var keepScrollPosition = function(editor, fn) {
- var scrollTopRow = editor.renderer.getScrollTopRow();
- var initialRow = editor.getCursorPosition().row;
- var diff = initialRow - scrollTopRow;
- fn && fn.call(editor);
- editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
-};
-
-function Motion(m) {
- if (typeof m == "function") {
- var getPos = m;
- m = this;
- } else {
- var getPos = m.getPos;
- }
- m.nav = function(editor, range, count, param) {
- var a = getPos(editor, range, count, param, false);
- if (!a)
- return;
- editor.selection.moveTo(a.row, a.column);
- };
- m.sel = function(editor, range, count, param) {
- var a = getPos(editor, range, count, param, true);
- if (!a)
- return;
- editor.selection.selectTo(a.row, a.column);
- };
- return m;
-}
-
-var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
-var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
-var whiteRe = /\s/;
-var StringStream = function(editor, cursor) {
- var sel = editor.selection;
- this.range = sel.getRange();
- cursor = cursor || sel.selectionLead;
- this.row = cursor.row;
- this.col = cursor.column;
- var line = editor.session.getLine(this.row);
- var maxRow = editor.session.getLength();
- this.ch = line[this.col] || '\n';
- this.skippedLines = 0;
-
- this.next = function() {
- this.ch = line[++this.col] || this.handleNewLine(1);
- return this.ch;
- };
- this.prev = function() {
- this.ch = line[--this.col] || this.handleNewLine(-1);
- return this.ch;
- };
- this.peek = function(dir) {
- var ch = line[this.col + dir];
- if (ch)
- return ch;
- if (dir == -1)
- return '\n';
- if (this.col == line.length - 1)
- return '\n';
- return editor.session.getLine(this.row + 1)[0] || '\n';
- };
-
- this.handleNewLine = function(dir) {
- if (dir == 1){
- if (this.col == line.length)
- return '\n';
- if (this.row == maxRow - 1)
- return '';
- this.col = 0;
- this.row ++;
- line = editor.session.getLine(this.row);
- this.skippedLines++;
- return line[0] || '\n';
- }
- if (dir == -1) {
- if (this.row === 0)
- return '';
- this.row --;
- line = editor.session.getLine(this.row);
- this.col = line.length;
- this.skippedLines--;
- return '\n';
- }
- };
- this.debug = function() {
- console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
- };
-};
-
-var Search = require("../../../search").Search;
-var search = new Search();
-
-function find(editor, needle, dir) {
- search.$options.needle = needle;
- search.$options.backwards = dir == -1;
- return search.find(editor.session);
-}
-
-var Range = require("../../../range").Range;
-
-var LAST_SEARCH_MOTION = {};
-
-module.exports = {
- "w": new Motion(function(editor) {
- var str = new StringStream(editor);
-
- if (str.ch && wordSeparatorRe.test(str.ch)) {
- while (str.ch && wordSeparatorRe.test(str.ch))
- str.next();
- } else {
- while (str.ch && !nonWordRe.test(str.ch))
- str.next();
- }
- while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
- str.next();
-
- str.skippedLines == 2 && str.prev();
- return {column: str.col, row: str.row};
- }),
- "W": new Motion(function(editor) {
- var str = new StringStream(editor);
- while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
- str.next();
- if (str.skippedLines == 2)
- str.prev();
- else
- str.next();
-
- return {column: str.col, row: str.row};
- }),
- "b": new Motion(function(editor) {
- var str = new StringStream(editor);
-
- str.prev();
- while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
- str.prev();
-
- if (str.ch && wordSeparatorRe.test(str.ch)) {
- while (str.ch && wordSeparatorRe.test(str.ch))
- str.prev();
- } else {
- while (str.ch && !nonWordRe.test(str.ch))
- str.prev();
- }
- str.ch && str.next();
- return {column: str.col, row: str.row};
- }),
- "B": new Motion(function(editor) {
- var str = new StringStream(editor);
- str.prev();
- while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
- str.prev();
-
- if (str.skippedLines == -2)
- str.next();
-
- return {column: str.col, row: str.row};
- }),
- "e": new Motion(function(editor) {
- var str = new StringStream(editor);
-
- str.next();
- while (str.ch && whiteRe.test(str.ch))
- str.next();
-
- if (str.ch && wordSeparatorRe.test(str.ch)) {
- while (str.ch && wordSeparatorRe.test(str.ch))
- str.next();
- } else {
- while (str.ch && !nonWordRe.test(str.ch))
- str.next();
- }
- str.ch && str.prev();
- return {column: str.col, row: str.row};
- }),
- "E": new Motion(function(editor) {
- var str = new StringStream(editor);
- str.next();
- while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
- str.next();
-
- return {column: str.col, row: str.row};
- }),
-
- "l": {
- nav: function(editor) {
- var pos = editor.getCursorPosition();
- var col = pos.column;
- var lineLen = editor.session.getLine(pos.row).length;
- if (lineLen && col !== lineLen)
- editor.navigateRight();
- },
- sel: function(editor) {
- var pos = editor.getCursorPosition();
- var col = pos.column;
- var lineLen = editor.session.getLine(pos.row).length;
- if (lineLen && col !== lineLen) //In selection mode you can select the newline
- editor.selection.selectRight();
- }
- },
- "h": {
- nav: function(editor) {
- var pos = editor.getCursorPosition();
- if (pos.column > 0)
- editor.navigateLeft();
- },
- sel: function(editor) {
- var pos = editor.getCursorPosition();
- if (pos.column > 0)
- editor.selection.selectLeft();
- }
- },
- "H": {
- nav: function(editor) {
- var row = editor.renderer.getScrollTopRow();
- editor.moveCursorTo(row);
- },
- sel: function(editor) {
- var row = editor.renderer.getScrollTopRow();
- editor.selection.selectTo(row);
- }
- },
- "M": {
- nav: function(editor) {
- var topRow = editor.renderer.getScrollTopRow();
- var bottomRow = editor.renderer.getScrollBottomRow();
- var row = topRow + ((bottomRow - topRow) / 2);
- editor.moveCursorTo(row);
- },
- sel: function(editor) {
- var topRow = editor.renderer.getScrollTopRow();
- var bottomRow = editor.renderer.getScrollBottomRow();
- var row = topRow + ((bottomRow - topRow) / 2);
- editor.selection.selectTo(row);
- }
- },
- "L": {
- nav: function(editor) {
- var row = editor.renderer.getScrollBottomRow();
- editor.moveCursorTo(row);
- },
- sel: function(editor) {
- var row = editor.renderer.getScrollBottomRow();
- editor.selection.selectTo(row);
- }
- },
- "k": {
- nav: function(editor) {
- editor.navigateUp();
- },
- sel: function(editor) {
- editor.selection.selectUp();
- }
- },
- "j": {
- nav: function(editor) {
- editor.navigateDown();
- },
- sel: function(editor) {
- editor.selection.selectDown();
- }
- },
-
- "i": {
- param: true,
- sel: function(editor, range, count, param) {
- switch (param) {
- case "w":
- editor.selection.selectWord();
- break;
- case "W":
- editor.selection.selectAWord();
- break;
- case "(":
- case "{":
- case "[":
- var cursor = editor.getCursorPosition();
- var end = editor.session.$findClosingBracket(param, cursor, /paren/);
- if (!end)
- return;
- var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
- if (!start)
- return;
- start.column ++;
- editor.selection.setSelectionRange(Range.fromPoints(start, end));
- break;
- case "'":
- case '"':
- case "/":
- var end = find(editor, param, 1);
- if (!end)
- return;
- var start = find(editor, param, -1);
- if (!start)
- return;
- editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
- break;
- }
- }
- },
- "a": {
- param: true,
- sel: function(editor, range, count, param) {
- switch (param) {
- case "w":
- editor.selection.selectAWord();
- break;
- case "W":
- editor.selection.selectAWord();
- break;
- case "(":
- case "{":
- case "[":
- var cursor = editor.getCursorPosition();
- var end = editor.session.$findClosingBracket(param, cursor, /paren/);
- if (!end)
- return;
- var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
- if (!start)
- return;
- end.column ++;
- editor.selection.setSelectionRange(Range.fromPoints(start, end));
- break;
- case "'":
- case "\"":
- case "/":
- var end = find(editor, param, 1);
- if (!end)
- return;
- var start = find(editor, param, -1);
- if (!start)
- return;
- end.column ++;
- editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
- break;
- }
- }
- },
-
- "f": new Motion({
- param: true,
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel, isRepeat) {
- if (!isRepeat)
- LAST_SEARCH_MOTION = {ch: "f", param: param};
- var cursor = editor.getCursorPosition();
- var column = util.getRightNthChar(editor, cursor, param, count || 1);
-
- if (typeof column === "number") {
- cursor.column += column + (isSel ? 2 : 1);
- return cursor;
- }
- }
- }),
- "F": new Motion({
- param: true,
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel, isRepeat) {
- if (!isRepeat)
- LAST_SEARCH_MOTION = {ch: "F", param: param};
- var cursor = editor.getCursorPosition();
- var column = util.getLeftNthChar(editor, cursor, param, count || 1);
-
- if (typeof column === "number") {
- cursor.column -= column + 1;
- return cursor;
- }
- }
- }),
- "t": new Motion({
- param: true,
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel, isRepeat) {
- if (!isRepeat)
- LAST_SEARCH_MOTION = {ch: "t", param: param};
- var cursor = editor.getCursorPosition();
- var column = util.getRightNthChar(editor, cursor, param, count || 1);
-
- if (isRepeat && column == 0 && !(count > 1))
- var column = util.getRightNthChar(editor, cursor, param, 2);
-
- if (typeof column === "number") {
- cursor.column += column + (isSel ? 1 : 0);
- return cursor;
- }
- }
- }),
- "T": new Motion({
- param: true,
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel, isRepeat) {
- if (!isRepeat)
- LAST_SEARCH_MOTION = {ch: "T", param: param};
- var cursor = editor.getCursorPosition();
- var column = util.getLeftNthChar(editor, cursor, param, count || 1);
-
- if (isRepeat && column == 0 && !(count > 1))
- var column = util.getLeftNthChar(editor, cursor, param, 2);
-
- if (typeof column === "number") {
- cursor.column -= column;
- return cursor;
- }
- }
- }),
- ";": new Motion({
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel) {
- var ch = LAST_SEARCH_MOTION.ch;
- if (!ch)
- return;
- return module.exports[ch].getPos(
- editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
- );
- }
- }),
- ",": new Motion({
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel) {
- var ch = LAST_SEARCH_MOTION.ch;
- if (!ch)
- return;
- var up = ch.toUpperCase();
- ch = ch === up ? ch.toLowerCase() : up;
-
- return module.exports[ch].getPos(
- editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
- );
- }
- }),
-
- "^": {
- nav: function(editor) {
- editor.navigateLineStart();
- },
- sel: function(editor) {
- editor.selection.selectLineStart();
- }
- },
- "$": {
- handlesCount: true,
- nav: function(editor, range, count, param) {
- if (count > 1) {
- editor.navigateDown(count-1);
- }
- editor.navigateLineEnd();
- },
- sel: function(editor, range, count, param) {
- if (count > 1) {
- editor.selection.moveCursorBy(count-1, 0);
- }
- editor.selection.selectLineEnd();
- }
- },
- "0": new Motion(function(ed) {
- return {row: ed.selection.lead.row, column: 0};
- }),
- "G": {
- nav: function(editor, range, count, param) {
- if (!count && count !== 0) { // Stupid JS
- count = editor.session.getLength();
- }
- editor.gotoLine(count);
- },
- sel: function(editor, range, count, param) {
- if (!count && count !== 0) { // Stupid JS
- count = editor.session.getLength();
- }
- editor.selection.selectTo(count, 0);
- }
- },
- "g": {
- param: true,
- nav: function(editor, range, count, param) {
- switch(param) {
- case "m":
- console.log("Middle line");
- break;
- case "e":
- console.log("End of prev word");
- break;
- case "g":
- editor.gotoLine(count || 0);
- case "u":
- editor.gotoLine(count || 0);
- case "U":
- editor.gotoLine(count || 0);
- }
- },
- sel: function(editor, range, count, param) {
- switch(param) {
- case "m":
- console.log("Middle line");
- break;
- case "e":
- console.log("End of prev word");
- break;
- case "g":
- editor.selection.selectTo(count || 0, 0);
- }
- }
- },
- "o": {
- nav: function(editor, range, count, param) {
- count = count || 1;
- var content = "";
- while (0 < count--)
- content += "\n";
-
- if (content.length) {
- editor.navigateLineEnd()
- editor.insert(content);
- util.insertMode(editor);
- }
- }
- },
- "O": {
- nav: function(editor, range, count, param) {
- var row = editor.getCursorPosition().row;
- count = count || 1;
- var content = "";
- while (0 < count--)
- content += "\n";
-
- if (content.length) {
- if(row > 0) {
- editor.navigateUp();
- editor.navigateLineEnd()
- editor.insert(content);
- } else {
- editor.session.insert({row: 0, column: 0}, content);
- editor.navigateUp();
- }
- util.insertMode(editor);
- }
- }
- },
- "%": new Motion(function(editor){
- var brRe = /[\[\]{}()]/g;
- var cursor = editor.getCursorPosition();
- var ch = editor.session.getLine(cursor.row)[cursor.column];
- if (!brRe.test(ch)) {
- var range = find(editor, brRe);
- if (!range)
- return;
- cursor = range.start;
- }
- var match = editor.session.findMatchingBracket({
- row: cursor.row,
- column: cursor.column + 1
- });
-
- return match;
- }),
- "{": new Motion(function(ed) {
- var session = ed.session;
- var row = session.selection.lead.row;
- while(row > 0 && !/\S/.test(session.getLine(row)))
- row--;
- while(/\S/.test(session.getLine(row)))
- row--;
- return {column: 0, row: row};
- }),
- "}": new Motion(function(ed) {
- var session = ed.session;
- var l = session.getLength();
- var row = session.selection.lead.row;
- while(row < l && !/\S/.test(session.getLine(row)))
- row++;
- while(/\S/.test(session.getLine(row)))
- row++;
- return {column: 0, row: row};
- }),
- "ctrl-d": {
- nav: function(editor, range, count, param) {
- editor.selection.clearSelection();
- keepScrollPosition(editor, editor.gotoPageDown);
- },
- sel: function(editor, range, count, param) {
- keepScrollPosition(editor, editor.selectPageDown);
- }
- },
- "ctrl-u": {
- nav: function(editor, range, count, param) {
- editor.selection.clearSelection();
- keepScrollPosition(editor, editor.gotoPageUp);
- },
- sel: function(editor, range, count, param) {
- keepScrollPosition(editor, editor.selectPageUp);
- }
- },
- "`": new Motion({
- param: true,
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel) {
- var s = editor.session;
- var marker = s.vimMarkers && s.vimMarkers[param];
- if (marker) {
- return marker.getPosition();
- }
- }
- }),
- "'": new Motion({
- param: true,
- handlesCount: true,
- getPos: function(editor, range, count, param, isSel) {
- var s = editor.session;
- var marker = s.vimMarkers && s.vimMarkers[param];
- if (marker) {
- var pos = marker.getPosition();
- var line = editor.session.getLine(pos.row);
- pos.column = line.search(/\S/);
- if (pos.column == -1)
- pos.column = line.length;
- return pos;
- }
- }
- })
-};
-
-module.exports.backspace = module.exports.left = module.exports.h;
-module.exports.space = module.exports['return'] = module.exports.right = module.exports.l;
-module.exports.up = module.exports.k;
-module.exports.down = module.exports.j;
-module.exports.pagedown = module.exports["ctrl-d"];
-module.exports.pageup = module.exports["ctrl-u"];
-module.exports.home = module.exports["0"];
-module.exports.end = module.exports["$"];
-
-});
-
-define('ace/ext/themelist', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
-var themeData = [
- ["Chrome" ],
- ["Clouds" ],
- ["Crimson Editor" ],
- ["Dawn" ],
- ["Dreamweaver" ],
- ["Eclipse" ],
- ["GitHub" ],
- ["Solarized Light"],
- ["TextMate" ],
- ["Tomorrow" ],
- ["XCode" ],
- ["Kuroir"],
- ["KatzenMilch"],
- ["Ambiance" ,"ambiance" , "dark"],
- ["Chaos" ,"chaos" , "dark"],
- ["Clouds Midnight" ,"clouds_midnight" , "dark"],
- ["Cobalt" ,"cobalt" , "dark"],
- ["idle Fingers" ,"idle_fingers" , "dark"],
- ["krTheme" ,"kr_theme" , "dark"],
- ["Merbivore" ,"merbivore" , "dark"],
- ["Merbivore Soft" ,"merbivore_soft" , "dark"],
- ["Mono Industrial" ,"mono_industrial" , "dark"],
- ["Monokai" ,"monokai" , "dark"],
- ["Pastel on dark" ,"pastel_on_dark" , "dark"],
- ["Solarized Dark" ,"solarized_dark" , "dark"],
- ["Terminal" ,"terminal" , "dark"],
- ["Tomorrow Night" ,"tomorrow_night" , "dark"],
- ["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
- ["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
- ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
- ["Twilight" ,"twilight" , "dark"],
- ["Vibrant Ink" ,"vibrant_ink" , "dark"]
-];
-
-
-exports.themesByName = {};
-exports.themes = themeData.map(function(data) {
- var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
- var theme = {
- caption: data[0],
- theme: "ace/theme/" + name,
- isDark: data[2] == "dark",
- name: name
- };
- exports.themesByName[name] = theme;
- return theme;
-});
-
-});
-
-define('ace/keyboard/vim/maps/operators', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/registers'], function(require, exports, module) {
-
-
-
-var util = require("./util");
-var registers = require("../registers");
-
-module.exports = {
- "d": {
- selFn: function(editor, range, count, param) {
- registers._default.text = editor.getCopyText();
- registers._default.isLine = util.onVisualLineMode;
- if(util.onVisualLineMode)
- editor.removeLines();
- else
- editor.session.remove(range);
- util.normalMode(editor);
- },
- fn: function(editor, range, count, param) {
- count = count || 1;
- switch (param) {
- case "d":
- registers._default.text = "";
- registers._default.isLine = true;
- for (var i = 0; i < count; i++) {
- editor.selection.selectLine();
- registers._default.text += editor.getCopyText();
- var selRange = editor.getSelectionRange();
- if (!selRange.isMultiLine()) {
- var row = selRange.start.row - 1;
- var col = editor.session.getLine(row).length
- selRange.setStart(row, col);
- editor.session.remove(selRange);
- editor.selection.clearSelection();
- break;
- }
- editor.session.remove(selRange);
- editor.selection.clearSelection();
- }
- registers._default.text = registers._default.text.replace(/\n$/, "");
- break;
- default:
- if (range) {
- editor.selection.setSelectionRange(range);
- registers._default.text = editor.getCopyText();
- registers._default.isLine = false;
- editor.session.remove(range);
- editor.selection.clearSelection();
- }
- }
- }
- },
- "c": {
- selFn: function(editor, range, count, param) {
- editor.session.remove(range);
- util.insertMode(editor);
- },
- fn: function(editor, range, count, param) {
- count = count || 1;
- switch (param) {
- case "c":
- for (var i = 0; i < count; i++) {
- editor.removeLines();
- util.insertMode(editor);
- }
-
- break;
- default:
- if (range) {
- editor.session.remove(range);
- util.insertMode(editor);
- }
- }
- }
- },
- "y": {
- selFn: function(editor, range, count, param) {
- registers._default.text = editor.getCopyText();
- registers._default.isLine = util.onVisualLineMode;
- editor.selection.clearSelection();
- util.normalMode(editor);
- },
- fn: function(editor, range, count, param) {
- count = count || 1;
- switch (param) {
- case "y":
- var pos = editor.getCursorPosition();
- editor.selection.selectLine();
- for (var i = 0; i < count - 1; i++) {
- editor.selection.moveCursorDown();
- }
- registers._default.text = editor.getCopyText().replace(/\n$/, "");
- editor.selection.clearSelection();
- registers._default.isLine = true;
- editor.moveCursorToPosition(pos);
- break;
- default:
- if (range) {
- var pos = editor.getCursorPosition();
- editor.selection.setSelectionRange(range);
- registers._default.text = editor.getCopyText();
- registers._default.isLine = false;
- editor.selection.clearSelection();
- editor.moveCursorTo(pos.row, pos.column);
- }
- }
- }
- },
- ">": {
- selFn: function(editor, range, count, param) {
- count = count || 1;
- for (var i = 0; i < count; i++) {
- editor.indent();
- }
- util.normalMode(editor);
- },
- fn: function(editor, range, count, param) {
- count = parseInt(count || 1, 10);
- switch (param) {
- case ">":
- var pos = editor.getCursorPosition();
- editor.selection.selectLine();
- for (var i = 0; i < count - 1; i++) {
- editor.selection.moveCursorDown();
- }
- editor.indent();
- editor.selection.clearSelection();
- editor.moveCursorToPosition(pos);
- editor.navigateLineEnd();
- editor.navigateLineStart();
- break;
- }
- }
- },
- "<": {
- selFn: function(editor, range, count, param) {
- count = count || 1;
- for (var i = 0; i < count; i++) {
- editor.blockOutdent();
- }
- util.normalMode(editor);
- },
- fn: function(editor, range, count, param) {
- count = count || 1;
- switch (param) {
- case "<":
- var pos = editor.getCursorPosition();
- editor.selection.selectLine();
- for (var i = 0; i < count - 1; i++) {
- editor.selection.moveCursorDown();
- }
- editor.blockOutdent();
- editor.selection.clearSelection();
- editor.moveCursorToPosition(pos);
- editor.navigateLineEnd();
- editor.navigateLineStart();
- break;
- }
- }
- }
-};
-});
-
- define('kitchen-sink/doclist', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/undomanager', 'ace/lib/net', 'ace/ext/modelist'], function(require, exports, module) {
-
-
-var EditSession = require("ace/edit_session").EditSession;
-var UndoManager = require("ace/undomanager").UndoManager;
-var net = require("ace/lib/net");
-
-var modelist = require("ace/ext/modelist");
-var fileCache = {};
-
-function initDoc(file, path, doc) {
- if (doc.prepare)
- file = doc.prepare(file);
-
- var session = new EditSession(file);
- session.setUndoManager(new UndoManager());
- doc.session = session;
- doc.path = path;
- session.name = doc.name;
- if (doc.wrapped) {
- session.setUseWrapMode(true);
- session.setWrapLimitRange(80, 80);
- }
- var mode = modelist.getModeForPath(path);
- session.modeName = mode.name;
- session.setMode(mode.mode);
- return session;
-}
-
-
-function makeHuge(txt) {
- for (var i = 0; i < 5; i++)
- txt += txt;
- return txt;
-}
-
-var docs = {
- "docs/javascript.js": {order: 1, name: "JavaScript"},
-
- "docs/latex.tex": {name: "LaTeX", wrapped: true},
- "docs/markdown.md": {name: "Markdown", wrapped: true},
- "docs/mushcode.mc": {name: "MUSHCode", wrapped: true},
- "docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
- "docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
- "docs/sql.sql": {name: "SQL", wrapped: true},
-
- "docs/textile.textile": {name: "Textile", wrapped: true},
-
- "docs/c9search.c9search_results": "C9 Search Results",
- "docs/mel.mel": "MEL",
- "docs/Nix.nix": "Nix"
-};
-
-var ownSource = {
-};
-
-var hugeDocs = {
- "src/ace.js": "",
- "src-min/ace.js": ""
-};
-
-modelist.modes.forEach(function(m) {
- var ext = m.extensions.split("|")[0];
- if (ext[0] === "^") {
- path = ext.substr(1);
- } else {
- var path = m.name + "." + ext;
- }
- path = "docs/" + path;
- if (!docs[path]) {
- docs[path] = {name: m.caption};
- } else if (typeof docs[path] == "object" && !docs[path].name) {
- docs[path].name = m.caption;
- }
-});
-
-
-
-if (window.require && window.require.s) try {
- for (var path in window.require.s.contexts._.defined) {
- if (path.indexOf("!") != -1)
- path = path.split("!").pop();
- else
- path = path + ".js";
- ownSource[path] = "";
- }
-} catch(e) {}
-
-function sort(list) {
- return list.sort(function(a, b) {
- var cmp = (b.order || 0) - (a.order || 0);
- return cmp || a.name && a.name.localeCompare(b.name);
- });
-}
-
-function prepareDocList(docs) {
- var list = [];
- for (var path in docs) {
- var doc = docs[path];
- if (typeof doc != "object")
- doc = {name: doc || path};
-
- doc.path = path;
- doc.desc = doc.name.replace(/^(ace|docs|demo|build)\//, "");
- if (doc.desc.length > 18)
- doc.desc = doc.desc.slice(0, 7) + ".." + doc.desc.slice(-9);
-
- fileCache[doc.name] = doc;
- list.push(doc);
- }
-
- return list;
-}
-
-function loadDoc(name, callback) {
- var doc = fileCache[name];
- if (!doc)
- return callback(null);
-
- if (doc.session)
- return callback(doc.session);
- var path = doc.path;
- var parts = path.split("/");
- if (parts[0] == "docs")
- path = "kitchen-sink/" + path;
- else if (parts[0] == "ace")
- path = "lib/" + path;
-
- net.get(path, function(x) {
- initDoc(x, path, doc);
- callback(doc.session);
- });
-}
-
-module.exports = {
- fileCache: fileCache,
- docs: sort(prepareDocList(docs)),
- ownSource: prepareDocList(ownSource),
- hugeDocs: prepareDocList(hugeDocs),
- initDoc: initDoc,
- loadDoc: loadDoc
-};
-module.exports.all = {
- "Mode Examples": module.exports.docs,
- "Huge documents": module.exports.hugeDocs,
- "own source": module.exports.ownSource
-};
-
-});
-
-"use strict"
-
-define('ace/keyboard/vim/maps/aliases', ['require', 'exports', 'module' ], function(require, exports, module) {
-module.exports = {
- "x": {
- operator: {
- ch: "d",
- count: 1
- },
- motion: {
- ch: "l",
- count: 1
- }
- },
- "X": {
- operator: {
- ch: "d",
- count: 1
- },
- motion: {
- ch: "h",
- count: 1
- }
- },
- "D": {
- operator: {
- ch: "d",
- count: 1
- },
- motion: {
- ch: "$",
- count: 1
- }
- },
- "C": {
- operator: {
- ch: "c",
- count: 1
- },
- motion: {
- ch: "$",
- count: 1
- }
- },
- "s": {
- operator: {
- ch: "c",
- count: 1
- },
- motion: {
- ch: "l",
- count: 1
- }
- },
- "S": {
- operator: {
- ch: "c",
- count: 1
- },
- param: "c"
- }
-};
-});
-
-define('ace/ext/whitespace', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
-
-
-var lang = require("../lib/lang");
-exports.$detectIndentation = function(lines, fallback) {
- var stats = [];
- var changes = [];
- var tabIndents = 0;
- var prevSpaces = 0;
- var max = Math.min(lines.length, 1000);
- for (var i = 0; i < max; i++) {
- var line = lines[i];
- if (!/^\s*[^*+\-\s]/.test(line))
- continue;
-
- var tabs = line.match(/^\t*/)[0].length;
- if (line[0] == "\t")
- tabIndents++;
-
- var spaces = line.match(/^ */)[0].length;
- if (spaces && line[spaces] != "\t") {
- var diff = spaces - prevSpaces;
- if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
- changes[diff] = (changes[diff] || 0) + 1;
-
- stats[spaces] = (stats[spaces] || 0) + 1;
- }
- prevSpaces = spaces;
- while (i < max && line[line.length - 1] == "\\")
- line = lines[i++];
- }
-
- if (!stats.length)
- return;
-
- function getScore(indent) {
- var score = 0;
- for (var i = indent; i < stats.length; i += indent)
- score += stats[i] || 0;
- return score;
- }
-
- var changesTotal = changes.reduce(function(a,b){return a+b}, 0);
-
- var first = {score: 0, length: 0};
- var spaceIndents = 0;
- for (var i = 1; i < 12; i++) {
- if (i == 1) {
- spaceIndents = getScore(i);
- var score = 1;
- } else
- var score = getScore(i) / spaceIndents;
-
- if (changes[i]) {
- score += changes[i] / changesTotal;
- }
-
- if (score > first.score)
- first = {score: score, length: i};
- }
-
- if (first.score && first.score > 1.4)
- var tabLength = first.length;
-
- if (tabIndents > spaceIndents + 1)
- return {ch: "\t", length: tabLength};
-
- if (spaceIndents + 1 > tabIndents)
- return {ch: " ", length: tabLength};
-};
-
-exports.detectIndentation = function(session) {
- var lines = session.getLines(0, 1000);
- var indent = exports.$detectIndentation(lines) || {};
-
- if (indent.ch)
- session.setUseSoftTabs(indent.ch == " ");
-
- if (indent.length)
- session.setTabSize(indent.length);
- return indent;
-};
-
-exports.trimTrailingSpace = function(session, trimEmpty) {
- var doc = session.getDocument();
- var lines = doc.getAllLines();
-
- var min = trimEmpty ? -1 : 0;
-
- for (var i = 0, l=lines.length; i < l; i++) {
- var line = lines[i];
- var index = line.search(/\s+$/);
-
- if (index > min)
- doc.removeInLine(i, index, line.length);
- }
-};
-
-exports.convertIndentation = function(session, ch, len) {
- var oldCh = session.getTabString()[0];
- var oldLen = session.getTabSize();
- if (!len) len = oldLen;
- if (!ch) ch = oldCh;
-
- var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len);
-
- var doc = session.doc;
- var lines = doc.getAllLines();
-
- var cache = {};
- var spaceCache = {};
- for (var i = 0, l=lines.length; i < l; i++) {
- var line = lines[i];
- var match = line.match(/^\s*/)[0];
- if (match) {
- var w = session.$getStringScreenWidth(match)[0];
- var tabCount = Math.floor(w/oldLen);
- var reminder = w%oldLen;
- var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));
- toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder));
-
- if (toInsert != match) {
- doc.removeInLine(i, 0, match.length);
- doc.insertInLine({row: i, column: 0}, toInsert);
- }
- }
- }
- session.setTabSize(len);
- session.setUseSoftTabs(ch == " ");
-};
-
-exports.$parseStringArg = function(text) {
- var indent = {};
- if (/t/.test(text))
- indent.ch = "\t";
- else if (/s/.test(text))
- indent.ch = " ";
- var m = text.match(/\d+/);
- if (m)
- indent.length = parseInt(m[0], 10);
- return indent;
-};
-
-exports.$parseArg = function(arg) {
- if (!arg)
- return {};
- if (typeof arg == "string")
- return exports.$parseStringArg(arg);
- if (typeof arg.text == "string")
- return exports.$parseStringArg(arg.text);
- return arg;
-};
-
-exports.commands = [{
- name: "detectIndentation",
- exec: function(editor) {
- exports.detectIndentation(editor.session);
- }
-}, {
- name: "trimTrailingSpace",
- exec: function(editor) {
- exports.trimTrailingSpace(editor.session);
- }
-}, {
- name: "convertIndentation",
- exec: function(editor, arg) {
- var indent = exports.$parseArg(arg);
- exports.convertIndentation(editor.session, indent.ch, indent.length);
- }
-}, {
- name: "setIndentation",
- exec: function(editor, arg) {
- var indent = exports.$parseArg(arg);
- indent.length && editor.session.setTabSize(indent.length);
- indent.ch && editor.session.setUseSoftTabs(indent.ch == " ");
- }
-}];
-
-});
-define('ace/ext/statusbar', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang'], function(require, exports, module) {
-var dom = require("ace/lib/dom");
-var lang = require("ace/lib/lang");
-
-var StatusBar = function(editor, parentNode) {
- this.element = dom.createElement("div");
- this.element.className = "ace_status-indicator";
- this.element.style.cssText = "display: inline-block;";
- parentNode.appendChild(this.element);
-
- var statusUpdate = lang.delayedCall(function(){
- this.updateStatus(editor)
- }.bind(this));
- editor.on("changeStatus", function() {
- statusUpdate.schedule(100);
- });
- editor.on("changeSelection", function() {
- statusUpdate.schedule(100);
- });
-};
-
-(function(){
- this.updateStatus = function(editor) {
- var status = [];
- function add(str, separator) {
- str && status.push(str, separator || "|");
- }
-
- if (editor.$vimModeHandler)
- add(editor.$vimModeHandler.getStatusText());
- else if (editor.commands.recording)
- add("REC");
-
- var c = editor.selection.lead;
- add(c.row + ":" + c.column, " ");
- if (!editor.selection.isEmpty()) {
- var r = editor.getSelectionRange();
- add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")");
- }
- status.pop();
- this.element.textContent = status.join("");
- };
-}).call(StatusBar.prototype);
-
-exports.StatusBar = StatusBar;
-
-});
-
-define('ace/ext/emmet', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler', 'ace/editor', 'ace/snippets', 'ace/range', 'ace/config'], function(require, exports, module) {
-
-var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
-var Editor = require("ace/editor").Editor;
-var snippetManager = require("ace/snippets").snippetManager;
-var Range = require("ace/range").Range;
-var emmet;
-
-Editor.prototype.indexToPosition = function(index) {
- return this.session.doc.indexToPosition(index);
-};
-
-Editor.prototype.positionToIndex = function(pos) {
- return this.session.doc.positionToIndex(pos);
-};
-function AceEmmetEditor() {}
-
-AceEmmetEditor.prototype = {
- setupContext: function(editor) {
- this.ace = editor;
- this.indentation = editor.session.getTabString();
- if (!emmet)
- emmet = window.emmet;
- emmet.require("resources").setVariable("indentation", this.indentation);
- this.$syntax = null;
- this.$syntax = this.getSyntax();
- },
- getSelectionRange: function() {
- var range = this.ace.getSelectionRange();
- return {
- start: this.ace.positionToIndex(range.start),
- end: this.ace.positionToIndex(range.end)
- };
- },
- createSelection: function(start, end) {
- this.ace.selection.setRange({
- start: this.ace.indexToPosition(start),
- end: this.ace.indexToPosition(end)
- });
- },
- getCurrentLineRange: function() {
- var row = this.ace.getCursorPosition().row;
- var lineLength = this.ace.session.getLine(row).length;
- var index = this.ace.positionToIndex({row: row, column: 0});
- return {
- start: index,
- end: index + lineLength
- };
- },
- getCaretPos: function(){
- var pos = this.ace.getCursorPosition();
- return this.ace.positionToIndex(pos);
- },
- setCaretPos: function(index){
- var pos = this.ace.indexToPosition(index);
- this.ace.selection.moveToPosition(pos);
- },
- getCurrentLine: function() {
- var row = this.ace.getCursorPosition().row;
- return this.ace.session.getLine(row);
- },
- replaceContent: function(value, start, end, noIndent) {
- if (end == null)
- end = start == null ? this.getContent().length : start;
- if (start == null)
- start = 0;
-
- var editor = this.ace;
- var range = Range.fromPoints(editor.indexToPosition(start), editor.indexToPosition(end));
- editor.session.remove(range);
-
- range.end = range.start;
-
- value = this.$updateTabstops(value);
- snippetManager.insertSnippet(editor, value)
- },
- getContent: function(){
- return this.ace.getValue();
- },
- getSyntax: function() {
- if (this.$syntax)
- return this.$syntax;
- var syntax = this.ace.session.$modeId.split("/").pop();
- if (syntax == "html" || syntax == "php") {
- var cursor = this.ace.getCursorPosition();
- var state = this.ace.session.getState(cursor.row);
- if (typeof state != "string")
- state = state[0];
- if (state) {
- state = state.split("-");
- if (state.length > 1)
- syntax = state[0];
- else if (syntax == "php")
- syntax = "html";
- }
- }
- return syntax;
- },
- getProfileName: function() {
- switch(this.getSyntax()) {
- case "css": return "css";
- case "xml":
- case "xsl":
- return "xml";
- case "html":
- var profile = emmet.require("resources").getVariable("profile");
- if (!profile)
- profile = this.ace.session.getLines(0,2).join("").search(/]+XHTML/i) != -1 ? "xhtml": "html";
- return profile;
- }
- return "xhtml";
- },
- prompt: function(title) {
- return prompt(title);
- },
- getSelection: function() {
- return this.ace.session.getTextRange();
- },
- getFilePath: function() {
- return "";
- },
- $updateTabstops: function(value) {
- var base = 1000;
- var zeroBase = 0;
- var lastZero = null;
- var range = emmet.require('range');
- var ts = emmet.require('tabStops');
- var settings = emmet.require('resources').getVocabulary("user");
- var tabstopOptions = {
- tabstop: function(data) {
- var group = parseInt(data.group, 10);
- var isZero = group === 0;
- if (isZero)
- group = ++zeroBase;
- else
- group += base;
-
- var placeholder = data.placeholder;
- if (placeholder) {
- placeholder = ts.processText(placeholder, tabstopOptions);
- }
-
- var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}';
-
- if (isZero) {
- lastZero = range.create(data.start, result);
- }
-
- return result
- },
- escape: function(ch) {
- if (ch == '$') return '\\$';
- if (ch == '\\') return '\\\\';
- return ch;
- }
- };
-
- value = ts.processText(value, tabstopOptions);
-
- if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) {
- value += '${0}';
- } else if (lastZero) {
- value = emmet.require('utils').replaceSubstring(value, '${0}', lastZero);
- }
-
- return value;
- }
-};
-
-
-var keymap = {
- expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"},
- match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"},
- match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"},
- matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"},
- next_edit_point: "alt+right",
- prev_edit_point: "alt+left",
- toggle_comment: {"mac": "command+/", "win": "ctrl+/"},
- split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"},
- remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"},
- evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"},
- increment_number_by_1: "ctrl+up",
- decrement_number_by_1: "ctrl+down",
- increment_number_by_01: "alt+up",
- decrement_number_by_01: "alt+down",
- increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"},
- decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"},
- select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."},
- select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"},
- reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"},
-
- encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"},
- expand_abbreviation_with_tab: "Tab",
- wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"}
-};
-
-var editorProxy = new AceEmmetEditor();
-exports.commands = new HashHandler();
-exports.runEmmetCommand = function(editor) {
- editorProxy.setupContext(editor);
- if (editorProxy.getSyntax() == "php")
- return false;
- var actions = emmet.require("actions");
-
- if (this.action == "expand_abbreviation_with_tab") {
- if (!editor.selection.isEmpty())
- return false;
- }
-
- if (this.action == "wrap_with_abbreviation") {
- return setTimeout(function() {
- actions.run("wrap_with_abbreviation", editorProxy);
- }, 0);
- }
-
- try {
- var result = actions.run(this.action, editorProxy);
- } catch(e) {
- editor._signal("changeStatus", typeof e == "string" ? e : e.message);
- console.log(e);
- }
- return result;
-};
-
-for (var command in keymap) {
- exports.commands.addCommand({
- name: "emmet:" + command,
- action: command,
- bindKey: keymap[command],
- exec: exports.runEmmetCommand,
- multiSelectAction: "forEach"
- });
-}
-
-var onChangeMode = function(e, target) {
- var editor = target;
- if (!editor)
- return;
- var modeId = editor.session.$modeId;
- var enabled = modeId && /css|less|scss|sass|stylus|html|php/.test(modeId);
- if (e.enableEmmet === false)
- enabled = false;
- if (enabled)
- editor.keyBinding.addKeyboardHandler(exports.commands);
- else
- editor.keyBinding.removeKeyboardHandler(exports.commands);
-};
-
-
-exports.AceEmmetEditor = AceEmmetEditor;
-require("ace/config").defineOptions(Editor.prototype, "editor", {
- enableEmmet: {
- set: function(val) {
- this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
- onChangeMode({enableEmmet: !!val}, this);
- },
- value: true
- }
-});
-
-
-exports.setCore = function(e) {emmet = e;};
-});
-
-define('ace/theme/textmate', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
-
-
-exports.isDark = false;
-exports.cssClass = "ace-tm";
-exports.cssText = ".ace-tm .ace_gutter {\
-background: #f0f0f0;\
-color: #333;\
-}\
-.ace-tm .ace_print-margin {\
-width: 1px;\
-background: #e8e8e8;\
-}\
-.ace-tm .ace_fold {\
-background-color: #6B72E6;\
-}\
-.ace-tm {\
-background-color: #FFFFFF;\
-color: black;\
-}\
-.ace-tm .ace_cursor {\
-color: black;\
-}\
-.ace-tm .ace_invisible {\
-color: rgb(191, 191, 191);\
-}\
-.ace-tm .ace_storage,\
-.ace-tm .ace_keyword {\
-color: blue;\
-}\
-.ace-tm .ace_constant {\
-color: rgb(197, 6, 11);\
-}\
-.ace-tm .ace_constant.ace_buildin {\
-color: rgb(88, 72, 246);\
-}\
-.ace-tm .ace_constant.ace_language {\
-color: rgb(88, 92, 246);\
-}\
-.ace-tm .ace_constant.ace_library {\
-color: rgb(6, 150, 14);\
-}\
-.ace-tm .ace_invalid {\
-background-color: rgba(255, 0, 0, 0.1);\
-color: red;\
-}\
-.ace-tm .ace_support.ace_function {\
-color: rgb(60, 76, 114);\
-}\
-.ace-tm .ace_support.ace_constant {\
-color: rgb(6, 150, 14);\
-}\
-.ace-tm .ace_support.ace_type,\
-.ace-tm .ace_support.ace_class {\
-color: rgb(109, 121, 222);\
-}\
-.ace-tm .ace_keyword.ace_operator {\
-color: rgb(104, 118, 135);\
-}\
-.ace-tm .ace_string {\
-color: rgb(3, 106, 7);\
-}\
-.ace-tm .ace_comment {\
-color: rgb(76, 136, 107);\
-}\
-.ace-tm .ace_comment.ace_doc {\
-color: rgb(0, 102, 255);\
-}\
-.ace-tm .ace_comment.ace_doc.ace_tag {\
-color: rgb(128, 159, 191);\
-}\
-.ace-tm .ace_constant.ace_numeric {\
-color: rgb(0, 0, 205);\
-}\
-.ace-tm .ace_variable {\
-color: rgb(49, 132, 149);\
-}\
-.ace-tm .ace_xml-pe {\
-color: rgb(104, 104, 91);\
-}\
-.ace-tm .ace_entity.ace_name.ace_function {\
-color: #0000A2;\
-}\
-.ace-tm .ace_heading {\
-color: rgb(12, 7, 255);\
-}\
-.ace-tm .ace_list {\
-color:rgb(185, 6, 144);\
-}\
-.ace-tm .ace_meta.ace_tag {\
-color:rgb(0, 22, 142);\
-}\
-.ace-tm .ace_string.ace_regex {\
-color: rgb(255, 0, 0)\
-}\
-.ace-tm .ace_marker-layer .ace_selection {\
-background: rgb(181, 213, 255);\
-}\
-.ace-tm.ace_multiselect .ace_selection.ace_start {\
-box-shadow: 0 0 3px 0px white;\
-border-radius: 2px;\
-}\
-.ace-tm .ace_marker-layer .ace_step {\
-background: rgb(252, 255, 0);\
-}\
-.ace-tm .ace_marker-layer .ace_stack {\
-background: rgb(164, 229, 101);\
-}\
-.ace-tm .ace_marker-layer .ace_bracket {\
-margin: -1px 0 0 -1px;\
-border: 1px solid rgb(192, 192, 192);\
-}\
-.ace-tm .ace_marker-layer .ace_active-line {\
-background: rgba(0, 0, 0, 0.07);\
-}\
-.ace-tm .ace_gutter-active-line {\
-background-color : #dcdcdc;\
-}\
-.ace-tm .ace_marker-layer .ace_selected-word {\
-background: rgb(250, 250, 255);\
-border: 1px solid rgb(200, 200, 250);\
-}\
-.ace-tm .ace_indent-guide {\
-background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
-}\
-";
-
-var dom = require("../lib/dom");
-dom.importCssString(exports.cssText, exports.cssClass);
-});
-
-define('ace/snippets', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/range', 'ace/keyboard/hash_handler', 'ace/tokenizer', 'ace/lib/dom'], function(require, exports, module) {
-
-var lang = require("./lib/lang")
-var Range = require("./range").Range
-var HashHandler = require("./keyboard/hash_handler").HashHandler;
-var Tokenizer = require("./tokenizer").Tokenizer;
-var comparePoints = Range.comparePoints;
-
-var SnippetManager = function() {
- this.snippetMap = {};
- this.snippetNameMap = {};
-};
-
-(function() {
- this.getTokenizer = function() {
- function TabstopToken(str, _, stack) {
- str = str.substr(1);
- if (/^\d+$/.test(str) && !stack.inFormatString)
- return [{tabstopId: parseInt(str, 10)}];
- return [{text: str}]
- }
- function escape(ch) {
- return "(?:[^\\\\" + ch + "]|\\\\.)";
- }
- SnippetManager.$tokenizer = new Tokenizer({
- start: [
- {regex: /:/, onMatch: function(val, state, stack) {
- if (stack.length && stack[0].expectIf) {
- stack[0].expectIf = false;
- stack[0].elseBranch = stack[0];
- return [stack[0]];
- }
- return ":";
- }},
- {regex: /\\./, onMatch: function(val, state, stack) {
- var ch = val[1];
- if (ch == "}" && stack.length) {
- val = ch;
- }else if ("`$\\".indexOf(ch) != -1) {
- val = ch;
- } else if (stack.inFormatString) {
- if (ch == "n")
- val = "\n";
- else if (ch == "t")
- val = "\n";
- else if ("ulULE".indexOf(ch) != -1) {
- val = {changeCase: ch, local: ch > "a"};
- }
- }
-
- return [val];
- }},
- {regex: /}/, onMatch: function(val, state, stack) {
- return [stack.length ? stack.shift() : val];
- }},
- {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
- {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
- var t = TabstopToken(str.substr(1), state, stack);
- stack.unshift(t[0]);
- return t;
- }, next: "snippetVar"},
- {regex: /\n/, token: "newline", merge: false}
- ],
- snippetVar: [
- {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
- stack[0].choices = val.slice(1, -1).split(",");
- }, next: "start"},
- {regex: "/(" + escape("/") + "+)/(?:(" + escape("/") + "*)/)(\\w*):?",
- onMatch: function(val, state, stack) {
- var ts = stack[0];
- ts.fmtString = val;
-
- val = this.splitRegex.exec(val);
- ts.guard = val[1];
- ts.fmt = val[2];
- ts.flag = val[3];
- return "";
- }, next: "start"},
- {regex: "`" + escape("`") + "*`", onMatch: function(val, state, stack) {
- stack[0].code = val.splice(1, -1);
- return "";
- }, next: "start"},
- {regex: "\\?", onMatch: function(val, state, stack) {
- if (stack[0])
- stack[0].expectIf = true;
- }, next: "start"},
- {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
- ],
- formatString: [
- {regex: "/(" + escape("/") + "+)/", token: "regex"},
- {regex: "", onMatch: function(val, state, stack) {
- stack.inFormatString = true;
- }, next: "start"}
- ]
- });
- SnippetManager.prototype.getTokenizer = function() {
- return SnippetManager.$tokenizer;
- }
- return SnippetManager.$tokenizer;
- };
-
- this.tokenizeTmSnippet = function(str, startState) {
- return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
- return x.value || x;
- });
- };
-
- this.$getDefaultValue = function(editor, name) {
- if (/^[A-Z]\d+$/.test(name)) {
- var i = name.substr(1);
- return (this.variables[name[0] + "__"] || {})[i];
- }
- if (/^\d+$/.test(name)) {
- return (this.variables.__ || {})[name];
- }
- name = name.replace(/^TM_/, "");
-
- if (!editor)
- return;
- var s = editor.session;
- switch(name) {
- case "CURRENT_WORD":
- var r = s.getWordRange();
- case "SELECTION":
- case "SELECTED_TEXT":
- return s.getTextRange(r);
- case "CURRENT_LINE":
- return s.getLine(editor.getCursorPosition().row);
- case "PREV_LINE": // not possible in textmate
- return s.getLine(editor.getCursorPosition().row - 1);
- case "LINE_INDEX":
- return editor.getCursorPosition().column;
- case "LINE_NUMBER":
- return editor.getCursorPosition().row + 1;
- case "SOFT_TABS":
- return s.getUseSoftTabs() ? "YES" : "NO";
- case "TAB_SIZE":
- return s.getTabSize();
- case "FILENAME":
- case "FILEPATH":
- return "";
- case "FULLNAME":
- return "Ace";
- }
- };
- this.variables = {};
- this.getVariableValue = function(editor, varName) {
- if (this.variables.hasOwnProperty(varName))
- return this.variables[varName](editor, varName) || "";
- return this.$getDefaultValue(editor, varName) || "";
- };
- this.tmStrFormat = function(str, ch, editor) {
- var flag = ch.flag || "";
- var re = ch.guard;
- re = new RegExp(re, flag.replace(/[^gi]/, ""));
- var fmtTokens = this.tokenizeTmSnippet(ch.fmt, "formatString");
- var _self = this;
- var formatted = str.replace(re, function() {
- _self.variables.__ = arguments;
- var fmtParts = _self.resolveVariables(fmtTokens, editor);
- var gChangeCase = "E";
- for (var i = 0; i < fmtParts.length; i++) {
- var ch = fmtParts[i];
- if (typeof ch == "object") {
- fmtParts[i] = "";
- if (ch.changeCase && ch.local) {
- var next = fmtParts[i + 1];
- if (next && typeof next == "string") {
- if (ch.changeCase == "u")
- fmtParts[i] = next[0].toUpperCase();
- else
- fmtParts[i] = next[0].toLowerCase();
- fmtParts[i + 1] = next.substr(1);
- }
- } else if (ch.changeCase) {
- gChangeCase = ch.changeCase;
- }
- } else if (gChangeCase == "U") {
- fmtParts[i] = ch.toUpperCase();
- } else if (gChangeCase == "L") {
- fmtParts[i] = ch.toLowerCase();
- }
- }
- return fmtParts.join("");
- });
- this.variables.__ = null;
- return formatted;
- };
-
- this.resolveVariables = function(snippet, editor) {
- var result = [];
- for (var i = 0; i < snippet.length; i++) {
- var ch = snippet[i];
- if (typeof ch == "string") {
- result.push(ch);
- } else if (typeof ch != "object") {
- continue;
- } else if (ch.skip) {
- gotoNext(ch);
- } else if (ch.processed < i) {
- continue;
- } else if (ch.text) {
- var value = this.getVariableValue(editor, ch.text);
- if (value && ch.fmtString)
- value = this.tmStrFormat(value, ch);
- ch.processed = i;
- if (ch.expectIf == null) {
- if (value) {
- result.push(value);
- gotoNext(ch);
- }
- } else {
- if (value) {
- ch.skip = ch.elseBranch;
- } else
- gotoNext(ch);
- }
- } else if (ch.tabstopId != null) {
- result.push(ch);
- } else if (ch.changeCase != null) {
- result.push(ch);
- }
- }
- function gotoNext(ch) {
- var i1 = snippet.indexOf(ch, i + 1);
- if (i1 != -1)
- i = i1;
- }
- return result;
- };
-
- this.insertSnippet = function(editor, snippetText) {
- var cursor = editor.getCursorPosition();
- var line = editor.session.getLine(cursor.row);
- var indentString = line.match(/^\s*/)[0];
- var tabString = editor.session.getTabString();
-
- var tokens = this.tokenizeTmSnippet(snippetText);
- tokens = this.resolveVariables(tokens, editor);
- tokens = tokens.map(function(x) {
- if (x == "\n")
- return x + indentString;
- if (typeof x == "string")
- return x.replace(/\t/g, tabString);
- return x;
- });
- var tabstops = [];
- tokens.forEach(function(p, i) {
- if (typeof p != "object")
- return;
- var id = p.tabstopId;
- var ts = tabstops[id];
- if (!ts) {
- ts = tabstops[id] = [];
- ts.index = id;
- ts.value = "";
- }
- if (ts.indexOf(p) !== -1)
- return;
- ts.push(p);
- var i1 = tokens.indexOf(p, i + 1);
- if (i1 === -1)
- return;
-
- var value = tokens.slice(i + 1, i1);
- var isNested = value.some(function(t) {return typeof t === "object"});
- if (isNested && !ts.value) {
- ts.value = value;
- } else if (value.length && (!ts.value || typeof ts.value !== "string")) {
- ts.value = value.join("");
- }
- });
- tabstops.forEach(function(ts) {ts.length = 0});
- var expanding = {};
- function copyValue(val) {
- var copy = []
- for (var i = 0; i < val.length; i++) {
- var p = val[i];
- if (typeof p == "object") {
- if (expanding[p.tabstopId])
- continue;
- var j = val.lastIndexOf(p, i - 1);
- p = copy[j] || {tabstopId: p.tabstopId};
- }
- copy[i] = p;
- }
- return copy;
- }
- for (var i = 0; i < tokens.length; i++) {
- var p = tokens[i];
- if (typeof p != "object")
- continue;
- var id = p.tabstopId;
- var i1 = tokens.indexOf(p, i + 1);
- if (expanding[id]) {
- if (expanding[id] === p)
- expanding[id] = null;
- continue;
- }
-
- var ts = tabstops[id];
- var arg = typeof ts.value == "string" ? [ts.value] : copyValue(ts.value);
- arg.unshift(i + 1, Math.max(0, i1 - i));
- arg.push(p);
- expanding[id] = p;
- tokens.splice.apply(tokens, arg);
-
- if (ts.indexOf(p) === -1)
- ts.push(p);
- };
- var row = 0, column = 0;
- var text = "";
- tokens.forEach(function(t) {
- if (typeof t === "string") {
- if (t[0] === "\n"){
- column = t.length - 1;
- row ++;
- } else
- column += t.length;
- text += t;
- } else {
- if (!t.start)
- t.start = {row: row, column: column};
- else
- t.end = {row: row, column: column};
- }
- });
- var range = editor.getSelectionRange();
- var end = editor.session.replace(range, text);
-
- var tabstopManager = new TabstopManager(editor);
- tabstopManager.addTabstops(tabstops, range.start, end);
- tabstopManager.tabNext();
- };
-
- this.$getScope = function(editor) {
- var scope = editor.session.$mode.$id || "";
- scope = scope.split("/").pop();
- if (scope === "html" || scope === "php") {
- if (scope === "php")
- scope = "html";
- var c = editor.getCursorPosition()
- var state = editor.session.getState(c.row);
- if (typeof state === "object") {
- state = state[0];
- }
- if (state.substring) {
- if (state.substring(0, 3) == "js-")
- scope = "javascript";
- else if (state.substring(0, 4) == "css-")
- scope = "css";
- else if (state.substring(0, 4) == "php-")
- scope = "php";
- }
- }
-
- return scope;
- };
-
- this.getActiveScopes = function(editor) {
- var scope = this.$getScope(editor);
- var scopes = [scope];
- var snippetMap = this.snippetMap;
- if (snippetMap[scope] && snippetMap[scope].includeScopes) {
- scopes.push.apply(scopes, snippetMap[scope].includeScopes);
- }
- scopes.push("_");
- return scopes;
- };
-
- this.expandWithTab = function(editor) {
- var cursor = editor.getCursorPosition();
- var line = editor.session.getLine(cursor.row);
- var before = line.substring(0, cursor.column);
- var after = line.substr(cursor.column);
-
- var snippetMap = this.snippetMap;
- var snippet;
- this.getActiveScopes(editor).some(function(scope) {
- var snippets = snippetMap[scope];
- if (snippets)
- snippet = this.findMatchingSnippet(snippets, before, after);
- return !!snippet;
- }, this);
- if (!snippet)
- return false;
-
- editor.session.doc.removeInLine(cursor.row,
- cursor.column - snippet.replaceBefore.length,
- cursor.column + snippet.replaceAfter.length
- );
-
- this.variables.M__ = snippet.matchBefore;
- this.variables.T__ = snippet.matchAfter;
- this.insertSnippet(editor, snippet.content);
-
- this.variables.M__ = this.variables.T__ = null;
- return true;
- };
-
- this.findMatchingSnippet = function(snippetList, before, after) {
- for (var i = snippetList.length; i--;) {
- var s = snippetList[i];
- if (s.startRe && !s.startRe.test(before))
- continue;
- if (s.endRe && !s.endRe.test(after))
- continue;
- if (!s.startRe && !s.endRe)
- continue;
-
- s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
- s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
- s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
- s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
- return s;
- }
- };
-
- this.snippetMap = {};
- this.snippetNameMap = {};
- this.register = function(snippets, scope) {
- var snippetMap = this.snippetMap;
- var snippetNameMap = this.snippetNameMap;
- var self = this;
- function wrapRegexp(src) {
- if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
- src = "(?:" + src + ")"
-
- return src || "";
- }
- function guardedRegexp(re, guard, opening) {
- re = wrapRegexp(re);
- guard = wrapRegexp(guard);
- if (opening) {
- re = guard + re;
- if (re && re[re.length - 1] != "$")
- re = re + "$";
- } else {
- re = re + guard;
- if (re && re[0] != "^")
- re = "^" + re;
- }
- return new RegExp(re);
- }
-
- function addSnippet(s) {
- if (!s.scope)
- s.scope = scope || "_";
- scope = s.scope
- if (!snippetMap[scope]) {
- snippetMap[scope] = [];
- snippetNameMap[scope] = {};
- }
-
- var map = snippetNameMap[scope];
- if (s.name) {
- var old = map[s.name];
- if (old)
- self.unregister(old);
- map[s.name] = s;
- }
- snippetMap[scope].push(s);
-
- if (s.tabTrigger && !s.trigger) {
- if (!s.guard && /^\w/.test(s.tabTrigger))
- s.guard = "\\b";
- s.trigger = lang.escapeRegExp(s.tabTrigger);
- }
-
- s.startRe = guardedRegexp(s.trigger, s.guard, true);
- s.triggerRe = new RegExp(s.trigger, "", true);
-
- s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
- s.endTriggerRe = new RegExp(s.endTrigger, "", true);
- };
-
- if (snippets.content)
- addSnippet(snippets);
- else if (Array.isArray(snippets))
- snippets.forEach(addSnippet);
- };
- this.unregister = function(snippets, scope) {
- var snippetMap = this.snippetMap;
- var snippetNameMap = this.snippetNameMap;
-
- function removeSnippet(s) {
- var nameMap = snippetNameMap[s.scope||scope];
- if (nameMap && nameMap[s.name]) {
- delete nameMap[s.name];
- var map = snippetMap[s.scope||scope];
- var i = map && map.indexOf(s);
- if (i >= 0)
- map.splice(i, 1);
- }
- }
- if (snippets.content)
- removeSnippet(snippets);
- else if (Array.isArray(snippets))
- snippets.forEach(removeSnippet);
- };
- this.parseSnippetFile = function(str) {
- str = str.replace(/\r/g, "");
- var list = [], snippet = {};
- var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
- var m;
- while (m = re.exec(str)) {
- if (m[1]) {
- try {
- snippet = JSON.parse(m[1])
- list.push(snippet);
- } catch (e) {}
- } if (m[4]) {
- snippet.content = m[4].replace(/^\t/gm, "");
- list.push(snippet);
- snippet = {};
- } else {
- var key = m[2], val = m[3];
- if (key == "regex") {
- var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
- snippet.guard = guardRe.exec(val)[1];
- snippet.trigger = guardRe.exec(val)[1];
- snippet.endTrigger = guardRe.exec(val)[1];
- snippet.endGuard = guardRe.exec(val)[1];
- } else if (key == "snippet") {
- snippet.tabTrigger = val.match(/^\S*/)[0];
- if (!snippet.name)
- snippet.name = val;
- } else {
- snippet[key] = val;
- }
- }
- }
- return list;
- };
- this.getSnippetByName = function(name, editor) {
- var snippetMap = this.snippetNameMap;
- var snippet;
- this.getActiveScopes(editor).some(function(scope) {
- var snippets = snippetMap[scope];
- if (snippets)
- snippet = snippets[name];
- return !!snippet;
- }, this);
- return snippet;
- };
-
-}).call(SnippetManager.prototype);
-
-
-var TabstopManager = function(editor) {
- if (editor.tabstopManager)
- return editor.tabstopManager;
- editor.tabstopManager = this;
- this.$onChange = this.onChange.bind(this);
- this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
- this.$onChangeSession = this.onChangeSession.bind(this);
- this.$onAfterExec = this.onAfterExec.bind(this);
- this.attach(editor);
-};
-(function() {
- this.attach = function(editor) {
- this.index = -1;
- this.ranges = [];
- this.tabstops = [];
- this.selectedTabstop = null;
-
- this.editor = editor;
- this.editor.on("change", this.$onChange);
- this.editor.on("changeSelection", this.$onChangeSelection);
- this.editor.on("changeSession", this.$onChangeSession);
- this.editor.commands.on("afterExec", this.$onAfterExec);
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
- };
- this.detach = function() {
- this.tabstops.forEach(this.removeTabstopMarkers, this);
- this.ranges = null;
- this.tabstops = null;
- this.selectedTabstop = null;
- this.editor.removeListener("change", this.$onChange);
- this.editor.removeListener("changeSelection", this.$onChangeSelection);
- this.editor.removeListener("changeSession", this.$onChangeSession);
- this.editor.commands.removeListener("afterExec", this.$onAfterExec);
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
- this.editor.tabstopManager = null;
- this.editor = null;
- };
-
- this.onChange = function(e) {
- var changeRange = e.data.range;
- var isRemove = e.data.action[0] == "r";
- var start = changeRange.start;
- var end = changeRange.end;
- var startRow = start.row;
- var endRow = end.row;
- var lineDif = endRow - startRow;
- var colDiff = end.column - start.column;
-
- if (isRemove) {
- lineDif = -lineDif;
- colDiff = -colDiff;
- }
- if (!this.$inChange && isRemove) {
- var ts = this.selectedTabstop;
- var changedOutside = !ts.some(function(r) {
- return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0;
- });
- if (changedOutside)
- return this.detach();
- }
- var ranges = this.ranges;
- for (var i = 0; i < ranges.length; i++) {
- var r = ranges[i];
- if (r.end.row < start.row)
- continue;
-
- if (comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
- this.removeRange(r);
- i--;
- continue;
- }
-
- if (r.start.row == startRow && r.start.column > start.column)
- r.start.column += colDiff;
- if (r.end.row == startRow && r.end.column >= start.column)
- r.end.column += colDiff;
- if (r.start.row >= startRow)
- r.start.row += lineDif;
- if (r.end.row >= startRow)
- r.end.row += lineDif;
-
- if (comparePoints(r.start, r.end) > 0)
- this.removeRange(r);
- }
- if (!ranges.length)
- this.detach();
- };
- this.updateLinkedFields = function() {
- var ts = this.selectedTabstop;
- if (!ts.hasLinkedRanges)
- return;
- this.$inChange = true;
- var session = this.editor.session;
- var text = session.getTextRange(ts.firstNonLinked);
- for (var i = ts.length; i--;) {
- var range = ts[i];
- if (!range.linked)
- continue;
- var fmt = exports.snippetManager.tmStrFormat(text, range.original)
- session.replace(range, fmt);
- }
- this.$inChange = false;
- };
- this.onAfterExec = function(e) {
- if (e.command && !e.command.readOnly)
- this.updateLinkedFields();
- };
- this.onChangeSelection = function() {
- if (!this.editor)
- return
- var lead = this.editor.selection.lead;
- var anchor = this.editor.selection.anchor;
- var isEmpty = this.editor.selection.isEmpty();
- for (var i = this.ranges.length; i--;) {
- if (this.ranges[i].linked)
- continue;
- var containsLead = this.ranges[i].contains(lead.row, lead.column);
- var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
- if (containsLead && containsAnchor)
- return;
- }
- this.detach();
- };
- this.onChangeSession = function() {
- this.detach();
- };
- this.tabNext = function(dir) {
- var max = this.tabstops.length - 1;
- var index = this.index + (dir || 1);
- index = Math.min(Math.max(index, 0), max);
- this.selectTabstop(index);
- if (index == max)
- this.detach();
- };
- this.selectTabstop = function(index) {
- var ts = this.tabstops[this.index];
- if (ts)
- this.addTabstopMarkers(ts);
- this.index = index;
- ts = this.tabstops[this.index];
- if (!ts || !ts.length)
- return;
-
- this.selectedTabstop = ts;
- if (!this.editor.inVirtualSelectionMode) {
- var sel = this.editor.multiSelect;
- sel.toSingleRange(ts.firstNonLinked.clone());
- for (var i = ts.length; i--;) {
- if (ts.hasLinkedRanges && ts[i].linked)
- continue;
- sel.addRange(ts[i].clone(), true);
- }
- } else {
- this.editor.selection.setRange(ts.firstNonLinked);
- }
-
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
- };
- this.addTabstops = function(tabstops, start, end) {
- if (!tabstops[0]) {
- var p = Range.fromPoints(end, end);
- moveRelative(p.start, start);
- moveRelative(p.end, start);
- tabstops[0] = [p];
- tabstops[0].index = 0;
- }
-
- var i = this.index;
- var arg = [i, 0];
- var ranges = this.ranges;
- var editor = this.editor;
- tabstops.forEach(function(ts) {
- for (var i = ts.length; i--;) {
- var p = ts[i];
- var range = Range.fromPoints(p.start, p.end || p.start);
- movePoint(range.start, start);
- movePoint(range.end, start);
- range.original = p;
- range.tabstop = ts;
- ranges.push(range);
- ts[i] = range;
- if (p.fmtString) {
- range.linked = true;
- ts.hasLinkedRanges = true;
- } else if (!ts.firstNonLinked)
- ts.firstNonLinked = range;
- }
- if (!ts.firstNonLinked)
- ts.hasLinkedRanges = false;
- arg.push(ts);
- this.addTabstopMarkers(ts);
- }, this);
- arg.push(arg.splice(2, 1)[0]);
- this.tabstops.splice.apply(this.tabstops, arg);
- };
-
- this.addTabstopMarkers = function(ts) {
- var session = this.editor.session;
- ts.forEach(function(range) {
- if (!range.markerId)
- range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
- });
- };
- this.removeTabstopMarkers = function(ts) {
- var session = this.editor.session;
- ts.forEach(function(range) {
- session.removeMarker(range.markerId);
- range.markerId = null;
- });
- };
- this.removeRange = function(range) {
- var i = range.tabstop.indexOf(range);
- range.tabstop.splice(i, 1);
- i = this.ranges.indexOf(range);
- this.ranges.splice(i, 1);
- this.editor.session.removeMarker(range.markerId);
- };
-
- this.keyboardHandler = new HashHandler();
- this.keyboardHandler.bindKeys({
- "Tab": function(ed) {
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
- return;
- }
-
- ed.tabstopManager.tabNext(1);
- },
- "Shift-Tab": function(ed) {
- ed.tabstopManager.tabNext(-1);
- },
- "Esc": function(ed) {
- ed.tabstopManager.detach();
- },
- "Return": function(ed) {
- return false;
- }
- });
-}).call(TabstopManager.prototype);
-
-
-var movePoint = function(point, diff) {
- if (point.row == 0)
- point.column += diff.column;
- point.row += diff.row;
-};
-
-var moveRelative = function(point, start) {
- if (point.row == start.row)
- point.column -= start.column;
- point.row -= start.row;
-};
-
-
-require("./lib/dom").importCssString("\
-.ace_snippet-marker {\
- -moz-box-sizing: border-box;\
- box-sizing: border-box;\
- background: rgba(194, 193, 208, 0.09);\
- border: 1px dotted rgba(211, 208, 235, 0.62);\
- position: absolute;\
-}");
-
-exports.snippetManager = new SnippetManager();
-
-
-});
-define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
-var modes = [];
-function getModeForPath(path) {
- var mode = modesByName.text;
- var fileName = path.split(/[\/\\]/).pop();
- for (var i = 0; i < modes.length; i++) {
- if (modes[i].supportsFile(fileName)) {
- mode = modes[i];
- break;
- }
- }
- return mode;
-}
-
-var Mode = function(name, caption, extensions) {
- this.name = name;
- this.caption = caption;
- this.mode = "ace/mode/" + name;
- this.extensions = extensions;
- if (/\^/.test(extensions)) {
- var re = extensions.replace(/\|(\^)?/g, function(a, b){
- return "$|" + (b ? "^" : "^.*\\.");
- }) + "$";
- } else {
- var re = "^.*\\.(" + extensions + ")$";
- }
-
- this.extRe = new RegExp(re, "gi");
-};
-
-Mode.prototype.supportsFile = function(filename) {
- return filename.match(this.extRe);
-};
-var supportedModes = {
- ABAP: ["abap"],
- ActionScript:["as"],
- ADA: ["ada|adb"],
- Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
- AsciiDoc: ["asciidoc"],
- Assembly_x86:["asm"],
- AutoHotKey: ["ahk"],
- BatchFile: ["bat|cmd"],
- C9Search: ["c9search_results"],
- C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
- Cirru: ["cirru|cr"],
- Clojure: ["clj"],
- Cobol: ["CBL|COB"],
- coffee: ["coffee|cf|cson|^Cakefile"],
- ColdFusion: ["cfm"],
- CSharp: ["cs"],
- CSS: ["css"],
- Curly: ["curly"],
- D: ["d|di"],
- Dart: ["dart"],
- Diff: ["diff|patch"],
- Dot: ["dot"],
- Erlang: ["erl|hrl"],
- EJS: ["ejs"],
- Forth: ["frt|fs|ldr"],
- FTL: ["ftl"],
- Gherkin: ["feature"],
- Glsl: ["glsl|frag|vert"],
- golang: ["go"],
- Groovy: ["groovy"],
- HAML: ["haml"],
- Handlebars: ["hbs|handlebars|tpl|mustache"],
- Haskell: ["hs"],
- haXe: ["hx"],
- HTML: ["html|htm|xhtml"],
- HTML_Ruby: ["erb|rhtml|html.erb"],
- INI: ["ini|conf|cfg|prefs"],
- Jack: ["jack"],
- Jade: ["jade"],
- Java: ["java"],
- JavaScript: ["js|jsm"],
- JSON: ["json"],
- JSONiq: ["jq"],
- JSP: ["jsp"],
- JSX: ["jsx"],
- Julia: ["jl"],
- LaTeX: ["tex|latex|ltx|bib"],
- LESS: ["less"],
- Liquid: ["liquid"],
- Lisp: ["lisp"],
- LiveScript: ["ls"],
- LogiQL: ["logic|lql"],
- LSL: ["lsl"],
- Lua: ["lua"],
- LuaPage: ["lp"],
- Lucene: ["lucene"],
- Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
- MATLAB: ["matlab"],
- Markdown: ["md|markdown"],
- MEL: ["mel"],
- MySQL: ["mysql"],
- MUSHCode: ["mc|mush"],
- Nix: ["nix"],
- ObjectiveC: ["m|mm"],
- OCaml: ["ml|mli"],
- Pascal: ["pas|p"],
- Perl: ["pl|pm"],
- pgSQL: ["pgsql"],
- PHP: ["php|phtml"],
- Powershell: ["ps1"],
- Prolog: ["plg|prolog"],
- Properties: ["properties"],
- Protobuf: ["proto"],
- Python: ["py"],
- R: ["r"],
- RDoc: ["Rd"],
- RHTML: ["Rhtml"],
- Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
- Rust: ["rs"],
- SASS: ["sass"],
- SCAD: ["scad"],
- Scala: ["scala"],
- Smarty: ["smarty|tpl"],
- Scheme: ["scm|rkt"],
- SCSS: ["scss"],
- SH: ["sh|bash|^.bashrc"],
- SJS: ["sjs"],
- Space: ["space"],
- snippets: ["snippets"],
- Soy_Template:["soy"],
- SQL: ["sql"],
- Stylus: ["styl|stylus"],
- SVG: ["svg"],
- Tcl: ["tcl"],
- Tex: ["tex"],
- Text: ["txt"],
- Textile: ["textile"],
- Toml: ["toml"],
- Twig: ["twig"],
- Typescript: ["ts|typescript|str"],
- VBScript: ["vbs"],
- Velocity: ["vm"],
- Verilog: ["v|vh|sv|svh"],
- XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
- XQuery: ["xq"],
- YAML: ["yaml|yml"]
-};
-
-var nameOverrides = {
- ObjectiveC: "Objective-C",
- CSharp: "C#",
- golang: "Go",
- C_Cpp: "C/C++",
- coffee: "CoffeeScript",
- HTML_Ruby: "HTML (Ruby)",
- FTL: "FreeMarker"
-};
-var modesByName = {};
-for (var name in supportedModes) {
- var data = supportedModes[name];
- var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
- var filename = name.toLowerCase();
- var mode = new Mode(filename, displayName, data[0]);
- modesByName[filename] = mode;
- modes.push(mode);
-}
-
-module.exports = {
- getModeForPath: getModeForPath,
- modes: modes,
- modesByName: modesByName
-};
-
-});
-
-define('ace/ext/language_tools', ['require', 'exports', 'module' , 'ace/snippets', 'ace/autocomplete', 'ace/config', 'ace/autocomplete/text_completer', 'ace/editor'], function(require, exports, module) {
-
-
-var snippetManager = require("../snippets").snippetManager;
-var Autocomplete = require("../autocomplete").Autocomplete;
-var config = require("../config");
-
-var textCompleter = require("../autocomplete/text_completer");
-var keyWordCompleter = {
- getCompletions: function(editor, session, pos, prefix, callback) {
- var state = editor.session.getState(pos.row);
- var completions = session.$mode.getCompletions(state, session, pos, prefix);
- callback(null, completions);
- }
-};
-
-var snippetCompleter = {
- getCompletions: function(editor, session, pos, prefix, callback) {
- var snippetMap = snippetManager.snippetMap;
- var completions = [];
- snippetManager.getActiveScopes(editor).forEach(function(scope) {
- var snippets = snippetMap[scope] || [];
- for (var i = snippets.length; i--;) {
- var s = snippets[i];
- var caption = s.name || s.tabTrigger;
- if (!caption)
- continue;
- completions.push({
- caption: caption,
- snippet: s.content,
- meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet"
- });
- }
- }, this);
- callback(null, completions);
- }
-};
-
-var completers = [snippetCompleter, textCompleter, keyWordCompleter];
-exports.addCompleter = function(completer) {
- completers.push(completer);
-};
-
-var expandSnippet = {
- name: "expandSnippet",
- exec: function(editor) {
- var success = snippetManager.expandWithTab(editor);
- if (!success)
- editor.execCommand("indent");
- },
- bindKey: "tab"
-};
-
-var onChangeMode = function(e, editor) {
- loadSnippetsForMode(editor.session.$mode);
-};
-
-var loadSnippetsForMode = function(mode) {
- var id = mode.$id;
- if (!snippetManager.files)
- snippetManager.files = {};
- loadSnippetFile(id);
- if (mode.modes)
- mode.modes.forEach(loadSnippetsForMode);
-};
-
-var loadSnippetFile = function(id) {
- if (!id || snippetManager.files[id])
- return;
- var snippetFilePath = id.replace("mode", "snippets");
- snippetManager.files[id] = {};
- config.loadModule(snippetFilePath, function(m) {
- if (m) {
- snippetManager.files[id] = m;
- m.snippets = snippetManager.parseSnippetFile(m.snippetText);
- snippetManager.register(m.snippets, m.scope);
- if (m.includeScopes) {
- snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
- m.includeScopes.forEach(function(x) {
- loadSnippetFile("ace/mode/" + x);
- });
- }
- }
- });
-};
-
-var Editor = require("../editor").Editor;
-require("../config").defineOptions(Editor.prototype, "editor", {
- enableBasicAutocompletion: {
- set: function(val) {
- if (val) {
- this.completers = completers;
- this.commands.addCommand(Autocomplete.startCommand);
- } else {
- this.commands.removeCommand(Autocomplete.startCommand);
- }
- },
- value: false
- },
- enableSnippets: {
- set: function(val) {
- if (val) {
- this.commands.addCommand(expandSnippet);
- this.on("changeMode", onChangeMode);
- onChangeMode(null, this);
- } else {
- this.commands.removeCommand(expandSnippet);
- this.off("changeMode", onChangeMode);
- }
- },
- value: false
- }
-});
-
-});
-
-define('kitchen-sink/file_drop', ['require', 'exports', 'module' , 'ace/config', 'ace/lib/event', 'ace/ext/modelist', 'ace/editor'], function(require, exports, module) {
-
-var config = require("ace/config");
-var event = require("ace/lib/event");
-var modelist = require("ace/ext/modelist");
-
-module.exports = function(editor) {
- event.addListener(editor.container, "dragover", function(e) {
- var types = e.dataTransfer.types;
- if (types && Array.prototype.indexOf.call(types, 'Files') !== -1)
- return event.preventDefault(e);
- });
-
- event.addListener(editor.container, "drop", function(e) {
- var file;
- try {
- file = e.dataTransfer.files[0];
- if (window.FileReader) {
- var reader = new FileReader();
- reader.onload = function() {
- var mode = modelist.getModeForPath(file.name);
- editor.session.doc.setValue(reader.result);
- editor.session.setMode(mode.mode);
- editor.session.modeName = mode.name;
- };
- reader.readAsText(file);
- }
- return event.preventDefault(e);
- } catch(err) {
- return event.stopEvent(e);
- }
- });
-};
-
-var Editor = require("ace/editor").Editor;
-config.defineOptions(Editor.prototype, "editor", {
- loadDroppedFile: {
- set: function() { module.exports(this); },
- value: true
- }
-});
-
-});
-
-define('ace/autocomplete', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler', 'ace/autocomplete/popup', 'ace/autocomplete/util', 'ace/lib/event', 'ace/lib/lang', 'ace/snippets'], function(require, exports, module) {
-
-
-var HashHandler = require("./keyboard/hash_handler").HashHandler;
-var AcePopup = require("./autocomplete/popup").AcePopup;
-var util = require("./autocomplete/util");
-var event = require("./lib/event");
-var lang = require("./lib/lang");
-var snippetManager = require("./snippets").snippetManager;
-
-var Autocomplete = function() {
- this.autoInsert = true;
- this.keyboardHandler = new HashHandler();
- this.keyboardHandler.bindKeys(this.commands);
-
- this.blurListener = this.blurListener.bind(this);
- this.changeListener = this.changeListener.bind(this);
- this.mousedownListener = this.mousedownListener.bind(this);
- this.mousewheelListener = this.mousewheelListener.bind(this);
-
- this.changeTimer = lang.delayedCall(function() {
- this.updateCompletions(true);
- }.bind(this))
-};
-
-(function() {
- this.$init = function() {
- this.popup = new AcePopup(document.body || document.documentElement);
- this.popup.on("click", function(e) {
- this.insertMatch();
- e.stop();
- }.bind(this));
- };
-
- this.openPopup = function(editor, prefix, keepPopupPosition) {
- if (!this.popup)
- this.$init();
-
- this.popup.setData(this.completions.filtered);
-
- var renderer = editor.renderer;
- if (!keepPopupPosition) {
- this.popup.setRow(0);
- this.popup.setFontSize(editor.getFontSize());
-
- var lineHeight = renderer.layerConfig.lineHeight;
-
- var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
- pos.left -= this.popup.getTextLeftOffset();
-
- var rect = editor.container.getBoundingClientRect();
- pos.top += rect.top - renderer.layerConfig.offset;
- pos.left += rect.left - editor.renderer.scrollLeft;
- pos.left += renderer.$gutterLayer.gutterWidth;
-
- this.popup.show(pos, lineHeight);
- }
- };
-
- this.detach = function() {
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
- this.editor.off("changeSelection", this.changeListener);
- this.editor.off("blur", this.blurListener);
- this.editor.off("mousedown", this.mousedownListener);
- this.editor.off("mousewheel", this.mousewheelListener);
- this.changeTimer.cancel();
-
- if (this.popup)
- this.popup.hide();
-
- this.activated = false;
- this.completions = this.base = null;
- };
-
- this.changeListener = function(e) {
- var cursor = this.editor.selection.lead;
- if (cursor.row != this.base.row || cursor.column < this.base.column) {
- this.detach();
- }
- if (this.activated)
- this.changeTimer.schedule();
- else
- this.detach();
- };
-
- this.blurListener = function() {
- if (document.activeElement != this.editor.textInput.getElement())
- this.detach();
- };
-
- this.mousedownListener = function(e) {
- this.detach();
- };
-
- this.mousewheelListener = function(e) {
- this.detach();
- };
-
- this.goTo = function(where) {
- var row = this.popup.getRow();
- var max = this.popup.session.getLength() - 1;
-
- switch(where) {
- case "up": row = row < 0 ? max : row - 1; break;
- case "down": row = row >= max ? -1 : row + 1; break;
- case "start": row = 0; break;
- case "end": row = max; break;
- }
-
- this.popup.setRow(row);
- };
-
- this.insertMatch = function(data) {
- if (!data)
- data = this.popup.getData(this.popup.getRow());
- if (!data)
- return false;
- if (data.completer && data.completer.insertMatch) {
- data.completer.insertMatch(this.editor);
- } else {
- if (this.completions.filterText) {
- var ranges = this.editor.selection.getAllRanges();
- for (var i = 0, range; range = ranges[i]; i++) {
- range.start.column -= this.completions.filterText.length;
- this.editor.session.remove(range);
- }
- }
- if (data.snippet)
- snippetManager.insertSnippet(this.editor, data.snippet);
- else
- this.editor.execCommand("insertstring", data.value || data);
- }
- this.detach();
- };
-
- this.commands = {
- "Up": function(editor) { editor.completer.goTo("up"); },
- "Down": function(editor) { editor.completer.goTo("down"); },
- "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
- "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
-
- "Esc": function(editor) { editor.completer.detach(); },
- "Space": function(editor) { editor.completer.detach(); editor.insert(" ");},
- "Return": function(editor) { editor.completer.insertMatch(); },
- "Shift-Return": function(editor) { editor.completer.insertMatch(true); },
- "Tab": function(editor) { editor.completer.insertMatch(); },
-
- "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
- "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
- };
-
- this.gatherCompletions = function(editor, callback) {
- var session = editor.getSession();
- var pos = editor.getCursorPosition();
-
- var line = session.getLine(pos.row);
- var prefix = util.retrievePrecedingIdentifier(line, pos.column);
-
- this.base = editor.getCursorPosition();
- this.base.column -= prefix.length;
-
- var matches = [];
- util.parForEach(editor.completers, function(completer, next) {
- completer.getCompletions(editor, session, pos, prefix, function(err, results) {
- if (!err)
- matches = matches.concat(results);
- next();
- });
- }, function() {
- callback(null, {
- prefix: prefix,
- matches: matches
- });
- });
- return true;
- };
-
- this.showPopup = function(editor) {
- if (this.editor)
- this.detach();
-
- this.activated = true;
-
- this.editor = editor;
- if (editor.completer != this) {
- if (editor.completer)
- editor.completer.detach();
- editor.completer = this;
- }
-
- editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
- editor.on("changeSelection", this.changeListener);
- editor.on("blur", this.blurListener);
- editor.on("mousedown", this.mousedownListener);
- editor.on("mousewheel", this.mousewheelListener);
-
- this.updateCompletions();
- };
-
- this.updateCompletions = function(keepPopupPosition) {
- if (keepPopupPosition && this.base && this.completions) {
- var pos = this.editor.getCursorPosition();
- var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
- if (prefix == this.completions.filterText)
- return;
- this.completions.setFilter(prefix);
- if (!this.completions.filtered.length)
- return this.detach();
- this.openPopup(this.editor, prefix, keepPopupPosition);
- return;
- }
- this.gatherCompletions(this.editor, function(err, results) {
- var matches = results && results.matches;
- if (!matches || !matches.length)
- return this.detach();
-
- this.completions = new FilteredList(matches);
- this.completions.setFilter(results.prefix);
- var filtered = this.completions.filtered;
- if (!filtered.length)
- return this.detach();
- if (this.autoInsert && filtered.length == 1)
- return this.insertMatch(filtered[0]);
- this.openPopup(this.editor, results.prefix, keepPopupPosition);
- }.bind(this));
- };
-
- this.cancelContextMenu = function() {
- var stop = function(e) {
- this.editor.off("nativecontextmenu", stop);
- if (e && e.domEvent)
- event.stopEvent(e.domEvent);
- }.bind(this);
- setTimeout(stop, 10);
- this.editor.on("nativecontextmenu", stop);
- };
-
-}).call(Autocomplete.prototype);
-
-Autocomplete.startCommand = {
- name: "startAutocomplete",
- exec: function(editor) {
- if (!editor.completer)
- editor.completer = new Autocomplete();
- editor.completer.showPopup(editor);
- editor.completer.cancelContextMenu();
- },
- bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
-};
-
-var FilteredList = function(array, filterText, mutateData) {
- this.all = array;
- this.filtered = array;
- this.filterText = filterText || "";
-};
-(function(){
- this.setFilter = function(str) {
- if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
- var matches = this.filtered;
- else
- var matches = this.all;
-
- this.filterText = str;
- matches = this.filterCompletions(matches, this.filterText);
- matches = matches.sort(function(a, b) {
- return b.exactMatch - a.exactMatch || b.score - a.score;
- });
- var prev = null;
- matches = matches.filter(function(item){
- var caption = item.value || item.caption || item.snippet;
- if (caption === prev) return false;
- prev = caption;
- return true;
- });
-
- this.filtered = matches;
- };
- this.filterCompletions = function(items, needle) {
- var results = [];
- var upper = needle.toUpperCase();
- var lower = needle.toLowerCase();
- loop: for (var i = 0, item; item = items[i]; i++) {
- var caption = item.value || item.caption || item.snippet;
- if (!caption) continue;
- var lastIndex = -1;
- var matchMask = 0;
- var penalty = 0;
- var index, distance;
- for (var j = 0; j < needle.length; j++) {
- var i1 = caption.indexOf(lower[j], lastIndex + 1);
- var i2 = caption.indexOf(upper[j], lastIndex + 1);
- index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
- if (index < 0)
- continue loop;
- distance = index - lastIndex - 1;
- if (distance > 0) {
- if (lastIndex === -1)
- penalty += 10;
- penalty += distance;
- }
- matchMask = matchMask | (1 << index);
- lastIndex = index;
- }
- item.matchMask = matchMask;
- item.exactMatch = penalty ? 0 : 1;
- item.score = (item.score || 0) - penalty;
- results.push(item);
- }
- return results;
- };
-}).call(FilteredList.prototype);
-
-exports.Autocomplete = Autocomplete;
-exports.FilteredList = FilteredList;
-
-});
-
-define('kitchen-sink/dev_util', ['require', 'exports', 'module' ], function(require, exports, module) {
-function isStrict() {
- try { return !arguments.callee.caller.caller.caller}
- catch(e){ return true }
-}
-function warn() {
- if (isStrict()) {
- console.error("trying to access to global variable");
- }
-}
-function def(o, key, get) {
- try {
- Object.defineProperty(o, key, {
- configurable: true,
- get: get,
- set: function(val) {
- delete o[key];
- o[key] = val;
- }
- });
- } catch(e) {
- console.error(e);
- }
-}
-def(window, "ace", function(){ warn(); return window.env.editor });
-def(window, "editor", function(){ warn(); return window.env.editor });
-def(window, "session", function(){ warn(); return window.env.editor.session });
-def(window, "split", function(){ warn(); return window.env.split });
-
-});
-
-define('ace/autocomplete/popup', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/virtual_renderer', 'ace/editor', 'ace/range', 'ace/lib/event', 'ace/lib/lang', 'ace/lib/dom'], function(require, exports, module) {
-
-
-var EditSession = require("../edit_session").EditSession;
-var Renderer = require("../virtual_renderer").VirtualRenderer;
-var Editor = require("../editor").Editor;
-var Range = require("../range").Range;
-var event = require("../lib/event");
-var lang = require("../lib/lang");
-var dom = require("../lib/dom");
-
-var $singleLineEditor = function(el) {
- var renderer = new Renderer(el);
-
- renderer.$maxLines = 4;
-
- var editor = new Editor(renderer);
-
- editor.setHighlightActiveLine(false);
- editor.setShowPrintMargin(false);
- editor.renderer.setShowGutter(false);
- editor.renderer.setHighlightGutterLine(false);
-
- editor.$mouseHandler.$focusWaitTimout = 0;
-
- return editor;
-};
-
-var AcePopup = function(parentNode) {
- var el = dom.createElement("div");
- var popup = new $singleLineEditor(el);
-
- if (parentNode)
- parentNode.appendChild(el);
- el.style.display = "none";
- popup.renderer.content.style.cursor = "default";
- popup.renderer.setStyle("ace_autocomplete");
-
- popup.setOption("displayIndentGuides", false);
-
- var noop = function(){};
-
- popup.focus = noop;
- popup.$isFocused = true;
-
- popup.renderer.$cursorLayer.restartTimer = noop;
- popup.renderer.$cursorLayer.element.style.opacity = 0;
-
- popup.renderer.$maxLines = 8;
- popup.renderer.$keepTextAreaAtCursor = false;
-
- popup.setHighlightActiveLine(false);
- popup.session.highlight("");
- popup.session.$searchHighlight.clazz = "ace_highlight-marker";
-
- popup.on("mousedown", function(e) {
- var pos = e.getDocumentPosition();
- popup.selection.moveToPosition(pos);
- selectionMarker.start.row = selectionMarker.end.row = pos.row;
- e.stop();
- });
-
- var lastMouseEvent;
- var hoverMarker = new Range(-1,0,-1,Infinity);
- var selectionMarker = new Range(-1,0,-1,Infinity);
- selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
- popup.setSelectOnHover = function(val) {
- if (!val) {
- hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
- } else if (hoverMarker.id) {
- popup.session.removeMarker(hoverMarker.id);
- hoverMarker.id = null;
- }
- }
- popup.setSelectOnHover(false);
- popup.on("mousemove", function(e) {
- if (!lastMouseEvent) {
- lastMouseEvent = e;
- return;
- }
- if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
- return;
- }
- lastMouseEvent = e;
- lastMouseEvent.scrollTop = popup.renderer.scrollTop;
- var row = lastMouseEvent.getDocumentPosition().row;
- if (hoverMarker.start.row != row) {
- if (!hoverMarker.id)
- popup.setRow(row);
- setHoverMarker(row);
- }
- });
- popup.renderer.on("beforeRender", function() {
- if (lastMouseEvent && hoverMarker.start.row != -1) {
- lastMouseEvent.$pos = null;
- var row = lastMouseEvent.getDocumentPosition().row;
- if (!hoverMarker.id)
- popup.setRow(row);
- setHoverMarker(row, true);
- }
- });
- popup.renderer.on("afterRender", function() {
- var row = popup.getRow();
- var t = popup.renderer.$textLayer;
- var selected = t.element.childNodes[row - t.config.firstRow];
- if (selected == t.selectedNode)
- return;
- if (t.selectedNode)
- dom.removeCssClass(t.selectedNode, "ace_selected");
- t.selectedNode = selected;
- if (selected)
- dom.addCssClass(selected, "ace_selected");
- });
- var hideHoverMarker = function() { setHoverMarker(-1) };
- var setHoverMarker = function(row, suppressRedraw) {
- if (row !== hoverMarker.start.row) {
- hoverMarker.start.row = hoverMarker.end.row = row;
- if (!suppressRedraw)
- popup.session._emit("changeBackMarker");
- popup._emit("changeHoverMarker");
- }
- };
- popup.getHoveredRow = function() {
- return hoverMarker.start.row;
- };
-
- event.addListener(popup.container, "mouseout", hideHoverMarker);
- popup.on("hide", hideHoverMarker);
- popup.on("changeSelection", hideHoverMarker);
-
- popup.session.doc.getLength = function() {
- return popup.data.length;
- };
- popup.session.doc.getLine = function(i) {
- var data = popup.data[i];
- if (typeof data == "string")
- return data;
- return (data && data.value) || "";
- };
-
- var bgTokenizer = popup.session.bgTokenizer;
- bgTokenizer.$tokenizeRow = function(i) {
- var data = popup.data[i];
- var tokens = [];
- if (!data)
- return tokens;
- if (typeof data == "string")
- data = {value: data};
- if (!data.caption)
- data.caption = data.value;
-
- var last = -1;
- var flag, c;
- for (var i = 0; i < data.caption.length; i++) {
- c = data.caption[i];
- flag = data.matchMask & (1 << i) ? 1 : 0;
- if (last !== flag) {
- tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c});
- last = flag;
- } else {
- tokens[tokens.length - 1].value += c;
- }
- }
-
- if (data.meta) {
- var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth;
- if (data.meta.length + data.caption.length < maxW - 2)
- tokens.push({type: "rightAlignedText", value: data.meta});
- }
- return tokens;
- };
- bgTokenizer.$updateOnChange = noop;
- bgTokenizer.start = noop;
-
- popup.session.$computeWidth = function() {
- return this.screenWidth = 0;
- }
- popup.isOpen = false;
- popup.isTopdown = false;
-
- popup.data = [];
- popup.setData = function(list) {
- popup.data = list || [];
- popup.setValue(lang.stringRepeat("\n", list.length), -1);
- popup.setRow(0);
- };
- popup.getData = function(row) {
- return popup.data[row];
- };
-
- popup.getRow = function() {
- return selectionMarker.start.row;
- };
- popup.setRow = function(line) {
- line = Math.max(-1, Math.min(this.data.length, line));
- if (selectionMarker.start.row != line) {
- popup.selection.clearSelection();
- selectionMarker.start.row = selectionMarker.end.row = line || 0;
- popup.session._emit("changeBackMarker");
- popup.moveCursorTo(line || 0, 0);
- if (popup.isOpen)
- popup._signal("select");
- }
- };
-
- popup.on("changeSelection", function() {
- if (popup.isOpen)
- popup.setRow(popup.selection.lead.row);
- });
-
- popup.hide = function() {
- this.container.style.display = "none";
- this._signal("hide");
- popup.isOpen = false;
- };
- popup.show = function(pos, lineHeight, topdownOnly) {
- var el = this.container;
- var screenHeight = window.innerHeight;
- var screenWidth = window.innerWidth;
- var renderer = this.renderer;
- var maxH = renderer.$maxLines * lineHeight * 1.4;
- var top = pos.top + this.$borderSize;
- if (top + maxH > screenHeight - lineHeight && !topdownOnly) {
- el.style.top = "";
- el.style.bottom = screenHeight - top + "px";
- popup.isTopdown = false;
- } else {
- top += lineHeight;
- el.style.top = top + "px";
- el.style.bottom = "";
- popup.isTopdown = true;
- }
-
- el.style.display = "";
- this.renderer.$textLayer.checkForSizeChanges();
-
- var left = pos.left;
- if (left + el.offsetWidth > screenWidth)
- left = screenWidth - el.offsetWidth;
-
- el.style.left = left + "px";
-
- this._signal("show");
- lastMouseEvent = null;
- popup.isOpen = true;
- };
-
- popup.getTextLeftOffset = function() {
- return this.$borderSize + this.renderer.$padding + this.$imageSize;
- };
-
- popup.$imageSize = 0;
- popup.$borderSize = 1;
-
- return popup;
-};
-
-dom.importCssString("\
-.ace_autocomplete.ace-tm .ace_marker-layer .ace_active-line {\
- background-color: #CAD6FA;\
- z-index: 1;\
-}\
-.ace_autocomplete.ace-tm .ace_line-hover {\
- border: 1px solid #abbffe;\
- margin-top: -1px;\
- background: rgba(233,233,253,0.4);\
-}\
-.ace_autocomplete .ace_line-hover {\
- position: absolute;\
- z-index: 2;\
-}\
-.ace_rightAlignedText {\
- color: gray;\
- display: inline-block;\
- position: absolute;\
- right: 4px;\
- text-align: right;\
- z-index: -1;\
-}\
-.ace_autocomplete .ace_completion-highlight{\
- color: #000;\
- text-shadow: 0 0 0.01em;\
-}\
-.ace_autocomplete {\
- width: 280px;\
- z-index: 200000;\
- background: #fbfbfb;\
- color: #444;\
- border: 1px lightgray solid;\
- position: fixed;\
- box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
- line-height: 1.4;\
-}");
-
-exports.AcePopup = AcePopup;
-
-});
-
-
-define('kitchen-sink/inline_editor', ['require', 'exports', 'module' , 'ace/line_widgets', 'ace/editor', 'ace/virtual_renderer', 'ace/lib/dom', 'ace/commands/default_commands'], function(require, exports, module) {
-
-
-var LineWidgets = require("ace/line_widgets").LineWidgets;
-var Editor = require("ace/editor").Editor;
-var Renderer = require("ace/virtual_renderer").VirtualRenderer;
-var dom = require("ace/lib/dom");
-
-
-require("ace/commands/default_commands").commands.push({
- name: "openInlineEditor",
- bindKey: "F3",
- exec: function(editor) {
- var split = window.env.split;
- var s = editor.session;
- var inlineEditor = new Editor(new Renderer());
- var splitSession = split.$cloneSession(s);
-
- var row = editor.getCursorPosition().row;
- if (editor.session.lineWidgets && editor.session.lineWidgets[row]) {
- editor.session.lineWidgets[row].destroy();
- return;
- }
-
- var rowCount = 10;
- var w = {
- row: row,
- fixedWidth: true,
- el: dom.createElement("div"),
- editor: editor
- };
- var el = w.el;
- el.appendChild(inlineEditor.container);
-
- if (!editor.session.widgetManager) {
- editor.session.widgetManager = new LineWidgets(editor.session);
- editor.session.widgetManager.attach(editor);
- }
-
- var h = rowCount*editor.renderer.layerConfig.lineHeight;
- inlineEditor.container.style.height = h + "px";
-
- el.style.position = "absolute";
- el.style.zIndex = "4";
- el.style.borderTop = "solid blue 2px";
- el.style.borderBottom = "solid blue 2px";
-
- inlineEditor.setSession(splitSession);
- editor.session.widgetManager.addLineWidget(w);
-
- var kb = {
- handleKeyboard:function(_,hashId, keyString) {
- if (hashId === 0 && keyString === "esc") {
- w.destroy();
- return true;
- }
- }
- };
-
- w.destroy = function() {
- editor.keyBinding.removeKeyboardHandler(kb);
- s.widgetManager.removeLineWidget(w);
- };
-
- editor.keyBinding.addKeyboardHandler(kb);
- inlineEditor.keyBinding.addKeyboardHandler(kb);
- editor.on("changeSession", function(e) {
- w.el.parentNode && w.el.parentNode.removeChild(w.el);
- });
- inlineEditor.setTheme("ace/theme/solarized_light");
- }
-});
-});
-
-define('ace/autocomplete/util', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
-exports.parForEach = function(array, fn, callback) {
- var completed = 0;
- var arLength = array.length;
- if (arLength === 0)
- callback();
- for (var i = 0; i < arLength; i++) {
- fn(array[i], function(result, err) {
- completed++;
- if (completed === arLength)
- callback(result, err);
- });
- }
-}
-
-var ID_REGEX = /[a-zA-Z_0-9\$-]/;
-
-exports.retrievePrecedingIdentifier = function(text, pos, regex) {
- regex = regex || ID_REGEX;
- var buf = [];
- for (var i = pos-1; i >= 0; i--) {
- if (regex.test(text[i]))
- buf.push(text[i]);
- else
- break;
- }
- return buf.reverse().join("");
-}
-
-exports.retrieveFollowingIdentifier = function(text, pos, regex) {
- regex = regex || ID_REGEX;
- var buf = [];
- for (var i = pos; i < text.length; i++) {
- if (regex.test(text[i]))
- buf.push(text[i]);
- else
- break;
- }
- return buf;
-}
-
-});
-define('ace/ext/spellcheck', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/editor', 'ace/config'], function(require, exports, module) {
-
-var event = require("../lib/event");
-
-exports.contextMenuHandler = function(e){
- var host = e.target;
- var text = host.textInput.getElement();
- if (!host.selection.isEmpty())
- return;
- var c = host.getCursorPosition();
- var r = host.session.getWordRange(c.row, c.column);
- var w = host.session.getTextRange(r);
-
- host.session.tokenRe.lastIndex = 0;
- if (!host.session.tokenRe.test(w))
- return;
- var PLACEHOLDER = "\x01\x01";
- var value = w + " " + PLACEHOLDER;
- text.value = value;
- text.setSelectionRange(w.length, w.length + 1);
- text.setSelectionRange(0, 0);
- text.setSelectionRange(0, w.length);
-
- var afterKeydown = false;
- event.addListener(text, "keydown", function onKeydown() {
- event.removeListener(text, "keydown", onKeydown);
- afterKeydown = true;
- });
-
- host.textInput.setInputHandler(function(newVal) {
- console.log(newVal , value, text.selectionStart, text.selectionEnd)
- if (newVal == value)
- return '';
- if (newVal.lastIndexOf(value, 0) === 0)
- return newVal.slice(value.length);
- if (newVal.substr(text.selectionEnd) == value)
- return newVal.slice(0, -value.length);
- if (newVal.slice(-2) == PLACEHOLDER) {
- var val = newVal.slice(0, -2);
- if (val.slice(-1) == " ") {
- if (afterKeydown)
- return val.substring(0, text.selectionEnd);
- val = val.slice(0, -1);
- host.session.replace(r, val);
- return "";
- }
- }
-
- return newVal;
- });
-};
-var Editor = require("../editor").Editor;
-require("../config").defineOptions(Editor.prototype, "editor", {
- spellcheck: {
- set: function(val) {
- var text = this.textInput.getElement();
- text.spellcheck = !!val;
- if (!val)
- this.removeListener("nativecontextmenu", exports.contextMenuHandler);
- else
- this.on("nativecontextmenu", exports.contextMenuHandler);
- },
- value: true
- }
-});
-
-});
-
-define('ace/autocomplete/text_completer', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
- var Range = require("ace/range").Range;
-
- var splitRegex = /[^a-zA-Z_0-9\$\-]+/;
-
- function getWordIndex(doc, pos) {
- var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));
- return textBefore.split(splitRegex).length - 1;
- }
- function wordDistance(doc, pos) {
- var prefixPos = getWordIndex(doc, pos);
- var words = doc.getValue().split(splitRegex);
- var wordScores = Object.create(null);
-
- var currentWord = words[prefixPos];
-
- words.forEach(function(word, idx) {
- if (!word || word === currentWord) return;
-
- var distance = Math.abs(prefixPos - idx);
- var score = words.length - distance;
- if (wordScores[word]) {
- wordScores[word] = Math.max(score, wordScores[word]);
- } else {
- wordScores[word] = score;
- }
- });
- return wordScores;
- }
-
- exports.getCompletions = function(editor, session, pos, prefix, callback) {
- var wordScore = wordDistance(session, pos, prefix);
- var wordList = Object.keys(wordScore);
- callback(null, wordList.map(function(word) {
- return {
- name: word,
- value: word,
- score: wordScore[word],
- meta: "local"
- };
- }));
- };
-});
-
-define('ace/commands/occur_commands', ['require', 'exports', 'module' , 'ace/config', 'ace/occur', 'ace/keyboard/hash_handler', 'ace/lib/oop'], function(require, exports, module) {
-
-var config = require("../config"),
- Occur = require("../occur").Occur;
-var occurStartCommand = {
- name: "occur",
- exec: function(editor, options) {
- var alreadyInOccur = !!editor.session.$occur;
- var occurSessionActive = new Occur().enter(editor, options);
- if (occurSessionActive && !alreadyInOccur)
- OccurKeyboardHandler.installIn(editor);
- },
- readOnly: true
-};
-
-var occurCommands = [{
- name: "occurexit",
- bindKey: 'esc|Ctrl-G',
- exec: function(editor) {
- var occur = editor.session.$occur;
- if (!occur) return;
- occur.exit(editor, {});
- if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
- },
- readOnly: true
-}, {
- name: "occuraccept",
- bindKey: 'enter',
- exec: function(editor) {
- var occur = editor.session.$occur;
- if (!occur) return;
- occur.exit(editor, {translatePosition: true});
- if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
- },
- readOnly: true
-}];
-
-var HashHandler = require("../keyboard/hash_handler").HashHandler;
-var oop = require("../lib/oop");
-
-
-function OccurKeyboardHandler() {}
-
-oop.inherits(OccurKeyboardHandler, HashHandler);
-
-;(function() {
-
- this.isOccurHandler = true;
-
- this.attach = function(editor) {
- HashHandler.call(this, occurCommands, editor.commands.platform);
- this.$editor = editor;
- }
-
- var handleKeyboard$super = this.handleKeyboard;
- this.handleKeyboard = function(data, hashId, key, keyCode) {
- var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
- return (cmd && cmd.command) ? cmd : undefined;
- }
-
-}).call(OccurKeyboardHandler.prototype);
-
-OccurKeyboardHandler.installIn = function(editor) {
- var handler = new this();
- editor.keyBinding.addKeyboardHandler(handler);
- editor.commands.addCommands(occurCommands);
-}
-
-OccurKeyboardHandler.uninstallFrom = function(editor) {
- editor.commands.removeCommands(occurCommands);
- var handler = editor.getKeyboardHandler();
- if (handler.isOccurHandler)
- editor.keyBinding.removeKeyboardHandler(handler);
-}
-
-exports.occurStartCommand = occurStartCommand;
-
-});
diff --git a/bower_components/ace-builds/kitchen-sink/docs/AsciiDoc.asciidoc b/bower_components/ace-builds/kitchen-sink/docs/AsciiDoc.asciidoc
deleted file mode 100644
index 90b341888..000000000
--- a/bower_components/ace-builds/kitchen-sink/docs/AsciiDoc.asciidoc
+++ /dev/null
@@ -1,6040 +0,0 @@
-AsciiDoc User Guide
-===================
-Stuart Rackham
-:Author Initials: SJR
-:toc:
-:icons:
-:numbered:
-:website: http://www.methods.co.nz/asciidoc/
-
-AsciiDoc is a text document format for writing notes, documentation,
-articles, books, ebooks, slideshows, web pages, blogs and UNIX man
-pages. AsciiDoc files can be translated to many formats including
-HTML, PDF, EPUB, man page. AsciiDoc is highly configurable: both the
-AsciiDoc source file syntax and the backend output markups (which can
-be almost any type of SGML/XML markup) can be customized and extended
-by the user.
-
-.This document
-**********************************************************************
-This is an overly large document, it probably needs to be refactored
-into a Tutorial, Quick Reference and Formal Reference.
-
-If you're new to AsciiDoc read this section and the <> section and take a look at the example AsciiDoc (`*.txt`)
-source files in the distribution `doc` directory.
-**********************************************************************
-
-
-Introduction
-------------
-AsciiDoc is a plain text human readable/writable document format that
-can be translated to DocBook or HTML using the asciidoc(1) command.
-You can then either use asciidoc(1) generated HTML directly or run
-asciidoc(1) DocBook output through your favorite DocBook toolchain or
-use the AsciiDoc a2x(1) toolchain wrapper to produce PDF, EPUB, DVI,
-LaTeX, PostScript, man page, HTML and text formats.
-
-The AsciiDoc format is a useful presentation format in its own right:
-AsciiDoc markup is simple, intuitive and as such is easily proofed and
-edited.
-
-AsciiDoc is light weight: it consists of a single Python script and a
-bunch of configuration files. Apart from asciidoc(1) and a Python
-interpreter, no other programs are required to convert AsciiDoc text
-files to DocBook or HTML. See <>
-below.
-
-Text markup conventions tend to be a matter of (often strong) personal
-preference: if the default syntax is not to your liking you can define
-your own by editing the text based asciidoc(1) configuration files.
-You can also create configuration files to translate AsciiDoc
-documents to almost any SGML/XML markup.
-
-asciidoc(1) comes with a set of configuration files to translate
-AsciiDoc articles, books and man pages to HTML or DocBook backend
-formats.
-
-.My AsciiDoc Itch
-**********************************************************************
-DocBook has emerged as the de facto standard Open Source documentation
-format. But DocBook is a complex language, the markup is difficult to
-read and even more difficult to write directly -- I found I was
-spending more time typing markup tags, consulting reference manuals
-and fixing syntax errors, than I was writing the documentation.
-**********************************************************************
-
-
-[[X6]]
-Getting Started
----------------
-Installing AsciiDoc
-~~~~~~~~~~~~~~~~~~~
-See the `README` and `INSTALL` files for install prerequisites and
-procedures. Packagers take a look at <>.
-
-[[X11]]
-Example AsciiDoc Documents
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-The best way to quickly get a feel for AsciiDoc is to view the
-AsciiDoc web site and/or distributed examples:
-
-- Take a look at the linked examples on the AsciiDoc web site home
- page {website}. Press the 'Page Source' sidebar menu item to view
- corresponding AsciiDoc source.
-- Read the `*.txt` source files in the distribution `./doc` directory
- along with the corresponding HTML and DocBook XML files.
-
-
-AsciiDoc Document Types
------------------------
-There are three types of AsciiDoc documents: article, book and
-manpage. All document types share the same AsciiDoc format with some
-minor variations. If you are familiar with DocBook you will have
-noticed that AsciiDoc document types correspond to the same-named
-DocBook document types.
-
-Use the asciidoc(1) `-d` (`--doctype`) option to specify the AsciiDoc
-document type -- the default document type is 'article'.
-
-By convention the `.txt` file extension is used for AsciiDoc document
-source files.
-
-article
-~~~~~~~
-Used for short documents, articles and general documentation. See the
-AsciiDoc distribution `./doc/article.txt` example.
-
-AsciiDoc defines standard DocBook article frontmatter and backmatter
-<> (appendix, abstract, bibliography,
-glossary, index).
-
-book
-~~~~
-Books share the same format as articles, with the following
-differences:
-
-- The part titles in multi-part books are <>
- (same level as book title).
-- Some sections are book specific e.g. preface and colophon.
-
-Book documents will normally be used to produce DocBook output since
-DocBook processors can automatically generate footnotes, table of
-contents, list of tables, list of figures, list of examples and
-indexes.
-
-AsciiDoc defines standard DocBook book frontmatter and backmatter
-<> (appendix, dedication, preface,
-bibliography, glossary, index, colophon).
-
-.Example book documents
-Book::
- The `./doc/book.txt` file in the AsciiDoc distribution.
-
-Multi-part book::
- The `./doc/book-multi.txt` file in the AsciiDoc distribution.
-
-manpage
-~~~~~~~
-Used to generate roff format UNIX manual pages. AsciiDoc manpage
-documents observe special header title and section naming conventions
--- see the <> section for details.
-
-AsciiDoc defines the 'synopsis' <> to
-generate the DocBook `refsynopsisdiv` section.
-
-See also the asciidoc(1) man page source (`./doc/asciidoc.1.txt`) from
-the AsciiDoc distribution.
-
-
-[[X5]]
-AsciiDoc Backends
------------------
-The asciidoc(1) command translates an AsciiDoc formatted file to the
-backend format specified by the `-b` (`--backend`) command-line
-option. asciidoc(1) itself has little intrinsic knowledge of backend
-formats, all translation rules are contained in customizable cascading
-configuration files. Backend specific attributes are listed in the
-<> section.
-
-docbook45::
- Outputs DocBook XML 4.5 markup.
-
-html4::
- This backend generates plain HTML 4.01 Transitional markup.
-
-xhtml11::
- This backend generates XHTML 1.1 markup styled with CSS2. Output
- files have an `.html` extension.
-
-html5::
- This backend generates HTML 5 markup, apart from the inclusion of
- <> it is functionally identical to
- the 'xhtml11' backend.
-
-slidy::
- Use this backend to generate self-contained
- http://www.w3.org/Talks/Tools/Slidy2/[Slidy] HTML slideshows for
- your web browser from AsciiDoc documents. The Slidy backend is
- documented in the distribution `doc/slidy.txt` file and
- {website}slidy.html[online].
-
-wordpress::
- A minor variant of the 'html4' backend to support
- http://srackham.wordpress.com/blogpost1/[blogpost].
-
-latex::
- Experimental LaTeX backend.
-
-Backend Aliases
-~~~~~~~~~~~~~~~
-Backend aliases are alternative names for AsciiDoc backends. AsciiDoc
-comes with two backend aliases: 'html' (aliased to 'xhtml11') and
-'docbook' (aliased to 'docbook45').
-
-You can assign (or reassign) backend aliases by setting an AsciiDoc
-attribute named like `backend-alias-` to an AsciiDoc backend
-name. For example, the following backend alias attribute definitions
-appear in the `[attributes]` section of the global `asciidoc.conf`
-configuration file:
-
- backend-alias-html=xhtml11
- backend-alias-docbook=docbook45
-
-[[X100]]
-Backend Plugins
-~~~~~~~~~~~~~~~
-The asciidoc(1) `--backend` option is also used to install and manage
-backend <>.
-
-- A backend plugin is used just like the built-in backends.
-- Backend plugins <> over built-in backends with
- the same name.
-- You can use the `{asciidoc-confdir}` <> to
- refer to the built-in backend configuration file location from
- backend plugin configuration files.
-- You can use the `{backend-confdir}` <> to
- refer to the backend plugin configuration file location.
-- By default backends plugins are installed in
- `$HOME/.asciidoc/backends/` where `` is the
- backend name.
-
-
-DocBook
--------
-AsciiDoc generates 'article', 'book' and 'refentry'
-http://www.docbook.org/[DocBook] documents (corresponding to the
-AsciiDoc 'article', 'book' and 'manpage' document types).
-
-Most Linux distributions come with conversion tools (collectively
-called a toolchain) for <> to
-presentation formats such as Postscript, HTML, PDF, EPUB, DVI,
-PostScript, LaTeX, roff (the native man page format), HTMLHelp,
-JavaHelp and text. There are also programs that allow you to view
-DocBook files directly, for example http://live.gnome.org/Yelp[Yelp]
-(the GNOME help viewer).
-
-[[X12]]
-Converting DocBook to other file formats
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-DocBook files are validated, parsed and translated various
-presentation file formats using a combination of applications
-collectively called a DocBook 'tool chain'. The function of a tool
-chain is to read the DocBook markup (produced by AsciiDoc) and
-transform it to a presentation format (for example HTML, PDF, HTML
-Help, EPUB, DVI, PostScript, LaTeX).
-
-A wide range of user output format requirements coupled with a choice
-of available tools and stylesheets results in many valid tool chain
-combinations.
-
-[[X43]]
-a2x Toolchain Wrapper
-~~~~~~~~~~~~~~~~~~~~~
-One of the biggest hurdles for new users is installing, configuring
-and using a DocBook XML toolchain. `a2x(1)` can help -- it's a
-toolchain wrapper command that will generate XHTML (chunked and
-unchunked), PDF, EPUB, DVI, PS, LaTeX, man page, HTML Help and text
-file outputs from an AsciiDoc text file. `a2x(1)` does all the grunt
-work associated with generating and sequencing the toolchain commands
-and managing intermediate and output files. `a2x(1)` also optionally
-deploys admonition and navigation icons and a CSS stylesheet. See the
-`a2x(1)` man page for more details. In addition to `asciidoc(1)` you
-also need <>, <> and
-optionally: <> or <> (to generate PDF);
-`w3m(1)` or `lynx(1)` (to generate text).
-
-The following examples generate `doc/source-highlight-filter.pdf` from
-the AsciiDoc `doc/source-highlight-filter.txt` source file. The first
-example uses `dblatex(1)` (the default PDF generator) the second
-example forces FOP to be used:
-
- $ a2x -f pdf doc/source-highlight-filter.txt
- $ a2x -f pdf --fop doc/source-highlight-filter.txt
-
-See the `a2x(1)` man page for details.
-
-TIP: Use the `--verbose` command-line option to view executed
-toolchain commands.
-
-HTML generation
-~~~~~~~~~~~~~~~
-AsciiDoc produces nicely styled HTML directly without requiring a
-DocBook toolchain but there are also advantages in going the DocBook
-route:
-
-- HTML from DocBook can optionally include automatically generated
- indexes, tables of contents, footnotes, lists of figures and tables.
-- DocBook toolchains can also (optionally) generate separate (chunked)
- linked HTML pages for each document section.
-- Toolchain processing performs link and document validity checks.
-- If the DocBook 'lang' attribute is set then things like table of
- contents, figure and table captions and admonition captions will be
- output in the specified language (setting the AsciiDoc 'lang'
- attribute sets the DocBook 'lang' attribute).
-
-On the other hand, HTML output directly from AsciiDoc is much faster,
-is easily customized and can be used in situations where there is no
-suitable DocBook toolchain (for example, see the {website}[AsciiDoc
-website]).
-
-PDF generation
-~~~~~~~~~~~~~~
-There are two commonly used tools to generate PDFs from DocBook,
-<> and <>.
-
-.dblatex or FOP?
-- 'dblatex' is easier to install, there's zero configuration
- required and no Java VM to install -- it just works out of the box.
-- 'dblatex' source code highlighting and numbering is superb.
-- 'dblatex' is easier to use as it converts DocBook directly to PDF
- whereas before using 'FOP' you have to convert DocBook to XML-FO
- using <>.
-- 'FOP' is more feature complete (for example, callouts are processed
- inside literal layouts) and arguably produces nicer looking output.
-
-HTML Help generation
-~~~~~~~~~~~~~~~~~~~~
-. Convert DocBook XML documents to HTML Help compiler source files
- using <> and <>.
-. Convert the HTML Help source (`.hhp` and `.html`) files to HTML Help
- (`.chm`) files using the <>.
-
-Toolchain components summary
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-AsciiDoc::
- Converts AsciiDoc (`.txt`) files to DocBook XML (`.xml`) files.
-
-[[X13]]http://docbook.sourceforge.net/projects/xsl/[DocBook XSL Stylesheets]::
- These are a set of XSL stylesheets containing rules for converting
- DocBook XML documents to HTML, XSL-FO, manpage and HTML Help files.
- The stylesheets are used in conjunction with an XML parser such as
- <>.
-
-[[X40]]http://www.xmlsoft.org[xsltproc]::
- An XML parser for applying XSLT stylesheets (in our case the
- <>) to XML documents.
-
-[[X31]]http://dblatex.sourceforge.net/[dblatex]::
- Generates PDF, DVI, PostScript and LaTeX formats directly from
- DocBook source via the intermediate LaTeX typesetting language --
- uses <>, <> and
- `latex(1)`.
-
-[[X14]]http://xml.apache.org/fop/[FOP]::
- The Apache Formatting Objects Processor converts XSL-FO (`.fo`)
- files to PDF files. The XSL-FO files are generated from DocBook
- source files using <> and
- <>.
-
-[[X67]]Microsoft Help Compiler::
- The Microsoft HTML Help Compiler (`hhc.exe`) is a command-line tool
- that converts HTML Help source files to a single HTML Help (`.chm`)
- file. It runs on MS Windows platforms and can be downloaded from
- http://www.microsoft.com.
-
-AsciiDoc dblatex configuration files
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The AsciiDoc distribution `./dblatex` directory contains
-`asciidoc-dblatex.xsl` (customized XSL parameter settings) and
-`asciidoc-dblatex.sty` (customized LaTeX settings). These are examples
-of optional <> output customization and are used by
-<>.
-
-AsciiDoc DocBook XSL Stylesheets drivers
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You will have noticed that the distributed HTML and HTML Help
-documentation files (for example `./doc/asciidoc.html`) are not the
-plain outputs produced using the default 'DocBook XSL Stylesheets'
-configuration. This is because they have been processed using
-customized DocBook XSL Stylesheets along with (in the case of HTML
-outputs) the custom `./stylesheets/docbook-xsl.css` CSS stylesheet.
-
-You'll find the customized DocBook XSL drivers along with additional
-documentation in the distribution `./docbook-xsl` directory. The
-examples that follow are executed from the distribution documentation
-(`./doc`) directory. These drivers are also used by <>.
-
-`common.xsl`::
- Shared driver parameters. This file is not used directly but is
- included in all the following drivers.
-
-`chunked.xsl`::
- Generate chunked XHTML (separate HTML pages for each document
- section) in the `./doc/chunked` directory. For example:
-
- $ python ../asciidoc.py -b docbook asciidoc.txt
- $ xsltproc --nonet ../docbook-xsl/chunked.xsl asciidoc.xml
-
-`epub.xsl`::
- Used by <> to generate EPUB formatted documents.
-
-`fo.xsl`::
- Generate XSL Formatting Object (`.fo`) files for subsequent PDF
- file generation using FOP. For example:
-
- $ python ../asciidoc.py -b docbook article.txt
- $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
- $ fop article.fo article.pdf
-
-`htmlhelp.xsl`::
- Generate Microsoft HTML Help source files for the MS HTML Help
- Compiler in the `./doc/htmlhelp` directory. This example is run on
- MS Windows from a Cygwin shell prompt:
-
- $ python ../asciidoc.py -b docbook asciidoc.txt
- $ xsltproc --nonet ../docbook-xsl/htmlhelp.xsl asciidoc.xml
- $ c:/Program\ Files/HTML\ Help\ Workshop/hhc.exe htmlhelp.hhp
-
-`manpage.xsl`::
- Generate a `roff(1)` format UNIX man page from a DocBook XML
- 'refentry' document. This example generates an `asciidoc.1` man
- page file:
-
- $ python ../asciidoc.py -d manpage -b docbook asciidoc.1.txt
- $ xsltproc --nonet ../docbook-xsl/manpage.xsl asciidoc.1.xml
-
-`xhtml.xsl`::
- Convert a DocBook XML file to a single XHTML file. For example:
-
- $ python ../asciidoc.py -b docbook asciidoc.txt
- $ xsltproc --nonet ../docbook-xsl/xhtml.xsl asciidoc.xml > asciidoc.html
-
-If you want to see how the complete documentation set is processed
-take a look at the A-A-P script `./doc/main.aap`.
-
-
-Generating Plain Text Files
----------------------------
-AsciiDoc does not have a text backend (for most purposes AsciiDoc
-source text is fine), however you can convert AsciiDoc text files to
-formatted text using the AsciiDoc <> toolchain wrapper
-utility.
-
-
-[[X35]]
-HTML5 and XHTML 1.1
--------------------
-The 'xhtml11' and 'html5' backends embed or link CSS and JavaScript
-files in their outputs, there is also a <> plugin
-framework.
-
-- If the AsciiDoc 'linkcss' attribute is defined then CSS and
- JavaScript files are linked to the output document, otherwise they
- are embedded (the default behavior).
-- The default locations for CSS and JavaScript files can be changed by
- setting the AsciiDoc 'stylesdir' and 'scriptsdir' attributes
- respectively.
-- The default locations for embedded and linked files differ and are
- calculated at different times -- embedded files are loaded when
- asciidoc(1) generates the output document, linked files are loaded
- by the browser when the user views the output document.
-- Embedded files are automatically inserted in the output files but
- you need to manually copy linked CSS and Javascript files from
- AsciiDoc <> to the correct location
- relative to the output document.
-
-.Stylesheet file locations
-[cols="3*",frame="topbot",options="header"]
-|====================================================================
-|'stylesdir' attribute
-|Linked location ('linkcss' attribute defined)
-|Embedded location ('linkcss' attribute undefined)
-
-|Undefined (default).
-|Same directory as the output document.
-|`stylesheets` subdirectory in the AsciiDoc configuration directory
-(the directory containing the backend conf file).
-
-|Absolute or relative directory name.
-|Absolute or relative to the output document.
-|Absolute or relative to the AsciiDoc configuration directory (the
-directory containing the backend conf file).
-
-|====================================================================
-
-.JavaScript file locations
-[cols="3*",frame="topbot",options="header"]
-|====================================================================
-|'scriptsdir' attribute
-|Linked location ('linkcss' attribute defined)
-|Embedded location ('linkcss' attribute undefined)
-
-|Undefined (default).
-|Same directory as the output document.
-|`javascripts` subdirectory in the AsciiDoc configuration directory
-(the directory containing the backend conf file).
-
-|Absolute or relative directory name.
-|Absolute or relative to the output document.
-|Absolute or relative to the AsciiDoc configuration directory (the
-directory containing the backend conf file).
-
-|====================================================================
-
-[[X99]]
-Themes
-~~~~~~
-The AsciiDoc 'theme' attribute is used to select an alternative CSS
-stylesheet and to optionally include additional JavaScript code.
-
-- Theme files reside in an AsciiDoc <>
- named `themes//` (where `` is the the theme name set
- by the 'theme' attribute). asciidoc(1) sets the 'themedir' attribute
- to the theme directory path name.
-- The 'theme' attribute can also be set using the asciidoc(1)
- `--theme` option, the `--theme` option can also be used to manage
- theme <>.
-- AsciiDoc ships with two themes: 'flask' and 'volnitsky'.
-- The `.css` file replaces the default `asciidoc.css` CSS file.
-- The `.js` file is included in addition to the default
- `asciidoc.js` JavaScript file.
-- If the <> attribute is defined then icons are loaded
- from the theme `icons` sub-directory if it exists (i.e. the
- 'iconsdir' attribute is set to theme `icons` sub-directory path).
-- Embedded theme files are automatically inserted in the output files
- but you need to manually copy linked CSS and Javascript files to the
- location of the output documents.
-- Linked CSS and JavaScript theme files are linked to the same linked
- locations as <>.
-
-For example, the command-line option `--theme foo` (or `--attribute
-theme=foo`) will cause asciidoc(1) to search <<"X27","configuration
-file locations 1, 2 and 3">> for a sub-directory called `themes/foo`
-containing the stylesheet `foo.css` and optionally a JavaScript file
-name `foo.js`.
-
-
-Document Structure
-------------------
-An AsciiDoc document consists of a series of <>
-starting with an optional document Header, followed by an optional
-Preamble, followed by zero or more document Sections.
-
-Almost any combination of zero or more elements constitutes a valid
-AsciiDoc document: documents can range from a single sentence to a
-multi-part book.
-
-Block Elements
-~~~~~~~~~~~~~~
-Block elements consist of one or more lines of text and may contain
-other block elements.
-
-The AsciiDoc block structure can be informally summarized as follows
-footnote:[This is a rough structural guide, not a rigorous syntax
-definition]:
-
- Document ::= (Header?,Preamble?,Section*)
- Header ::= (Title,(AuthorInfo,RevisionInfo?)?)
- AuthorInfo ::= (FirstName,(MiddleName?,LastName)?,EmailAddress?)
- RevisionInfo ::= (RevisionNumber?,RevisionDate,RevisionRemark?)
- Preamble ::= (SectionBody)
- Section ::= (Title,SectionBody?,(Section)*)
- SectionBody ::= ((BlockTitle?,Block)|BlockMacro)+
- Block ::= (Paragraph|DelimitedBlock|List|Table)
- List ::= (BulletedList|NumberedList|LabeledList|CalloutList)
- BulletedList ::= (ListItem)+
- NumberedList ::= (ListItem)+
- CalloutList ::= (ListItem)+
- LabeledList ::= (ListEntry)+
- ListEntry ::= (ListLabel,ListItem)
- ListLabel ::= (ListTerm+)
- ListItem ::= (ItemText,(List|ListParagraph|ListContinuation)*)
-
-Where:
-
-- '?' implies zero or one occurrence, '+' implies one or more
- occurrences, '*' implies zero or more occurrences.
-- All block elements are separated by line boundaries.
-- `BlockId`, `AttributeEntry` and `AttributeList` block elements (not
- shown) can occur almost anywhere.
-- There are a number of document type and backend specific
- restrictions imposed on the block syntax.
-- The following elements cannot contain blank lines: Header, Title,
- Paragraph, ItemText.
-- A ListParagraph is a Paragraph with its 'listelement' option set.
-- A ListContinuation is a <>.
-
-[[X95]]
-Header
-~~~~~~
-The Header contains document meta-data, typically title plus optional
-authorship and revision information:
-
-- The Header is optional, but if it is used it must start with a
- document <>.
-- Optional Author and Revision information immediately follows the
- header title.
-- The document header must be separated from the remainder of the
- document by one or more blank lines and cannot contain blank lines.
-- The header can include comments.
-- The header can include <>, typically
- 'doctype', 'lang', 'encoding', 'icons', 'data-uri', 'toc',
- 'numbered'.
-- Header attributes are overridden by command-line attributes.
-- If the header contains non-UTF-8 characters then the 'encoding' must
- precede the header (either in the document or on the command-line).
-
-Here's an example AsciiDoc document header:
-
- Writing Documentation using AsciiDoc
- ====================================
- Joe Bloggs
- v2.0, February 2003:
- Rewritten for version 2 release.
-
-The author information line contains the author's name optionally
-followed by the author's email address. The author's name is formatted
-like:
-
- firstname[ [middlename ]lastname][ ]]
-
-i.e. a first name followed by optional middle and last names followed
-by an email address in that order. Multi-word first, middle and last
-names can be entered using the underscore as a word separator. The
-email address comes last and must be enclosed in angle <> brackets.
-Here a some examples of author information lines:
-
- Joe Bloggs
- Joe Bloggs
- Vincent Willem van_Gogh
-
-If the author line does not match the above specification then the
-entire author line is treated as the first name.
-
-The optional revision information line follows the author information
-line. The revision information can be one of two formats:
-
-. An optional document revision number followed by an optional
- revision date followed by an optional revision remark:
-+
---
- * If the revision number is specified it must be followed by a
- comma.
- * The revision number must contain at least one numeric character.
- * Any non-numeric characters preceding the first numeric character
- will be dropped.
- * If a revision remark is specified it must be preceded by a colon.
- The revision remark extends from the colon up to the next blank
- line, attribute entry or comment and is subject to normal text
- substitutions.
- * If a revision number or remark has been set but the revision date
- has not been set then the revision date is set to the value of the
- 'docdate' attribute.
-
-Examples:
-
- v2.0, February 2003
- February 2003
- v2.0,
- v2.0, February 2003: Rewritten for version 2 release.
- February 2003: Rewritten for version 2 release.
- v2.0,: Rewritten for version 2 release.
- :Rewritten for version 2 release.
---
-
-. The revision information line can also be an RCS/CVS/SVN $Id$
- marker:
-+
---
- * AsciiDoc extracts the 'revnumber', 'revdate', and 'author'
- attributes from the $Id$ revision marker and displays them in the
- document header.
- * If an $Id$ revision marker is used the header author line can be
- omitted.
-
-Example:
-
- $Id: mydoc.txt,v 1.5 2009/05/17 17:58:44 jbloggs Exp $
---
-
-You can override or set header parameters by passing 'revnumber',
-'revremark', 'revdate', 'email', 'author', 'authorinitials',
-'firstname' and 'lastname' attributes using the asciidoc(1) `-a`
-(`--attribute`) command-line option. For example:
-
- $ asciidoc -a revdate=2004/07/27 article.txt
-
-Attribute entries can also be added to the header for substitution in
-the header template with <> elements.
-
-The 'title' element in HTML outputs is set to the AsciiDoc document
-title, you can set it to a different value by including a 'title'
-attribute entry in the document header.
-
-[[X87]]
-Additional document header information
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-AsciiDoc has two mechanisms for optionally including additional
-meta-data in the header of the output document:
-
-'docinfo' configuration file sections::
-If a <> section named 'docinfo' has been loaded
-then it will be included in the document header. Typically the
-'docinfo' section name will be prefixed with a '+' character so that it
-is appended to (rather than replace) other 'docinfo' sections.
-
-'docinfo' files::
-Two docinfo files are recognized: one named `docinfo` and a second
-named like the AsciiDoc source file with a `-docinfo` suffix. For
-example, if the source document is called `mydoc.txt` then the
-document information files would be `docinfo.xml` and
-`mydoc-docinfo.xml` (for DocBook outputs) and `docinfo.html` and
-`mydoc-docinfo.html` (for HTML outputs). The <> attributes control which docinfo files are included in
-the output files.
-
-The contents docinfo templates and files is dependent on the type of
-output:
-
-HTML::
- Valid 'head' child elements. Typically 'style' and 'script' elements
- for CSS and JavaScript inclusion.
-
-DocBook::
- Valid 'articleinfo' or 'bookinfo' child elements. DocBook defines
- numerous elements for document meta-data, for example: copyrights,
- document history and authorship information. See the DocBook
- `./doc/article-docinfo.xml` example that comes with the AsciiDoc
- distribution. The rendering of meta-data elements (or not) is
- DocBook processor dependent.
-
-
-[[X86]]
-Preamble
-~~~~~~~~
-The Preamble is an optional untitled section body between the document
-Header and the first Section title.
-
-Sections
-~~~~~~~~
-In addition to the document title (level 0), AsciiDoc supports four
-section levels: 1 (top) to 4 (bottom). Section levels are delimited
-by section <>. Sections are translated using
-configuration file <>. AsciiDoc
-generates the following <> specifically for
-use in section markup templates:
-
-level::
-The `level` attribute is the section level number, it is normally just
-the <> level number (1..4). However, if the `leveloffset`
-attribute is defined it will be added to the `level` attribute. The
-`leveloffset` attribute is useful for <>.
-
-sectnum::
-The `-n` (`--section-numbers`) command-line option generates the
-`sectnum` (section number) attribute. The `sectnum` attribute is used
-for section numbers in HTML outputs (DocBook section numbering are
-handled automatically by the DocBook toolchain commands).
-
-[[X93]]
-Section markup templates
-^^^^^^^^^^^^^^^^^^^^^^^^
-Section markup templates specify output markup and are defined in
-AsciiDoc configuration files. Section markup template names are
-derived as follows (in order of precedence):
-
-1. From the title's first positional attribute or 'template'
- attribute. For example, the following three section titles are
- functionally equivalent:
-+
-.....................................................................
-[[terms]]
-[glossary]
-List of Terms
--------------
-
-["glossary",id="terms"]
-List of Terms
--------------
-
-[template="glossary",id="terms"]
-List of Terms
--------------
-.....................................................................
-
-2. When the title text matches a configuration file
- <> entry.
-3. If neither of the above the default `sect` template is used
- (where `` is a number from 1 to 4).
-
-In addition to the normal section template names ('sect1', 'sect2',
-'sect3', 'sect4') AsciiDoc has the following templates for
-frontmatter, backmatter and other special sections: 'abstract',
-'preface', 'colophon', 'dedication', 'glossary', 'bibliography',
-'synopsis', 'appendix', 'index'. These special section templates
-generate the corresponding Docbook elements; for HTML outputs they
-default to the 'sect1' section template.
-
-Section IDs
-^^^^^^^^^^^
-If no explicit section ID is specified an ID will be synthesised from
-the section title. The primary purpose of this feature is to ensure
-persistence of table of contents links (permalinks): the missing
-section IDs are generated dynamically by the JavaScript TOC generator
-*after* the page is loaded. If you link to a dynamically generated TOC
-address the page will load but the browser will ignore the (as yet
-ungenerated) section ID.
-
-The IDs are generated by the following algorithm:
-
-- Replace all non-alphanumeric title characters with underscores.
-- Strip leading or trailing underscores.
-- Convert to lowercase.
-- Prepend the `idprefix` attribute (so there's no possibility of name
- clashes with existing document IDs). Prepend an underscore if the
- `idprefix` attribute is not defined.
-- A numbered suffix (`_2`, `_3` ...) is added if a same named
- auto-generated section ID exists.
-- If the `ascii-ids` attribute is defined then non-ASCII characters
- are replaced with ASCII equivalents. This attribute may be
- deprecated in future releases and *should be avoided*, it's sole
- purpose is to accommodate deficient downstream applications that
- cannot process non-ASCII ID attributes.
-
-Example: the title 'Jim's House' would generate the ID `_jim_s_house`.
-
-Section ID synthesis can be disabled by undefining the `sectids`
-attribute.
-
-[[X16]]
-Special Section Titles
-^^^^^^^^^^^^^^^^^^^^^^
-AsciiDoc has a mechanism for mapping predefined section titles
-auto-magically to specific markup templates. For example a title
-'Appendix A: Code Reference' will automatically use the 'appendix'
-<>. The mappings from title to template
-name are specified in `[specialsections]` sections in the Asciidoc
-language configuration files (`lang-*.conf`). Section entries are
-formatted like:
-
- =
-
-`` is a Python regular expression and `` is the name
-of a configuration file markup template section. If the ``
-matches an AsciiDoc document section title then the backend output is
-marked up using the `` markup template (instead of the
-default `sect` section template). The `{title}` attribute value
-is set to the value of the matched regular expression group named
-'title', if there is no 'title' group `{title}` defaults to the whole
-of the AsciiDoc section title. If `` is blank then any
-existing entry with the same `` will be deleted.
-
-.Special section titles vs. explicit template names
-*********************************************************************
-AsciiDoc has two mechanisms for specifying non-default section markup
-templates: you can specify the template name explicitly (using the
-'template' attribute) or indirectly (using 'special section titles').
-Specifying a <> attribute explicitly is
-preferred. Auto-magical 'special section titles' have the following
-drawbacks:
-
-- They are non-obvious, you have to know the exact matching
- title for each special section on a language by language basis.
-- Section titles are predefined and can only be customised with a
- configuration change.
-- The implementation is complicated by multiple languages: every
- special section title has to be defined for each language (in each
- of the `lang-*.conf` files).
-
-Specifying special section template names explicitly does add more
-noise to the source document (the 'template' attribute declaration),
-but the intention is obvious and the syntax is consistent with other
-AsciiDoc elements c.f. bibliographic, Q&A and glossary lists.
-
-Special section titles have been deprecated but are retained for
-backward compatibility.
-
-*********************************************************************
-
-Inline Elements
-~~~~~~~~~~~~~~~
-<> are used to format text and to
-perform various types of text substitution. Inline elements and inline
-element syntax is defined in the asciidoc(1) configuration files.
-
-Here is a list of AsciiDoc inline elements in the (default) order in
-which they are processed:
-
-Special characters::
- These character sequences escape special characters used by
- the backend markup (typically `<`, `>`, and `&` characters).
- See `[specialcharacters]` configuration file sections.
-
-Quotes::
- Elements that markup words and phrases; usually for character
- formatting. See `[quotes]` configuration file sections.
-
-Special Words::
- Word or word phrase patterns singled out for markup without
- the need for further annotation. See `[specialwords]`
- configuration file sections.
-
-Replacements::
- Each replacement defines a word or word phrase pattern to
- search for along with corresponding replacement text. See
- `[replacements]` configuration file sections.
-
-Attribute references::
- Document attribute names enclosed in braces are replaced by
- the corresponding attribute value.
-
-Inline Macros::
- Inline macros are replaced by the contents of parametrized
- configuration file sections.
-
-
-Document Processing
--------------------
-The AsciiDoc source document is read and processed as follows:
-
-1. The document 'Header' is parsed, header parameter values are
- substituted into the configuration file `[header]` template section
- which is then written to the output file.
-2. Each document 'Section' is processed and its constituent elements
- translated to the output file.
-3. The configuration file `[footer]` template section is substituted
- and written to the output file.
-
-When a block element is encountered asciidoc(1) determines the type of
-block by checking in the following order (first to last): (section)
-Titles, BlockMacros, Lists, DelimitedBlocks, Tables, AttributeEntrys,
-AttributeLists, BlockTitles, Paragraphs.
-
-The default paragraph definition `[paradef-default]` is last element
-to be checked.
-
-Knowing the parsing order will help you devise unambiguous macro, list
-and block syntax rules.
-
-Inline substitutions within block elements are performed in the
-following default order:
-
-1. Special characters
-2. Quotes
-3. Special words
-4. Replacements
-5. Attributes
-6. Inline Macros
-7. Replacements2
-
-The substitutions and substitution order performed on
-Title, Paragraph and DelimitedBlock elements is determined by
-configuration file parameters.
-
-
-Text Formatting
----------------
-[[X51]]
-Quoted Text
-~~~~~~~~~~~
-Words and phrases can be formatted by enclosing inline text with
-quote characters:
-
-_Emphasized text_::
- Word phrases \'enclosed in single quote characters' (acute
- accents) or \_underline characters_ are emphasized.
-
-*Strong text*::
- Word phrases \*enclosed in asterisk characters* are rendered
- in a strong font (usually bold).
-
-[[X81]]+Monospaced text+::
- Word phrases \+enclosed in plus characters+ are rendered in a
- monospaced font. Word phrases \`enclosed in backtick
- characters` (grave accents) are also rendered in a monospaced
- font but in this case the enclosed text is rendered literally
- and is not subject to further expansion (see <>).
-
-`Single quoted text'::
- Phrases enclosed with a \`single grave accent to the left and
- a single acute accent to the right' are rendered in single
- quotation marks.
-
-``Double quoted text''::
- Phrases enclosed with \\``two grave accents to the left and
- two acute accents to the right'' are rendered in quotation
- marks.
-
-#Unquoted text#::
- Placing \#hashes around text# does nothing, it is a mechanism
- to allow inline attributes to be applied to otherwise
- unformatted text.
-
-New quote types can be defined by editing asciidoc(1) configuration
-files. See the <> section for details.
-
-.Quoted text behavior
-- Quoting cannot be overlapped.
-- Different quoting types can be nested.
-- To suppress quoted text formatting place a backslash character
- immediately in front of the leading quote character(s). In the case
- of ambiguity between escaped and non-escaped text you will need to
- escape both leading and trailing quotes, in the case of
- multi-character quotes you may even need to escape individual
- characters.
-
-[[X96]]
-Quoted text attributes
-^^^^^^^^^^^^^^^^^^^^^^
-Quoted text can be prefixed with an <>. The first
-positional attribute ('role' attribute) is translated by AsciiDoc to
-an HTML 'span' element 'class' attribute or a DocBook 'phrase' element
-'role' attribute.
-
-DocBook XSL Stylesheets translate DocBook 'phrase' elements with
-'role' attributes to corresponding HTML 'span' elements with the same
-'class' attributes; CSS can then be used
-http://www.sagehill.net/docbookxsl/UsingCSS.html[to style the
-generated HTML]. Thus CSS styling can be applied to both DocBook and
-AsciiDoc generated HTML outputs. You can also specify multiple class
-names separated by spaces.
-
-CSS rules for text color, text background color, text size and text
-decorators are included in the distributed AsciiDoc CSS files and are
-used in conjunction with AsciiDoc 'xhtml11', 'html5' and 'docbook'
-outputs. The CSS class names are:
-
-- '' (text foreground color).
-- '-background' (text background color).
-- 'big' and 'small' (text size).
-- 'underline', 'overline' and 'line-through' (strike through) text
- decorators.
-
-Where '' can be any of the
-http://en.wikipedia.org/wiki/Web_colors#HTML_color_names[sixteen HTML
-color names]. Examples:
-
- [red]#Obvious# and [big red yellow-background]*very obvious*.
-
- [underline]#Underline text#, [overline]#overline text# and
- [blue line-through]*bold blue and line-through*.
-
-is rendered as:
-
-[red]#Obvious# and [big red yellow-background]*very obvious*.
-
-[underline]#Underline text#, [overline]#overline text# and
-[bold blue line-through]*bold blue and line-through*.
-
-NOTE: Color and text decorator attributes are rendered for XHTML and
-HTML 5 outputs using CSS stylesheets. The mechanism to implement
-color and text decorator attributes is provided for DocBook toolchains
-via the DocBook 'phrase' element 'role' attribute, but the actual
-rendering is toolchain specific and is not part of the AsciiDoc
-distribution.
-
-[[X52]]
-Constrained and Unconstrained Quotes
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-There are actually two types of quotes:
-
-Constrained quotes
-++++++++++++++++++
-Quoted must be bounded by white space or commonly adjoining
-punctuation characters. These are the most commonly used type of
-quote.
-
-Unconstrained quotes
-++++++++++++++++++++
-Unconstrained quotes have no boundary constraints and can be placed
-anywhere within inline text. For consistency and to make them easier
-to remember unconstrained quotes are double-ups of the `_`, `*`, `+`
-and `#` constrained quotes:
-
- __unconstrained emphasized text__
- **unconstrained strong text**
- ++unconstrained monospaced text++
- ##unconstrained unquoted text##
-
-The following example emboldens the letter F:
-
- **F**ile Open...
-
-Superscripts and Subscripts
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Put \^carets on either^ side of the text to be superscripted, put
-\~tildes on either side~ of text to be subscripted. For example, the
-following line:
-
- e^πi^+1 = 0. H~2~O and x^10^. Some ^super text^
- and ~some sub text~
-
-Is rendered like:
-
-e^πi^+1 = 0. H~2~O and x^10^. Some ^super text^
-and ~some sub text~
-
-Superscripts and subscripts are implemented as <> and they can be escaped with a leading backslash and prefixed
-with with an attribute list.
-
-Line Breaks
-~~~~~~~~~~~
-A plus character preceded by at least one space character at the end
-of a non-blank line forces a line break. It generates a line break
-(`br`) tag for HTML outputs and a custom XML `asciidoc-br` processing
-instruction for DocBook outputs. The `asciidoc-br` processing
-instruction is handled by <>.
-
-Page Breaks
-~~~~~~~~~~~
-A line of three or more less-than (`<<<`) characters will generate a
-hard page break in DocBook and printed HTML outputs. It uses the CSS
-`page-break-after` property for HTML outputs and a custom XML
-`asciidoc-pagebreak` processing instruction for DocBook outputs. The
-`asciidoc-pagebreak` processing instruction is handled by
-<>. Hard page breaks are sometimes handy but as a general
-rule you should let your page processor generate page breaks for you.
-
-Rulers
-~~~~~~
-A line of three or more apostrophe characters will generate a ruler
-line. It generates a ruler (`hr`) tag for HTML outputs and a custom
-XML `asciidoc-hr` processing instruction for DocBook outputs. The
-`asciidoc-hr` processing instruction is handled by <>.
-
-Tabs
-~~~~
-By default tab characters input files will translated to 8 spaces. Tab
-expansion is set with the 'tabsize' entry in the configuration file
-`[miscellaneous]` section and can be overridden in included files by
-setting a 'tabsize' attribute in the `include` macro's attribute list.
-For example:
-
- include::addendum.txt[tabsize=2]
-
-The tab size can also be set using the attribute command-line option,
-for example `--attribute tabsize=4`
-
-Replacements
-~~~~~~~~~~~~
-The following replacements are defined in the default AsciiDoc
-configuration:
-
- (C) copyright, (TM) trademark, (R) registered trademark,
- -- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
- double arrow, <= left double arrow.
-
-Which are rendered as:
-
-(C) copyright, (TM) trademark, (R) registered trademark,
--- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
-double arrow, <= left double arrow.
-
-You can also include arbitrary entity references in the AsciiDoc
-source. Examples:
-
- ➊ ¶
-
-renders:
-
-➊ ¶
-
-To render a replacement literally escape it with a leading back-slash.
-
-The <> section explains how to configure your
-own replacements.
-
-Special Words
-~~~~~~~~~~~~~
-Words defined in `[specialwords]` configuration file sections are
-automatically marked up without having to be explicitly notated.
-
-The <> section explains how to add and replace
-special words.
-
-
-[[X17]]
-Titles
-------
-Document and section titles can be in either of two formats:
-
-Two line titles
-~~~~~~~~~~~~~~~
-A two line title consists of a title line, starting hard against the
-left margin, and an underline. Section underlines consist a repeated
-character pairs spanning the width of the preceding title (give or
-take up to two characters):
-
-The default title underlines for each of the document levels are:
-
-
- Level 0 (top level): ======================
- Level 1: ----------------------
- Level 2: ~~~~~~~~~~~~~~~~~~~~~~
- Level 3: ^^^^^^^^^^^^^^^^^^^^^^
- Level 4 (bottom level): ++++++++++++++++++++++
-
-Examples:
-
- Level One Section Title
- -----------------------
-
- Level 2 Subsection Title
- ~~~~~~~~~~~~~~~~~~~~~~~~
-
-[[X46]]
-One line titles
-~~~~~~~~~~~~~~~
-One line titles consist of a single line delimited on either side by
-one or more equals characters (the number of equals characters
-corresponds to the section level minus one). Here are some examples:
-
- = Document Title (level 0) =
- == Section title (level 1) ==
- === Section title (level 2) ===
- ==== Section title (level 3) ====
- ===== Section title (level 4) =====
-
-[NOTE]
-=====================================================================
-- One or more spaces must fall between the title and the delimiters.
-- The trailing title delimiter is optional.
-- The one-line title syntax can be changed by editing the
- configuration file `[titles]` section `sect0`...`sect4` entries.
-=====================================================================
-
-Floating titles
-~~~~~~~~~~~~~~~
-Setting the title's first positional attribute or 'style' attribute to
-'float' generates a free-floating title. A free-floating title is
-rendered just like a normal section title but is not formally
-associated with a text body and is not part of the regular section
-hierarchy so the normal ordering rules do not apply. Floating titles
-can also be used in contexts where section titles are illegal: for
-example sidebar and admonition blocks. Example:
-
- [float]
- The second day
- ~~~~~~~~~~~~~~
-
-Floating titles do not appear in a document's table of contents.
-
-
-[[X42]]
-Block Titles
-------------
-A 'BlockTitle' element is a single line beginning with a period
-followed by the title text. A BlockTitle is applied to the immediately
-following Paragraph, DelimitedBlock, List, Table or BlockMacro. For
-example:
-
-........................
-.Notes
-- Note 1.
-- Note 2.
-........................
-
-is rendered as:
-
-.Notes
-- Note 1.
-- Note 2.
-
-
-[[X41]]
-BlockId Element
----------------
-A 'BlockId' is a single line block element containing a unique
-identifier enclosed in double square brackets. It is used to assign an
-identifier to the ensuing block element. For example:
-
- [[chapter-titles]]
- Chapter titles can be ...
-
-The preceding example identifies the ensuing paragraph so it can be
-referenced from other locations, for example with
-`<>`.
-
-'BlockId' elements can be applied to Title, Paragraph, List,
-DelimitedBlock, Table and BlockMacro elements. The BlockId element
-sets the `{id}` attribute for substitution in the subsequent block's
-markup template. If a second positional argument is supplied it sets
-the `{reftext}` attribute which is used to set the DocBook `xreflabel`
-attribute.
-
-The 'BlockId' element has the same syntax and serves the same function
-to the <>.
-
-[[X79]]
-AttributeList Element
----------------------
-An 'AttributeList' block element is an <> on a
-line by itself:
-
-- 'AttributeList' attributes are only applied to the immediately
- following block element -- the attributes are made available to the
- block's markup template.
-- Multiple contiguous 'AttributeList' elements are additively combined
- in the order they appear..
-- The first positional attribute in the list is often used to specify
- the ensuing element's <>.
-
-Attribute value substitution
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-By default, only substitutions that take place inside attribute list
-values are attribute references, this is because not all attributes
-are destined to be marked up and rendered as text (for example the
-table 'cols' attribute). To perform normal inline text substitutions
-(special characters, quotes, macros, replacements) on an attribute
-value you need to enclose it in single quotes. In the following quote
-block the second attribute value in the AttributeList is quoted to
-ensure the 'http' macro is expanded to a hyperlink.
-
----------------------------------------------------------------------
-[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]']
-_____________________________________________________________________
-Sir, a woman's preaching is like a dog's walking on his hind legs. It
-is not done well; but you are surprised to find it done at all.
-_____________________________________________________________________
----------------------------------------------------------------------
-
-Common attributes
-~~~~~~~~~~~~~~~~~
-Most block elements support the following attributes:
-
-[cols="1e,1,5a",frame="topbot",options="header"]
-|====================================================================
-|Name |Backends |Description
-
-|id |html4, html5, xhtml11, docbook |
-Unique identifier typically serve as link targets.
-Can also be set by the 'BlockId' element.
-
-|role |html4, html5, xhtml11, docbook |
-Role contains a string used to classify or subclassify an element and
-can be applied to AsciiDoc block elements. The AsciiDoc 'role'
-attribute is translated to the 'role' attribute in DocBook outputs and
-is included in the 'class' attribute in HTML outputs, in this respect
-it behaves like the <>.
-
-DocBook XSL Stylesheets translate DocBook 'role' attributes to HTML
-'class' attributes; CSS can then be used
-http://www.sagehill.net/docbookxsl/UsingCSS.html[to style the
-generated HTML].
-
-|reftext |docbook |
-'reftext' is used to set the DocBook 'xreflabel' attribute.
-The 'reftext' attribute can an also be set by the 'BlockId' element.
-
-|====================================================================
-
-
-Paragraphs
-----------
-Paragraphs are blocks of text terminated by a blank line, the end of
-file, or the start of a delimited block or a list. There are three
-paragraph syntaxes: normal, indented (literal) and admonition which
-are rendered, by default, with the corresponding paragraph style.
-
-Each syntax has a default style, but you can explicitly apply any
-paragraph style to any paragraph syntax. You can also apply
-<> styles to single paragraphs.
-
-The built-in paragraph styles are: 'normal', 'literal', 'verse',
-'quote', 'listing', 'TIP', 'NOTE', 'IMPORTANT', 'WARNING', 'CAUTION',
-'abstract', 'partintro', 'comment', 'example', 'sidebar', 'source',
-'music', 'latex', 'graphviz'.
-
-normal paragraph syntax
-~~~~~~~~~~~~~~~~~~~~~~~
-Normal paragraph syntax consists of one or more non-blank lines of
-text. The first line must start hard against the left margin (no
-intervening white space). The default processing expectation is that
-of a normal paragraph of text.
-
-[[X85]]
-literal paragraph syntax
-~~~~~~~~~~~~~~~~~~~~~~~~
-Literal paragraphs are rendered verbatim in a monospaced font without
-any distinguishing background or border. By default there is no text
-formatting or substitutions within Literal paragraphs apart from
-Special Characters and Callouts.
-
-The 'literal' style is applied implicitly to indented paragraphs i.e.
-where the first line of the paragraph is indented by one or more space
-or tab characters. For example:
-
----------------------------------------------------------------------
- Consul *necessitatibus* per id,
- consetetur, eu pro everti postulant
- homero verear ea mea, qui.
----------------------------------------------------------------------
-
-Renders:
-
- Consul *necessitatibus* per id,
- consetetur, eu pro everti postulant
- homero verear ea mea, qui.
-
-NOTE: Because <> can be indented it's possible for your
-indented paragraph to be misinterpreted as a list -- in situations
-like this apply the 'literal' style to a normal paragraph.
-
-Instead of using a paragraph indent you could apply the 'literal'
-style explicitly, for example:
-
----------------------------------------------------------------------
-[literal]
-Consul *necessitatibus* per id,
-consetetur, eu pro everti postulant
-homero verear ea mea, qui.
----------------------------------------------------------------------
-
-Renders:
-
-[literal]
-Consul *necessitatibus* per id,
-consetetur, eu pro everti postulant
-homero verear ea mea, qui.
-
-[[X94]]
-quote and verse paragraph styles
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The optional 'attribution' and 'citetitle' attributes (positional
-attributes 2 and 3) specify the author and source respectively.
-
-The 'verse' style retains the line breaks, for example:
-
----------------------------------------------------------------------
-[verse, William Blake, from Auguries of Innocence]
-To see a world in a grain of sand,
-And a heaven in a wild flower,
-Hold infinity in the palm of your hand,
-And eternity in an hour.
----------------------------------------------------------------------
-
-Which is rendered as:
-
-[verse, William Blake, from Auguries of Innocence]
-To see a world in a grain of sand,
-And a heaven in a wild flower,
-Hold infinity in the palm of your hand,
-And eternity in an hour.
-
-The 'quote' style flows the text at left and right margins, for
-example:
-
----------------------------------------------------------------------
-[quote, Bertrand Russell, The World of Mathematics (1956)]
-A good notation has subtlety and suggestiveness which at times makes
-it almost seem like a live teacher.
----------------------------------------------------------------------
-
-Which is rendered as:
-
-[quote, Bertrand Russell, The World of Mathematics (1956)]
-A good notation has subtlety and suggestiveness which at times makes
-it almost seem like a live teacher.
-
-[[X28]]
-Admonition Paragraphs
-~~~~~~~~~~~~~~~~~~~~~
-'TIP', 'NOTE', 'IMPORTANT', 'WARNING' and 'CAUTION' admonishment
-paragraph styles are generated by placing `NOTE:`, `TIP:`,
-`IMPORTANT:`, `WARNING:` or `CAUTION:` as the first word of the
-paragraph. For example:
-
- NOTE: This is an example note.
-
-Alternatively, you can specify the paragraph admonition style
-explicitly using an <>. For example:
-
- [NOTE]
- This is an example note.
-
-Renders:
-
-NOTE: This is an example note.
-
-TIP: If your admonition requires more than a single paragraph use an
-<> instead.
-
-[[X47]]
-Admonition Icons and Captions
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-NOTE: Admonition customization with `icons`, `iconsdir`, `icon` and
-`caption` attributes does not apply when generating DocBook output. If
-you are going the DocBook route then the <> `--no-icons`
-and `--icons-dir` options can be used to set the appropriate XSL
-Stylesheets parameters.
-
-By default the asciidoc(1) HTML backends generate text captions
-instead of admonition icon image links. To generate links to icon
-images define the <> attribute, for example using the `-a
-icons` command-line option.
-
-The <> attribute sets the location of linked icon
-images.
-
-You can override the default icon image using the `icon` attribute to
-specify the path of the linked image. For example:
-
- [icon="./images/icons/wink.png"]
- NOTE: What lovely war.
-
-Use the `caption` attribute to customize the admonition captions (not
-applicable to `docbook` backend). The following example suppresses the
-icon image and customizes the caption of a 'NOTE' admonition
-(undefining the `icons` attribute with `icons=None` is only necessary
-if <> have been enabled):
-
- [icons=None, caption="My Special Note"]
- NOTE: This is my special note.
-
-This subsection also applies to <>.
-
-
-[[X104]]
-Delimited Blocks
-----------------
-Delimited blocks are blocks of text enveloped by leading and trailing
-delimiter lines (normally a series of four or more repeated
-characters). The behavior of Delimited Blocks is specified by entries
-in configuration file `[blockdef-*]` sections.
-
-Predefined Delimited Blocks
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-AsciiDoc ships with a number of predefined DelimitedBlocks (see the
-`asciidoc.conf` configuration file in the asciidoc(1) program
-directory):
-
-Predefined delimited block underlines:
-
- CommentBlock: //////////////////////////
- PassthroughBlock: ++++++++++++++++++++++++++
- ListingBlock: --------------------------
- LiteralBlock: ..........................
- SidebarBlock: **************************
- QuoteBlock: __________________________
- ExampleBlock: ==========================
- OpenBlock: --
-
-.Default DelimitedBlock substitutions
-[cols="2e,7*^",frame="topbot",options="header,autowidth"]
-|=====================================================
-| |Attributes |Callouts |Macros | Quotes |Replacements
-|Special chars |Special words
-
-|PassthroughBlock |Yes |No |Yes |No |No |No |No
-|ListingBlock |No |Yes |No |No |No |Yes |No
-|LiteralBlock |No |Yes |No |No |No |Yes |No
-|SidebarBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
-|QuoteBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
-|ExampleBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
-|OpenBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
-|=====================================================
-
-Listing Blocks
-~~~~~~~~~~~~~~
-'ListingBlocks' are rendered verbatim in a monospaced font, they
-retain line and whitespace formatting and are often distinguished by a
-background or border. There is no text formatting or substitutions
-within Listing blocks apart from Special Characters and Callouts.
-Listing blocks are often used for computer output and file listings.
-
-Here's an example:
-
-[listing]
-......................................
---------------------------------------
-#include
-
-int main() {
- printf("Hello World!\n");
- exit(0);
-}
---------------------------------------
-......................................
-
-Which will be rendered like:
-
---------------------------------------
-#include
-
-int main() {
- printf("Hello World!\n");
- exit(0);
-}
---------------------------------------
-
-By convention <> use the listing block syntax and
-are implemented as distinct listing block styles.
-
-[[X65]]
-Literal Blocks
-~~~~~~~~~~~~~~
-'LiteralBlocks' are rendered just like <>.
-Example:
-
----------------------------------------------------------------------
-...................................
-Consul *necessitatibus* per id,
-consetetur, eu pro everti postulant
-homero verear ea mea, qui.
-...................................
----------------------------------------------------------------------
-
-Renders:
-...................................
-Consul *necessitatibus* per id,
-consetetur, eu pro everti postulant
-homero verear ea mea, qui.
-...................................
-
-If the 'listing' style is applied to a LiteralBlock it will be
-rendered as a ListingBlock (this is handy if you have a listing
-containing a ListingBlock).
-
-Sidebar Blocks
-~~~~~~~~~~~~~~
-A sidebar is a short piece of text presented outside the narrative
-flow of the main text. The sidebar is normally presented inside a
-bordered box to set it apart from the main text.
-
-The sidebar body is treated like a normal section body.
-
-Here's an example:
-
----------------------------------------------------------------------
-.An Example Sidebar
-************************************************
-Any AsciiDoc SectionBody element (apart from
-SidebarBlocks) can be placed inside a sidebar.
-************************************************
----------------------------------------------------------------------
-
-Which will be rendered like:
-
-.An Example Sidebar
-************************************************
-Any AsciiDoc SectionBody element (apart from
-SidebarBlocks) can be placed inside a sidebar.
-************************************************
-
-[[X26]]
-Comment Blocks
-~~~~~~~~~~~~~~
-The contents of 'CommentBlocks' are not processed; they are useful for
-annotations and for excluding new or outdated content that you don't
-want displayed. CommentBlocks are never written to output files.
-Example:
-
----------------------------------------------------------------------
-//////////////////////////////////////////
-CommentBlock contents are not processed by
-asciidoc(1).
-//////////////////////////////////////////
----------------------------------------------------------------------
-
-See also <>.
-
-NOTE: System macros are executed inside comment blocks.
-
-[[X76]]
-Passthrough Blocks
-~~~~~~~~~~~~~~~~~~
-By default the block contents is subject only to 'attributes' and
-'macros' substitutions (use an explicit 'subs' attribute to apply
-different substitutions). PassthroughBlock content will often be
-backend specific. Here's an example:
-
----------------------------------------------------------------------
-[subs="quotes"]
-++++++++++++++++++++++++++++++++++++++
-
-
*Cell 1*
-
*Cell 2*
-
-++++++++++++++++++++++++++++++++++++++
----------------------------------------------------------------------
-
-The following styles can be applied to passthrough blocks:
-
-pass::
- No substitutions are performed. This is equivalent to `subs="none"`.
-
-asciimath, latexmath::
- By default no substitutions are performed, the contents are rendered
- as <>.
-
-Quote Blocks
-~~~~~~~~~~~~
-'QuoteBlocks' are used for quoted passages of text. There are two
-styles: 'quote' and 'verse'. The style behavior is identical to
-<> except that blocks can contain
-multiple paragraphs and, in the case of the 'quote' style, other
-section elements. The first positional attribute sets the style, if
-no attributes are specified the 'quote' style is used. The optional
-'attribution' and 'citetitle' attributes (positional attributes 2 and
-3) specify the quote's author and source. For example:
-
----------------------------------------------------------------------
-[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
-____________________________________________________________________
-As he spoke there was the sharp sound of horses' hoofs and
-grating wheels against the curb, followed by a sharp pull at the
-bell. Holmes whistled.
-
-"A pair, by the sound," said he. "Yes," he continued, glancing
-out of the window. "A nice little brougham and a pair of
-beauties. A hundred and fifty guineas apiece. There's money in
-this case, Watson, if there is nothing else."
-____________________________________________________________________
----------------------------------------------------------------------
-
-Which is rendered as:
-
-[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
-____________________________________________________________________
-As he spoke there was the sharp sound of horses' hoofs and
-grating wheels against the curb, followed by a sharp pull at the
-bell. Holmes whistled.
-
-"A pair, by the sound," said he. "Yes," he continued, glancing
-out of the window. "A nice little brougham and a pair of
-beauties. A hundred and fifty guineas apiece. There's money in
-this case, Watson, if there is nothing else."
-____________________________________________________________________
-
-[[X48]]
-Example Blocks
-~~~~~~~~~~~~~~
-'ExampleBlocks' encapsulate the DocBook Example element and are used
-for, well, examples. Example blocks can be titled by preceding them
-with a 'BlockTitle'. DocBook toolchains will normally automatically
-number examples and generate a 'List of Examples' backmatter section.
-
-Example blocks are delimited by lines of equals characters and can
-contain any block elements apart from Titles, BlockTitles and
-Sidebars) inside an example block. For example:
-
----------------------------------------------------------------------
-.An example
-=====================================================================
-Qui in magna commodo, est labitur dolorum an. Est ne magna primis
-adolescens.
-=====================================================================
----------------------------------------------------------------------
-
-Renders:
-
-.An example
-=====================================================================
-Qui in magna commodo, est labitur dolorum an. Est ne magna primis
-adolescens.
-=====================================================================
-
-A title prefix that can be inserted with the `caption` attribute
-(HTML backends). For example:
-
----------------------------------------------------------------------
-[caption="Example 1: "]
-.An example with a custom caption
-=====================================================================
-Qui in magna commodo, est labitur dolorum an. Est ne magna primis
-adolescens.
-=====================================================================
----------------------------------------------------------------------
-
-[[X22]]
-Admonition Blocks
-~~~~~~~~~~~~~~~~~
-The 'ExampleBlock' definition includes a set of admonition
-<> ('NOTE', 'TIP', 'IMPORTANT', 'WARNING', 'CAUTION') for
-generating admonition blocks (admonitions containing more than a
-<>). Just precede the 'ExampleBlock' with an
-attribute list specifying the admonition style name. For example:
-
----------------------------------------------------------------------
-[NOTE]
-.A NOTE admonition block
-=====================================================================
-Qui in magna commodo, est labitur dolorum an. Est ne magna primis
-adolescens.
-
-. Fusce euismod commodo velit.
-. Vivamus fringilla mi eu lacus.
- .. Fusce euismod commodo velit.
- .. Vivamus fringilla mi eu lacus.
-. Donec eget arcu bibendum
- nunc consequat lobortis.
-=====================================================================
----------------------------------------------------------------------
-
-Renders:
-
-[NOTE]
-.A NOTE admonition block
-=====================================================================
-Qui in magna commodo, est labitur dolorum an. Est ne magna primis
-adolescens.
-
-. Fusce euismod commodo velit.
-. Vivamus fringilla mi eu lacus.
- .. Fusce euismod commodo velit.
- .. Vivamus fringilla mi eu lacus.
-. Donec eget arcu bibendum
- nunc consequat lobortis.
-=====================================================================
-
-See also <>.
-
-[[X29]]
-Open Blocks
-~~~~~~~~~~~
-Open blocks are special:
-
-- The open block delimiter is line containing two hyphen characters
- (instead of four or more repeated characters).
-
-- They can be used to group block elements for <>.
-
-- Open blocks can be styled to behave like any other type of delimited
- block. The following built-in styles can be applied to open
- blocks: 'literal', 'verse', 'quote', 'listing', 'TIP', 'NOTE',
- 'IMPORTANT', 'WARNING', 'CAUTION', 'abstract', 'partintro',
- 'comment', 'example', 'sidebar', 'source', 'music', 'latex',
- 'graphviz'. For example, the following open block and listing block
- are functionally identical:
-
- [listing]
- --
- Lorum ipsum ...
- --
-
- ---------------
- Lorum ipsum ...
- ---------------
-
-- An unstyled open block groups section elements but otherwise does
- nothing.
-
-Open blocks are used to generate document abstracts and book part
-introductions:
-
-- Apply the 'abstract' style to generate an abstract, for example:
-
- [abstract]
- --
- In this paper we will ...
- --
-
-. Apply the 'partintro' style to generate a book part introduction for
- a multi-part book, for example:
-
- [partintro]
- .Optional part introduction title
- --
- Optional part introduction goes here.
- --
-
-
-[[X64]]
-Lists
------
-.List types
-- Bulleted lists. Also known as itemized or unordered lists.
-- Numbered lists. Also called ordered lists.
-- Labeled lists. Sometimes called variable or definition lists.
-- Callout lists (a list of callout annotations).
-
-.List behavior
-- List item indentation is optional and does not determine nesting,
- indentation does however make the source more readable.
-- Another list or a literal paragraph immediately following a list
- item will be implicitly included in the list item; use <> to explicitly append other block elements to a
- list item.
-- A comment block or a comment line block macro element will terminate
- a list -- use inline comment lines to put comments inside lists.
-- The `listindex` <> is the current list item
- index (1..). If this attribute is used outside a list then it's value
- is the number of items in the most recently closed list. Useful for
- displaying the number of items in a list.
-
-Bulleted Lists
-~~~~~~~~~~~~~~
-Bulleted list items start with a single dash or one to five asterisks
-followed by some white space then some text. Bulleted list syntaxes
-are:
-
-...................
-- List item.
-* List item.
-** List item.
-*** List item.
-**** List item.
-***** List item.
-...................
-
-Numbered Lists
-~~~~~~~~~~~~~~
-List item numbers are explicit or implicit.
-
-.Explicit numbering
-List items begin with a number followed by some white space then the
-item text. The numbers can be decimal (arabic), roman (upper or lower
-case) or alpha (upper or lower case). Decimal and alpha numbers are
-terminated with a period, roman numbers are terminated with a closing
-parenthesis. The different terminators are necessary to ensure 'i',
-'v' and 'x' roman numbers are are distinguishable from 'x', 'v' and
-'x' alpha numbers. Examples:
-
-.....................................................................
-1. Arabic (decimal) numbered list item.
-a. Lower case alpha (letter) numbered list item.
-F. Upper case alpha (letter) numbered list item.
-iii) Lower case roman numbered list item.
-IX) Upper case roman numbered list item.
-.....................................................................
-
-.Implicit numbering
-List items begin one to five period characters, followed by some white
-space then the item text. Examples:
-
-.....................................................................
-. Arabic (decimal) numbered list item.
-.. Lower case alpha (letter) numbered list item.
-... Lower case roman numbered list item.
-.... Upper case alpha (letter) numbered list item.
-..... Upper case roman numbered list item.
-.....................................................................
-
-You can use the 'style' attribute (also the first positional
-attribute) to specify an alternative numbering style. The numbered
-list style can be one of the following values: 'arabic', 'loweralpha',
-'upperalpha', 'lowerroman', 'upperroman'.
-
-Here are some examples of bulleted and numbered lists:
-
----------------------------------------------------------------------
-- Praesent eget purus quis magna eleifend eleifend.
- 1. Fusce euismod commodo velit.
- a. Fusce euismod commodo velit.
- b. Vivamus fringilla mi eu lacus.
- c. Donec eget arcu bibendum nunc consequat lobortis.
- 2. Vivamus fringilla mi eu lacus.
- i) Fusce euismod commodo velit.
- ii) Vivamus fringilla mi eu lacus.
- 3. Donec eget arcu bibendum nunc consequat lobortis.
- 4. Nam fermentum mattis ante.
-- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- * Fusce euismod commodo velit.
- ** Qui in magna commodo, est labitur dolorum an. Est ne magna primis
- adolescens. Sit munere ponderum dignissim et. Minim luptatum et
- vel.
- ** Vivamus fringilla mi eu lacus.
- * Donec eget arcu bibendum nunc consequat lobortis.
-- Nulla porttitor vulputate libero.
- . Fusce euismod commodo velit.
- . Vivamus fringilla mi eu lacus.
-[upperroman]
- .. Fusce euismod commodo velit.
- .. Vivamus fringilla mi eu lacus.
- . Donec eget arcu bibendum nunc consequat lobortis.
----------------------------------------------------------------------
-
-Which render as:
-
-- Praesent eget purus quis magna eleifend eleifend.
- 1. Fusce euismod commodo velit.
- a. Fusce euismod commodo velit.
- b. Vivamus fringilla mi eu lacus.
- c. Donec eget arcu bibendum nunc consequat lobortis.
- 2. Vivamus fringilla mi eu lacus.
- i) Fusce euismod commodo velit.
- ii) Vivamus fringilla mi eu lacus.
- 3. Donec eget arcu bibendum nunc consequat lobortis.
- 4. Nam fermentum mattis ante.
-- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- * Fusce euismod commodo velit.
- ** Qui in magna commodo, est labitur dolorum an. Est ne magna primis
- adolescens. Sit munere ponderum dignissim et. Minim luptatum et
- vel.
- ** Vivamus fringilla mi eu lacus.
- * Donec eget arcu bibendum nunc consequat lobortis.
-- Nulla porttitor vulputate libero.
- . Fusce euismod commodo velit.
- . Vivamus fringilla mi eu lacus.
-[upperroman]
- .. Fusce euismod commodo velit.
- .. Vivamus fringilla mi eu lacus.
- . Donec eget arcu bibendum nunc consequat lobortis.
-
-A predefined 'compact' option is available to bulleted and numbered
-lists -- this translates to the DocBook 'spacing="compact"' lists
-attribute which may or may not be processed by the DocBook toolchain.
-Example:
-
- [options="compact"]
- - Compact list item.
- - Another compact list item.
-
-TIP: To apply the 'compact' option globally define a document-wide
-'compact-option' attribute, e.g. using the `-a compact-option`
-command-line option.
-
-You can set the list start number using the 'start' attribute (works
-for HTML outputs and DocBook outputs processed by DocBook XSL
-Stylesheets). Example:
-
- [start=7]
- . List item 7.
- . List item 8.
-
-Labeled Lists
-~~~~~~~~~~~~~
-Labeled list items consist of one or more text labels followed by the
-text of the list item.
-
-An item label begins a line with an alphanumeric character hard
-against the left margin and ends with two, three or four colons or two
-semi-colons. A list item can have multiple labels, one per line.
-
-The list item text consists of one or more lines of text starting
-after the last label (either on the same line or a new line) and can
-be followed by nested List or ListParagraph elements. Item text can be
-optionally indented.
-
-Here are some examples:
-
----------------------------------------------------------------------
-In::
-Lorem::
- Fusce euismod commodo velit.
-
- Fusce euismod commodo velit.
-
-Ipsum:: Vivamus fringilla mi eu lacus.
- * Vivamus fringilla mi eu lacus.
- * Donec eget arcu bibendum nunc consequat lobortis.
-Dolor::
- Donec eget arcu bibendum nunc consequat lobortis.
- Suspendisse;;
- A massa id sem aliquam auctor.
- Morbi;;
- Pretium nulla vel lorem.
- In;;
- Dictum mauris in urna.
- Vivamus::: Fringilla mi eu lacus.
- Donec::: Eget arcu bibendum nunc consequat lobortis.
----------------------------------------------------------------------
-
-Which render as:
-
-In::
-Lorem::
- Fusce euismod commodo velit.
-
- Fusce euismod commodo velit.
-
-Ipsum:: Vivamus fringilla mi eu lacus.
- * Vivamus fringilla mi eu lacus.
- * Donec eget arcu bibendum nunc consequat lobortis.
-Dolor::
- Donec eget arcu bibendum nunc consequat lobortis.
- Suspendisse;;
- A massa id sem aliquam auctor.
- Morbi;;
- Pretium nulla vel lorem.
- In;;
- Dictum mauris in urna.
- Vivamus::: Fringilla mi eu lacus.
- Donec::: Eget arcu bibendum nunc consequat lobortis.
-
-Horizontal labeled list style
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The 'horizontal' labeled list style (also the first positional
-attribute) places the list text side-by-side with the label instead of
-under the label. Here is an example:
-
----------------------------------------------------------------------
-[horizontal]
-*Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
-labitur dolorum an. Est ne magna primis adolescens.
-
- Fusce euismod commodo velit.
-
-*Ipsum*:: Vivamus fringilla mi eu lacus.
-- Vivamus fringilla mi eu lacus.
-- Donec eget arcu bibendum nunc consequat lobortis.
-
-*Dolor*::
- - Vivamus fringilla mi eu lacus.
- - Donec eget arcu bibendum nunc consequat lobortis.
-
----------------------------------------------------------------------
-
-Which render as:
-
-[horizontal]
-*Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
-labitur dolorum an. Est ne magna primis adolescens.
-
- Fusce euismod commodo velit.
-
-*Ipsum*:: Vivamus fringilla mi eu lacus.
-- Vivamus fringilla mi eu lacus.
-- Donec eget arcu bibendum nunc consequat lobortis.
-
-*Dolor*::
- - Vivamus fringilla mi eu lacus.
- - Donec eget arcu bibendum nunc consequat lobortis.
-
-[NOTE]
-=====================================================================
-- Current PDF toolchains do not make a good job of determining
- the relative column widths for horizontal labeled lists.
-- Nested horizontal labeled lists will generate DocBook validation
- errors because the 'DocBook XML V4.2' DTD does not permit nested
- informal tables (although <> and
- <> process them correctly).
-- The label width can be set as a percentage of the total width by
- setting the 'width' attribute e.g. `width="10%"`
-=====================================================================
-
-Question and Answer Lists
-~~~~~~~~~~~~~~~~~~~~~~~~~
-AsciiDoc comes pre-configured with a 'qanda' style labeled list for generating
-DocBook question and answer (Q&A) lists. Example:
-
----------------------------------------------------------------------
-[qanda]
-Question one::
- Answer one.
-Question two::
- Answer two.
----------------------------------------------------------------------
-
-Renders:
-
-[qanda]
-Question one::
- Answer one.
-Question two::
- Answer two.
-
-Glossary Lists
-~~~~~~~~~~~~~~
-AsciiDoc comes pre-configured with a 'glossary' style labeled list for
-generating DocBook glossary lists. Example:
-
----------------------------------------------------------------------
-[glossary]
-A glossary term::
- The corresponding definition.
-A second glossary term::
- The corresponding definition.
----------------------------------------------------------------------
-
-For working examples see the `article.txt` and `book.txt` documents in
-the AsciiDoc `./doc` distribution directory.
-
-NOTE: To generate valid DocBook output glossary lists must be located
-in a section that uses the 'glossary' <>.
-
-Bibliography Lists
-~~~~~~~~~~~~~~~~~~
-AsciiDoc comes with a predefined 'bibliography' bulleted list style
-generating DocBook bibliography entries. Example:
-
----------------------------------------------------------------------
-[bibliography]
-.Optional list title
-- [[[taoup]]] Eric Steven Raymond. 'The Art of UNIX
- Programming'. Addison-Wesley. ISBN 0-13-142901-9.
-- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
- 'DocBook - The Definitive Guide'. O'Reilly & Associates.
- 1999. ISBN 1-56592-580-7.
----------------------------------------------------------------------
-
-The `[[[]]]` syntax is a bibliography entry anchor, it
-generates an anchor named `` and additionally displays
-`[]` at the anchor position. For example `[[[taoup]]]`
-generates an anchor named `taoup` that displays `[taoup]` at the
-anchor position. Cite the reference from elsewhere your document using
-`<>`, this displays a hyperlink (`[taoup]`) to the
-corresponding bibliography entry anchor.
-
-For working examples see the `article.txt` and `book.txt` documents in
-the AsciiDoc `./doc` distribution directory.
-
-NOTE: To generate valid DocBook output bibliography lists must be
-located in a <>.
-
-[[X15]]
-List Item Continuation
-~~~~~~~~~~~~~~~~~~~~~~
-Another list or a literal paragraph immediately following a list item
-is implicitly appended to the list item; to append other block
-elements to a list item you need to explicitly join them to the list
-item with a 'list continuation' (a separator line containing a single
-plus character). Multiple block elements can be appended to a list
-item using list continuations (provided they are legal list item
-children in the backend markup).
-
-Here are some examples of list item continuations: list item one
-contains multiple continuations; list item two is continued with an
-<> containing multiple elements:
-
----------------------------------------------------------------------
-1. List item one.
-+
-List item one continued with a second paragraph followed by an
-Indented block.
-+
-.................
-$ ls *.sh
-$ mv *.sh ~/tmp
-.................
-+
-List item continued with a third paragraph.
-
-2. List item two continued with an open block.
-+
---
-This paragraph is part of the preceding list item.
-
-a. This list is nested and does not require explicit item continuation.
-+
-This paragraph is part of the preceding list item.
-
-b. List item b.
-
-This paragraph belongs to item two of the outer list.
---
----------------------------------------------------------------------
-
-Renders:
-
-1. List item one.
-+
-List item one continued with a second paragraph followed by an
-Indented block.
-+
-.................
-$ ls *.sh
-$ mv *.sh ~/tmp
-.................
-+
-List item continued with a third paragraph.
-
-2. List item two continued with an open block.
-+
---
-This paragraph is part of the preceding list item.
-
-a. This list is nested and does not require explicit item continuation.
-+
-This paragraph is part of the preceding list item.
-
-b. List item b.
-
-This paragraph belongs to item two of the outer list.
---
-
-
-[[X92]]
-Footnotes
----------
-The shipped AsciiDoc configuration includes three footnote inline
-macros:
-
-`footnote:[]`::
- Generates a footnote with text ``.
-
-`footnoteref:[,]`::
- Generates a footnote with a reference ID `` and text ``.
-
-`footnoteref:[]`::
- Generates a reference to the footnote with ID ``.
-
-The footnote text can span multiple lines.
-
-The 'xhtml11' and 'html5' backends render footnotes dynamically using
-JavaScript; 'html4' outputs do not use JavaScript and leave the
-footnotes inline; 'docbook' footnotes are processed by the downstream
-DocBook toolchain.
-
-Example footnotes:
-
- A footnote footnote:[An example footnote.];
- a second footnote with a reference ID footnoteref:[note2,Second footnote.];
- finally a reference to the second footnote footnoteref:[note2].
-
-Renders:
-
-A footnote footnote:[An example footnote.];
-a second footnote with a reference ID footnoteref:[note2,Second footnote.];
-finally a reference to the second footnote footnoteref:[note2].
-
-
-Indexes
--------
-The shipped AsciiDoc configuration includes the inline macros for
-generating DocBook index entries.
-
-`indexterm:[,,]`::
-`(((,,)))`::
- This inline macro generates an index term (the `` and
- `` positional attributes are optional). Example:
- `indexterm:[Tigers,Big cats]` (or, using the alternative syntax
- `(((Tigers,Big cats)))`. Index terms that have secondary and
- tertiary entries also generate separate index terms for the
- secondary and tertiary entries. The index terms appear in the
- index, not the primary text flow.
-
-`indexterm2:[]`::
-`(())`::
- This inline macro generates an index term that appears in both the
- index and the primary text flow. The `` should not be
- padded to the left or right with white space characters.
-
-For working examples see the `article.txt` and `book.txt` documents in
-the AsciiDoc `./doc` distribution directory.
-
-NOTE: Index entries only really make sense if you are generating
-DocBook markup -- DocBook conversion programs automatically generate
-an index at the point an 'Index' section appears in source document.
-
-
-[[X105]]
-Callouts
---------
-Callouts are a mechanism for annotating verbatim text (for example:
-source code, computer output and user input). Callout markers are
-placed inside the annotated text while the actual annotations are
-presented in a callout list after the annotated text. Here's an
-example:
-
----------------------------------------------------------------------
- .MS-DOS directory listing
- -----------------------------------------------------
- 10/17/97 9:04 bin
- 10/16/97 14:11 DOS \<1>
- 10/16/97 14:40 Program Files
- 10/16/97 14:46 TEMP
- 10/17/97 9:04 tmp
- 10/16/97 14:37 WINNT
- 10/16/97 14:25 119 AUTOEXEC.BAT \<2>
- 2/13/94 6:21 54,619 COMMAND.COM \<2>
- 10/16/97 14:25 115 CONFIG.SYS \<2>
- 11/16/97 17:17 61,865,984 pagefile.sys
- 2/13/94 6:21 9,349 WINA20.386 \<3>
- -----------------------------------------------------
-
- \<1> This directory holds MS-DOS.
- \<2> System startup code for DOS.
- \<3> Some sort of Windows 3.1 hack.
----------------------------------------------------------------------
-
-Which renders:
-
-.MS-DOS directory listing
------------------------------------------------------
-10/17/97 9:04 bin
-10/16/97 14:11 DOS <1>
-10/16/97 14:40 Program Files
-10/16/97 14:46 TEMP
-10/17/97 9:04 tmp
-10/16/97 14:37 WINNT
-10/16/97 14:25 119 AUTOEXEC.BAT <2>
- 2/13/94 6:21 54,619 COMMAND.COM <2>
-10/16/97 14:25 115 CONFIG.SYS <2>
-11/16/97 17:17 61,865,984 pagefile.sys
- 2/13/94 6:21 9,349 WINA20.386 <3>
------------------------------------------------------
-
-<1> This directory holds MS-DOS.
-<2> System startup code for DOS.
-<3> Some sort of Windows 3.1 hack.
-
-.Explanation
-- The callout marks are whole numbers enclosed in angle brackets --
- they refer to the correspondingly numbered item in the following
- callout list.
-- By default callout marks are confined to 'LiteralParagraphs',
- 'LiteralBlocks' and 'ListingBlocks' (although this is a
- configuration file option and can be changed).
-- Callout list item numbering is fairly relaxed -- list items can
- start with ``, `n>` or `>` where `n` is the optional list item
- number (in the latter case list items starting with a single `>`
- character are implicitly numbered starting at one).
-- Callout lists should not be nested.
-- Callout lists start list items hard against the left margin.
-- If you want to present a number inside angle brackets you'll need to
- escape it with a backslash to prevent it being interpreted as a
- callout mark.
-
-NOTE: Define the AsciiDoc 'icons' attribute (for example using the `-a
-icons` command-line option) to display callout icons.
-
-Implementation Notes
-~~~~~~~~~~~~~~~~~~~~
-Callout marks are generated by the 'callout' inline macro while
-callout lists are generated using the 'callout' list definition. The
-'callout' macro and 'callout' list are special in that they work
-together. The 'callout' inline macro is not enabled by the normal
-'macros' substitutions option, instead it has its own 'callouts'
-substitution option.
-
-The following attributes are available during inline callout macro
-substitution:
-
-`{index}`::
- The callout list item index inside the angle brackets.
-`{coid}`::
- An identifier formatted like `CO-` that
- uniquely identifies the callout mark. For example `CO2-4`
- identifies the fourth callout mark in the second set of callout
- marks.
-
-The `{coids}` attribute can be used during callout list item
-substitution -- it is a space delimited list of callout IDs that refer
-to the explanatory list item.
-
-Including callouts in included code
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You can annotate working code examples with callouts -- just remember
-to put the callouts inside source code comments. This example displays
-the `test.py` source file (containing a single callout) using the
-'source' (code highlighter) filter:
-
-.AsciiDoc source
----------------------------------------------------------------------
- [source,python]
- -------------------------------------------
- \include::test.py[]
- -------------------------------------------
-
- \<1> Print statement.
----------------------------------------------------------------------
-
-.Included `test.py` source
----------------------------------------------------------------------
-print 'Hello World!' # \<1>
----------------------------------------------------------------------
-
-
-Macros
-------
-Macros are a mechanism for substituting parametrized text into output
-documents.
-
-Macros have a 'name', a single 'target' argument and an 'attribute
-list'. The usual syntax is `:[]` (for
-inline macros) and `::[]` (for block
-macros). Here are some examples:
-
- http://www.docbook.org/[DocBook.org]
- include::chapt1.txt[tabsize=2]
- mailto:srackham@gmail.com[]
-
-.Macro behavior
-- `` is the macro name. It can only contain letters, digits or
- dash characters and cannot start with a dash.
-- The optional `` cannot contain white space characters.
-- `` is a <> enclosed in square
- brackets.
-- `]` characters inside attribute lists must be escaped with a
- backslash.
-- Expansion of macro references can normally be escaped by prefixing a
- backslash character (see the AsciiDoc 'FAQ' for examples of
- exceptions to this rule).
-- Attribute references in block macros are expanded.
-- The substitutions performed prior to Inline macro macro expansion
- are determined by the inline context.
-- Macros are processed in the order they appear in the configuration
- file(s).
-- Calls to inline macros can be nested inside different inline macros
- (an inline macro call cannot contain a nested call to itself).
-- In addition to ``, `` and `` the
- `` and `` named groups are available to
- <>. A macro is a passthrough macro if the
- definition includes a `` named group.
-
-Inline Macros
-~~~~~~~~~~~~~
-Inline Macros occur in an inline element context. Predefined Inline
-macros include 'URLs', 'image' and 'link' macros.
-
-URLs
-^^^^
-'http', 'https', 'ftp', 'file', 'mailto' and 'callto' URLs are
-rendered using predefined inline macros.
-
-- If you don't need a custom link caption you can enter the 'http',
- 'https', 'ftp', 'file' URLs and email addresses without any special
- macro syntax.
-- If the `` is empty the URL is displayed.
-
-Here are some examples:
-
- http://www.docbook.org/[DocBook.org]
- http://www.docbook.org/
- mailto:joe.bloggs@foobar.com[email Joe Bloggs]
- joe.bloggs@foobar.com
-
-Which are rendered:
-
-http://www.docbook.org/[DocBook.org]
-
-http://www.docbook.org/
-
-mailto:joe.bloggs@foobar.com[email Joe Bloggs]
-
-joe.bloggs@foobar.com
-
-If the `` necessitates space characters use `%20`, for example
-`large%20image.png`.
-
-Internal Cross References
-^^^^^^^^^^^^^^^^^^^^^^^^^
-Two AsciiDoc inline macros are provided for creating hypertext links
-within an AsciiDoc document. You can use either the standard macro
-syntax or the (preferred) alternative.
-
-[[X30]]
-anchor
-++++++
-Used to specify hypertext link targets:
-
- [[,]]
- anchor:[]
-
-The `` is a unique string that conforms to the output markup's
-anchor syntax. The optional `` is the text to be displayed
-by captionless 'xref' macros that refer to this anchor. The optional
-`` is only really useful when generating DocBook output.
-Example anchor:
-
- [[X1]]
-
-You may have noticed that the syntax of this inline element is the
-same as that of the <>, this is no
-coincidence since they are functionally equivalent.
-
-xref
-++++
-Creates a hypertext link to a document anchor.
-
- <<,
>>
- xref:[
]
-
-The `` refers to an anchor ID. The optional `
` is the
-link's displayed text. Example:
-
- <>
-
-If `
` is not specified then the displayed text is
-auto-generated:
-
-- The AsciiDoc 'xhtml11' and 'html5' backends display the ``
- enclosed in square brackets.
-- If DocBook is produced the DocBook toolchain is responsible for the
- displayed text which will normally be the referenced figure, table
- or section title number followed by the element's title text.
-
-Here is an example:
-
----------------------------------------------------------------------
-[[tiger_image]]
-.Tyger tyger
-image::tiger.png[]
-
-This can be seen in <>.
----------------------------------------------------------------------
-
-Linking to Local Documents
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-Hypertext links to files on the local file system are specified using
-the 'link' inline macro.
-
- link:[
]
-
-The 'link' macro generates relative URLs. The link macro `` is
-the target file name (relative to the file system location of the
-referring document). The optional `
` is the link's displayed
-text. If `
` is not specified then `` is displayed.
-Example:
-
- link:downloads/foo.zip[download foo.zip]
-
-You can use the `#` syntax to refer to an anchor within
-a target document but this usually only makes sense when targeting
-HTML documents.
-
-[[X9]]
-Images
-^^^^^^
-Inline images are inserted into the output document using the 'image'
-macro. The inline syntax is:
-
- image:[]
-
-The contents of the image file `` is displayed. To display the
-image its file format must be supported by the target backend
-application. HTML and DocBook applications normally support PNG or JPG
-files.
-
-`` file name paths are relative to the location of the
-referring document.
-
-[[X55]]
-.Image macro attributes
-- The optional 'alt' attribute is also the first positional attribute,
- it specifies alternative text which is displayed if the output
- application is unable to display the image file (see also
- http://htmlhelp.com/feature/art3.htm[Use of ALT texts in IMGs]). For
- example:
-
- image:images/logo.png[Company Logo]
-
-- The optional 'title' attribute provides a title for the image. The
- <> renders the title alongside the image.
- The inline image macro displays the title as a popup ``tooltip'' in
- visual browsers (AsciiDoc HTML outputs only).
-
-- The optional `width` and `height` attributes scale the image size
- and can be used in any combination. The units are pixels. The
- following example scales the previous example to a height of 32
- pixels:
-
- image:images/logo.png["Company Logo",height=32]
-
-- The optional `link` attribute is used to link the image to an
- external document. The following example links a screenshot
- thumbnail to a full size version:
-
- image:screen-thumbnail.png[height=32,link="screen.png"]
-
-- The optional `scaledwidth` attribute is only used in DocBook block
- images (specifically for PDF documents). The following example
- scales the images to 75% of the available print width:
-
- image::images/logo.png[scaledwidth="75%",alt="Company Logo"]
-
-- The image `scale` attribute sets the DocBook `imagedata` element
- `scale` attribute.
-
-- The optional `align` attribute is used for horizontal image
- alignment. Allowed values are `center`, `left` and `right`. For
- example:
-
- image::images/tiger.png["Tiger image",align="left"]
-
-- The optional `float` attribute floats the image `left` or `right` on
- the page (works with HTML outputs only, has no effect on DocBook
- outputs). `float` and `align` attributes are mutually exclusive.
- Use the `unfloat::[]` block macro to stop floating.
-
-Comment Lines
-^^^^^^^^^^^^^
-See <>.
-
-Block Macros
-~~~~~~~~~~~~
-A Block macro reference must be contained in a single line separated
-either side by a blank line or a block delimiter.
-
-Block macros behave just like Inline macros, with the following
-differences:
-
-- They occur in a block context.
-- The default syntax is `::[]` (two
- colons, not one).
-- Markup template section names end in `-blockmacro` instead of
- `-inlinemacro`.
-
-Block Identifier
-^^^^^^^^^^^^^^^^
-The Block Identifier macro sets the `id` attribute and has the same
-syntax as the <> since it performs
-essentially the same function -- block templates use the `id`
-attribute as a block element ID. For example:
-
- [[X30]]
-
-This is equivalent to the `[id="X30"]` <>).
-
-[[X49]]
-Images
-^^^^^^
-The 'image' block macro is used to display images in a block context.
-The syntax is:
-
- image::[]
-
-The block `image` macro has the same <> as it's
-<> counterpart.
-
-Block images can be titled by preceding the 'image' macro with a
-'BlockTitle'. DocBook toolchains normally number titled block images
-and optionally list them in an automatically generated 'List of
-Figures' backmatter section.
-
-This example:
-
- .Main circuit board
- image::images/layout.png[J14P main circuit board]
-
-is equivalent to:
-
- image::images/layout.png["J14P main circuit board",
- title="Main circuit board"]
-
-A title prefix that can be inserted with the `caption` attribute
-(HTML backends). For example:
-
- .Main circuit board
- [caption="Figure 2: "]
- image::images/layout.png[J14P main circuit board]
-
-[[X66]]
-.Embedding images in XHTML documents
-*********************************************************************
-If you define the `data-uri` attribute then images will be embedded in
-XHTML outputs using the
-http://en.wikipedia.org/wiki/Data:_URI_scheme[data URI scheme]. You
-can use the 'data-uri' attribute with the 'xhtml11' and 'html5'
-backends to produce single-file XHTML documents with embedded images
-and CSS, for example:
-
- $ asciidoc -a data-uri mydocument.txt
-
-[NOTE]
-======
-- All current popular browsers support data URIs, although versions
- of Internet Explorer prior to version 8 do not.
-- Some browsers limit the size of data URIs.
-======
-*********************************************************************
-
-[[X25]]
-Comment Lines
-^^^^^^^^^^^^^
-Single lines starting with two forward slashes hard up against the
-left margin are treated as comments. Comment lines do not appear in
-the output unless the 'showcomments' attribute is defined. Comment
-lines have been implemented as both block and inline macros so a
-comment line can appear as a stand-alone block or within block elements
-that support inline macro expansion. Example comment line:
-
- // This is a comment.
-
-If the 'showcomments' attribute is defined comment lines are written
-to the output:
-
-- In DocBook the comment lines are enclosed by the 'remark' element
- (which may or may not be rendered by your toolchain).
-- The 'showcomments' attribute does not expose <>.
- Comment Blocks are never passed to the output.
-
-System Macros
-~~~~~~~~~~~~~
-System macros are block macros that perform a predefined task and are
-hardwired into the asciidoc(1) program.
-
-- You can escape system macros with a leading backslash character
- (as you can with other macros).
-- The syntax and tasks performed by system macros is built into
- asciidoc(1) so they don't appear in configuration files. You can
- however customize the syntax by adding entries to a configuration
- file `[macros]` section.
-
-[[X63]]
-Include Macros
-^^^^^^^^^^^^^^
-The `include` and `include1` system macros to include the contents of
-a named file into the source document.
-
-The `include` macro includes a file as if it were part of the parent
-document -- tabs are expanded and system macros processed. The
-contents of `include1` files are not subject to tab expansion or
-system macro processing nor are attribute or lower priority
-substitutions performed. The `include1` macro's intended use is to
-include verbatim embedded CSS or scripts into configuration file
-headers. Example:
-
-------------------------------------
-\include::chapter1.txt[tabsize=4]
-------------------------------------
-
-.Include macro behavior
-- If the included file name is specified with a relative path then the
- path is relative to the location of the referring document.
-- Include macros can appear inside configuration files.
-- Files included from within 'DelimitedBlocks' are read to completion
- to avoid false end-of-block underline termination.
-- Attribute references are expanded inside the include 'target'; if an
- attribute is undefined then the included file is silently skipped.
-- The 'tabsize' macro attribute sets the number of space characters to
- be used for tab expansion in the included file (not applicable to
- `include1` macro).
-- The 'depth' macro attribute sets the maximum permitted number of
- subsequent nested includes (not applicable to `include1` macro which
- does not process nested includes). Setting 'depth' to '1' disables
- nesting inside the included file. By default, nesting is limited to
- a depth of ten.
-- If the he 'warnings' attribute is set to 'False' (or any other
- Python literal that evaluates to boolean false) then no warning
- message is printed if the included file does not exist. By default
- 'warnings' are enabled.
-- Internally the `include1` macro is translated to the `include1`
- system attribute which means it must be evaluated in a region where
- attribute substitution is enabled. To inhibit nested substitution in
- included files it is preferable to use the `include` macro and set
- the attribute `depth=1`.
-
-Conditional Inclusion Macros
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Lines of text in the source document can be selectively included or
-excluded from processing based on the existence (or not) of a document
-attribute.
-
-Document text between the `ifdef` and `endif` macros is included if a
-document attribute is defined:
-
- ifdef::[]
- :
- endif::[]
-
-Document text between the `ifndef` and `endif` macros is not included
-if a document attribute is defined:
-
- ifndef::[]
- :
- endif::[]
-
-`` is an attribute name which is optional in the trailing
-`endif` macro.
-
-If you only want to process a single line of text then the text can be
-put inside the square brackets and the `endif` macro omitted, for
-example:
-
- ifdef::revnumber[Version number 42]
-
-Is equivalent to:
-
- ifdef::revnumber[]
- Version number 42
- endif::revnumber[]
-
-'ifdef' and 'ifndef' macros also accept multiple attribute names:
-
-- Multiple ',' separated attribute names evaluate to defined if one
- or more of the attributes is defined, otherwise it's value is
- undefined.
-- Multiple '+' separated attribute names evaluate to defined if all
- of the attributes is defined, otherwise it's value is undefined.
-
-Document text between the `ifeval` and `endif` macros is included if
-the Python expression inside the square brackets is true. Example:
-
- ifeval::[{rs458}==2]
- :
- endif::[]
-
-- Document attribute references are expanded before the expression is
- evaluated.
-- If an attribute reference is undefined then the expression is
- considered false.
-
-Take a look at the `*.conf` configuration files in the AsciiDoc
-distribution for examples of conditional inclusion macro usage.
-
-Executable system macros
-^^^^^^^^^^^^^^^^^^^^^^^^
-The 'eval', 'sys' and 'sys2' block macros exhibit the same behavior as
-their same named <>. The difference
-is that system macros occur in a block macro context whereas system
-attributes are confined to inline contexts where attribute
-substitution is enabled.
-
-The following example displays a long directory listing inside a
-literal block:
-
- ------------------
- sys::[ls -l *.txt]
- ------------------
-
-NOTE: There are no block macro versions of the 'eval3' and 'sys3'
-system attributes.
-
-Template System Macro
-^^^^^^^^^^^^^^^^^^^^^
-The `template` block macro allows the inclusion of one configuration
-file template section within another. The following example includes
-the `[admonitionblock]` section in the `[admonitionparagraph]`
-section:
-
- [admonitionparagraph]
- template::[admonitionblock]
-
-.Template macro behavior
-- The `template::[]` macro is useful for factoring configuration file
- markup.
-- `template::[]` macros cannot be nested.
-- `template::[]` macro expansion is applied after all configuration
- files have been read.
-
-
-[[X77]]
-Passthrough macros
-~~~~~~~~~~~~~~~~~~
-Passthrough macros are analogous to <> and are
-used to pass text directly to the output. The substitution performed
-on the text is determined by the macro definition but can be overridden
-by the ``. The usual syntax is
-`:[]` (for inline macros) and
-`::[]` (for block macros). Passthroughs, by
-definition, take precedence over all other text substitutions.
-
-pass::
- Inline and block. Passes text unmodified (apart from explicitly
- specified substitutions). Examples:
-
- pass:[To be or not to be]
- pass:attributes,quotes[the '{author}']
-
-asciimath, latexmath::
- Inline and block. Passes text unmodified. Used for
- <>.
-
-\+++::
- Inline and block. The triple-plus passthrough is functionally
- identical to the 'pass' macro but you don't have to escape `]`
- characters and you can prefix with quoted attributes in the inline
- version. Example:
-
- Red [red]+++`sum_(i=1)\^n i=(n(n+1))/2`$+++ AsciiMathML formula
-
-$$::
- Inline and block. The double-dollar passthrough is functionally
- identical to the triple-plus passthrough with one exception: special
- characters are escaped. Example:
-
- $$`[[a,b],[c,d]]((n),(k))`$$
-
-[[X80]]`::
- Text quoted with single backtick characters constitutes an 'inline
- literal' passthrough. The enclosed text is rendered in a monospaced
- font and is only subject to special character substitution. This
- makes sense since monospace text is usually intended to be rendered
- literally and often contains characters that would otherwise have to
- be escaped. If you need monospaced text containing inline
- substitutions use a <>.
-
-Macro Definitions
-~~~~~~~~~~~~~~~~~
-Each entry in the configuration `[macros]` section is a macro
-definition which can take one of the following forms:
-
-`=[=#[=+[`:: Delete the existing macro with this ``.
-
-`` is a Python regular expression and `` is the name of
-a markup template. If `` is omitted then it is the value of the
-regular expression match group named 'name'. The optional
-`[` regular
-expressions and are available as markup template attributes:
-
-name::
- The macro name.
-
-target::
- The macro target.
-
-attrlist::
- The macro attribute list.
-
-passtext::
- Contents of this group are passed unmodified to the output subject
- only to 'subslist' substitutions.
-
-subslist::
- Processed as a comma-separated list of substitution names for
- 'passtext' substitution, overrides the the macro definition
- 'subslist'.
-
-.Here's what happens during macro substitution
-- Each contextually relevant macro 'pattern' from the `[macros]`
- section is matched against the input source line.
-- If a match is found the text to be substituted is loaded from a
- configuration markup template section named like
- `-inlinemacro` or `-blockmacro` (depending on the macro
- type).
-- Global and macro attribute list attributes are substituted in the
- macro's markup template.
-- The substituted template replaces the macro reference in the output
- document.
-
-
-[[X98]]
-HTML 5 audio and video block macros
------------------------------------
-The 'html5' backend 'audio' and 'video' block macros generate the HTML
-5 'audio' and 'video' elements respectively. They follow the usual
-AsciiDoc block macro syntax `::[