Skip to content

Commit 1c63b39

Browse files
committed
fix tests and address README issues
1 parent b12e277 commit 1c63b39

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,14 @@ Only the following Haml filters are supported:
464464
- `:javascript`
465465
- `:css`
466466

467+
### Whitespace Removal
468+
GoHT supports the removal of whitespace between tags. This is done by adding a `>` or `<` to the end of the tag.
469+
470+
- `>` will remove all whitespace between the tag and its parent or siblings.
471+
- `<` will remove all whitespace between the tag and its first and last child.
472+
473+
Both can be used together to remove whitespace both inside and outside a tag; the order they're in does not matter.
474+
467475
### Template nesting
468476
The biggest departure from Haml is how templates can be combined. When working Haml you could use `= render :partial_name` or `= haml :partial_name` to render a partial. The `render` and `haml` functions are not available in GoHT, instead you can use the `@render` directive.
469477
```haml

examples/examples_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,6 @@ func TestExamples(t *testing.T) {
223223
}(),
224224
htmlFile: "example_userDetails",
225225
},
226-
"indents_usingSpaces": {
227-
template: indents.UsingSpaces(),
228-
htmlFile: "indents_usingSpaces",
229-
},
230226
"indents_usingTabs": {
231227
template: indents.UsingTabs(),
232228
htmlFile: "indents_usingTabs",

examples/tags/whitespace.goht

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
package tags
22
// Whitespace will be added between tags and between tags and text
33
// if that text is on a new line after the tag.
4+
//
5+
// %p Some text
6+
// The above line will render as:
7+
// <p>Some text</p>
8+
//
9+
// %p
10+
// Some text
11+
// The above line will render as:
12+
// <p>
13+
// Some text
14+
// </p>
15+
//
416
// Whitespace can have subtle effects on the final output of the
517
// rendered HTML, so it is important to understand how it works.
618

719
@goht Whitespace() {
820
%p This text has no whitespace between it and the tag.
921
%p
10-
This text has whitespace between it and the tag.
11-
%p This tag has whitespace between it and the tag above.
22+
This text has whitespace between it and the tag.
23+
%p This tag has whitespace between it and the tag above.
1224
}
1325

1426
// You can control the whitespace that will be rendered between tags
@@ -22,11 +34,11 @@ package tags
2234

2335
@goht RemoveWhitespace() {
2436
%p<
25-
This text has no whitespace between it and the parent tag.
37+
This text has no whitespace between it and the parent tag.
2638
%p
27-
There is whitespace between this text and the parent tag.
28-
%p><
29-
This text has no whitespace between it and the parent tag.
30-
There is also no whitespace between this tag and the sibling text above it.
31-
Finally, the tag has no whitespace between it and the outer tag.
39+
There is whitespace between this text and the parent tag.
40+
%p><
41+
This text has no whitespace between it and the parent tag.
42+
There is also no whitespace between this tag and the sibling text above it.
43+
Finally, the tag has no whitespace between it and the outer tag.
3244
}

examples/tags/whitespace.goht.go

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

0 commit comments

Comments
 (0)