Skip to content

Commit

Permalink
feat: use more aggressive newlines in html mode tag bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Mar 16, 2023
1 parent 6678784 commit 93ebb54
Show file tree
Hide file tree
Showing 49 changed files with 300 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<div>${foo} (<span>${bar}</span>)</div>
<div>
${foo} (
<span>${bar}</span>
)
</div>
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<div>${foo} (<span>${bar}</span>)</div>
<div>
${foo} (
<span>${bar}</span>
)
</div>
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<div>${foo} (<span>${bar}</span>)</div>
<div>
${foo} (
<span>${bar}</span>
)
</div>
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<div class="hello">
// This is a line comment

<span>Welcome to <b>Marko</b></span>

<span>
Welcome to
<b>Marko</b>
</span>
Foo<!--
This is a multiline HTML comment
This is indented further
Expand Down
6 changes: 4 additions & 2 deletions src/__tests__/__snapshots__/comments.expected/html.marko
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<div class="hello">
// This is a line comment

<span>Welcome to <b>Marko</b></span>

<span>
Welcome to
<b>Marko</b>
</span>
Foo<!--
This is a multiline HTML comment
This is indented further
Expand Down
4 changes: 3 additions & 1 deletion src/__tests__/__snapshots__/component.expected/auto.marko
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ class {
}

<div>The current count is ${state.count}</div>
<button on-click("increment")>+1</button>
<button on-click("increment")>
+1
</button>
4 changes: 3 additions & 1 deletion src/__tests__/__snapshots__/component.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ class {
}

<div>The current count is ${state.count}</div>
<button on-click("increment")>+1</button>
<button on-click("increment")>
+1
</button>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ class {
}

<div>The current count is ${state.count}</div>
<button on-click("increment")>+1</button>
<button on-click("increment")>
+1
</button>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<for(element in blah)>
<${element.foo}><include("foo")/></>
<${element.foo}>
<include("foo")/>
</>
</for>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<for(element in blah)>
<${element.foo}><include("foo")/></>
<${element.foo}>
<include("foo")/>
</>
</for>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<for(element in blah)>
<${element.foo}><include("foo")/></>
<${element.foo}>
<include("foo")/>
</>
</for>
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<div class="hello">
<span>Welcome to the wonderful world of <b>Marko</b></span>
<span>
Welcome to the wonderful world of
<b>Marko</b>
</span>
</div>
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<div class="hello"><span>Welcome to the <b>Marko</b></span></div>
<div class="hello">
<span>
Welcome to the
<b>Marko</b>
</span>
</div>
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<b><i/><span/></b>
<b>
<i/>
<span/>
</b>
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<b><i/><span/></b>
<b>
<i/>
<span/>
</b>
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<b><i/><span/></b>
<b>
<i/>
<span/>
</b>
8 changes: 6 additions & 2 deletions src/__tests__/__snapshots__/indent.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
<body>
<h1>Hello ${data.name}!</h1>
<ul if(notEmpty(data.colors))>
<li for(color in data.colors)>${color}</li>
<li for(color in data.colors)>
${color}
</li>
</ul>
<div else>No colors!</div>
<div else>
No colors!
</div>
</body>
</html>
1 change: 0 additions & 1 deletion src/__tests__/__snapshots__/markdown.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
<title>Marko Templating Engine</title>
body
<h1>Hello ${data.name}!</h1>

