5d1543d89f404122d87ebbfb99b51a7a.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  59. var Range = require("../range").Range;
  60. var MatchingBraceOutdent = function () { };
  61. (function () {
  62. this.checkOutdent = function (line, input) {
  63. if (!/^\s+$/.test(line))
  64. return false;
  65. return /^\s*\}/.test(input);
  66. };
  67. this.autoOutdent = function (doc, row) {
  68. var line = doc.getLine(row);
  69. var match = line.match(/^(\s*\})/);
  70. if (!match)
  71. return 0;
  72. var column = match[1].length;
  73. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  74. if (!openBracePos || openBracePos.row == row)
  75. return 0;
  76. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  77. doc.replace(new Range(row, 0, row, column - 1), indent);
  78. };
  79. this.$getIndent = function (line) {
  80. return line.match(/^\s*/)[0];
  81. };
  82. }).call(MatchingBraceOutdent.prototype);
  83. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  84. });
  85. 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";
  86. var oop = require("../lib/oop");
  87. var TextMode = require("./text").Mode;
  88. var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules;
  89. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  90. var Mode = function () {
  91. this.HighlightRules = TextileHighlightRules;
  92. this.$outdent = new MatchingBraceOutdent();
  93. this.$behaviour = this.$defaultBehaviour;
  94. };
  95. oop.inherits(Mode, TextMode);
  96. (function () {
  97. this.type = "text";
  98. this.getNextLineIndent = function (state, line, tab) {
  99. if (state == "intag")
  100. return tab;
  101. return "";
  102. };
  103. this.checkOutdent = function (state, line, input) {
  104. return this.$outdent.checkOutdent(line, input);
  105. };
  106. this.autoOutdent = function (state, doc, row) {
  107. this.$outdent.autoOutdent(doc, row);
  108. };
  109. this.$id = "ace/mode/textile";
  110. this.snippetFileId = "ace/snippets/textile";
  111. }).call(Mode.prototype);
  112. exports.Mode = Mode;
  113. }); (function() {
  114. ace.require(["ace/mode/textile"], function(m) {
  115. if (typeof module == "object" && typeof exports == "object" && module) {
  116. module.exports = m;
  117. }
  118. });
  119. })();