@@ -71,31 +71,35 @@ private struct UserView: HTML {
71
71
name: " Erik Bautista Santibanez " ,
72
72
role: " Mobile & Web Developer " ,
73
73
home: " \( residency ?? . default) " \
74
- \( currentLocation. flatMap { " , \n location: \" Currently in \( $0) \" " } ?? " " ) ,
75
- about: \" \" \"
76
- \( Self . aboutDescription)
77
- \" \" \"
74
+ \( currentLocation. flatMap { " , \n location: \" Currently in \( $0) \" " } ?? " " )
78
75
)
76
+
77
+ > print(user.about())
78
+ // \( Self . aboutDescription)
79
79
"""
80
80
case . typescript:
81
81
"""
82
- const user = {
82
+ const user: User = {
83
83
name: " Erik Bautista Santibanez " ,
84
84
role: " Mobile & Web Developer " ,
85
85
home: " \( residency ?? . default) " \
86
- \( currentLocation. flatMap { " , \n location: \" Currently in \( $0) \" " } ?? " " ) ,
87
- about: ` \( Self . aboutDescription) `
86
+ \( currentLocation. flatMap { " , \n location: \" Currently in \( $0) \" " } ?? " " )
88
87
};
88
+
89
+ > console.log(user.about());
90
+ // \( Self . aboutDescription)
89
91
"""
90
92
case . rust:
91
93
"""
92
94
let user = User {
93
95
name: " Erik Bautista Santibanez " ,
94
96
role: " Mobile & Web Developer " ,
95
97
home: " \( residency ?? . default) " \
96
- \( currentLocation. flatMap { " , \n location: \" Currently in \( $0) \" " } ?? " " ) ,
97
- about: " \( Self . aboutDescription) "
98
+ \( currentLocation. flatMap { " , \n location: \" Currently in \( $0) \" " } ?? " " )
98
99
};
100
+
101
+ > println!( " {} " , user.about());
102
+ // \( Self . aboutDescription)
99
103
"""
100
104
case . none:
101
105
h1 ( . aria. label ( " Name " ) ) {
@@ -280,14 +284,15 @@ private struct PostsView: HTML {
280
284
}
281
285
} content: {
282
286
for (num, post) in Post . allCases. enumerated ( ) . reversed ( ) {
283
- PostView ( number: num, post: post)
287
+ PostView ( number: num, post: post, selected : selected )
284
288
}
285
289
}
286
290
}
287
291
288
292
struct PostView : HTML {
289
293
let number : Int
290
294
let post : Post
295
+ let selected : Vue . Expression < CodeLang ? >
291
296
292
297
var body : some HTML {
293
298
article (
@@ -305,8 +310,13 @@ private struct PostsView: HTML {
305
310
306
311
pre {
307
312
a ( . href( " # \( self . post. slug) " ) ) {
308
- code ( . class( " hljs language-swift " ) ) {
309
- " logs[ \( self . number) ] "
313
+ CodeLang . conditionalCases ( initial: selected) { lang in
314
+ code ( . class( " hljs \( " language- \( lang? . rawValue ?? " markdown " ) " ) " ) ) {
315
+ switch lang {
316
+ case . none: " log- \( self . number) .md "
317
+ case . some: " logs[ \( self . number) ] "
318
+ }
319
+ }
310
320
}
311
321
}
312
322
. inlineStyle ( " font-size " , " 0.75em " )
@@ -333,7 +343,6 @@ private struct PostsView: HTML {
333
343
. inlineStyle ( " background " , " #2A2A2A " , post: " blockquote " )
334
344
. inlineStyle ( " padding " , " 0.125rem 1rem " , post: " blockquote " )
335
345
. inlineStyle ( " border " , " 1.5px solid #4A4A4A " , post: " blockquote " )
336
- . inlineStyle ( " border-radius " , " 0.125rem " , post: " blockquote " )
337
346
. inlineStyle ( " margin-left " , " 0 " , post: " blockquote " )
338
347
. inlineStyle ( " margin-right " , " 0 " , post: " blockquote " )
339
348
@@ -414,7 +423,6 @@ private struct PostsView: HTML {
414
423
. inlineStyle ( " margin-top " , " 1.25rem " , post: " > * " )
415
424
. inlineStyle ( " margin-bottom " , " 1.25rem " , post: " > * " )
416
425
. inlineStyle ( " border " , " 1.5px solid #3A3A3A " , post: " > * " )
417
- . inlineStyle ( " border-radius " , " 1rem " , post: " > * " )
418
426
. postCodeBlockStyling ( )
419
427
}
420
428
}
@@ -479,7 +487,6 @@ extension HTML {
479
487
self . inlineStyle ( " padding " , " 0.75rem " , post: " pre " )
480
488
. inlineStyle ( " background " , " #242424 " , post: " pre " )
481
489
. inlineStyle ( " border " , " 1.5px solid #3A3A3A " , post: " pre " )
482
- . inlineStyle ( " border-radius " , " 0.75rem " , post: " pre " )
483
490
. inlineStyle ( " overflow-x " , " auto " , post: " pre " )
484
491
. inlineStyle ( " font-size " , " 0.85em " , post: " pre " )
485
492
}
0 commit comments