File tree Expand file tree Collapse file tree 1 file changed +14
-17
lines changed
Benchmarks/Benchmarks/Elementary Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -12,29 +12,26 @@ package struct ElementaryTests : HTMLGenerator {
1212 package init ( ) { }
1313
1414 package func staticHTML( ) -> String {
15- StaticView ( ) . render ( )
16- }
17- package func dynamicHTML( _ context: HTMLContext ) -> String {
18- DynamicView ( context: context) . rawHTML. render ( )
15+ html {
16+ head {
17+ title { " StaticView " }
18+ }
19+ body {
20+ h1 { " Swift HTML Benchmarks " }
21+ }
22+ } . render ( )
1923 }
20- }
21-
22- struct StaticView : HTMLDocument {
23- var title : String = " StaticView "
2424
25- var head : some HTML {
26- " "
27- }
28- var body : some HTML {
29- h1 { " Swift HTML Benchmarks " }
25+ package func dynamicHTML( _ context: HTMLContext ) -> String {
26+ DynamicView ( context: context) . render ( )
3027 }
3128}
3229
33- struct DynamicView {
30+ struct DynamicView : HTML {
3431 let context : HTMLContext
3532
3633 // Elementary puts the title element first in the head, which is wrong; it needs to be charset | this is a workaround
37- @ HTMLBuilder var rawHTML : some HTML {
34+ var content : some HTML {
3835 HTMLRaw ( " <!DOCTYPE html> " )
3936 html {
4037 head {
@@ -45,12 +42,12 @@ struct DynamicView {
4542 }
4643 body {
4744 h1 { context. heading }
48- div ( attributes : [ . id( context. desc_id) ] ) {
45+ div ( . id( context. desc_id) ) {
4946 p { context. string }
5047 }
5148 h2 { context. user. details_heading }
5249 h3 { context. user. qualities_heading }
53- ul ( attributes : [ . id( context. user. qualities_id) ] ) {
50+ ul ( . id( context. user. qualities_id) ) {
5451 for quality in context. user. qualities {
5552 li { quality }
5653 }
You can’t perform that action at this time.
0 commit comments