html.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. 'use strict'
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.37.0(14a92401d7aff24ad84578a4c8b9a701ff533a84)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define('vs/basic-languages/html/html', ['require', 'require'], (require) => {
  9. var moduleExports = (() => {
  10. var u = Object.create
  11. var a = Object.defineProperty
  12. var b = Object.getOwnPropertyDescriptor
  13. var x = Object.getOwnPropertyNames
  14. var y = Object.getPrototypeOf,
  15. g = Object.prototype.hasOwnProperty
  16. var k = ((e) =>
  17. typeof require != 'undefined'
  18. ? require
  19. : typeof Proxy != 'undefined'
  20. ? new Proxy(e, { get: (t, n) => (typeof require != 'undefined' ? require : t)[n] })
  21. : e)(function (e) {
  22. if (typeof require != 'undefined') return require.apply(this, arguments)
  23. throw new Error('Dynamic require of "' + e + '" is not supported')
  24. })
  25. var E = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports),
  26. T = (e, t) => {
  27. for (var n in t) a(e, n, { get: t[n], enumerable: !0 })
  28. },
  29. o = (e, t, n, s) => {
  30. if ((t && typeof t == 'object') || typeof t == 'function')
  31. for (let r of x(t))
  32. !g.call(e, r) &&
  33. r !== n &&
  34. a(e, r, { get: () => t[r], enumerable: !(s = b(t, r)) || s.enumerable })
  35. return e
  36. },
  37. d = (e, t, n) => (o(e, t, 'default'), n && o(n, t, 'default')),
  38. m = (e, t, n) => (
  39. (n = e != null ? u(y(e)) : {}),
  40. o(t || !e || !e.__esModule ? a(n, 'default', { value: e, enumerable: !0 }) : n, e)
  41. ),
  42. w = (e) => o(a({}, '__esModule', { value: !0 }), e)
  43. var l = E((A, p) => {
  44. var h = m(k('vs/editor/editor.api'))
  45. p.exports = h
  46. })
  47. var $ = {}
  48. T($, { conf: () => v, language: () => f })
  49. var i = {}
  50. d(i, m(l()))
  51. var c = [
  52. 'area',
  53. 'base',
  54. 'br',
  55. 'col',
  56. 'embed',
  57. 'hr',
  58. 'img',
  59. 'input',
  60. 'keygen',
  61. 'link',
  62. 'menuitem',
  63. 'meta',
  64. 'param',
  65. 'source',
  66. 'track',
  67. 'wbr',
  68. ],
  69. v = {
  70. wordPattern:
  71. /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
  72. comments: { blockComment: ['<!--', '-->'] },
  73. brackets: [
  74. ['<!--', '-->'],
  75. ['<', '>'],
  76. ['{', '}'],
  77. ['(', ')'],
  78. ],
  79. autoClosingPairs: [
  80. { open: '{', close: '}' },
  81. { open: '[', close: ']' },
  82. { open: '(', close: ')' },
  83. { open: '"', close: '"' },
  84. { open: "'", close: "'" },
  85. ],
  86. surroundingPairs: [
  87. { open: '"', close: '"' },
  88. { open: "'", close: "'" },
  89. { open: '{', close: '}' },
  90. { open: '[', close: ']' },
  91. { open: '(', close: ')' },
  92. { open: '<', close: '>' },
  93. ],
  94. onEnterRules: [
  95. {
  96. beforeText: new RegExp(
  97. `<(?!(?:${c.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,
  98. 'i'
  99. ),
  100. afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>$/i,
  101. action: { indentAction: i.languages.IndentAction.IndentOutdent },
  102. },
  103. {
  104. beforeText: new RegExp(
  105. `<(?!(?:${c.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
  106. 'i'
  107. ),
  108. action: { indentAction: i.languages.IndentAction.Indent },
  109. },
  110. ],
  111. folding: {
  112. markers: {
  113. start: new RegExp('^\\s*<!--\\s*#region\\b.*-->'),
  114. end: new RegExp('^\\s*<!--\\s*#endregion\\b.*-->'),
  115. },
  116. },
  117. },
  118. f = {
  119. defaultToken: '',
  120. tokenPostfix: '.html',
  121. ignoreCase: !0,
  122. tokenizer: {
  123. root: [
  124. [/<!DOCTYPE/, 'metatag', '@doctype'],
  125. [/<!--/, 'comment', '@comment'],
  126. [/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, ['delimiter', 'tag', '', 'delimiter']],
  127. [/(<)(script)/, ['delimiter', { token: 'tag', next: '@script' }]],
  128. [/(<)(style)/, ['delimiter', { token: 'tag', next: '@style' }]],
  129. [/(<)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
  130. [/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
  131. [/</, 'delimiter'],
  132. [/[^<]+/],
  133. ],
  134. doctype: [
  135. [/[^>]+/, 'metatag.content'],
  136. [/>/, 'metatag', '@pop'],
  137. ],
  138. comment: [
  139. [/-->/, 'comment', '@pop'],
  140. [/[^-]+/, 'comment.content'],
  141. [/./, 'comment.content'],
  142. ],
  143. otherTag: [
  144. [/\/?>/, 'delimiter', '@pop'],
  145. [/"([^"]*)"/, 'attribute.value'],
  146. [/'([^']*)'/, 'attribute.value'],
  147. [/[\w\-]+/, 'attribute.name'],
  148. [/=/, 'delimiter'],
  149. [/[ \t\r\n]+/],
  150. ],
  151. script: [
  152. [/type/, 'attribute.name', '@scriptAfterType'],
  153. [/"([^"]*)"/, 'attribute.value'],
  154. [/'([^']*)'/, 'attribute.value'],
  155. [/[\w\-]+/, 'attribute.name'],
  156. [/=/, 'delimiter'],
  157. [/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
  158. [/[ \t\r\n]+/],
  159. [/(<\/)(script\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]],
  160. ],
  161. scriptAfterType: [
  162. [/=/, 'delimiter', '@scriptAfterTypeEquals'],
  163. [/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
  164. [/[ \t\r\n]+/],
  165. [/<\/script\s*>/, { token: '@rematch', next: '@pop' }],
  166. ],
  167. scriptAfterTypeEquals: [
  168. [
  169. /"module"/,
  170. { token: 'attribute.value', switchTo: '@scriptWithCustomType.text/javascript' },
  171. ],
  172. [
  173. /'module'/,
  174. { token: 'attribute.value', switchTo: '@scriptWithCustomType.text/javascript' },
  175. ],
  176. [/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
  177. [/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
  178. [/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
  179. [/[ \t\r\n]+/],
  180. [/<\/script\s*>/, { token: '@rematch', next: '@pop' }],
  181. ],
  182. scriptWithCustomType: [
  183. [/>/, { token: 'delimiter', next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
  184. [/"([^"]*)"/, 'attribute.value'],
  185. [/'([^']*)'/, 'attribute.value'],
  186. [/[\w\-]+/, 'attribute.name'],
  187. [/=/, 'delimiter'],
  188. [/[ \t\r\n]+/],
  189. [/<\/script\s*>/, { token: '@rematch', next: '@pop' }],
  190. ],
  191. scriptEmbedded: [
  192. [/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
  193. [/[^<]+/, ''],
  194. ],
  195. style: [
  196. [/type/, 'attribute.name', '@styleAfterType'],
  197. [/"([^"]*)"/, 'attribute.value'],
  198. [/'([^']*)'/, 'attribute.value'],
  199. [/[\w\-]+/, 'attribute.name'],
  200. [/=/, 'delimiter'],
  201. [/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }],
  202. [/[ \t\r\n]+/],
  203. [/(<\/)(style\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]],
  204. ],
  205. styleAfterType: [
  206. [/=/, 'delimiter', '@styleAfterTypeEquals'],
  207. [/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }],
  208. [/[ \t\r\n]+/],
  209. [/<\/style\s*>/, { token: '@rematch', next: '@pop' }],
  210. ],
  211. styleAfterTypeEquals: [
  212. [/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
  213. [/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
  214. [/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }],
  215. [/[ \t\r\n]+/],
  216. [/<\/style\s*>/, { token: '@rematch', next: '@pop' }],
  217. ],
  218. styleWithCustomType: [
  219. [/>/, { token: 'delimiter', next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
  220. [/"([^"]*)"/, 'attribute.value'],
  221. [/'([^']*)'/, 'attribute.value'],
  222. [/[\w\-]+/, 'attribute.name'],
  223. [/=/, 'delimiter'],
  224. [/[ \t\r\n]+/],
  225. [/<\/style\s*>/, { token: '@rematch', next: '@pop' }],
  226. ],
  227. styleEmbedded: [
  228. [/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
  229. [/[^<]+/, ''],
  230. ],
  231. },
  232. }
  233. return w($)
  234. })()
  235. return moduleExports
  236. })