Skip to content

Commit 4433ccf

Browse files
authoredSep 15, 2021
Added support for ASP.NET Razor (#3064)
1 parent 6a356d2 commit 4433ccf

13 files changed

+1844
-3
lines changed
 

‎components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components.json

+12
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,18 @@
10861086
"alias": "rkt",
10871087
"owner": "RunDevelopment"
10881088
},
1089+
"cshtml": {
1090+
"title": "Razor C#",
1091+
"alias": "razor",
1092+
"require": ["markup", "csharp"],
1093+
"optional":[
1094+
"css",
1095+
"css-extras",
1096+
"javascript",
1097+
"js-extras"
1098+
],
1099+
"owner": "RunDevelopment"
1100+
},
10891101
"jsx": {
10901102
"title": "React JSX",
10911103
"require": ["markup", "javascript"],

‎components/prism-cshtml.js

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
// Docs:
2+
// https://docs.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-5.0&tabs=visual-studio
3+
// https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-5.0
4+
5+
(function (Prism) {
6+
7+
var commentLike = /\/(?![/*])|\/\/.*[\r\n]|\/\*[^*]*(?:\*(?!\/)[^*]*)*\*\//.source;
8+
var stringLike =
9+
/@(?!")|"(?:[^\r\n\\"]|\\.)*"|@"(?:[^\\"]|""|\\[\s\S])*"(?!")/.source +
10+
'|' +
11+
/'(?:(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'|(?=[^\\](?!')))/.source;
12+
13+
/**
14+
* Creates a nested pattern where all occurrences of the string `<<self>>` are replaced with the pattern itself.
15+
*
16+
* @param {string} pattern
17+
* @param {number} depthLog2
18+
* @returns {string}
19+
*/
20+
function nested(pattern, depthLog2) {
21+
for (var i = 0; i < depthLog2; i++) {
22+
pattern = pattern.replace(/<self>/g, function () { return '(?:' + pattern + ')'; });
23+
}
24+
return pattern
25+
.replace(/<self>/g, '[^\\s\\S]')
26+
.replace(/<str>/g, '(?:' + stringLike + ')')
27+
.replace(/<comment>/g, '(?:' + commentLike + ')');
28+
}
29+
30+
var round = nested(/\((?:[^()'"@/]|<str>|<comment>|<self>)*\)/.source, 2);
31+
var square = nested(/\[(?:[^\[\]'"@/]|<str>|<comment>|<self>)*\]/.source, 2);
32+
var curly = nested(/\{(?:[^{}'"@/]|<str>|<comment>|<self>)*\}/.source, 2);
33+
var angle = nested(/<(?:[^<>'"@/]|<str>|<comment>|<self>)*>/.source, 2);
34+
35+
// Note about the above bracket patterns:
36+
// They all ignore HTML expressions that might be in the C# code. This is a problem because HTML (like strings and
37+
// comments) is parsed differently. This is a huge problem because HTML might contain brackets and quotes which
38+
// messes up the bracket and string counting implemented by the above patterns.
39+
//
40+
// This problem is not fixable because 1) HTML expression are highly context sensitive and very difficult to detect
41+
// and 2) they require one capturing group at every nested level. See the `tagRegion` pattern to admire the
42+
// complexity of an HTML expression.
43+
//
44+
// To somewhat alleviate the problem a bit, the patterns for characters (e.g. 'a') is very permissive, it also
45+
// allows invalid characters to support HTML expressions like this: <p>That's it!</p>.
46+
47+
var tagAttrs = /(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?/.source;
48+
var tagContent = /(?!\d)[^\s>\/=$<%]+/.source + tagAttrs + /\s*\/?>/.source;
49+
var tagRegion =
50+
/\B@?/.source +
51+
'(?:' +
52+
/<([a-zA-Z][\w:]*)/.source + tagAttrs + /\s*>/.source +
53+
'(?:' +
54+
(
55+
/[^<]/.source +
56+
'|' +
57+
// all tags that are not the start tag
58+
// eslint-disable-next-line regexp/strict
59+
/<\/?(?!\1\b)/.source + tagContent +
60+
'|' +
61+
// nested start tag
62+
nested(
63+
// eslint-disable-next-line regexp/strict
64+
/<\1/.source + tagAttrs + /\s*>/.source +
65+
'(?:' +
66+
(
67+
/[^<]/.source +
68+
'|' +
69+
// all tags that are not the start tag
70+
// eslint-disable-next-line regexp/strict
71+
/<\/?(?!\1\b)/.source + tagContent +
72+
'|' +
73+
'<self>'
74+
) +
75+
')*' +
76+
// eslint-disable-next-line regexp/strict
77+
/<\/\1\s*>/.source,
78+
2
79+
)
80+
) +
81+
')*' +
82+
// eslint-disable-next-line regexp/strict
83+
/<\/\1\s*>/.source +
84+
'|' +
85+
/</.source + tagContent +
86+
')';
87+
88+
// Now for the actual language definition(s):
89+
//
90+
// Razor as a language has 2 parts:
91+
// 1) CSHTML: A markup-like language that has been extended with inline C# code expressions and blocks.
92+
// 2) C#+HTML: A variant of C# that can contain CSHTML tags as expressions.
93+
//
94+
// In the below code, both CSHTML and C#+HTML will be create as separate language definitions that reference each
95+
// other. However, only CSHTML will be exported via `Prism.languages`.
96+
97+
Prism.languages.cshtml = Prism.languages.extend('markup', {});
98+
99+
var csharpWithHtml = Prism.languages.insertBefore('csharp', 'string', {
100+
'html': {
101+
pattern: RegExp(tagRegion),
102+
greedy: true,
103+
inside: Prism.languages.cshtml
104+
},
105+
}, { csharp: Prism.languages.extend('csharp', {}) });
106+
107+
var cs = {
108+
pattern: /\S[\s\S]*/,
109+
alias: 'language-csharp',
110+
inside: csharpWithHtml
111+
};
112+
113+
Prism.languages.insertBefore('cshtml', 'prolog', {
114+
'razor-comment': {
115+
pattern: /@\*[\s\S]*?\*@/,
116+
greedy: true,
117+
alias: 'comment'
118+
},
119+
120+
'block': {
121+
pattern: RegExp(
122+
/(^|[^@])@/.source +
123+
'(?:' +
124+
[
125+
// @{ ... }
126+
curly,
127+
// @code{ ... }
128+
/(?:code|functions)\s*/.source + curly,
129+
// @for (...) { ... }
130+
/(?:for|foreach|lock|switch|using|while)\s*/.source + round + /\s*/.source + curly,
131+
// @do { ... } while (...);
132+
/do\s*/.source + curly + /\s*while\s*/.source + round + /(?:\s*;)?/.source,
133+
// @try { ... } catch (...) { ... } finally { ... }
134+
/try\s*/.source + curly + /\s*catch\s*/.source + round + /\s*/.source + curly + /\s*finally\s*/.source + curly,
135+
// @if (...) {...} else if (...) {...} else {...}
136+
/if\s*/.source + round + /\s*/.source + curly + '(?:' + /\s*else/.source + '(?:' + /\s+if\s*/.source + round + ')?' + /\s*/.source + curly + ')*',
137+
].join('|') +
138+
')'
139+
),
140+
lookbehind: true,
141+
greedy: true,
142+
inside: {
143+
'keyword': /^@\w*/,
144+
'csharp': cs
145+
}
146+
},
147+
148+
'directive': {
149+
pattern: /^([ \t]*)@(?:addTagHelper|attribute|implements|inherits|inject|layout|model|namespace|page|preservewhitespace|removeTagHelper|section|tagHelperPrefix|using)(?=\s).*/m,
150+
lookbehind: true,
151+
greedy: true,
152+
inside: {
153+
'keyword': /^@\w+/,
154+
'csharp': cs
155+
}
156+
},
157+
158+
'value': {
159+
pattern: RegExp(
160+
/(^|[^@])@/.source +
161+
/(?:await\b\s*)?/.source +
162+
'(?:' + /\w+\b/.source + '|' + round + ')' +
163+
'(?:' + /[?!]?\.\w+\b/.source + '|' + round + '|' + square + '|' + angle + round + ')*'
164+
),
165+
lookbehind: true,
166+
greedy: true,
167+
alias: 'variable',
168+
inside: {
169+
'keyword': /^@/,
170+
'csharp': cs
171+
}
172+
},
173+
174+
'delegate-operator': {
175+
pattern: /(^|[^@])@(?=<)/,
176+
lookbehind: true,
177+
alias: 'operator'
178+
}
179+
});
180+
181+
Prism.languages.razor = Prism.languages.cshtml;
182+
183+
}(Prism));

‎components/prism-cshtml.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎examples/prism-cshtml.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<h2>Full example</h2>
2+
<pre><code>@* Source: https://docs.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-5.0&amp;tabs=visual-studio#the-home-page *@
3+
4+
@page
5+
@model RazorPagesContacts.Pages.Customers.IndexModel
6+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
7+
8+
&lt;h1>Contacts home page&lt;/h1>
9+
&lt;form method="post">
10+
&lt;table class="table">
11+
&lt;thead>
12+
&lt;tr>
13+
&lt;th>ID&lt;/th>
14+
&lt;th>Name&lt;/th>
15+
&lt;th>&lt;/th>
16+
&lt;/tr>
17+
&lt;/thead>
18+
&lt;tbody>
19+
@foreach (var contact in Model.Customer)
20+
{
21+
&lt;tr>
22+
&lt;td> @contact.Id &lt;/td>
23+
&lt;td>@contact.Name&lt;/td>
24+
&lt;td>
25+
&lt;a asp-page="./Edit" asp-route-id="@contact.Id">Edit&lt;/a> |
26+
&lt;button type="submit" asp-page-handler="delete"
27+
asp-route-id="@contact.Id">delete
28+
&lt;/button>
29+
&lt;/td>
30+
&lt;/tr>
31+
}
32+
&lt;/tbody>
33+
&lt;/table>
34+
&lt;a asp-page="Create">Create New&lt;/a>
35+
&lt;/form>
36+
</code></pre>

‎plugins/autoloader/prism-autoloader.js

+5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
"qml": "javascript",
116116
"qore": "clike",
117117
"racket": "scheme",
118+
"cshtml": [
119+
"markup",
120+
"csharp"
121+
],
118122
"jsx": [
119123
"markup",
120124
"javascript"
@@ -224,6 +228,7 @@
224228
"py": "python",
225229
"qs": "qsharp",
226230
"rkt": "racket",
231+
"razor": "cshtml",
227232
"rpy": "renpy",
228233
"robot": "robotframework",
229234
"rb": "ruby",

‎plugins/autoloader/prism-autoloader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎plugins/show-language/prism-show-language.js

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@
190190
"q": "Q (kdb+ database)",
191191
"qml": "QML",
192192
"rkt": "Racket",
193+
"cshtml": "Razor C#",
194+
"razor": "Razor C#",
193195
"jsx": "React JSX",
194196
"tsx": "React TSX",
195197
"renpy": "Ren'py",

‎plugins/show-language/prism-show-language.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/languages/cshtml/block_feature.test

+899
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
@{
2+
var quote = "The future depends on what you do today. - Mahatma Gandhi";
3+
}
4+
5+
<p>@quote</p>
6+
7+
@{
8+
quote = "Hate cannot drive out hate, only love can do that. - Martin Luther King, Jr.";
9+
}
10+
11+
<p>@quote</p>
12+
13+
@{
14+
void RenderName(string name)
15+
{
16+
<p>Name: <strong>@name</strong></p>
17+
}
18+
19+
RenderName("Mahatma Gandhi");
20+
RenderName("Martin Luther King, Jr.");
21+
}
22+
23+
@{
24+
var inCSharp = true;
25+
<p>Now in HTML, was in C# @inCSharp</p>
26+
}
27+
28+
@{
29+
Func<dynamic, object> petTemplate = @<p>You have a pet named <strong>@item.Name</strong>.</p>;
30+
31+
var pets = new List<Pet>
32+
{
33+
new Pet { Name = "Rin Tin Tin" },
34+
new Pet { Name = "Mr. Bigglesworth" },
35+
new Pet { Name = "K-9" }
36+
};
37+
}
38+
39+
----------------------------------------------------
40+
41+
[
42+
["block", [
43+
["keyword", "@"],
44+
["csharp", [
45+
["punctuation", "{"],
46+
47+
["class-name", [
48+
["keyword", "var"]
49+
]],
50+
" quote ",
51+
["operator", "="],
52+
["string", "\"The future depends on what you do today. - Mahatma Gandhi\""],
53+
["punctuation", ";"],
54+
55+
["punctuation", "}"]
56+
]]
57+
]],
58+
59+
["tag", [
60+
["tag", [
61+
["punctuation", "<"],
62+
"p"
63+
]],
64+
["punctuation", ">"]
65+
]],
66+
["value", [
67+
["keyword", "@"],
68+
["csharp", ["quote"]]
69+
]],
70+
["tag", [
71+
["tag", [
72+
["punctuation", "</"],
73+
"p"
74+
]],
75+
["punctuation", ">"]
76+
]],
77+
78+
["block", [
79+
["keyword", "@"],
80+
["csharp", [
81+
["punctuation", "{"],
82+
83+
"\r\n quote ",
84+
["operator", "="],
85+
["string", "\"Hate cannot drive out hate, only love can do that. - Martin Luther King, Jr.\""],
86+
["punctuation", ";"],
87+
88+
["punctuation", "}"]
89+
]]
90+
]],
91+
92+
["tag", [
93+
["tag", [
94+
["punctuation", "<"],
95+
"p"
96+
]],
97+
["punctuation", ">"]
98+
]],
99+
["value", [
100+
["keyword", "@"],
101+
["csharp", ["quote"]]
102+
]],
103+
["tag", [
104+
["tag", [
105+
["punctuation", "</"],
106+
"p"
107+
]],
108+
["punctuation", ">"]
109+
]],
110+
111+
["block", [
112+
["keyword", "@"],
113+
["csharp", [
114+
["punctuation", "{"],
115+
116+
["return-type", [
117+
["keyword", "void"]
118+
]],
119+
["function", "RenderName"],
120+
["punctuation", "("],
121+
["class-name", [
122+
["keyword", "string"]
123+
]],
124+
" name",
125+
["punctuation", ")"],
126+
127+
["punctuation", "{"],
128+
129+
["html", [
130+
["tag", [
131+
["tag", [
132+
["punctuation", "<"],
133+
"p"
134+
]],
135+
["punctuation", ">"]
136+
]],
137+
"Name: ",
138+
["tag", [
139+
["tag", [
140+
["punctuation", "<"],
141+
"strong"
142+
]],
143+
["punctuation", ">"]
144+
]],
145+
["value", [
146+
["keyword", "@"],
147+
["csharp", ["name"]]
148+
]],
149+
["tag", [
150+
["tag", [
151+
["punctuation", "</"],
152+
"strong"
153+
]],
154+
["punctuation", ">"]
155+
]],
156+
["tag", [
157+
["tag", [
158+
["punctuation", "</"],
159+
"p"
160+
]],
161+
["punctuation", ">"]
162+
]]
163+
]],
164+
165+
["punctuation", "}"],
166+
167+
["function", "RenderName"],
168+
["punctuation", "("],
169+
["string", "\"Mahatma Gandhi\""],
170+
["punctuation", ")"],
171+
["punctuation", ";"],
172+
173+
["function", "RenderName"],
174+
["punctuation", "("],
175+
["string", "\"Martin Luther King, Jr.\""],
176+
["punctuation", ")"],
177+
["punctuation", ";"],
178+
179+
["punctuation", "}"]
180+
]]
181+
]],
182+
183+
["block", [
184+
["keyword", "@"],
185+
["csharp", [
186+
["punctuation", "{"],
187+
188+
["class-name", [
189+
["keyword", "var"]
190+
]],
191+
" inCSharp ",
192+
["operator", "="],
193+
["boolean", "true"],
194+
["punctuation", ";"],
195+
196+
["html", [
197+
["tag", [
198+
["tag", [
199+
["punctuation", "<"],
200+
"p"
201+
]],
202+
["punctuation", ">"]
203+
]],
204+
"Now in HTML, was in C# ",
205+
["value", [
206+
["keyword", "@"],
207+
["csharp", ["inCSharp"]]
208+
]],
209+
["tag", [
210+
["tag", [
211+
["punctuation", "</"],
212+
"p"
213+
]],
214+
["punctuation", ">"]
215+
]]
216+
]],
217+
218+
["punctuation", "}"]
219+
]]
220+
]],
221+
222+
["block", [
223+
["keyword", "@"],
224+
["csharp", [
225+
["punctuation", "{"],
226+
227+
["class-name", [
228+
"Func",
229+
["punctuation", "<"],
230+
["keyword", "dynamic"],
231+
["punctuation", ","],
232+
["keyword", "object"],
233+
["punctuation", ">"]
234+
]],
235+
" petTemplate ",
236+
["operator", "="],
237+
["html", [
238+
["delegate-operator", "@"],
239+
["tag", [
240+
["tag", [
241+
["punctuation", "<"],
242+
"p"
243+
]],
244+
["punctuation", ">"]
245+
]],
246+
"You have a pet named ",
247+
["tag", [
248+
["tag", [
249+
["punctuation", "<"],
250+
"strong"
251+
]],
252+
["punctuation", ">"]
253+
]],
254+
["value", [
255+
["keyword", "@"],
256+
["csharp", [
257+
"item",
258+
["punctuation", "."],
259+
"Name"
260+
]]
261+
]],
262+
["tag", [
263+
["tag", [
264+
["punctuation", "</"],
265+
"strong"
266+
]],
267+
["punctuation", ">"]
268+
]],
269+
".",
270+
["tag", [
271+
["tag", [
272+
["punctuation", "</"],
273+
"p"
274+
]],
275+
["punctuation", ">"]
276+
]]
277+
]],
278+
["punctuation", ";"],
279+
280+
["class-name", [
281+
["keyword", "var"]
282+
]],
283+
" pets ",
284+
["operator", "="],
285+
["keyword", "new"],
286+
["constructor-invocation", [
287+
"List",
288+
["punctuation", "<"],
289+
"Pet",
290+
["punctuation", ">"]
291+
]],
292+
293+
["punctuation", "{"],
294+
295+
["keyword", "new"],
296+
["constructor-invocation", ["Pet"]],
297+
["punctuation", "{"],
298+
" Name ",
299+
["operator", "="],
300+
["string", "\"Rin Tin Tin\""],
301+
["punctuation", "}"],
302+
["punctuation", ","],
303+
304+
["keyword", "new"],
305+
["constructor-invocation", ["Pet"]],
306+
["punctuation", "{"],
307+
" Name ",
308+
["operator", "="],
309+
["string", "\"Mr. Bigglesworth\""],
310+
["punctuation", "}"],
311+
["punctuation", ","],
312+
313+
["keyword", "new"],
314+
["constructor-invocation", ["Pet"]],
315+
["punctuation", "{"],
316+
" Name ",
317+
["operator", "="],
318+
["string", "\"K-9\""],
319+
["punctuation", "}"],
320+
321+
["punctuation", "}"],
322+
["punctuation", ";"],
323+
324+
["punctuation", "}"]
325+
]]
326+
]]
327+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@{
2+
/* C# comment */
3+
// Another C# comment
4+
}
5+
<!-- HTML comment -->
6+
7+
@*
8+
@{
9+
/* C# comment */
10+
// Another C# comment
11+
}
12+
<!-- HTML comment -->
13+
*@
14+
15+
----------------------------------------------------
16+
17+
[
18+
["block", [
19+
["keyword", "@"],
20+
["csharp", [
21+
["punctuation", "{"],
22+
["comment", "/* C# comment */"],
23+
["comment", "// Another C# comment"],
24+
["punctuation", "}"]
25+
]]
26+
]],
27+
["comment", "<!-- HTML comment -->"],
28+
29+
["razor-comment", "@*\r\n @{\r\n /* C# comment */\r\n // Another C# comment\r\n }\r\n <!-- HTML comment -->\r\n*@"]
30+
]
+346
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,346 @@
1+
<p>@@Username</p>
2+
<p>@Username</p>
3+
4+
<p>@DateTime.Now</p>
5+
<p>@DateTime.IsLeapYear(2016)</p>
6+
7+
<p>@await DoSomething("hello", "world")</p>
8+
9+
<p>@GenericMethod<int>()</p>
10+
11+
<p>Last week this time: @(DateTime.Now - TimeSpan.FromDays(7))</p>
12+
<p>Last week: @DateTime.Now - TimeSpan.FromDays(7)</p>
13+
<p>Last week: 7/7/2016 4:39:52 PM - TimeSpan.FromDays(7)</p>
14+
15+
@{
16+
var joe = new Person("Joe", 33);
17+
}
18+
19+
<p>Age@(joe.Age)</p>
20+
21+
<p>@(GenericMethod<int>())</p>
22+
23+
@("<span>Hello World</span>")
24+
25+
@Html.Raw("<span>Hello World</span>")
26+
27+
----------------------------------------------------
28+
29+
[
30+
["tag", [
31+
["tag", [
32+
["punctuation", "<"],
33+
"p"
34+
]],
35+
["punctuation", ">"]
36+
]],
37+
"@@Username",
38+
["tag", [
39+
["tag", [
40+
["punctuation", "</"],
41+
"p"
42+
]],
43+
["punctuation", ">"]
44+
]],
45+
46+
["tag", [
47+
["tag", [
48+
["punctuation", "<"],
49+
"p"
50+
]],
51+
["punctuation", ">"]
52+
]],
53+
["value", [
54+
["keyword", "@"],
55+
["csharp", ["Username"]]
56+
]],
57+
["tag", [
58+
["tag", [
59+
["punctuation", "</"],
60+
"p"
61+
]],
62+
["punctuation", ">"]
63+
]],
64+
65+
["tag", [
66+
["tag", [
67+
["punctuation", "<"],
68+
"p"
69+
]],
70+
["punctuation", ">"]
71+
]],
72+
["value", [
73+
["keyword", "@"],
74+
["csharp", [
75+
"DateTime",
76+
["punctuation", "."],
77+
"Now"
78+
]]
79+
]],
80+
["tag", [
81+
["tag", [
82+
["punctuation", "</"],
83+
"p"
84+
]],
85+
["punctuation", ">"]
86+
]],
87+
88+
["tag", [
89+
["tag", [
90+
["punctuation", "<"],
91+
"p"
92+
]],
93+
["punctuation", ">"]
94+
]],
95+
["value", [
96+
["keyword", "@"],
97+
["csharp", [
98+
"DateTime",
99+
["punctuation", "."],
100+
["function", "IsLeapYear"],
101+
["punctuation", "("],
102+
["number", "2016"],
103+
["punctuation", ")"]
104+
]]
105+
]],
106+
["tag", [
107+
["tag", [
108+
["punctuation", "</"],
109+
"p"
110+
]],
111+
["punctuation", ">"]
112+
]],
113+
114+
["tag", [
115+
["tag", [
116+
["punctuation", "<"],
117+
"p"
118+
]],
119+
["punctuation", ">"]
120+
]],
121+
["value", [
122+
["keyword", "@"],
123+
["csharp", [
124+
["keyword", "await"],
125+
["function", "DoSomething"],
126+
["punctuation", "("],
127+
["string", "\"hello\""],
128+
["punctuation", ","],
129+
["string", "\"world\""],
130+
["punctuation", ")"]
131+
]]
132+
]],
133+
["tag", [
134+
["tag", [
135+
["punctuation", "</"],
136+
"p"
137+
]],
138+
["punctuation", ">"]
139+
]],
140+
141+
["tag", [
142+
["tag", [
143+
["punctuation", "<"],
144+
"p"
145+
]],
146+
["punctuation", ">"]
147+
]],
148+
["value", [
149+
["keyword", "@"],
150+
["csharp", [
151+
["generic-method", [
152+
["function", "GenericMethod"],
153+
["generic", [
154+
["punctuation", "<"],
155+
["keyword", "int"],
156+
["punctuation", ">"]
157+
]]
158+
]],
159+
["punctuation", "("],
160+
["punctuation", ")"]
161+
]]
162+
]],
163+
["tag", [
164+
["tag", [
165+
["punctuation", "</"],
166+
"p"
167+
]],
168+
["punctuation", ">"]
169+
]],
170+
171+
["tag", [
172+
["tag", [
173+
["punctuation", "<"],
174+
"p"
175+
]],
176+
["punctuation", ">"]
177+
]],
178+
"Last week this time: ",
179+
["value", [
180+
["keyword", "@"],
181+
["csharp", [
182+
["punctuation", "("],
183+
"DateTime",
184+
["punctuation", "."],
185+
"Now ",
186+
["operator", "-"],
187+
" TimeSpan",
188+
["punctuation", "."],
189+
["function", "FromDays"],
190+
["punctuation", "("],
191+
["number", "7"],
192+
["punctuation", ")"],
193+
["punctuation", ")"]
194+
]]
195+
]],
196+
["tag", [
197+
["tag", [
198+
["punctuation", "</"],
199+
"p"
200+
]],
201+
["punctuation", ">"]
202+
]],
203+
204+
["tag", [
205+
["tag", [
206+
["punctuation", "<"],
207+
"p"
208+
]],
209+
["punctuation", ">"]
210+
]],
211+
"Last week: ",
212+
["value", [
213+
["keyword", "@"],
214+
["csharp", [
215+
"DateTime",
216+
["punctuation", "."],
217+
"Now"
218+
]]
219+
]],
220+
" - TimeSpan.FromDays(7)",
221+
["tag", [
222+
["tag", [
223+
["punctuation", "</"],
224+
"p"
225+
]],
226+
["punctuation", ">"]
227+
]],
228+
229+
["tag", [
230+
["tag", [
231+
["punctuation", "<"],
232+
"p"
233+
]],
234+
["punctuation", ">"]
235+
]],
236+
"Last week: 7/7/2016 4:39:52 PM - TimeSpan.FromDays(7)",
237+
["tag", [
238+
["tag", [
239+
["punctuation", "</"],
240+
"p"
241+
]],
242+
["punctuation", ">"]
243+
]],
244+
245+
["block", [
246+
["keyword", "@"],
247+
["csharp", [
248+
["punctuation", "{"],
249+
250+
["class-name", [
251+
["keyword", "var"]
252+
]],
253+
" joe ",
254+
["operator", "="],
255+
["keyword", "new"],
256+
["constructor-invocation", ["Person"]],
257+
["punctuation", "("],
258+
["string", "\"Joe\""],
259+
["punctuation", ","],
260+
["number", "33"],
261+
["punctuation", ")"],
262+
["punctuation", ";"],
263+
264+
["punctuation", "}"]
265+
]]
266+
]],
267+
268+
["tag", [
269+
["tag", [
270+
["punctuation", "<"],
271+
"p"
272+
]],
273+
["punctuation", ">"]
274+
]],
275+
"Age",
276+
["value", [
277+
["keyword", "@"],
278+
["csharp", [
279+
["punctuation", "("],
280+
"joe",
281+
["punctuation", "."],
282+
"Age",
283+
["punctuation", ")"]
284+
]]
285+
]],
286+
["tag", [
287+
["tag", [
288+
["punctuation", "</"],
289+
"p"
290+
]],
291+
["punctuation", ">"]
292+
]],
293+
294+
["tag", [
295+
["tag", [
296+
["punctuation", "<"],
297+
"p"
298+
]],
299+
["punctuation", ">"]
300+
]],
301+
["value", [
302+
["keyword", "@"],
303+
["csharp", [
304+
["punctuation", "("],
305+
["generic-method", [
306+
["function", "GenericMethod"],
307+
["generic", [
308+
["punctuation", "<"],
309+
["keyword", "int"],
310+
["punctuation", ">"]
311+
]]
312+
]],
313+
["punctuation", "("],
314+
["punctuation", ")"],
315+
["punctuation", ")"]
316+
]]
317+
]],
318+
["tag", [
319+
["tag", [
320+
["punctuation", "</"],
321+
"p"
322+
]],
323+
["punctuation", ">"]
324+
]],
325+
326+
["value", [
327+
["keyword", "@"],
328+
["csharp", [
329+
["punctuation", "("],
330+
["string", "\"<span>Hello World</span>\""],
331+
["punctuation", ")"]
332+
]]
333+
]],
334+
335+
["value", [
336+
["keyword", "@"],
337+
["csharp", [
338+
"Html",
339+
["punctuation", "."],
340+
["function", "Raw"],
341+
["punctuation", "("],
342+
["string", "\"<span>Hello World</span>\""],
343+
["punctuation", ")"]
344+
]]
345+
]]
346+
]

0 commit comments

Comments
 (0)
Please sign in to comment.