mode-markdown.js 122 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190
  1. define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. };
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  42. "use strict";
  43. var oop = require("../lib/oop");
  44. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hexadecimal, octal and binary
  96. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // decimal integers and floats
  99. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "from(?=\\s*('|\"))"
  151. }, {
  152. token : "keyword",
  153. regex : "(?:" + kwBeforeRe + ")\\b",
  154. next : "start"
  155. }, {
  156. token : ["support.constant"],
  157. regex : /that\b/
  158. }, {
  159. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  160. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  161. }, {
  162. token : keywordMapper,
  163. regex : identifierRe
  164. }, {
  165. token : "punctuation.operator",
  166. regex : /[.](?![.])/,
  167. next : "property"
  168. }, {
  169. token : "storage.type",
  170. regex : /=>/,
  171. next : "start"
  172. }, {
  173. token : "keyword.operator",
  174. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  175. next : "start"
  176. }, {
  177. token : "punctuation.operator",
  178. regex : /[?:,;.]/,
  179. next : "start"
  180. }, {
  181. token : "paren.lparen",
  182. regex : /[\[({]/,
  183. next : "start"
  184. }, {
  185. token : "paren.rparen",
  186. regex : /[\])}]/
  187. }, {
  188. token: "comment",
  189. regex: /^#!.*$/
  190. }
  191. ],
  192. property: [{
  193. token : "text",
  194. regex : "\\s+"
  195. }, {
  196. token : [
  197. "storage.type", "punctuation.operator", "entity.name.function", "text",
  198. "keyword.operator", "text",
  199. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  200. ],
  201. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  202. next: "function_arguments"
  203. }, {
  204. token : "punctuation.operator",
  205. regex : /[.](?![.])/
  206. }, {
  207. token : "support.function",
  208. regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  209. }, {
  210. token : "support.function.dom",
  211. regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  212. }, {
  213. token : "support.constant",
  214. regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
  215. }, {
  216. token : "identifier",
  217. regex : identifierRe
  218. }, {
  219. regex: "",
  220. token: "empty",
  221. next: "no_regex"
  222. }
  223. ],
  224. "start": [
  225. DocCommentHighlightRules.getStartRule("doc-start"),
  226. comments("start"),
  227. {
  228. token: "string.regexp",
  229. regex: "\\/",
  230. next: "regex"
  231. }, {
  232. token : "text",
  233. regex : "\\s+|^$",
  234. next : "start"
  235. }, {
  236. token: "empty",
  237. regex: "",
  238. next: "no_regex"
  239. }
  240. ],
  241. "regex": [
  242. {
  243. token: "regexp.keyword.operator",
  244. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  245. }, {
  246. token: "string.regexp",
  247. regex: "/[sxngimy]*",
  248. next: "no_regex"
  249. }, {
  250. token : "invalid",
  251. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  252. }, {
  253. token : "constant.language.escape",
  254. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  255. }, {
  256. token : "constant.language.delimiter",
  257. regex: /\|/
  258. }, {
  259. token: "constant.language.escape",
  260. regex: /\[\^?/,
  261. next: "regex_character_class"
  262. }, {
  263. token: "empty",
  264. regex: "$",
  265. next: "no_regex"
  266. }, {
  267. defaultToken: "string.regexp"
  268. }
  269. ],
  270. "regex_character_class": [
  271. {
  272. token: "regexp.charclass.keyword.operator",
  273. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  274. }, {
  275. token: "constant.language.escape",
  276. regex: "]",
  277. next: "regex"
  278. }, {
  279. token: "constant.language.escape",
  280. regex: "-"
  281. }, {
  282. token: "empty",
  283. regex: "$",
  284. next: "no_regex"
  285. }, {
  286. defaultToken: "string.regexp.charachterclass"
  287. }
  288. ],
  289. "function_arguments": [
  290. {
  291. token: "variable.parameter",
  292. regex: identifierRe
  293. }, {
  294. token: "punctuation.operator",
  295. regex: "[, ]+"
  296. }, {
  297. token: "punctuation.operator",
  298. regex: "$"
  299. }, {
  300. token: "empty",
  301. regex: "",
  302. next: "no_regex"
  303. }
  304. ],
  305. "qqstring" : [
  306. {
  307. token : "constant.language.escape",
  308. regex : escapedRe
  309. }, {
  310. token : "string",
  311. regex : "\\\\$",
  312. consumeLineEnd : true
  313. }, {
  314. token : "string",
  315. regex : '"|$',
  316. next : "no_regex"
  317. }, {
  318. defaultToken: "string"
  319. }
  320. ],
  321. "qstring" : [
  322. {
  323. token : "constant.language.escape",
  324. regex : escapedRe
  325. }, {
  326. token : "string",
  327. regex : "\\\\$",
  328. consumeLineEnd : true
  329. }, {
  330. token : "string",
  331. regex : "'|$",
  332. next : "no_regex"
  333. }, {
  334. defaultToken: "string"
  335. }
  336. ]
  337. };
  338. if (!options || !options.noES6) {
  339. this.$rules.no_regex.unshift({
  340. regex: "[{}]", onMatch: function(val, state, stack) {
  341. this.next = val == "{" ? this.nextState : "";
  342. if (val == "{" && stack.length) {
  343. stack.unshift("start", state);
  344. }
  345. else if (val == "}" && stack.length) {
  346. stack.shift();
  347. this.next = stack.shift();
  348. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  349. return "paren.quasi.end";
  350. }
  351. return val == "{" ? "paren.lparen" : "paren.rparen";
  352. },
  353. nextState: "start"
  354. }, {
  355. token : "string.quasi.start",
  356. regex : /`/,
  357. push : [{
  358. token : "constant.language.escape",
  359. regex : escapedRe
  360. }, {
  361. token : "paren.quasi.start",
  362. regex : /\${/,
  363. push : "start"
  364. }, {
  365. token : "string.quasi.end",
  366. regex : /`/,
  367. next : "pop"
  368. }, {
  369. defaultToken: "string.quasi"
  370. }]
  371. });
  372. if (!options || options.jsx != false)
  373. JSX.call(this);
  374. }
  375. this.embedRules(DocCommentHighlightRules, "doc-",
  376. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  377. this.normalizeRules();
  378. };
  379. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  380. function JSX() {
  381. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  382. var jsxTag = {
  383. onMatch : function(val, state, stack) {
  384. var offset = val.charAt(1) == "/" ? 2 : 1;
  385. if (offset == 1) {
  386. if (state != this.nextState)
  387. stack.unshift(this.next, this.nextState, 0);
  388. else
  389. stack.unshift(this.next);
  390. stack[2]++;
  391. } else if (offset == 2) {
  392. if (state == this.nextState) {
  393. stack[1]--;
  394. if (!stack[1] || stack[1] < 0) {
  395. stack.shift();
  396. stack.shift();
  397. }
  398. }
  399. }
  400. return [{
  401. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  402. value: val.slice(0, offset)
  403. }, {
  404. type: "meta.tag.tag-name.xml",
  405. value: val.substr(offset)
  406. }];
  407. },
  408. regex : "</?" + tagRegex + "",
  409. next: "jsxAttributes",
  410. nextState: "jsx"
  411. };
  412. this.$rules.start.unshift(jsxTag);
  413. var jsxJsRule = {
  414. regex: "{",
  415. token: "paren.quasi.start",
  416. push: "start"
  417. };
  418. this.$rules.jsx = [
  419. jsxJsRule,
  420. jsxTag,
  421. {include : "reference"},
  422. {defaultToken: "string"}
  423. ];
  424. this.$rules.jsxAttributes = [{
  425. token : "meta.tag.punctuation.tag-close.xml",
  426. regex : "/?>",
  427. onMatch : function(value, currentState, stack) {
  428. if (currentState == stack[0])
  429. stack.shift();
  430. if (value.length == 2) {
  431. if (stack[0] == this.nextState)
  432. stack[1]--;
  433. if (!stack[1] || stack[1] < 0) {
  434. stack.splice(0, 2);
  435. }
  436. }
  437. this.next = stack[0] || "start";
  438. return [{type: this.token, value: value}];
  439. },
  440. nextState: "jsx"
  441. },
  442. jsxJsRule,
  443. comments("jsxAttributes"),
  444. {
  445. token : "entity.other.attribute-name.xml",
  446. regex : tagRegex
  447. }, {
  448. token : "keyword.operator.attribute-equals.xml",
  449. regex : "="
  450. }, {
  451. token : "text.tag-whitespace.xml",
  452. regex : "\\s+"
  453. }, {
  454. token : "string.attribute-value.xml",
  455. regex : "'",
  456. stateName : "jsx_attr_q",
  457. push : [
  458. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  459. {include : "reference"},
  460. {defaultToken : "string.attribute-value.xml"}
  461. ]
  462. }, {
  463. token : "string.attribute-value.xml",
  464. regex : '"',
  465. stateName : "jsx_attr_qq",
  466. push : [
  467. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  468. {include : "reference"},
  469. {defaultToken : "string.attribute-value.xml"}
  470. ]
  471. },
  472. jsxTag
  473. ];
  474. this.$rules.reference = [{
  475. token : "constant.language.escape.reference.xml",
  476. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  477. }];
  478. }
  479. function comments(next) {
  480. return [
  481. {
  482. token : "comment", // multi line comment
  483. regex : /\/\*/,
  484. next: [
  485. DocCommentHighlightRules.getTagRule(),
  486. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  487. {defaultToken : "comment", caseInsensitive: true}
  488. ]
  489. }, {
  490. token : "comment",
  491. regex : "\\/\\/",
  492. next: [
  493. DocCommentHighlightRules.getTagRule(),
  494. {token : "comment", regex : "$|^", next : next || "pop"},
  495. {defaultToken : "comment", caseInsensitive: true}
  496. ]
  497. }
  498. ];
  499. }
  500. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  501. });
  502. define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  503. "use strict";
  504. var Range = require("../range").Range;
  505. var MatchingBraceOutdent = function() {};
  506. (function() {
  507. this.checkOutdent = function(line, input) {
  508. if (! /^\s+$/.test(line))
  509. return false;
  510. return /^\s*\}/.test(input);
  511. };
  512. this.autoOutdent = function(doc, row) {
  513. var line = doc.getLine(row);
  514. var match = line.match(/^(\s*\})/);
  515. if (!match) return 0;
  516. var column = match[1].length;
  517. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  518. if (!openBracePos || openBracePos.row == row) return 0;
  519. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  520. doc.replace(new Range(row, 0, row, column-1), indent);
  521. };
  522. this.$getIndent = function(line) {
  523. return line.match(/^\s*/)[0];
  524. };
  525. }).call(MatchingBraceOutdent.prototype);
  526. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  527. });
  528. define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  529. "use strict";
  530. var oop = require("../../lib/oop");
  531. var Range = require("../../range").Range;
  532. var BaseFoldMode = require("./fold_mode").FoldMode;
  533. var FoldMode = exports.FoldMode = function(commentRegex) {
  534. if (commentRegex) {
  535. this.foldingStartMarker = new RegExp(
  536. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  537. );
  538. this.foldingStopMarker = new RegExp(
  539. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  540. );
  541. }
  542. };
  543. oop.inherits(FoldMode, BaseFoldMode);
  544. (function() {
  545. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  546. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  547. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  548. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  549. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  550. this._getFoldWidgetBase = this.getFoldWidget;
  551. this.getFoldWidget = function(session, foldStyle, row) {
  552. var line = session.getLine(row);
  553. if (this.singleLineBlockCommentRe.test(line)) {
  554. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  555. return "";
  556. }
  557. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  558. if (!fw && this.startRegionRe.test(line))
  559. return "start"; // lineCommentRegionStart
  560. return fw;
  561. };
  562. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  563. var line = session.getLine(row);
  564. if (this.startRegionRe.test(line))
  565. return this.getCommentRegionBlock(session, line, row);
  566. var match = line.match(this.foldingStartMarker);
  567. if (match) {
  568. var i = match.index;
  569. if (match[1])
  570. return this.openingBracketBlock(session, match[1], row, i);
  571. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  572. if (range && !range.isMultiLine()) {
  573. if (forceMultiline) {
  574. range = this.getSectionRange(session, row);
  575. } else if (foldStyle != "all")
  576. range = null;
  577. }
  578. return range;
  579. }
  580. if (foldStyle === "markbegin")
  581. return;
  582. var match = line.match(this.foldingStopMarker);
  583. if (match) {
  584. var i = match.index + match[0].length;
  585. if (match[1])
  586. return this.closingBracketBlock(session, match[1], row, i);
  587. return session.getCommentFoldRange(row, i, -1);
  588. }
  589. };
  590. this.getSectionRange = function(session, row) {
  591. var line = session.getLine(row);
  592. var startIndent = line.search(/\S/);
  593. var startRow = row;
  594. var startColumn = line.length;
  595. row = row + 1;
  596. var endRow = row;
  597. var maxRow = session.getLength();
  598. while (++row < maxRow) {
  599. line = session.getLine(row);
  600. var indent = line.search(/\S/);
  601. if (indent === -1)
  602. continue;
  603. if (startIndent > indent)
  604. break;
  605. var subRange = this.getFoldWidgetRange(session, "all", row);
  606. if (subRange) {
  607. if (subRange.start.row <= startRow) {
  608. break;
  609. } else if (subRange.isMultiLine()) {
  610. row = subRange.end.row;
  611. } else if (startIndent == indent) {
  612. break;
  613. }
  614. }
  615. endRow = row;
  616. }
  617. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  618. };
  619. this.getCommentRegionBlock = function(session, line, row) {
  620. var startColumn = line.search(/\s*$/);
  621. var maxRow = session.getLength();
  622. var startRow = row;
  623. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  624. var depth = 1;
  625. while (++row < maxRow) {
  626. line = session.getLine(row);
  627. var m = re.exec(line);
  628. if (!m) continue;
  629. if (m[1]) depth--;
  630. else depth++;
  631. if (!depth) break;
  632. }
  633. var endRow = row;
  634. if (endRow > startRow) {
  635. return new Range(startRow, startColumn, endRow, line.length);
  636. }
  637. };
  638. }).call(FoldMode.prototype);
  639. });
  640. define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  641. "use strict";
  642. var oop = require("../lib/oop");
  643. var TextMode = require("./text").Mode;
  644. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  645. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  646. var WorkerClient = require("../worker/worker_client").WorkerClient;
  647. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  648. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  649. var Mode = function() {
  650. this.HighlightRules = JavaScriptHighlightRules;
  651. this.$outdent = new MatchingBraceOutdent();
  652. this.$behaviour = new CstyleBehaviour();
  653. this.foldingRules = new CStyleFoldMode();
  654. };
  655. oop.inherits(Mode, TextMode);
  656. (function() {
  657. this.lineCommentStart = "//";
  658. this.blockComment = {start: "/*", end: "*/"};
  659. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  660. this.getNextLineIndent = function(state, line, tab) {
  661. var indent = this.$getIndent(line);
  662. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  663. var tokens = tokenizedLine.tokens;
  664. var endState = tokenizedLine.state;
  665. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  666. return indent;
  667. }
  668. if (state == "start" || state == "no_regex") {
  669. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  670. if (match) {
  671. indent += tab;
  672. }
  673. } else if (state == "doc-start") {
  674. if (endState == "start" || endState == "no_regex") {
  675. return "";
  676. }
  677. var match = line.match(/^\s*(\/?)\*/);
  678. if (match) {
  679. if (match[1]) {
  680. indent += " ";
  681. }
  682. indent += "* ";
  683. }
  684. }
  685. return indent;
  686. };
  687. this.checkOutdent = function(state, line, input) {
  688. return this.$outdent.checkOutdent(line, input);
  689. };
  690. this.autoOutdent = function(state, doc, row) {
  691. this.$outdent.autoOutdent(doc, row);
  692. };
  693. this.createWorker = function(session) {
  694. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  695. worker.attachToDocument(session.getDocument());
  696. worker.on("annotate", function(results) {
  697. session.setAnnotations(results.data);
  698. });
  699. worker.on("terminate", function() {
  700. session.clearAnnotations();
  701. });
  702. return worker;
  703. };
  704. this.$id = "ace/mode/javascript";
  705. }).call(Mode.prototype);
  706. exports.Mode = Mode;
  707. });
  708. define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  709. "use strict";
  710. var oop = require("../lib/oop");
  711. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  712. var XmlHighlightRules = function(normalize) {
  713. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  714. this.$rules = {
  715. start : [
  716. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  717. {
  718. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  719. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  720. },
  721. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  722. {
  723. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  724. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  725. },
  726. {include : "tag"},
  727. {token : "text.end-tag-open.xml", regex: "</"},
  728. {token : "text.tag-open.xml", regex: "<"},
  729. {include : "reference"},
  730. {defaultToken : "text.xml"}
  731. ],
  732. processing_instruction : [{
  733. token : "entity.other.attribute-name.decl-attribute-name.xml",
  734. regex : tagRegex
  735. }, {
  736. token : "keyword.operator.decl-attribute-equals.xml",
  737. regex : "="
  738. }, {
  739. include: "whitespace"
  740. }, {
  741. include: "string"
  742. }, {
  743. token : "punctuation.xml-decl.xml",
  744. regex : "\\?>",
  745. next : "start"
  746. }],
  747. doctype : [
  748. {include : "whitespace"},
  749. {include : "string"},
  750. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  751. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  752. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  753. ],
  754. int_subset : [{
  755. token : "text.xml",
  756. regex : "\\s+"
  757. }, {
  758. token: "punctuation.int-subset.xml",
  759. regex: "]",
  760. next: "pop"
  761. }, {
  762. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  763. regex : "(<\\!)(" + tagRegex + ")",
  764. push : [{
  765. token : "text",
  766. regex : "\\s+"
  767. },
  768. {
  769. token : "punctuation.markup-decl.xml",
  770. regex : ">",
  771. next : "pop"
  772. },
  773. {include : "string"}]
  774. }],
  775. cdata : [
  776. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  777. {token : "text.xml", regex : "\\s+"},
  778. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  779. ],
  780. comment : [
  781. {token : "comment.end.xml", regex : "-->", next : "start"},
  782. {defaultToken : "comment.xml"}
  783. ],
  784. reference : [{
  785. token : "constant.language.escape.reference.xml",
  786. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  787. }],
  788. attr_reference : [{
  789. token : "constant.language.escape.reference.attribute-value.xml",
  790. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  791. }],
  792. tag : [{
  793. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  794. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  795. next: [
  796. {include : "attributes"},
  797. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  798. ]
  799. }],
  800. tag_whitespace : [
  801. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  802. ],
  803. whitespace : [
  804. {token : "text.whitespace.xml", regex : "\\s+"}
  805. ],
  806. string: [{
  807. token : "string.xml",
  808. regex : "'",
  809. push : [
  810. {token : "string.xml", regex: "'", next: "pop"},
  811. {defaultToken : "string.xml"}
  812. ]
  813. }, {
  814. token : "string.xml",
  815. regex : '"',
  816. push : [
  817. {token : "string.xml", regex: '"', next: "pop"},
  818. {defaultToken : "string.xml"}
  819. ]
  820. }],
  821. attributes: [{
  822. token : "entity.other.attribute-name.xml",
  823. regex : tagRegex
  824. }, {
  825. token : "keyword.operator.attribute-equals.xml",
  826. regex : "="
  827. }, {
  828. include: "tag_whitespace"
  829. }, {
  830. include: "attribute_value"
  831. }],
  832. attribute_value: [{
  833. token : "string.attribute-value.xml",
  834. regex : "'",
  835. push : [
  836. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  837. {include : "attr_reference"},
  838. {defaultToken : "string.attribute-value.xml"}
  839. ]
  840. }, {
  841. token : "string.attribute-value.xml",
  842. regex : '"',
  843. push : [
  844. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  845. {include : "attr_reference"},
  846. {defaultToken : "string.attribute-value.xml"}
  847. ]
  848. }]
  849. };
  850. if (this.constructor === XmlHighlightRules)
  851. this.normalizeRules();
  852. };
  853. (function() {
  854. this.embedTagRules = function(HighlightRules, prefix, tag){
  855. this.$rules.tag.unshift({
  856. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  857. regex : "(<)(" + tag + "(?=\\s|>|$))",
  858. next: [
  859. {include : "attributes"},
  860. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  861. ]
  862. });
  863. this.$rules[tag + "-end"] = [
  864. {include : "attributes"},
  865. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  866. onMatch : function(value, currentState, stack) {
  867. stack.splice(0);
  868. return this.token;
  869. }}
  870. ];
  871. this.embedRules(HighlightRules, prefix, [{
  872. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  873. regex : "(</)(" + tag + "(?=\\s|>|$))",
  874. next: tag + "-end"
  875. }, {
  876. token: "string.cdata.xml",
  877. regex : "<\\!\\[CDATA\\["
  878. }, {
  879. token: "string.cdata.xml",
  880. regex : "\\]\\]>"
  881. }]);
  882. };
  883. }).call(TextHighlightRules.prototype);
  884. oop.inherits(XmlHighlightRules, TextHighlightRules);
  885. exports.XmlHighlightRules = XmlHighlightRules;
  886. });
  887. define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
  888. "use strict";
  889. var oop = require("../../lib/oop");
  890. var Behaviour = require("../behaviour").Behaviour;
  891. var TokenIterator = require("../../token_iterator").TokenIterator;
  892. var lang = require("../../lib/lang");
  893. function is(token, type) {
  894. return token && token.type.lastIndexOf(type + ".xml") > -1;
  895. }
  896. var XmlBehaviour = function () {
  897. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  898. if (text == '"' || text == "'") {
  899. var quote = text;
  900. var selected = session.doc.getTextRange(editor.getSelectionRange());
  901. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  902. return {
  903. text: quote + selected + quote,
  904. selection: false
  905. };
  906. }
  907. var cursor = editor.getCursorPosition();
  908. var line = session.doc.getLine(cursor.row);
  909. var rightChar = line.substring(cursor.column, cursor.column + 1);
  910. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  911. var token = iterator.getCurrentToken();
  912. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  913. return {
  914. text: "",
  915. selection: [1, 1]
  916. };
  917. }
  918. if (!token)
  919. token = iterator.stepBackward();
  920. if (!token)
  921. return;
  922. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  923. token = iterator.stepBackward();
  924. }
  925. var rightSpace = !rightChar || rightChar.match(/\s/);
  926. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  927. return {
  928. text: quote + quote,
  929. selection: [1, 1]
  930. };
  931. }
  932. }
  933. });
  934. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  935. var selected = session.doc.getTextRange(range);
  936. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  937. var line = session.doc.getLine(range.start.row);
  938. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  939. if (rightChar == selected) {
  940. range.end.column++;
  941. return range;
  942. }
  943. }
  944. });
  945. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  946. if (text == '>') {
  947. var position = editor.getSelectionRange().start;
  948. var iterator = new TokenIterator(session, position.row, position.column);
  949. var token = iterator.getCurrentToken() || iterator.stepBackward();
  950. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  951. return;
  952. if (is(token, "reference.attribute-value"))
  953. return;
  954. if (is(token, "attribute-value")) {
  955. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  956. if (position.column < tokenEndColumn)
  957. return;
  958. if (position.column == tokenEndColumn) {
  959. var nextToken = iterator.stepForward();
  960. if (nextToken && is(nextToken, "attribute-value"))
  961. return;
  962. iterator.stepBackward();
  963. }
  964. }
  965. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  966. return;
  967. while (!is(token, "tag-name")) {
  968. token = iterator.stepBackward();
  969. if (token.value == "<") {
  970. token = iterator.stepForward();
  971. break;
  972. }
  973. }
  974. var tokenRow = iterator.getCurrentTokenRow();
  975. var tokenColumn = iterator.getCurrentTokenColumn();
  976. if (is(iterator.stepBackward(), "end-tag-open"))
  977. return;
  978. var element = token.value;
  979. if (tokenRow == position.row)
  980. element = element.substring(0, position.column - tokenColumn);
  981. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  982. return;
  983. return {
  984. text: ">" + "</" + element + ">",
  985. selection: [1, 1]
  986. };
  987. }
  988. });
  989. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  990. if (text == "\n") {
  991. var cursor = editor.getCursorPosition();
  992. var line = session.getLine(cursor.row);
  993. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  994. var token = iterator.getCurrentToken();
  995. if (token && token.type.indexOf("tag-close") !== -1) {
  996. if (token.value == "/>")
  997. return;
  998. while (token && token.type.indexOf("tag-name") === -1) {
  999. token = iterator.stepBackward();
  1000. }
  1001. if (!token) {
  1002. return;
  1003. }
  1004. var tag = token.value;
  1005. var row = iterator.getCurrentTokenRow();
  1006. token = iterator.stepBackward();
  1007. if (!token || token.type.indexOf("end-tag") !== -1) {
  1008. return;
  1009. }
  1010. if (this.voidElements && !this.voidElements[tag]) {
  1011. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1012. var line = session.getLine(row);
  1013. var nextIndent = this.$getIndent(line);
  1014. var indent = nextIndent + session.getTabString();
  1015. if (nextToken && nextToken.value === "</") {
  1016. return {
  1017. text: "\n" + indent + "\n" + nextIndent,
  1018. selection: [1, indent.length, 1, indent.length]
  1019. };
  1020. } else {
  1021. return {
  1022. text: "\n" + indent
  1023. };
  1024. }
  1025. }
  1026. }
  1027. }
  1028. });
  1029. };
  1030. oop.inherits(XmlBehaviour, Behaviour);
  1031. exports.XmlBehaviour = XmlBehaviour;
  1032. });
  1033. define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) {
  1034. "use strict";
  1035. var oop = require("../../lib/oop");
  1036. var lang = require("../../lib/lang");
  1037. var Range = require("../../range").Range;
  1038. var BaseFoldMode = require("./fold_mode").FoldMode;
  1039. var TokenIterator = require("../../token_iterator").TokenIterator;
  1040. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1041. BaseFoldMode.call(this);
  1042. this.voidElements = voidElements || {};
  1043. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1044. if (optionalEndTags)
  1045. oop.mixin(this.optionalEndTags, optionalEndTags);
  1046. };
  1047. oop.inherits(FoldMode, BaseFoldMode);
  1048. var Tag = function() {
  1049. this.tagName = "";
  1050. this.closing = false;
  1051. this.selfClosing = false;
  1052. this.start = {row: 0, column: 0};
  1053. this.end = {row: 0, column: 0};
  1054. };
  1055. function is(token, type) {
  1056. return token.type.lastIndexOf(type + ".xml") > -1;
  1057. }
  1058. (function() {
  1059. this.getFoldWidget = function(session, foldStyle, row) {
  1060. var tag = this._getFirstTagInLine(session, row);
  1061. if (!tag)
  1062. return this.getCommentFoldWidget(session, row);
  1063. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1064. return foldStyle == "markbeginend" ? "end" : "";
  1065. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1066. return "";
  1067. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1068. return "";
  1069. return "start";
  1070. };
  1071. this.getCommentFoldWidget = function(session, row) {
  1072. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1073. return "start";
  1074. return "";
  1075. };
  1076. this._getFirstTagInLine = function(session, row) {
  1077. var tokens = session.getTokens(row);
  1078. var tag = new Tag();
  1079. for (var i = 0; i < tokens.length; i++) {
  1080. var token = tokens[i];
  1081. if (is(token, "tag-open")) {
  1082. tag.end.column = tag.start.column + token.value.length;
  1083. tag.closing = is(token, "end-tag-open");
  1084. token = tokens[++i];
  1085. if (!token)
  1086. return null;
  1087. tag.tagName = token.value;
  1088. tag.end.column += token.value.length;
  1089. for (i++; i < tokens.length; i++) {
  1090. token = tokens[i];
  1091. tag.end.column += token.value.length;
  1092. if (is(token, "tag-close")) {
  1093. tag.selfClosing = token.value == '/>';
  1094. break;
  1095. }
  1096. }
  1097. return tag;
  1098. } else if (is(token, "tag-close")) {
  1099. tag.selfClosing = token.value == '/>';
  1100. return tag;
  1101. }
  1102. tag.start.column += token.value.length;
  1103. }
  1104. return null;
  1105. };
  1106. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1107. var tokens = session.getTokens(row);
  1108. var column = 0;
  1109. for (var i = 0; i < tokens.length; i++) {
  1110. var token = tokens[i];
  1111. column += token.value.length;
  1112. if (column < startColumn)
  1113. continue;
  1114. if (is(token, "end-tag-open")) {
  1115. token = tokens[i + 1];
  1116. if (token && token.value == tagName)
  1117. return true;
  1118. }
  1119. }
  1120. return false;
  1121. };
  1122. this._readTagForward = function(iterator) {
  1123. var token = iterator.getCurrentToken();
  1124. if (!token)
  1125. return null;
  1126. var tag = new Tag();
  1127. do {
  1128. if (is(token, "tag-open")) {
  1129. tag.closing = is(token, "end-tag-open");
  1130. tag.start.row = iterator.getCurrentTokenRow();
  1131. tag.start.column = iterator.getCurrentTokenColumn();
  1132. } else if (is(token, "tag-name")) {
  1133. tag.tagName = token.value;
  1134. } else if (is(token, "tag-close")) {
  1135. tag.selfClosing = token.value == "/>";
  1136. tag.end.row = iterator.getCurrentTokenRow();
  1137. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1138. iterator.stepForward();
  1139. return tag;
  1140. }
  1141. } while(token = iterator.stepForward());
  1142. return null;
  1143. };
  1144. this._readTagBackward = function(iterator) {
  1145. var token = iterator.getCurrentToken();
  1146. if (!token)
  1147. return null;
  1148. var tag = new Tag();
  1149. do {
  1150. if (is(token, "tag-open")) {
  1151. tag.closing = is(token, "end-tag-open");
  1152. tag.start.row = iterator.getCurrentTokenRow();
  1153. tag.start.column = iterator.getCurrentTokenColumn();
  1154. iterator.stepBackward();
  1155. return tag;
  1156. } else if (is(token, "tag-name")) {
  1157. tag.tagName = token.value;
  1158. } else if (is(token, "tag-close")) {
  1159. tag.selfClosing = token.value == "/>";
  1160. tag.end.row = iterator.getCurrentTokenRow();
  1161. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1162. }
  1163. } while(token = iterator.stepBackward());
  1164. return null;
  1165. };
  1166. this._pop = function(stack, tag) {
  1167. while (stack.length) {
  1168. var top = stack[stack.length-1];
  1169. if (!tag || top.tagName == tag.tagName) {
  1170. return stack.pop();
  1171. }
  1172. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1173. stack.pop();
  1174. continue;
  1175. } else {
  1176. return null;
  1177. }
  1178. }
  1179. };
  1180. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1181. var firstTag = this._getFirstTagInLine(session, row);
  1182. if (!firstTag) {
  1183. return this.getCommentFoldWidget(session, row)
  1184. && session.getCommentFoldRange(row, session.getLine(row).length);
  1185. }
  1186. var isBackward = firstTag.closing || firstTag.selfClosing;
  1187. var stack = [];
  1188. var tag;
  1189. if (!isBackward) {
  1190. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1191. var start = {
  1192. row: row,
  1193. column: firstTag.start.column + firstTag.tagName.length + 2
  1194. };
  1195. if (firstTag.start.row == firstTag.end.row)
  1196. start.column = firstTag.end.column;
  1197. while (tag = this._readTagForward(iterator)) {
  1198. if (tag.selfClosing) {
  1199. if (!stack.length) {
  1200. tag.start.column += tag.tagName.length + 2;
  1201. tag.end.column -= 2;
  1202. return Range.fromPoints(tag.start, tag.end);
  1203. } else
  1204. continue;
  1205. }
  1206. if (tag.closing) {
  1207. this._pop(stack, tag);
  1208. if (stack.length == 0)
  1209. return Range.fromPoints(start, tag.start);
  1210. }
  1211. else {
  1212. stack.push(tag);
  1213. }
  1214. }
  1215. }
  1216. else {
  1217. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1218. var end = {
  1219. row: row,
  1220. column: firstTag.start.column
  1221. };
  1222. while (tag = this._readTagBackward(iterator)) {
  1223. if (tag.selfClosing) {
  1224. if (!stack.length) {
  1225. tag.start.column += tag.tagName.length + 2;
  1226. tag.end.column -= 2;
  1227. return Range.fromPoints(tag.start, tag.end);
  1228. } else
  1229. continue;
  1230. }
  1231. if (!tag.closing) {
  1232. this._pop(stack, tag);
  1233. if (stack.length == 0) {
  1234. tag.start.column += tag.tagName.length + 2;
  1235. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1236. tag.start.column = tag.end.column;
  1237. return Range.fromPoints(tag.start, end);
  1238. }
  1239. }
  1240. else {
  1241. stack.push(tag);
  1242. }
  1243. }
  1244. }
  1245. };
  1246. }).call(FoldMode.prototype);
  1247. });
  1248. define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module) {
  1249. "use strict";
  1250. var oop = require("../lib/oop");
  1251. var lang = require("../lib/lang");
  1252. var TextMode = require("./text").Mode;
  1253. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1254. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  1255. var XmlFoldMode = require("./folding/xml").FoldMode;
  1256. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1257. var Mode = function() {
  1258. this.HighlightRules = XmlHighlightRules;
  1259. this.$behaviour = new XmlBehaviour();
  1260. this.foldingRules = new XmlFoldMode();
  1261. };
  1262. oop.inherits(Mode, TextMode);
  1263. (function() {
  1264. this.voidElements = lang.arrayToMap([]);
  1265. this.blockComment = {start: "<!--", end: "-->"};
  1266. this.createWorker = function(session) {
  1267. var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
  1268. worker.attachToDocument(session.getDocument());
  1269. worker.on("error", function(e) {
  1270. session.setAnnotations(e.data);
  1271. });
  1272. worker.on("terminate", function() {
  1273. session.clearAnnotations();
  1274. });
  1275. return worker;
  1276. };
  1277. this.$id = "ace/mode/xml";
  1278. }).call(Mode.prototype);
  1279. exports.Mode = Mode;
  1280. });
  1281. define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  1282. "use strict";
  1283. var oop = require("../lib/oop");
  1284. var lang = require("../lib/lang");
  1285. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1286. var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  1287. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  1288. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
  1289. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  1290. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  1291. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  1292. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  1293. var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
  1294. var CssHighlightRules = function() {
  1295. var keywordMapper = this.createKeywordMapper({
  1296. "support.function": supportFunction,
  1297. "support.constant": supportConstant,
  1298. "support.type": supportType,
  1299. "support.constant.color": supportConstantColor,
  1300. "support.constant.fonts": supportConstantFonts
  1301. }, "text", true);
  1302. this.$rules = {
  1303. "start" : [{
  1304. include : ["strings", "url", "comments"]
  1305. }, {
  1306. token: "paren.lparen",
  1307. regex: "\\{",
  1308. next: "ruleset"
  1309. }, {
  1310. token: "paren.rparen",
  1311. regex: "\\}"
  1312. }, {
  1313. token: "string",
  1314. regex: "@(?!viewport)",
  1315. next: "media"
  1316. }, {
  1317. token: "keyword",
  1318. regex: "#[a-z0-9-_]+"
  1319. }, {
  1320. token: "keyword",
  1321. regex: "%"
  1322. }, {
  1323. token: "variable",
  1324. regex: "\\.[a-z0-9-_]+"
  1325. }, {
  1326. token: "string",
  1327. regex: ":[a-z0-9-_]+"
  1328. }, {
  1329. token : "constant.numeric",
  1330. regex : numRe
  1331. }, {
  1332. token: "constant",
  1333. regex: "[a-z0-9-_]+"
  1334. }, {
  1335. caseInsensitive: true
  1336. }],
  1337. "media": [{
  1338. include : ["strings", "url", "comments"]
  1339. }, {
  1340. token: "paren.lparen",
  1341. regex: "\\{",
  1342. next: "start"
  1343. }, {
  1344. token: "paren.rparen",
  1345. regex: "\\}",
  1346. next: "start"
  1347. }, {
  1348. token: "string",
  1349. regex: ";",
  1350. next: "start"
  1351. }, {
  1352. token: "keyword",
  1353. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  1354. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  1355. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  1356. }],
  1357. "comments" : [{
  1358. token: "comment", // multi line comment
  1359. regex: "\\/\\*",
  1360. push: [{
  1361. token : "comment",
  1362. regex : "\\*\\/",
  1363. next : "pop"
  1364. }, {
  1365. defaultToken : "comment"
  1366. }]
  1367. }],
  1368. "ruleset" : [{
  1369. regex : "-(webkit|ms|moz|o)-",
  1370. token : "text"
  1371. }, {
  1372. token : "punctuation.operator",
  1373. regex : "[:;]"
  1374. }, {
  1375. token : "paren.rparen",
  1376. regex : "\\}",
  1377. next : "start"
  1378. }, {
  1379. include : ["strings", "url", "comments"]
  1380. }, {
  1381. token : ["constant.numeric", "keyword"],
  1382. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
  1383. }, {
  1384. token : "constant.numeric",
  1385. regex : numRe
  1386. }, {
  1387. token : "constant.numeric", // hex6 color
  1388. regex : "#[a-f0-9]{6}"
  1389. }, {
  1390. token : "constant.numeric", // hex3 color
  1391. regex : "#[a-f0-9]{3}"
  1392. }, {
  1393. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1394. regex : pseudoElements
  1395. }, {
  1396. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1397. regex : pseudoClasses
  1398. }, {
  1399. include: "url"
  1400. }, {
  1401. token : keywordMapper,
  1402. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1403. }, {
  1404. caseInsensitive: true
  1405. }],
  1406. url: [{
  1407. token : "support.function",
  1408. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  1409. push: [{
  1410. token : "support.function",
  1411. regex : "\\)",
  1412. next : "pop"
  1413. }, {
  1414. defaultToken: "string"
  1415. }]
  1416. }],
  1417. strings: [{
  1418. token : "string.start",
  1419. regex : "'",
  1420. push : [{
  1421. token : "string.end",
  1422. regex : "'|$",
  1423. next: "pop"
  1424. }, {
  1425. include : "escapes"
  1426. }, {
  1427. token : "constant.language.escape",
  1428. regex : /\\$/,
  1429. consumeLineEnd: true
  1430. }, {
  1431. defaultToken: "string"
  1432. }]
  1433. }, {
  1434. token : "string.start",
  1435. regex : '"',
  1436. push : [{
  1437. token : "string.end",
  1438. regex : '"|$',
  1439. next: "pop"
  1440. }, {
  1441. include : "escapes"
  1442. }, {
  1443. token : "constant.language.escape",
  1444. regex : /\\$/,
  1445. consumeLineEnd: true
  1446. }, {
  1447. defaultToken: "string"
  1448. }]
  1449. }],
  1450. escapes: [{
  1451. token : "constant.language.escape",
  1452. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  1453. }]
  1454. };
  1455. this.normalizeRules();
  1456. };
  1457. oop.inherits(CssHighlightRules, TextHighlightRules);
  1458. exports.CssHighlightRules = CssHighlightRules;
  1459. });
  1460. define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
  1461. "use strict";
  1462. var propertyMap = {
  1463. "background": {"#$0": 1},
  1464. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1465. "background-image": {"url('/$0')": 1},
  1466. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1467. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1468. "background-attachment": {"scroll": 1, "fixed": 1},
  1469. "background-size": {"cover": 1, "contain": 1},
  1470. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1471. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1472. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1473. "border-color": {"#$0": 1},
  1474. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1475. "border-collapse": {"collapse": 1, "separate": 1},
  1476. "bottom": {"px": 1, "em": 1, "%": 1},
  1477. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1478. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1479. "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
  1480. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1481. "empty-cells": {"show": 1, "hide": 1},
  1482. "float": {"left": 1, "right": 1, "none": 1},
  1483. "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
  1484. "font-size": {"px": 1, "em": 1, "%": 1},
  1485. "font-weight": {"bold": 1, "normal": 1},
  1486. "font-style": {"italic": 1, "normal": 1},
  1487. "font-variant": {"normal": 1, "small-caps": 1},
  1488. "height": {"px": 1, "em": 1, "%": 1},
  1489. "left": {"px": 1, "em": 1, "%": 1},
  1490. "letter-spacing": {"normal": 1},
  1491. "line-height": {"normal": 1},
  1492. "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
  1493. "margin": {"px": 1, "em": 1, "%": 1},
  1494. "margin-right": {"px": 1, "em": 1, "%": 1},
  1495. "margin-left": {"px": 1, "em": 1, "%": 1},
  1496. "margin-top": {"px": 1, "em": 1, "%": 1},
  1497. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1498. "max-height": {"px": 1, "em": 1, "%": 1},
  1499. "max-width": {"px": 1, "em": 1, "%": 1},
  1500. "min-height": {"px": 1, "em": 1, "%": 1},
  1501. "min-width": {"px": 1, "em": 1, "%": 1},
  1502. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1503. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1504. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1505. "padding": {"px": 1, "em": 1, "%": 1},
  1506. "padding-top": {"px": 1, "em": 1, "%": 1},
  1507. "padding-right": {"px": 1, "em": 1, "%": 1},
  1508. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1509. "padding-left": {"px": 1, "em": 1, "%": 1},
  1510. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1511. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1512. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1513. "right": {"px": 1, "em": 1, "%": 1},
  1514. "table-layout": {"fixed": 1, "auto": 1},
  1515. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1516. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1517. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1518. "top": {"px": 1, "em": 1, "%": 1},
  1519. "vertical-align": {"top": 1, "bottom": 1},
  1520. "visibility": {"hidden": 1, "visible": 1},
  1521. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1522. "width": {"px": 1, "em": 1, "%": 1},
  1523. "word-spacing": {"normal": 1},
  1524. "filter": {"alpha(opacity=$0100)": 1},
  1525. "text-shadow": {"$02px 2px 2px #777": 1},
  1526. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1527. "-moz-border-radius": 1,
  1528. "-moz-border-radius-topright": 1,
  1529. "-moz-border-radius-bottomright": 1,
  1530. "-moz-border-radius-topleft": 1,
  1531. "-moz-border-radius-bottomleft": 1,
  1532. "-webkit-border-radius": 1,
  1533. "-webkit-border-top-right-radius": 1,
  1534. "-webkit-border-top-left-radius": 1,
  1535. "-webkit-border-bottom-right-radius": 1,
  1536. "-webkit-border-bottom-left-radius": 1,
  1537. "-moz-box-shadow": 1,
  1538. "-webkit-box-shadow": 1,
  1539. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1540. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1541. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1542. };
  1543. var CssCompletions = function() {
  1544. };
  1545. (function() {
  1546. this.completionsDefined = false;
  1547. this.defineCompletions = function() {
  1548. if (document) {
  1549. var style = document.createElement('c').style;
  1550. for (var i in style) {
  1551. if (typeof style[i] !== 'string')
  1552. continue;
  1553. var name = i.replace(/[A-Z]/g, function(x) {
  1554. return '-' + x.toLowerCase();
  1555. });
  1556. if (!propertyMap.hasOwnProperty(name))
  1557. propertyMap[name] = 1;
  1558. }
  1559. }
  1560. this.completionsDefined = true;
  1561. };
  1562. this.getCompletions = function(state, session, pos, prefix) {
  1563. if (!this.completionsDefined) {
  1564. this.defineCompletions();
  1565. }
  1566. if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
  1567. var line = session.getLine(pos.row).substr(0, pos.column);
  1568. if (/:[^;]+$/.test(line)) {
  1569. /([\w\-]+):[^:]*$/.test(line);
  1570. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1571. } else {
  1572. return this.getPropertyCompletions(state, session, pos, prefix);
  1573. }
  1574. }
  1575. return [];
  1576. };
  1577. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1578. var properties = Object.keys(propertyMap);
  1579. return properties.map(function(property){
  1580. return {
  1581. caption: property,
  1582. snippet: property + ': $0;',
  1583. meta: "property",
  1584. score: 1000000
  1585. };
  1586. });
  1587. };
  1588. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1589. var line = session.getLine(pos.row).substr(0, pos.column);
  1590. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1591. if (!property)
  1592. return [];
  1593. var values = [];
  1594. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1595. values = Object.keys(propertyMap[property]);
  1596. }
  1597. return values.map(function(value){
  1598. return {
  1599. caption: value,
  1600. snippet: value,
  1601. meta: "property value",
  1602. score: 1000000
  1603. };
  1604. });
  1605. };
  1606. }).call(CssCompletions.prototype);
  1607. exports.CssCompletions = CssCompletions;
  1608. });
  1609. define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
  1610. "use strict";
  1611. var oop = require("../../lib/oop");
  1612. var Behaviour = require("../behaviour").Behaviour;
  1613. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1614. var TokenIterator = require("../../token_iterator").TokenIterator;
  1615. var CssBehaviour = function () {
  1616. this.inherit(CstyleBehaviour);
  1617. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1618. if (text === ':' && editor.selection.isEmpty()) {
  1619. var cursor = editor.getCursorPosition();
  1620. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1621. var token = iterator.getCurrentToken();
  1622. if (token && token.value.match(/\s+/)) {
  1623. token = iterator.stepBackward();
  1624. }
  1625. if (token && token.type === 'support.type') {
  1626. var line = session.doc.getLine(cursor.row);
  1627. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1628. if (rightChar === ':') {
  1629. return {
  1630. text: '',
  1631. selection: [1, 1]
  1632. };
  1633. }
  1634. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1635. return {
  1636. text: ':;',
  1637. selection: [1, 1]
  1638. };
  1639. }
  1640. }
  1641. }
  1642. });
  1643. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1644. var selected = session.doc.getTextRange(range);
  1645. if (!range.isMultiLine() && selected === ':') {
  1646. var cursor = editor.getCursorPosition();
  1647. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1648. var token = iterator.getCurrentToken();
  1649. if (token && token.value.match(/\s+/)) {
  1650. token = iterator.stepBackward();
  1651. }
  1652. if (token && token.type === 'support.type') {
  1653. var line = session.doc.getLine(range.start.row);
  1654. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1655. if (rightChar === ';') {
  1656. range.end.column ++;
  1657. return range;
  1658. }
  1659. }
  1660. }
  1661. });
  1662. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1663. if (text === ';' && editor.selection.isEmpty()) {
  1664. var cursor = editor.getCursorPosition();
  1665. var line = session.doc.getLine(cursor.row);
  1666. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1667. if (rightChar === ';') {
  1668. return {
  1669. text: '',
  1670. selection: [1, 1]
  1671. };
  1672. }
  1673. }
  1674. });
  1675. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1676. if (text === '!' && editor.selection.isEmpty()) {
  1677. var cursor = editor.getCursorPosition();
  1678. var line = session.doc.getLine(cursor.row);
  1679. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1680. return {
  1681. text: '!important',
  1682. selection: [10, 10]
  1683. };
  1684. }
  1685. }
  1686. });
  1687. };
  1688. oop.inherits(CssBehaviour, CstyleBehaviour);
  1689. exports.CssBehaviour = CssBehaviour;
  1690. });
  1691. define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
  1692. "use strict";
  1693. var oop = require("../lib/oop");
  1694. var TextMode = require("./text").Mode;
  1695. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1696. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1697. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1698. var CssCompletions = require("./css_completions").CssCompletions;
  1699. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1700. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1701. var Mode = function() {
  1702. this.HighlightRules = CssHighlightRules;
  1703. this.$outdent = new MatchingBraceOutdent();
  1704. this.$behaviour = new CssBehaviour();
  1705. this.$completer = new CssCompletions();
  1706. this.foldingRules = new CStyleFoldMode();
  1707. };
  1708. oop.inherits(Mode, TextMode);
  1709. (function() {
  1710. this.foldingRules = "cStyle";
  1711. this.blockComment = {start: "/*", end: "*/"};
  1712. this.getNextLineIndent = function(state, line, tab) {
  1713. var indent = this.$getIndent(line);
  1714. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1715. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1716. return indent;
  1717. }
  1718. var match = line.match(/^.*\{\s*$/);
  1719. if (match) {
  1720. indent += tab;
  1721. }
  1722. return indent;
  1723. };
  1724. this.checkOutdent = function(state, line, input) {
  1725. return this.$outdent.checkOutdent(line, input);
  1726. };
  1727. this.autoOutdent = function(state, doc, row) {
  1728. this.$outdent.autoOutdent(doc, row);
  1729. };
  1730. this.getCompletions = function(state, session, pos, prefix) {
  1731. return this.$completer.getCompletions(state, session, pos, prefix);
  1732. };
  1733. this.createWorker = function(session) {
  1734. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1735. worker.attachToDocument(session.getDocument());
  1736. worker.on("annotate", function(e) {
  1737. session.setAnnotations(e.data);
  1738. });
  1739. worker.on("terminate", function() {
  1740. session.clearAnnotations();
  1741. });
  1742. return worker;
  1743. };
  1744. this.$id = "ace/mode/css";
  1745. }).call(Mode.prototype);
  1746. exports.Mode = Mode;
  1747. });
  1748. define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
  1749. "use strict";
  1750. var oop = require("../lib/oop");
  1751. var lang = require("../lib/lang");
  1752. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1753. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1754. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1755. var tagMap = lang.createMap({
  1756. a : 'anchor',
  1757. button : 'form',
  1758. form : 'form',
  1759. img : 'image',
  1760. input : 'form',
  1761. label : 'form',
  1762. option : 'form',
  1763. script : 'script',
  1764. select : 'form',
  1765. textarea : 'form',
  1766. style : 'style',
  1767. table : 'table',
  1768. tbody : 'table',
  1769. td : 'table',
  1770. tfoot : 'table',
  1771. th : 'table',
  1772. tr : 'table'
  1773. });
  1774. var HtmlHighlightRules = function() {
  1775. XmlHighlightRules.call(this);
  1776. this.addRules({
  1777. attributes: [{
  1778. include : "tag_whitespace"
  1779. }, {
  1780. token : "entity.other.attribute-name.xml",
  1781. regex : "[-_a-zA-Z0-9:.]+"
  1782. }, {
  1783. token : "keyword.operator.attribute-equals.xml",
  1784. regex : "=",
  1785. push : [{
  1786. include: "tag_whitespace"
  1787. }, {
  1788. token : "string.unquoted.attribute-value.html",
  1789. regex : "[^<>='\"`\\s]+",
  1790. next : "pop"
  1791. }, {
  1792. token : "empty",
  1793. regex : "",
  1794. next : "pop"
  1795. }]
  1796. }, {
  1797. include : "attribute_value"
  1798. }],
  1799. tag: [{
  1800. token : function(start, tag) {
  1801. var group = tagMap[tag];
  1802. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1803. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1804. },
  1805. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  1806. next: "tag_stuff"
  1807. }],
  1808. tag_stuff: [
  1809. {include : "attributes"},
  1810. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1811. ]
  1812. });
  1813. this.embedTagRules(CssHighlightRules, "css-", "style");
  1814. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  1815. if (this.constructor === HtmlHighlightRules)
  1816. this.normalizeRules();
  1817. };
  1818. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1819. exports.HtmlHighlightRules = HtmlHighlightRules;
  1820. });
  1821. define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1822. "use strict";
  1823. var oop = require("../../lib/oop");
  1824. var BaseFoldMode = require("./fold_mode").FoldMode;
  1825. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1826. this.defaultMode = defaultMode;
  1827. this.subModes = subModes;
  1828. };
  1829. oop.inherits(FoldMode, BaseFoldMode);
  1830. (function() {
  1831. this.$getMode = function(state) {
  1832. if (typeof state != "string")
  1833. state = state[0];
  1834. for (var key in this.subModes) {
  1835. if (state.indexOf(key) === 0)
  1836. return this.subModes[key];
  1837. }
  1838. return null;
  1839. };
  1840. this.$tryMode = function(state, session, foldStyle, row) {
  1841. var mode = this.$getMode(state);
  1842. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1843. };
  1844. this.getFoldWidget = function(session, foldStyle, row) {
  1845. return (
  1846. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1847. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1848. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1849. );
  1850. };
  1851. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1852. var mode = this.$getMode(session.getState(row-1));
  1853. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1854. mode = this.$getMode(session.getState(row));
  1855. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1856. mode = this.defaultMode;
  1857. return mode.getFoldWidgetRange(session, foldStyle, row);
  1858. };
  1859. }).call(FoldMode.prototype);
  1860. });
  1861. define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) {
  1862. "use strict";
  1863. var oop = require("../../lib/oop");
  1864. var MixedFoldMode = require("./mixed").FoldMode;
  1865. var XmlFoldMode = require("./xml").FoldMode;
  1866. var CStyleFoldMode = require("./cstyle").FoldMode;
  1867. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1868. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1869. "js-": new CStyleFoldMode(),
  1870. "css-": new CStyleFoldMode()
  1871. });
  1872. };
  1873. oop.inherits(FoldMode, MixedFoldMode);
  1874. });
  1875. define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
  1876. "use strict";
  1877. var TokenIterator = require("../token_iterator").TokenIterator;
  1878. var commonAttributes = [
  1879. "accesskey",
  1880. "class",
  1881. "contenteditable",
  1882. "contextmenu",
  1883. "dir",
  1884. "draggable",
  1885. "dropzone",
  1886. "hidden",
  1887. "id",
  1888. "inert",
  1889. "itemid",
  1890. "itemprop",
  1891. "itemref",
  1892. "itemscope",
  1893. "itemtype",
  1894. "lang",
  1895. "spellcheck",
  1896. "style",
  1897. "tabindex",
  1898. "title",
  1899. "translate"
  1900. ];
  1901. var eventAttributes = [
  1902. "onabort",
  1903. "onblur",
  1904. "oncancel",
  1905. "oncanplay",
  1906. "oncanplaythrough",
  1907. "onchange",
  1908. "onclick",
  1909. "onclose",
  1910. "oncontextmenu",
  1911. "oncuechange",
  1912. "ondblclick",
  1913. "ondrag",
  1914. "ondragend",
  1915. "ondragenter",
  1916. "ondragleave",
  1917. "ondragover",
  1918. "ondragstart",
  1919. "ondrop",
  1920. "ondurationchange",
  1921. "onemptied",
  1922. "onended",
  1923. "onerror",
  1924. "onfocus",
  1925. "oninput",
  1926. "oninvalid",
  1927. "onkeydown",
  1928. "onkeypress",
  1929. "onkeyup",
  1930. "onload",
  1931. "onloadeddata",
  1932. "onloadedmetadata",
  1933. "onloadstart",
  1934. "onmousedown",
  1935. "onmousemove",
  1936. "onmouseout",
  1937. "onmouseover",
  1938. "onmouseup",
  1939. "onmousewheel",
  1940. "onpause",
  1941. "onplay",
  1942. "onplaying",
  1943. "onprogress",
  1944. "onratechange",
  1945. "onreset",
  1946. "onscroll",
  1947. "onseeked",
  1948. "onseeking",
  1949. "onselect",
  1950. "onshow",
  1951. "onstalled",
  1952. "onsubmit",
  1953. "onsuspend",
  1954. "ontimeupdate",
  1955. "onvolumechange",
  1956. "onwaiting"
  1957. ];
  1958. var globalAttributes = commonAttributes.concat(eventAttributes);
  1959. var attributeMap = {
  1960. "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
  1961. "abbr": {},
  1962. "address": {},
  1963. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  1964. "article": {"pubdate": 1},
  1965. "aside": {},
  1966. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  1967. "b": {},
  1968. "base": {"href": 1, "target": 1},
  1969. "bdi": {},
  1970. "bdo": {},
  1971. "blockquote": {"cite": 1},
  1972. "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
  1973. "br": {},
  1974. "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
  1975. "canvas": {"width": 1, "height": 1},
  1976. "caption": {},
  1977. "cite": {},
  1978. "code": {},
  1979. "col": {"span": 1},
  1980. "colgroup": {"span": 1},
  1981. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  1982. "data": {},
  1983. "datalist": {},
  1984. "dd": {},
  1985. "del": {"cite": 1, "datetime": 1},
  1986. "details": {"open": 1},
  1987. "dfn": {},
  1988. "dialog": {"open": 1},
  1989. "div": {},
  1990. "dl": {},
  1991. "dt": {},
  1992. "em": {},
  1993. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  1994. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  1995. "figcaption": {},
  1996. "figure": {},
  1997. "footer": {},
  1998. "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
  1999. "h1": {},
  2000. "h2": {},
  2001. "h3": {},
  2002. "h4": {},
  2003. "h5": {},
  2004. "h6": {},
  2005. "head": {},
  2006. "header": {},
  2007. "hr": {},
  2008. "html": {"manifest": 1},
  2009. "i": {},
  2010. "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
  2011. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2012. "input": {
  2013. "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
  2014. "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
  2015. "ins": {"cite": 1, "datetime": 1},
  2016. "kbd": {},
  2017. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2018. "label": {"form": 1, "for": 1},
  2019. "legend": {},
  2020. "li": {"value": 1},
  2021. "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
  2022. "main": {},
  2023. "map": {"name": 1},
  2024. "mark": {},
  2025. "math": {},
  2026. "menu": {"type": 1, "label": 1},
  2027. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2028. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2029. "nav": {},
  2030. "noscript": {"href": 1},
  2031. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2032. "ol": {"start": 1, "reversed": 1},
  2033. "optgroup": {"disabled": 1, "label": 1},
  2034. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2035. "output": {"for": 1, "form": 1, "name": 1},
  2036. "p": {},
  2037. "param": {"name": 1, "value": 1},
  2038. "pre": {},
  2039. "progress": {"value": 1, "max": 1},
  2040. "q": {"cite": 1},
  2041. "rp": {},
  2042. "rt": {},
  2043. "ruby": {},
  2044. "s": {},
  2045. "samp": {},
  2046. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2047. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2048. "small": {},
  2049. "source": {"src": 1, "type": 1, "media": 1},
  2050. "span": {},
  2051. "strong": {},
  2052. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2053. "sub": {},
  2054. "sup": {},
  2055. "svg": {},
  2056. "table": {"summary": 1},
  2057. "tbody": {},
  2058. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2059. "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
  2060. "tfoot": {},
  2061. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2062. "thead": {},
  2063. "time": {"datetime": 1},
  2064. "title": {},
  2065. "tr": {},
  2066. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2067. "section": {},
  2068. "summary": {},
  2069. "u": {},
  2070. "ul": {},
  2071. "var": {},
  2072. "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
  2073. "wbr": {}
  2074. };
  2075. var elements = Object.keys(attributeMap);
  2076. function is(token, type) {
  2077. return token.type.lastIndexOf(type + ".xml") > -1;
  2078. }
  2079. function findTagName(session, pos) {
  2080. var iterator = new TokenIterator(session, pos.row, pos.column);
  2081. var token = iterator.getCurrentToken();
  2082. while (token && !is(token, "tag-name")){
  2083. token = iterator.stepBackward();
  2084. }
  2085. if (token)
  2086. return token.value;
  2087. }
  2088. function findAttributeName(session, pos) {
  2089. var iterator = new TokenIterator(session, pos.row, pos.column);
  2090. var token = iterator.getCurrentToken();
  2091. while (token && !is(token, "attribute-name")){
  2092. token = iterator.stepBackward();
  2093. }
  2094. if (token)
  2095. return token.value;
  2096. }
  2097. var HtmlCompletions = function() {
  2098. };
  2099. (function() {
  2100. this.getCompletions = function(state, session, pos, prefix) {
  2101. var token = session.getTokenAt(pos.row, pos.column);
  2102. if (!token)
  2103. return [];
  2104. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2105. return this.getTagCompletions(state, session, pos, prefix);
  2106. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2107. return this.getAttributeCompletions(state, session, pos, prefix);
  2108. if (is(token, "attribute-value"))
  2109. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2110. var line = session.getLine(pos.row).substr(0, pos.column);
  2111. if (/&[a-z]*$/i.test(line))
  2112. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2113. return [];
  2114. };
  2115. this.getTagCompletions = function(state, session, pos, prefix) {
  2116. return elements.map(function(element){
  2117. return {
  2118. value: element,
  2119. meta: "tag",
  2120. score: 1000000
  2121. };
  2122. });
  2123. };
  2124. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2125. var tagName = findTagName(session, pos);
  2126. if (!tagName)
  2127. return [];
  2128. var attributes = globalAttributes;
  2129. if (tagName in attributeMap) {
  2130. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2131. }
  2132. return attributes.map(function(attribute){
  2133. return {
  2134. caption: attribute,
  2135. snippet: attribute + '="$0"',
  2136. meta: "attribute",
  2137. score: 1000000
  2138. };
  2139. });
  2140. };
  2141. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2142. var tagName = findTagName(session, pos);
  2143. var attributeName = findAttributeName(session, pos);
  2144. if (!tagName)
  2145. return [];
  2146. var values = [];
  2147. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2148. values = Object.keys(attributeMap[tagName][attributeName]);
  2149. }
  2150. return values.map(function(value){
  2151. return {
  2152. caption: value,
  2153. snippet: value,
  2154. meta: "attribute value",
  2155. score: 1000000
  2156. };
  2157. });
  2158. };
  2159. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2160. var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
  2161. return values.map(function(value){
  2162. return {
  2163. caption: value,
  2164. snippet: value,
  2165. meta: "html entity",
  2166. score: 1000000
  2167. };
  2168. });
  2169. };
  2170. }).call(HtmlCompletions.prototype);
  2171. exports.HtmlCompletions = HtmlCompletions;
  2172. });
  2173. define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) {
  2174. "use strict";
  2175. var oop = require("../lib/oop");
  2176. var lang = require("../lib/lang");
  2177. var TextMode = require("./text").Mode;
  2178. var JavaScriptMode = require("./javascript").Mode;
  2179. var CssMode = require("./css").Mode;
  2180. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2181. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2182. var HtmlFoldMode = require("./folding/html").FoldMode;
  2183. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2184. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2185. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2186. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2187. var Mode = function(options) {
  2188. this.fragmentContext = options && options.fragmentContext;
  2189. this.HighlightRules = HtmlHighlightRules;
  2190. this.$behaviour = new XmlBehaviour();
  2191. this.$completer = new HtmlCompletions();
  2192. this.createModeDelegates({
  2193. "js-": JavaScriptMode,
  2194. "css-": CssMode
  2195. });
  2196. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2197. };
  2198. oop.inherits(Mode, TextMode);
  2199. (function() {
  2200. this.blockComment = {start: "<!--", end: "-->"};
  2201. this.voidElements = lang.arrayToMap(voidElements);
  2202. this.getNextLineIndent = function(state, line, tab) {
  2203. return this.$getIndent(line);
  2204. };
  2205. this.checkOutdent = function(state, line, input) {
  2206. return false;
  2207. };
  2208. this.getCompletions = function(state, session, pos, prefix) {
  2209. return this.$completer.getCompletions(state, session, pos, prefix);
  2210. };
  2211. this.createWorker = function(session) {
  2212. if (this.constructor != Mode)
  2213. return;
  2214. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2215. worker.attachToDocument(session.getDocument());
  2216. if (this.fragmentContext)
  2217. worker.call("setOptions", [{context: this.fragmentContext}]);
  2218. worker.on("error", function(e) {
  2219. session.setAnnotations(e.data);
  2220. });
  2221. worker.on("terminate", function() {
  2222. session.clearAnnotations();
  2223. });
  2224. return worker;
  2225. };
  2226. this.$id = "ace/mode/html";
  2227. }).call(Mode.prototype);
  2228. exports.Mode = Mode;
  2229. });
  2230. define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
  2231. "use strict";
  2232. var modes = require("../config").$modes;
  2233. var oop = require("../lib/oop");
  2234. var lang = require("../lib/lang");
  2235. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2236. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2237. var escaped = function(ch) {
  2238. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  2239. };
  2240. var MarkdownHighlightRules = function() {
  2241. HtmlHighlightRules.call(this);
  2242. var codeBlockStartRule = {
  2243. token : "support.function",
  2244. regex : /^\s*(```+[^`]*|~~~+[^~]*)$/,
  2245. onMatch: function(value, state, stack, line) {
  2246. var m = value.match(/^(\s*)([`~]+)(.*)/);
  2247. var language = /[\w-]+|$/.exec(m[3])[0];
  2248. if (!modes[language])
  2249. language = "";
  2250. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  2251. return this.token;
  2252. },
  2253. next : "githubblock"
  2254. };
  2255. var codeBlockRules = [{
  2256. token : "support.function",
  2257. regex : ".*",
  2258. onMatch: function(value, state, stack, line) {
  2259. var embedState = stack[1];
  2260. var indent = stack[2][0];
  2261. var endMarker = stack[2][1];
  2262. var language = stack[2][2];
  2263. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  2264. if (
  2265. m && m[1].length < indent.length + 3
  2266. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]
  2267. ) {
  2268. stack.splice(0, 3);
  2269. this.next = stack.shift();
  2270. return this.token;
  2271. }
  2272. this.next = "";
  2273. if (language && modes[language]) {
  2274. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  2275. stack[1] = data.state;
  2276. return data.tokens;
  2277. }
  2278. return this.token;
  2279. }
  2280. }];
  2281. this.$rules["start"].unshift({
  2282. token : "empty_line",
  2283. regex : '^$',
  2284. next: "allowBlock"
  2285. }, { // h1
  2286. token: "markup.heading.1",
  2287. regex: "^=+(?=\\s*$)"
  2288. }, { // h2
  2289. token: "markup.heading.2",
  2290. regex: "^\\-+(?=\\s*$)"
  2291. }, {
  2292. token : function(value) {
  2293. return "markup.heading." + value.length;
  2294. },
  2295. regex : /^#{1,6}(?=\s|$)/,
  2296. next : "header"
  2297. },
  2298. codeBlockStartRule,
  2299. { // block quote
  2300. token : "string.blockquote",
  2301. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2302. next : "blockquote"
  2303. }, { // HR * - _
  2304. token : "constant",
  2305. regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  2306. next: "allowBlock"
  2307. }, { // list
  2308. token : "markup.list",
  2309. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2310. next : "listblock-start"
  2311. }, {
  2312. include : "basic"
  2313. });
  2314. this.addRules({
  2315. "basic" : [{
  2316. token : "constant.language.escape",
  2317. regex : /\\[\\`*_{}\[\]()#+\-.!]/
  2318. }, { // code span `
  2319. token : "support.function",
  2320. regex : "(`+)(.*?[^`])(\\1)"
  2321. }, { // reference
  2322. token : ["text", "constant", "text", "url", "string", "text"],
  2323. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  2324. }, { // link by reference
  2325. token : ["text", "string", "text", "constant", "text"],
  2326. regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
  2327. }, { // link by url
  2328. token : ["text", "string", "text", "markup.underline", "string", "text"],
  2329. regex : "(\\!?\\[)(" + // [
  2330. escaped("]") + // link text or alt text
  2331. ")(\\]\\()"+ // ](
  2332. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  2333. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  2334. "(\\))" // )
  2335. }, { // strong ** __
  2336. token : "string.strong",
  2337. regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  2338. }, { // emphasis * _
  2339. token : "string.emphasis",
  2340. regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  2341. }, { //
  2342. token : ["text", "url", "text"],
  2343. regex : "(<)("+
  2344. "(?:https?|ftp|dict):[^'\">\\s]+"+
  2345. "|"+
  2346. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  2347. ")(>)"
  2348. }],
  2349. "allowBlock": [
  2350. {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
  2351. {token : "empty_line", regex : '^$', next: "allowBlock"},
  2352. {token : "empty", regex : "", next : "start"}
  2353. ],
  2354. "header" : [{
  2355. regex: "$",
  2356. next : "start"
  2357. }, {
  2358. include: "basic"
  2359. }, {
  2360. defaultToken : "heading"
  2361. } ],
  2362. "listblock-start" : [{
  2363. token : "support.variable",
  2364. regex : /(?:\[[ x]\])?/,
  2365. next : "listblock"
  2366. }],
  2367. "listblock" : [ { // Lists only escape on completely blank lines.
  2368. token : "empty_line",
  2369. regex : "^$",
  2370. next : "start"
  2371. }, { // list
  2372. token : "markup.list",
  2373. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2374. next : "listblock-start"
  2375. }, {
  2376. include : "basic", noEscape: true
  2377. },
  2378. codeBlockStartRule,
  2379. {
  2380. defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
  2381. } ],
  2382. "blockquote" : [ { // Blockquotes only escape on blank lines.
  2383. token : "empty_line",
  2384. regex : "^\\s*$",
  2385. next : "start"
  2386. }, { // block quote
  2387. token : "string.blockquote",
  2388. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2389. next : "blockquote"
  2390. }, {
  2391. include : "basic", noEscape: true
  2392. }, {
  2393. defaultToken : "string.blockquote"
  2394. } ],
  2395. "githubblock" : codeBlockRules
  2396. });
  2397. this.normalizeRules();
  2398. };
  2399. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  2400. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  2401. });
  2402. define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
  2403. "use strict";
  2404. var oop = require("../../lib/oop");
  2405. var BaseFoldMode = require("./fold_mode").FoldMode;
  2406. var Range = require("../../range").Range;
  2407. var FoldMode = exports.FoldMode = function() {};
  2408. oop.inherits(FoldMode, BaseFoldMode);
  2409. (function() {
  2410. this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
  2411. this.getFoldWidget = function(session, foldStyle, row) {
  2412. var line = session.getLine(row);
  2413. if (!this.foldingStartMarker.test(line))
  2414. return "";
  2415. if (line[0] == "`") {
  2416. if (session.bgTokenizer.getState(row) == "start")
  2417. return "end";
  2418. return "start";
  2419. }
  2420. return "start";
  2421. };
  2422. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2423. var line = session.getLine(row);
  2424. var startColumn = line.length;
  2425. var maxRow = session.getLength();
  2426. var startRow = row;
  2427. var endRow = row;
  2428. if (!line.match(this.foldingStartMarker))
  2429. return;
  2430. if (line[0] == "`") {
  2431. if (session.bgTokenizer.getState(row) !== "start") {
  2432. while (++row < maxRow) {
  2433. line = session.getLine(row);
  2434. if (line[0] == "`" & line.substring(0, 3) == "```")
  2435. break;
  2436. }
  2437. return new Range(startRow, startColumn, row, 0);
  2438. } else {
  2439. while (row -- > 0) {
  2440. line = session.getLine(row);
  2441. if (line[0] == "`" & line.substring(0, 3) == "```")
  2442. break;
  2443. }
  2444. return new Range(row, line.length, startRow, 0);
  2445. }
  2446. }
  2447. var token;
  2448. function isHeading(row) {
  2449. token = session.getTokens(row)[0];
  2450. return token && token.type.lastIndexOf(heading, 0) === 0;
  2451. }
  2452. var heading = "markup.heading";
  2453. function getLevel() {
  2454. var ch = token.value[0];
  2455. if (ch == "=") return 6;
  2456. if (ch == "-") return 5;
  2457. return 7 - token.value.search(/[^#]|$/);
  2458. }
  2459. if (isHeading(row)) {
  2460. var startHeadingLevel = getLevel();
  2461. while (++row < maxRow) {
  2462. if (!isHeading(row))
  2463. continue;
  2464. var level = getLevel();
  2465. if (level >= startHeadingLevel)
  2466. break;
  2467. }
  2468. endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
  2469. if (endRow > startRow) {
  2470. while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
  2471. endRow--;
  2472. }
  2473. if (endRow > startRow) {
  2474. var endColumn = session.getLine(endRow).length;
  2475. return new Range(startRow, startColumn, endRow, endColumn);
  2476. }
  2477. }
  2478. };
  2479. }).call(FoldMode.prototype);
  2480. });
  2481. define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2482. "use strict";
  2483. var oop = require("../lib/oop");
  2484. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2485. var reservedKeywords = exports.reservedKeywords = (
  2486. '!|{|}|case|do|done|elif|else|'+
  2487. 'esac|fi|for|if|in|then|until|while|'+
  2488. '&|;|export|local|read|typeset|unset|'+
  2489. 'elif|select|set|function|declare|readonly'
  2490. );
  2491. var languageConstructs = exports.languageConstructs = (
  2492. '[|]|alias|bg|bind|break|builtin|'+
  2493. 'cd|command|compgen|complete|continue|'+
  2494. 'dirs|disown|echo|enable|eval|exec|'+
  2495. 'exit|fc|fg|getopts|hash|help|history|'+
  2496. 'jobs|kill|let|logout|popd|printf|pushd|'+
  2497. 'pwd|return|set|shift|shopt|source|'+
  2498. 'suspend|test|times|trap|type|ulimit|'+
  2499. 'umask|unalias|wait'
  2500. );
  2501. var ShHighlightRules = function() {
  2502. var keywordMapper = this.createKeywordMapper({
  2503. "keyword": reservedKeywords,
  2504. "support.function.builtin": languageConstructs,
  2505. "invalid.deprecated": "debugger"
  2506. }, "identifier");
  2507. var integer = "(?:(?:[1-9]\\d*)|(?:0))";
  2508. var fraction = "(?:\\.\\d+)";
  2509. var intPart = "(?:\\d+)";
  2510. var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
  2511. var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
  2512. var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
  2513. var fileDescriptor = "(?:&" + intPart + ")";
  2514. var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
  2515. var variable = "(?:" + variableName + "(?==))";
  2516. var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
  2517. var func = "(?:" + variableName + "\\s*\\(\\))";
  2518. this.$rules = {
  2519. "start" : [{
  2520. token : "constant",
  2521. regex : /\\./
  2522. }, {
  2523. token : ["text", "comment"],
  2524. regex : /(^|\s)(#.*)$/
  2525. }, {
  2526. token : "string.start",
  2527. regex : '"',
  2528. push : [{
  2529. token : "constant.language.escape",
  2530. regex : /\\(?:[$`"\\]|$)/
  2531. }, {
  2532. include : "variables"
  2533. }, {
  2534. token : "keyword.operator",
  2535. regex : /`/ // TODO highlight `
  2536. }, {
  2537. token : "string.end",
  2538. regex : '"',
  2539. next: "pop"
  2540. }, {
  2541. defaultToken: "string"
  2542. }]
  2543. }, {
  2544. token : "string",
  2545. regex : "\\$'",
  2546. push : [{
  2547. token : "constant.language.escape",
  2548. regex : /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
  2549. }, {
  2550. token : "string",
  2551. regex : "'",
  2552. next: "pop"
  2553. }, {
  2554. defaultToken: "string"
  2555. }]
  2556. }, {
  2557. regex : "<<<",
  2558. token : "keyword.operator"
  2559. }, {
  2560. stateName: "heredoc",
  2561. regex : "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
  2562. onMatch : function(value, currentState, stack) {
  2563. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  2564. var tokens = value.split(this.splitRegex);
  2565. stack.push(next, tokens[4]);
  2566. return [
  2567. {type:"constant", value: tokens[1]},
  2568. {type:"text", value: tokens[2]},
  2569. {type:"string", value: tokens[3]},
  2570. {type:"support.class", value: tokens[4]},
  2571. {type:"string", value: tokens[5]}
  2572. ];
  2573. },
  2574. rules: {
  2575. heredoc: [{
  2576. onMatch: function(value, currentState, stack) {
  2577. if (value === stack[1]) {
  2578. stack.shift();
  2579. stack.shift();
  2580. this.next = stack[0] || "start";
  2581. return "support.class";
  2582. }
  2583. this.next = "";
  2584. return "string";
  2585. },
  2586. regex: ".*$",
  2587. next: "start"
  2588. }],
  2589. indentedHeredoc: [{
  2590. token: "string",
  2591. regex: "^\t+"
  2592. }, {
  2593. onMatch: function(value, currentState, stack) {
  2594. if (value === stack[1]) {
  2595. stack.shift();
  2596. stack.shift();
  2597. this.next = stack[0] || "start";
  2598. return "support.class";
  2599. }
  2600. this.next = "";
  2601. return "string";
  2602. },
  2603. regex: ".*$",
  2604. next: "start"
  2605. }]
  2606. }
  2607. }, {
  2608. regex : "$",
  2609. token : "empty",
  2610. next : function(currentState, stack) {
  2611. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2612. return stack[0];
  2613. return currentState;
  2614. }
  2615. }, {
  2616. token : ["keyword", "text", "text", "text", "variable"],
  2617. regex : /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/
  2618. }, {
  2619. token : "variable.language",
  2620. regex : builtinVariable
  2621. }, {
  2622. token : "variable",
  2623. regex : variable
  2624. }, {
  2625. include : "variables"
  2626. }, {
  2627. token : "support.function",
  2628. regex : func
  2629. }, {
  2630. token : "support.function",
  2631. regex : fileDescriptor
  2632. }, {
  2633. token : "string", // ' string
  2634. start : "'", end : "'"
  2635. }, {
  2636. token : "constant.numeric", // float
  2637. regex : floatNumber
  2638. }, {
  2639. token : "constant.numeric", // integer
  2640. regex : integer + "\\b"
  2641. }, {
  2642. token : keywordMapper,
  2643. regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
  2644. }, {
  2645. token : "keyword.operator",
  2646. regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"
  2647. }, {
  2648. token : "punctuation.operator",
  2649. regex : ";"
  2650. }, {
  2651. token : "paren.lparen",
  2652. regex : "[\\[\\(\\{]"
  2653. }, {
  2654. token : "paren.rparen",
  2655. regex : "[\\]]"
  2656. }, {
  2657. token : "paren.rparen",
  2658. regex : "[\\)\\}]",
  2659. next : "pop"
  2660. }],
  2661. variables: [{
  2662. token : "variable",
  2663. regex : /(\$)(\w+)/
  2664. }, {
  2665. token : ["variable", "paren.lparen"],
  2666. regex : /(\$)(\()/,
  2667. push : "start"
  2668. }, {
  2669. token : ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"],
  2670. regex : /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
  2671. push : "start"
  2672. }, {
  2673. token : "variable",
  2674. regex : /\$[*@#?\-$!0_]/
  2675. }, {
  2676. token : ["variable", "paren.lparen"],
  2677. regex : /(\$)(\{)/,
  2678. push : "start"
  2679. }]
  2680. };
  2681. this.normalizeRules();
  2682. };
  2683. oop.inherits(ShHighlightRules, TextHighlightRules);
  2684. exports.ShHighlightRules = ShHighlightRules;
  2685. });
  2686. define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle","ace/mode/behaviour/cstyle"], function(require, exports, module) {
  2687. "use strict";
  2688. var oop = require("../lib/oop");
  2689. var TextMode = require("./text").Mode;
  2690. var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
  2691. var Range = require("../range").Range;
  2692. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  2693. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  2694. var Mode = function() {
  2695. this.HighlightRules = ShHighlightRules;
  2696. this.foldingRules = new CStyleFoldMode();
  2697. this.$behaviour = new CstyleBehaviour();
  2698. };
  2699. oop.inherits(Mode, TextMode);
  2700. (function() {
  2701. this.lineCommentStart = "#";
  2702. this.getNextLineIndent = function(state, line, tab) {
  2703. var indent = this.$getIndent(line);
  2704. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2705. var tokens = tokenizedLine.tokens;
  2706. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  2707. return indent;
  2708. }
  2709. if (state == "start") {
  2710. var match = line.match(/^.*[\{\(\[:]\s*$/);
  2711. if (match) {
  2712. indent += tab;
  2713. }
  2714. }
  2715. return indent;
  2716. };
  2717. var outdents = {
  2718. "pass": 1,
  2719. "return": 1,
  2720. "raise": 1,
  2721. "break": 1,
  2722. "continue": 1
  2723. };
  2724. this.checkOutdent = function(state, line, input) {
  2725. if (input !== "\r\n" && input !== "\r" && input !== "\n")
  2726. return false;
  2727. var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
  2728. if (!tokens)
  2729. return false;
  2730. do {
  2731. var last = tokens.pop();
  2732. } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
  2733. if (!last)
  2734. return false;
  2735. return (last.type == "keyword" && outdents[last.value]);
  2736. };
  2737. this.autoOutdent = function(state, doc, row) {
  2738. row += 1;
  2739. var indent = this.$getIndent(doc.getLine(row));
  2740. var tab = doc.getTabString();
  2741. if (indent.slice(-tab.length) == tab)
  2742. doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
  2743. };
  2744. this.$id = "ace/mode/sh";
  2745. }).call(Mode.prototype);
  2746. exports.Mode = Mode;
  2747. });
  2748. define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript","ace/mode/xml","ace/mode/html","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown","ace/mode/javascript","ace/mode/html","ace/mode/sh","ace/mode/sh","ace/mode/xml","ace/mode/css"], function(require, exports, module) {
  2749. "use strict";
  2750. var oop = require("../lib/oop");
  2751. var TextMode = require("./text").Mode;
  2752. var JavaScriptMode = require("./javascript").Mode;
  2753. var XmlMode = require("./xml").Mode;
  2754. var HtmlMode = require("./html").Mode;
  2755. var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  2756. var MarkdownFoldMode = require("./folding/markdown").FoldMode;
  2757. var Mode = function() {
  2758. this.HighlightRules = MarkdownHighlightRules;
  2759. this.createModeDelegates({
  2760. javascript: require("./javascript").Mode,
  2761. html: require("./html").Mode,
  2762. bash: require("./sh").Mode,
  2763. sh: require("./sh").Mode,
  2764. xml: require("./xml").Mode,
  2765. css: require("./css").Mode
  2766. });
  2767. this.foldingRules = new MarkdownFoldMode();
  2768. this.$behaviour = this.$defaultBehaviour;
  2769. };
  2770. oop.inherits(Mode, TextMode);
  2771. (function() {
  2772. this.type = "text";
  2773. this.blockComment = {start: "<!--", end: "-->"};
  2774. this.$quotes = {'"': '"', "`": "`"};
  2775. this.getNextLineIndent = function(state, line, tab) {
  2776. if (state == "listblock") {
  2777. var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
  2778. if (!match)
  2779. return "";
  2780. var marker = match[2];
  2781. if (!marker)
  2782. marker = parseInt(match[3], 10) + 1 + ".";
  2783. return match[1] + marker + match[4];
  2784. } else {
  2785. return this.$getIndent(line);
  2786. }
  2787. };
  2788. this.$id = "ace/mode/markdown";
  2789. }).call(Mode.prototype);
  2790. exports.Mode = Mode;
  2791. });
  2792. (function() {
  2793. window.require(["ace/mode/markdown"], function(m) {
  2794. if (typeof module == "object" && typeof exports == "object" && module) {
  2795. module.exports = m;
  2796. }
  2797. });
  2798. })();