E58E Merge pull request #3 from spekary/main · goradd/html5tag@c406140 · GitHub
[go: up one dir, main page]

Skip to content

Commit c406140

Browse files
authored
Merge pull request #3 from spekary/main
Fixing some documentation
2 parents c24d3e0 + 0c5c691 commit c406140

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ html5tag does some checks to make sure tags are well-formed. For example,
1616
when adding data-* attributes, it will make sure the key used for the
1717
attribute does not violate html syntax rules.
1818

19+
html5tag has options to pretty-print tags and the content of tags so they appear formatted
20+
in a document. However, in certain contexts, like in inline text, or in a textarea tag, adding
21+
extra returns and spaces changes the look of the output. In these situations, use the functions
22+
that do not add spaces to the inner HTML of a tag.
23+
1924
Some examples:
2025

2126
```go

attributes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,8 @@ func ValueString(i interface{}) string {
743743
case bool:
744744
if v {
745745
return "" // boolean true
746-
} else {
747-
return FalseValue // Our special value to indicate to NOT print the attribute at all
748746
}
747+
return FalseValue // Our special value to indicate to NOT print the attribute at all
749748
case string:
750749
return v
751750
case int:

class.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func RemoveWords(originalValues string, removeValues string) string {
7979
// Bootstrap uses 'col-lg-6' to represent a table that is 6 units wide on large screens and Foundation
8080
// uses 'large-6' to do the same thing. This utility removes classes that start with a particular prefix
8181
// to remove whatever sizing class was specified.
82-
// Returns the resulting class list, and true if the list actually changed.
82+
// Returns the resulting class list.
8383
func RemoveClassesWithPrefix(class string, prefix string) string {
8484
classes := strings.Fields(class)
8585
ret := ""

style.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ func (s Style) SetChanged(property string, value string) (changed bool, err erro
142142
}
143143

144144
// Set is like SetChanged, but returns the Style for chaining.
145-
//
146-
// It will also allocate a style if passed a nil style, and return it.
147145
func (s Style) Set(property string, value string) Style {
148146
_, err := s.SetChanged(property, value)
149147
if err != nil {

tag_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ func (b *errBuffer) Write(p []byte) (n int, err error) {
1818
l := b.cap - b.buf.Len()
1919
n, _ = b.Write(p[:l])
2020
return n, fmt.Errorf("out of memory")
21-
} else {
22-
return b.buf.Write(p)
2321
}
22+
return b.buf.Write(p)
2423
}
2524

2625
func newErrBuf(cap int) *errBuffer {

0 commit comments

Comments
 (0)
0