ul if(notEmpty(data.colors)) li for(color in data.colors) ${color}${" "}div else - No colors! ```
</app-markdown>
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<div><span>Hello World</span></div>
<div>
<span>Hello World</span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<title>Marko Templating Engine</title>
</head>
<body>
<h1 class="super-duper-long__class-name">Hello ${data.name}!</h1>
<h1 class="super-duper-long__class-name">
Hello ${data.name}!
</h1>
<h2
class="super-duper-long__class-name"
data-test="test attribute data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<title>Marko Templating Engine</title>
</head>
<body>
<h1 class="super-duper-long__class-name">Hello ${data.name}!</h1>
<h1 class="super-duper-long__class-name">
Hello ${data.name}!
</h1>
<h2
class="super-duper-long__class-name"
data-test="test attribute data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<title>Marko Templating Engine</title>
</head>
<body>
<h1 class="super-duper-long__class-name">Hello ${data.name}!</h1>
<h1 class="super-duper-long__class-name">
Hello ${data.name}!
</h1>
<h2
class="super-duper-long__class-name"
data-test="test attribute data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
<await(generator.next())>
<@then|{ value, done }|>
<div>
<ul><li>${value}</li></ul>
<ul><li>${value}</li></ul>
<ul><li>${value}</li></ul>
<ul>
<li>${value}</li>
</ul>
<ul>
<li>${value}</li>
</ul>
<ul>
<li>${value}</li>
</ul>
</div>
</@then>
</await>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
<await(generator.next())>
<@then|{ value, done }|>
<div>
<ul><li>${value}</li></ul>
<ul><li>${value}</li></ul>
<ul><li>${value}</li></ul>
<ul>
<li>${value}</li>
</ul>
<ul>
<li>${value}</li>
</ul>
<ul>
<li>${value}</li>
</ul>
</div>
</@then>
</await>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
<await(generator.next())>
<@then|{ value, done }|>
<div>
<ul><li>${value}</li></ul>
<ul><li>${value}</li></ul>
<ul><li>${value}</li></ul>
<ul>
<li>${value}</li>
</ul>
<ul>
<li>${value}</li>
</ul>
<ul>
<li>${value}</li>
</ul>
</div>
</@then>
</await>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<div id="foo">Hello World</div>
<div id="foo">
Hello World
</div>
11 changes: 10 additions & 1 deletion src/__tests__/__snapshots__/single-line.expected/auto.marko
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
<div><span>Hello <b><a href="#">World</a></b></span></div>
<div>
<span>
Hello
<b>
<a href="#">
World
</a>
</b>
</span>
</div>
11 changes: 10 additions & 1 deletion src/__tests__/__snapshots__/single-line.expected/html.marko
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
<div><span>Hello <b><a href="#">World</a></b></span></div>
<div>
<span>
Hello
<b>
<a href="#">
World
</a>
</b>
</span>
</div>
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
<div><span>Hello <b><a href="#">World</a></b></span></div>
<div>
<span>
Hello
<b>
<a href="#">
World
</a>
</b>
</span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ $ var count = state.count;
]>
${count}
</div>
<button on-click("increment", -1)>-1</button>
<button on-click("increment", 1)>+1</button>
<button on-click("increment", -1)>
-1
</button>
<button on-click("increment", 1)>
+1
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ $ var count = state.count;
]>
${count}
</div>
<button on-click("increment", -1)>-1</button>
<button on-click("increment", 1)>+1</button>
<button on-click("increment", -1)>
-1
</button>
<button on-click("increment", 1)>
+1
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ $ var count = state.count;
]>
${count}
</div>
<button on-click("increment", -1)>-1</button>
<button on-click("increment", 1)>+1</button>
<button on-click("increment", -1)>
-1
</button>
<button on-click("increment", 1)>
+1
</button>
</div>
12 changes: 9 additions & 3 deletions src/__tests__/__snapshots__/static-function.expected/auto.marko
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ static function getAnchorName(section) {
<div class="tableOfContents">
<ul>
<li for(section in data.sections)>
<a href="#${getAnchorName(section)}">${section.title}</a>
<a href="#${getAnchorName(section)}">
${section.title}
</a>
</li>
</ul>
</div>
<div class="sections-ctr">
<div class="section" for(section in data.sections)>
<h2 id=getAnchorName(section)>${section.title}</h2>
<div class="section-body"><include(section)/></div>
<h2 id=getAnchorName(section)>
${section.title}
</h2>
<div class="section-body">
<include(section)/>
</div>
</div>
</div>
</div>
12 changes: 9 additions & 3 deletions src/__tests__/__snapshots__/static-function.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ static function getAnchorName(section) {
<div class="tableOfContents">
<ul>
<li for(section in data.sections)>
<a href="#${getAnchorName(section)}">${section.title}</a>
<a href="#${getAnchorName(section)}">
${section.title}
</a>
</li>
</ul>
</div>
<div class="sections-ctr">
<div class="section" for(section in data.sections)>
<h2 id=getAnchorName(section)>${section.title}</h2>
<div class="section-body"><include(section)/></div>
<h2 id=getAnchorName(section)>
${section.title}
</h2>
<div class="section-body">
<include(section)/>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ static function getAnchorName(section) {
<div class="tableOfContents">
<ul>
<li for(section in data.sections)>
<a href="#${getAnchorName(section)}">${section.title}</a>
<a href="#${getAnchorName(section)}">
${section.title}
</a>
</li>
</ul>
</div>
<div class="sections-ctr">
<div class="section" for(section in data.sections)>
<h2 id=getAnchorName(section)>${section.title}</h2>
<div class="section-body"><include(section)/></div>
<h2 id=getAnchorName(section)>
${section.title}
</h2>
<div class="section-body">
<include(section)/>
</div>
</div>
</div>
</div>
Loading

0 comments on commit 93ebb54

Please sign in to comment.