| 1 | ace.define("ace/mode/textile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2 | var oop = require("../lib/oop"); |
| 3 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 4 | var TextileHighlightRules = function () { |
| 5 | this.$rules = { |
| 6 | "start": [ |
| 7 | { |
| 8 | token: function (value) { |
| 9 | if (value.charAt(0) == "h") |
| 10 | return "markup.heading." + value.charAt(1); |
| 11 | else |
| 12 | return "markup.heading"; |
| 13 | }, |
| 14 | regex: "h1|h2|h3|h4|h5|h6|bq|p|bc|pre", |
| 15 | next: "blocktag" |
| 16 | }, |
| 17 | { |
| 18 | token: "keyword", |
| 19 | regex: "[\\*]+|[#]+" |
| 20 | }, |
| 21 | { |
| 22 | token: "text", |
| 23 | regex: ".+" |
| 24 | } |
| 25 | ], |
| 26 | "blocktag": [ |
| 27 | { |
| 28 | token: "keyword", |
| 29 | regex: "\\. ", |
| 30 | next: "start" |
| 31 | }, |
| 32 | { |
| 33 | token: "keyword", |
| 34 | regex: "\\(", |
| 35 | next: "blocktagproperties" |
| 36 | } |
| 37 | ], |
| 38 | "blocktagproperties": [ |
| 39 | { |
| 40 | token: "keyword", |
| 41 | regex: "\\)", |
| 42 | next: "blocktag" |
| 43 | }, |
| 44 | { |
| 45 | token: "string", |
| 46 | regex: "[a-zA-Z0-9\\-_]+" |
| 47 | }, |
| 48 | { |
| 49 | token: "keyword", |
| 50 | regex: "#" |
| 51 | } |
| 52 | ] |
| 53 | }; |
| 54 | }; |
| 55 | oop.inherits(TextileHighlightRules, TextHighlightRules); |
| 56 | exports.TextileHighlightRules = TextileHighlightRules; |
| 57 | |
| 58 | }); |
| 59 | |
| 60 | ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 61 | var Range = require("../range").Range; |
| 62 | var MatchingBraceOutdent = function () { }; |
| 63 | (function () { |
| 64 | this.checkOutdent = function (line, input) { |
| 65 | if (!/^\s+$/.test(line)) |
| 66 | return false; |
| 67 | return /^\s*\}/.test(input); |
| 68 | }; |
| 69 | this.autoOutdent = function (doc, row) { |
| 70 | var line = doc.getLine(row); |
| 71 | var match = line.match(/^(\s*\})/); |
| 72 | if (!match) |
| 73 | return 0; |
| 74 | var column = match[1].length; |
| 75 | var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 76 | if (!openBracePos || openBracePos.row == row) |
| 77 | return 0; |
| 78 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 79 | doc.replace(new Range(row, 0, row, column - 1), indent); |
| 80 | }; |
| 81 | this.$getIndent = function (line) { |
| 82 | return line.match(/^\s*/)[0]; |
| 83 | }; |
| 84 | }).call(MatchingBraceOutdent.prototype); |
| 85 | exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 86 | |
| 87 | }); |
| 88 | |
| 89 | ace.define("ace/mode/textile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/textile_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module){"use strict"; |
| 90 | var oop = require("../lib/oop"); |
| 91 | var TextMode = require("./text").Mode; |
| 92 | var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules; |
| 93 | var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 94 | var Mode = function () { |
| 95 | this.HighlightRules = TextileHighlightRules; |
| 96 | this.$outdent = new MatchingBraceOutdent(); |
| 97 | this.$behaviour = this.$defaultBehaviour; |
| 98 | }; |
| 99 | oop.inherits(Mode, TextMode); |
| 100 | (function () { |
| 101 | this.type = "text"; |
| 102 | this.getNextLineIndent = function (state, line, tab) { |
| 103 | if (state == "intag") |
| 104 | return tab; |
| 105 | return ""; |
| 106 | }; |
| 107 | this.checkOutdent = function (state, line, input) { |
| 108 | return this.$outdent.checkOutdent(line, input); |
| 109 | }; |
| 110 | this.autoOutdent = function (state, doc, row) { |
| 111 | this.$outdent.autoOutdent(doc, row); |
| 112 | }; |
| 113 | this.$id = "ace/mode/textile"; |
| 114 | this.snippetFileId = "ace/snippets/textile"; |
| 115 | }).call(Mode.prototype); |
| 116 | exports.Mode = Mode; |
| 117 | |
| 118 | }); (function() { |
| 119 | ace.require(["ace/mode/textile"], function(m) { |
| 120 | if (typeof module == "object" && typeof exports == "object" && module) { |
| 121 | module.exports = m; |
| 122 | } |
| 123 | }); |
| 124 | })(); |
| 125 |