about summary refs log tree commit diff stats
path: root/attr
Commit message (Collapse)AuthorAgeLines
* Move elements and attributes into html package (#52)Markus Wüstenberg2020-12-10-319/+0
| | | | | This makes it easier to use dot-imports. Also updated the readme and examples with new usage, and move the `Classes` helper into the `components` package.
* Add svg element (#46)Markus Wüstenberg2020-11-16-0/+10
| | | | | Also add `cols` and `rows` attributes. Fixes #43.
* Add NodeType which replaces the Placer interface (#45)Markus Wüstenberg2020-11-16-2/+2
| | | The `Placer` interface was a weird interface that tried to abstract away nodes being elements or attributes, but it doesn't really make sense. Now `Nodes` just have a `NodeType`.
* Render correct HTML5 (#44)Markus Wüstenberg2020-11-16-3/+3
| | | | | | | | | Previously, elements of kind void and empty elements generally would be rendered auto-closing (with a final `/` character in the start tag), which is allowed sometimes but arguably wrong. See https://dev.w3.org/html5/spec-LC/syntax.html#end-tags This created problems with for example `textarea` and `script`, which cannot be auto-closing, or the browser renders it wrong. Also clarified in the docs that this library outputs HTML5. Fixes #42.
* Render to Writer instead of string (#39)Markus Wüstenberg2020-11-02-3/+6
| | | | | | | The Render function has been changed to take a `Writer` instead of returning a string. This makes it possible to generate documents without having the whole content in memory. This also removes the `gomponents.Write` function, which is now redundant. Furthermore, the `el.Document` function has been changed to only take one child, as multiple children never make sense for it. (It's not even a child, more a sibling.)
* Add HTML5 document template (#36)Markus Wüstenberg2020-10-29-0/+10
|
* Add attribute helpers (#35)Markus Wüstenberg2020-10-28-53/+229
| | | Also refactor tests to be table-driven, for readability.
* Group element helpers in different files (#21)Markus Wüstenberg2020-09-25-0/+0
| | | According to the section at https://developer.mozilla.org/en-US/docs/Web/HTML/Element
* Add space before auto-closing element (#20)Markus Wüstenberg2020-09-24-2/+2
|
* Add convenience helpers for form elements (#19)Markus Wüstenberg2020-09-24-0/+31
|
* Introduce Placer interface (#18)Markus Wüstenberg2020-09-24-0/+10
| | | | | When implemented, the `Place` method of the `Placer` interface tells `Render` in `El` where to put a Node. This is relevant for helpers that want to be rendered like attributes, inside the parent element. Fixes the bug where `attr.Classes` was rendered outside the element.
* Make attr.Classes a map type (#14)Markus Wüstenberg2020-09-23-7/+22
| | | This makes the usage syntax prettier. Instead of `attr.Classes(map[string]bool{})`, we can just use `attr.Classes{}`.
* Add package attr with attribute helpers (#7)Markus Wüstenberg2020-09-18-0/+64