// Docs: // https://docs.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-5.0&tabs=visual-studio // https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-5.0 (function (Prism) { var commentLike = /\/(?![/*])|\/\/.*[\r\n]|\/\*[^*]*(?:\*(?!\/)[^*]*)*\*\//.source; var stringLike = /@(?!")|"(?:[^\r\n\\"]|\\.)*"|@"(?:[^\\"]|""|\\[\s\S])*"(?!")/.source + '|' + /'(?:(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'|(?=[^\\](?!')))/.source; /** * Creates a nested pattern where all occurrences of the string `<>` are replaced with the pattern itself. * * @param {string} pattern * @param {number} depthLog2 * @returns {string} */ function nested(pattern, depthLog2) { for (var i = 0; i < depthLog2; i++) { pattern = pattern.replace(//g, function () { return '(?:' + pattern + ')'; }); } return pattern .replace(//g, '[^\\s\\S]') .replace(//g, '(?:' + stringLike + ')') .replace(//g, '(?:' + commentLike + ')'); } var round = nested(/\((?:[^()'"@/]|||)*\)/.source, 2); var square = nested(/\[(?:[^\[\]'"@/]|||)*\]/.source, 1); var curly = nested(/\{(?:[^{}'"@/]|||)*\}/.source, 2); var angle = nested(/<(?:[^<>'"@/]||)*>/.source, 1); var inlineCs = /@/.source + /(?:await\b\s*)?/.source + '(?:' + /(?!await\b)\w+\b/.source + '|' + round + ')' + '(?:' + /[?!]?\.\w+\b/.source + '|' + '(?:' + angle + ')?' + round + '|' + square + ')*' + /(?![?!\.(\[]|<(?!\/))/.source; // Note about the above bracket patterns: // They all ignore HTML expressions that might be in the C# code. This is a problem because HTML (like strings and // comments) is parsed differently. This is a huge problem because HTML might contain brackets and quotes which // messes up the bracket and string counting implemented by the above patterns. // // This problem is not fixable because 1) HTML expression are highly context sensitive and very difficult to detect // and 2) they require one capturing group at every nested level. See the `tagRegion` pattern to admire the // complexity of an HTML expression. // // To somewhat alleviate the problem a bit, the patterns for characters (e.g. 'a') is very permissive, it also // allows invalid characters to support HTML expressions like this:

That's it!

. var tagAttrInlineCs = /@(?![\w()])/.source + '|' + inlineCs; var tagAttrValue = '(?:' + /"[^"@]*"|'[^'@]*'|[^\s'"@>=]+(?=[\s>])/.source + '|' + '["\'][^"\'@]*(?:(?:' + tagAttrInlineCs + ')[^"\'@]*)+["\']' + ')'; var tagAttrs = /(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*|(?=[\s/>])))+)?/.source.replace(//, tagAttrValue); var tagContent = /(?!\d)[^\s>\/=$<%]+/.source + tagAttrs + /\s*\/?>/.source; var tagRegion = /\B@?/.source + '(?:' + /<([a-zA-Z][\w:]*)/.source + tagAttrs + /\s*>/.source + '(?:' + ( /[^<]/.source + '|' + // all tags that are not the start tag // eslint-disable-next-line regexp/strict /<\/?(?!\1\b)/.source + tagContent + '|' + // nested start tag nested( // eslint-disable-next-line regexp/strict /<\1/.source + tagAttrs + /\s*>/.source + '(?:' + ( /[^<]/.source + '|' + // all tags that are not the start tag // eslint-disable-next-line regexp/strict /<\/?(?!\1\b)/.source + tagContent + '|' + '' ) + ')*' + // eslint-disable-next-line regexp/strict /<\/\1\s*>/.source, 2 ) ) + ')*' + // eslint-disable-next-line regexp/strict /<\/\1\s*>/.source + '|' + /