ca66e3089e6c4a01fceaa4c4675d4da1.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. ace.define("ace/mode/rst_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var lang = require("../lib/lang");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var RSTHighlightRules = function () {
  6. var tokens = {
  7. title: "markup.heading",
  8. list: "markup.heading",
  9. table: "constant",
  10. directive: "keyword.operator",
  11. entity: "string",
  12. link: "markup.underline.list",
  13. bold: "markup.bold",
  14. italic: "markup.italic",
  15. literal: "support.function",
  16. comment: "comment"
  17. };
  18. var startStringPrefix = "(^|\\s|[\"'(<\\[{\\-/:])";
  19. var endStringSuffix = "(?:$|(?=\\s|[\\\\.,;!?\\-/:\"')>\\]}]))";
  20. this.$rules = {
  21. "start": [
  22. {
  23. token: tokens.title,
  24. regex: "(^)([\\=\\-`:\\.'\"~\\^_\\*\\+#])(\\2{2,}\\s*$)"
  25. },
  26. {
  27. token: ["text", tokens.directive, tokens.literal],
  28. regex: "(^\\s*\\.\\. )([^: ]+::)(.*$)",
  29. next: "codeblock"
  30. },
  31. {
  32. token: tokens.directive,
  33. regex: "::$",
  34. next: "codeblock"
  35. },
  36. {
  37. token: [tokens.entity, tokens.link],
  38. regex: "(^\\.\\. _[^:]+:)(.*$)"
  39. },
  40. {
  41. token: [tokens.entity, tokens.link],
  42. regex: "(^__ )(https?://.*$)"
  43. },
  44. {
  45. token: tokens.entity,
  46. regex: "^\\.\\. \\[[^\\]]+\\] "
  47. },
  48. {
  49. token: tokens.comment,
  50. regex: "^\\.\\. .*$",
  51. next: "comment"
  52. },
  53. {
  54. token: tokens.list,
  55. regex: "^\\s*[\\*\\+-] "
  56. },
  57. {
  58. token: tokens.list,
  59. regex: "^\\s*(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\. "
  60. },
  61. {
  62. token: tokens.list,
  63. regex: "^\\s*\\(?(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\) "
  64. },
  65. {
  66. token: tokens.table,
  67. regex: "^={2,}(?: +={2,})+$"
  68. },
  69. {
  70. token: tokens.table,
  71. regex: "^\\+-{2,}(?:\\+-{2,})+\\+$"
  72. },
  73. {
  74. token: tokens.table,
  75. regex: "^\\+={2,}(?:\\+={2,})+\\+$"
  76. },
  77. {
  78. token: ["text", tokens.literal],
  79. regex: startStringPrefix + "(``)(?=\\S)",
  80. next: "code"
  81. },
  82. {
  83. token: ["text", tokens.bold],
  84. regex: startStringPrefix + "(\\*\\*)(?=\\S)",
  85. next: "bold"
  86. },
  87. {
  88. token: ["text", tokens.italic],
  89. regex: startStringPrefix + "(\\*)(?=\\S)",
  90. next: "italic"
  91. },
  92. {
  93. token: tokens.entity,
  94. regex: "\\|[\\w\\-]+?\\|"
  95. },
  96. {
  97. token: tokens.entity,
  98. regex: ":[\\w-:]+:`\\S",
  99. next: "entity"
  100. },
  101. {
  102. token: ["text", tokens.entity],
  103. regex: startStringPrefix + "(_`)(?=\\S)",
  104. next: "entity"
  105. },
  106. {
  107. token: tokens.entity,
  108. regex: "_[A-Za-z0-9\\-]+?"
  109. },
  110. {
  111. token: ["text", tokens.link],
  112. regex: startStringPrefix + "(`)(?=\\S)",
  113. next: "link"
  114. },
  115. {
  116. token: tokens.link,
  117. regex: "[A-Za-z0-9\\-]+?__?"
  118. },
  119. {
  120. token: tokens.link,
  121. regex: "\\[[^\\]]+?\\]_"
  122. },
  123. {
  124. token: tokens.link,
  125. regex: "https?://\\S+"
  126. },
  127. {
  128. token: tokens.table,
  129. regex: "\\|"
  130. }
  131. ],
  132. "codeblock": [
  133. {
  134. token: tokens.literal,
  135. regex: "^ +.+$",
  136. next: "codeblock"
  137. },
  138. {
  139. token: tokens.literal,
  140. regex: '^$',
  141. next: "codeblock"
  142. },
  143. {
  144. token: "empty",
  145. regex: "",
  146. next: "start"
  147. }
  148. ],
  149. "code": [
  150. {
  151. token: tokens.literal,
  152. regex: "\\S``" + endStringSuffix,
  153. next: "start"
  154. },
  155. {
  156. defaultToken: tokens.literal
  157. }
  158. ],
  159. "bold": [
  160. {
  161. token: tokens.bold,
  162. regex: "\\S\\*\\*" + endStringSuffix,
  163. next: "start"
  164. },
  165. {
  166. defaultToken: tokens.bold
  167. }
  168. ],
  169. "italic": [
  170. {
  171. token: tokens.italic,
  172. regex: "\\S\\*" + endStringSuffix,
  173. next: "start"
  174. },
  175. {
  176. defaultToken: tokens.italic
  177. }
  178. ],
  179. "entity": [
  180. {
  181. token: tokens.entity,
  182. regex: "\\S`" + endStringSuffix,
  183. next: "start"
  184. },
  185. {
  186. defaultToken: tokens.entity
  187. }
  188. ],
  189. "link": [
  190. {
  191. token: tokens.link,
  192. regex: "\\S`__?" + endStringSuffix,
  193. next: "start"
  194. },
  195. {
  196. defaultToken: tokens.link
  197. }
  198. ],
  199. "comment": [
  200. {
  201. token: tokens.comment,
  202. regex: "^ +.+$",
  203. next: "comment"
  204. },
  205. {
  206. token: tokens.comment,
  207. regex: '^$',
  208. next: "comment"
  209. },
  210. {
  211. token: "empty",
  212. regex: "",
  213. next: "start"
  214. }
  215. ]
  216. };
  217. };
  218. oop.inherits(RSTHighlightRules, TextHighlightRules);
  219. exports.RSTHighlightRules = RSTHighlightRules;
  220. });
  221. ace.define("ace/mode/rst",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/rst_highlight_rules"], function(require, exports, module){"use strict";
  222. var oop = require("../lib/oop");
  223. var TextMode = require("./text").Mode;
  224. var RSTHighlightRules = require("./rst_highlight_rules").RSTHighlightRules;
  225. var Mode = function () {
  226. this.HighlightRules = RSTHighlightRules;
  227. };
  228. oop.inherits(Mode, TextMode);
  229. (function () {
  230. this.type = "text";
  231. this.$id = "ace/mode/rst";
  232. this.snippetFileId = "ace/snippets/rst";
  233. }).call(Mode.prototype);
  234. exports.Mode = Mode;
  235. }); (function() {
  236. ace.require(["ace/mode/rst"], function(m) {
  237. if (typeof module == "object" && typeof exports == "object" && module) {
  238. module.exports = m;
  239. }
  240. });
  241. })();