Skip to content

Commit

Permalink
🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
aslilac committed May 25, 2024
1 parent deaa052 commit ae0bbb7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
src/nakai/html.gleam linguist-generated
src/nakai/html/attrs.gleam linguist-generated
src/nakai/attr.gleam linguist-generated
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ all: build
# `gleam run -m ...` does a full build, but we need to run it again after our codegen
# step, or we might end up with the build artifacts being stale, if the new generated
# is different.
build:
@$(GLEAM) run -m nakai_codegen
build: codegen
@$(GLEAM) build
.PHONY: build

docs: build
codegen:
@$(GLEAM) run -m nakai_codegen
.PHONY: codegen

docs: codegen
@$(GLEAM) docs build
.PHONY: docs

Expand All @@ -22,11 +25,11 @@ format:
@$(GLEAM) run -m nakai_codegen
.PHONY: format

test: build
test: codegen
@$(GLEAM) test
.PHONY: test

bench: build
bench: codegen
@$(GLEAM) run -m nakai_benchmark
.PHONY: bench

Expand Down
11 changes: 7 additions & 4 deletions codegen/html_prelude.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub type Node {
/// will be rendered in-place, equivalent to using `html.Fragment(children)`.
/// ## Example
/// ```gleam
/// html.Html([attrs.lang("en-US")], [
/// html.Html([attr.lang("en-US")], [
/// ...
/// ])
/// ```
Expand All @@ -35,7 +35,7 @@ pub type Node {
/// will be rendered in-place, equivalent to using `html.Fragment(children)`.
/// ## Example
/// ```gleam
/// html.Body([attrs.class("dark-mode")], [
/// html.Body([attr.class("dark-mode")], [
/// ...
/// ])
/// ```
Expand Down Expand Up @@ -74,7 +74,7 @@ pub type Node {
/// ## Example
/// ```gleam
/// // bad example, pls use `html.link`
/// html.LeafElement("link", [attrs.rel("stylesheet"), attrs.href(...)])
/// html.LeafElement("link", [attr.rel("stylesheet"), attr.href(...)])
/// ```
LeafElement(tag: String, attrs: List(Attr))
/// An HTML comment, which will be included in the document.
Expand Down Expand Up @@ -122,7 +122,10 @@ pub type Node {
/// any other script, so **do not use any untrusted input**.
/// ## Example
/// ```gleam
/// html.Script("alert('hello, lucy!')")
/// html.Script([], "alert('hello, lucy!')")
/// ```
/// ```gleam
/// html.Script([attr.type_("module"), attr.src(...)], "")
/// ```
Script(attrs: List(Attr), content: String)
/// Renders absolutely nothing. For when you may or may not have something to render,
Expand Down
11 changes: 7 additions & 4 deletions src/nakai/html.gleam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae0bbb7

Please sign in to comment.