1
0
Commit Graph

90 Commits

Author SHA1 Message Date
Markus Wüstenberg
a5a7242ae0
Add stroke-width SVG attribute (#116) 2022-11-15 14:48:01 +01:00
Markus Wüstenberg
b12942fb32
Delete low-value helper components (#115)
I'd rather reserve the package for components that have proven
repeatedly useful, like `Classes` and `HTML5`.
2022-11-03 11:32:16 +01:00
Markus Wüstenberg
3bb4e3efea
Add Rawf (#114)
Like `Raw`, but interpolates like `Textf`.
2022-11-03 11:24:26 +01:00
Markus Wüstenberg
34df17d356
Add Go report card to readme (#111)
Also fix godoc badge to point to pkg.go.dev.
2022-10-17 12:09:37 +00:00
Markus Wüstenberg
0e52e94472
Fix small typo occured -> occurred (#110) 2022-10-17 14:04:24 +02:00
Markus Wüstenberg
32ad318ce8
Add EncType html attribute (#109) 2022-09-29 10:46:36 +00:00
Markus Wüstenberg
f387a71230
Add generic Map implementation (#108)
Instead of waiting for a good time to switch the `Map` implementation,
I've decided to just offer two implementations: one for Go versions
before 1.18, and one for 1.18 and onwards. This is achieved using build
tags in the source files.

This is obviously a breaking change for consumers of this library that
use Go 1.18 and onwards.

See #88
2022-09-22 09:41:06 +02:00
Markus Wüstenberg
3334d6c7d0
Add Go 1.19 to test matrix (#107) 2022-09-21 10:42:07 +02:00
Markus Wüstenberg
3e992ed66c
Use output of strings.Builder in assert.Equal (#106) 2022-09-21 10:37:44 +02:00
Markus Wüstenberg
f4da48fb57
Make void elements a map (#103)
Makes it easier to lookup by name.

Also, fixed some doc comments.
2022-05-27 14:16:19 +02:00
Markus Wüstenberg
c868c525b4
Update package doc to reflect new content (#102)
It hadn't been updated in a while.
2022-05-25 14:36:26 +02:00
Markus Wüstenberg
97698614be
Fix CI badge in Readme (#100) 2022-05-25 09:01:53 +00:00
Markus Wüstenberg
b016f271d7
Update CI config (#98)
- Drop current test workflows if a new one has come in
- Use newer checkout and setup actions
- Delete CodeQL workflow
2022-05-25 08:21:27 +00:00
Markus Wüstenberg
565c60a8e4 Update copyright year in license 2022-03-21 12:22:32 +01:00
Markus Wüstenberg
540b2a3491
Use a test matrix with the last three stable Go versions (#96) 2022-03-21 12:05:17 +01:00
Markus Wüstenberg
0001b1d609
Add http.Adapt function (#92)
In the new package `http`, an `Adapt` function converts a `Handler` into a `http.HandlerFunc` from the `http` stdlib package.
2021-10-08 15:00:20 +02:00
Markus Wüstenberg
44c2744837
Test using Go 1.17 (#91)
Also set the new `-shuffle` flag when testing.
2021-10-06 20:51:31 +02:00
Markus Wüstenberg
4858e5d47d
Mark the assert test helpers as such (#90)
Using `t.Helper()`.

Also move the assert package to be internal.
2021-10-06 20:49:43 +02:00
Josep Jesus Bigorra Algaba
33524d6836
Add loading and srcset HTML attributes (#86)
Useful for `img` and `picture` elements.

Fixes #85.

Co-authored-by: Josep Jesus Bigorra Algaba <josep@prowarehouse.nl>
2021-09-07 12:09:57 +02:00
Markus Wüstenberg
bd722def27
Add link to maragu.dk and golang.dk in readme 2021-06-18 10:35:58 +02:00
Markus Wüstenberg
aca5cdfe9d Add Github action status badge to readme 2021-06-18 10:10:55 +02:00
Markus Wüstenberg
1ed5851e03 Add contributors file 2021-06-18 10:09:00 +02:00
Markus Wüstenberg
ec86ca5c71
Add video element and related attributes (#84)
Adds the `video` element and `loop`, `muted`, `playsinline`, `poster` attributes.
2021-06-18 09:39:47 +02:00
Markus Wüstenberg
0efc71d6f3
Add javascript alert onclick handler to Raw example (#82)
Makes for fun XSS testing.
2021-06-09 10:56:22 +02:00
Markus Wüstenberg
ba0d83f4fb
Add examples in test files (#80)
These show up in godoc.
2021-06-08 18:12:04 +02:00
Markus Wüstenberg
7c0f2e4cbb
Add LinkStylesheet and LinkPreload components (#79)
These are often used in the `<head>` part of the HTML.
2021-06-08 16:52:57 +02:00
Markus Wüstenberg
3e9e00ca0d
Escape Attr values (#77)
Because this can be a place of injection if untrusted data is passed, escape all attribute values.

Fixes #74.
2021-05-18 14:21:53 +02:00
Markus Wüstenberg
ac7471aac6
Fix TailwindCSS CDN URL in example (#76)
The CSS style URLs from unpkg.com redirected to a different page, but the first request set a `Content-Type` header of `text/plain`. Using the direct URLs fixes this.

Fixes #75. Thanks to @gedw99 for reporting.
2021-05-11 16:39:04 +02:00
Markus Wüstenberg
1072ec9b70
Update readme with content from website (#73) 2021-05-07 14:40:55 +02:00
Markus Wüstenberg
d34b28be56
Bump Go version to 1.16 in CI (#72) 2021-05-07 14:35:47 +02:00
Markus Wüstenberg
e6538392ad
Add more complex example using TailwindCSS (#71) 2021-05-07 14:12:23 +02:00
Markus Wüstenberg
6f7752c20f
Add svg package and a few helpers (#67)
Introducing SVG, to inline vector graphics in your HTML! 🥳
2021-05-05 12:53:32 +02:00
Markus Wüstenberg
eb1d1f22b4
Fix code in readme (#69)
Broken in #66.
2021-05-05 09:53:19 +02:00
Markus Wüstenberg
6f3eea403a
Update license year (#68) 2021-05-05 09:51:42 +02:00
Markus Wüstenberg
3b7dceab89
Streamline HTML element API (#66)
There were a lot of elements previously, like `Em`, `H1`, and a lot more, that took a string as the first argument previously. This was weird when you wanted to mix elements to output html like `<strong><em>…</em></strong>` or `<h1>Something <em>something</em> something</h1>`. gomponents is not an HTML validator, so I want people to be able to use elements however they please, also without text content.

This also means that all elements now have the same API.
2021-05-05 09:03:16 +02:00
Markus Wüstenberg
5d2f0f1b87
Use g.If in HTML5 helper (#65)
Inlining looks much nicer.
2021-04-28 10:42:49 +02:00
Markus Wüstenberg
c899a050c0
Return Node from all helpers instead of NodeFunc (#62)
This makes it clearer that the helpers return a `Node` of any kind, and that the type is not important.

This also streamlines the API, as attribute helpers already return just `Node`.
2021-01-07 10:20:03 +01:00
Markus Wüstenberg
d41c4e5a85
Add data- attribute helper (#61)
Fixes #49.
2020-12-22 11:46:49 +01:00
Markus Wüstenberg
b4918d5a63
Add test for InputHidden (#60) 2020-12-22 11:12:45 +01:00
Markus Wüstenberg
6efec2175f
Add aria-* and role attributes (#59)
Fixes #50.
2020-12-22 11:07:33 +01:00
Markus Wüstenberg
f22ce3fb68
Add If helper function (#57)
Used to inline conditional nodes.
2020-12-22 10:53:22 +01:00
Markus Wüstenberg
428a2519ea
Change main example to be the dot-import version (#56) 2020-12-10 14:27:10 +01:00
Markus Wüstenberg
febffb600d
Simplify available elements (#55)
`a`, `form`, `img`, `input`, `label`, `option`, `progress`, `select`, and `textarea` are now just regular elements (without helper parameters), because:
- Sometimes the use case doesn't fit (`a` as anchor without href, for example)
- There's no reason these are special among the others, so streamlining them makes sense

Also added new attributes `action`, `alt`, `for`, `method` that I had somehow missed.
2020-12-10 14:20:33 +01:00
Markus Wüstenberg
100ae9e830
Rename Document to Doctype (#54) 2020-12-10 13:13:10 +01:00
Markus Wüstenberg
a76262652b
Move elements and attributes into html package (#52)
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.
2020-12-10 13:00:23 +01:00
Markus Wüstenberg
a7e24c6cdd
Minor refactoring and comment changes (#51) 2020-12-08 21:59:47 +01:00
Markus Wüstenberg
44b18894ac
Add example with dot imports (#47) 2020-11-17 14:50:42 +01:00
Markus Wüstenberg
633b000d91
Add svg element (#46)
Also add `cols` and `rows` attributes.

Fixes #43.
2020-11-16 13:03:54 +01:00
Markus Wüstenberg
108f8d9ba5
Add NodeType which replaces the Placer interface (#45)
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`.
2020-11-16 12:58:42 +01:00
Markus Wüstenberg
794c3b26ac
Render correct HTML5 (#44)
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.
2020-11-16 12:38:24 +01:00