Skip to content

Commit

Permalink
Merge pull request #3 from spekary/main
Browse files Browse the repository at this point in the history
Fixing some documentation
  • Loading branch information
spekary authored Mar 17, 2022
2 parents c24d3e0 + 0c5c691 commit c406140
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ html5tag does some checks to make sure tags are well-formed. For example,
when adding data-* attributes, it will make sure the key used for the
attribute does not violate html syntax rules.

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

Some examples:

```go
Expand Down
3 changes: 1 addition & 2 deletions attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,8 @@ func ValueString(i interface{}) string {
case bool:
if v {
return "" // boolean true
} else {
return FalseValue // Our special value to indicate to NOT print the attribute at all
}
return FalseValue // Our special value to indicate to NOT print the attribute at all
case string:
return v
case int:
Expand Down
2 changes: 1 addition & 1 deletion class.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func RemoveWords(originalValues string, removeValues string) string {
// Bootstrap uses 'col-lg-6' to represent a table that is 6 units wide on large screens and Foundation
// uses 'large-6' to do the same thing. This utility removes classes that start with a particular prefix
// to remove whatever sizing class was specified.
// Returns the resulting class list, and true if the list actually changed.
// Returns the resulting class list.
func RemoveClassesWithPrefix(class string, prefix string) string {
classes := strings.Fields(class)
ret := ""
Expand Down
2 changes: 0 additions & 2 deletions style.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ func (s Style) SetChanged(property string, value string) (changed bool, err erro
}

// Set is like SetChanged, but returns the Style for chaining.
//
// It will also allocate a style if passed a nil style, and return it.
func (s Style) Set(property string, value string) Style {
_, err := s.SetChanged(property, value)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ func (b *errBuffer) Write(p []byte) (n int, err error) {
l := b.cap - b.buf.Len()
n, _ = b.Write(p[:l])
return n, fmt.Errorf("out of memory")
} else {
return b.buf.Write(p)
}
return b.buf.Write(p)
}

func newErrBuf(cap int) *errBuffer {
Expand Down

0 comments on commit c406140

Please sign in to comment.