From 260ce84c550e5993bcf3ef9aafa7a7a641458450 Mon Sep 17 00:00:00 2001 From: valentin gagarin Date: Wed, 13 Nov 2024 15:24:41 +0100 Subject: [PATCH] fix module for `` and `` --- presentation/dom.nix | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/presentation/dom.nix b/presentation/dom.nix index cb69d2c6..7e52a819 100644 --- a/presentation/dom.nix +++ b/presentation/dom.nix @@ -30,7 +30,6 @@ let # TODO: add fields for upstream documentation references # TODO: programmatically generate documentation options = with lib; { - attrs = mkAttrs { }; categories = mkOption { type = types.listOfUnique (types.enum content-categories); }; @@ -157,6 +156,7 @@ let imports = [ element ]; options = { inherit (element-types) html; + attrs = mkAttrs { }; }; config.categories = [ ]; @@ -169,6 +169,7 @@ let html = { name, ... }: { imports = [ element ]; options = { + attrs = mkAttrs { }; inherit (element-types) head body; }; @@ -182,6 +183,7 @@ let head = { name, ... }: { imports = [ element ]; options = with lib; { + attrs = mkAttrs { }; # https://html.spec.whatwg.org/multipage/semantics.html#the-head-element:concept-element-content-model # XXX: this doesn't implement the iframe srcdoc semantics # as those have questionable value and would complicate things a bit. @@ -289,6 +291,7 @@ let title = { name, ... }: { imports = [ element ]; + options.attrs = mkAttrs { }; options.text = mkOption { type = types.str; }; @@ -300,18 +303,17 @@ let base = { name, ... }: { imports = [ element ]; # TODO: "A base element must have either an href attribute, a target attribute, or both." - attrs = mkAttrs { inherit (attrs) href target; }; + options = global-attrs // { inherit (attrs) href target; }; config.categories = [ "metadata" ]; + config.__toString = self: ""; }; link = { name, ... }: { imports = [ element ]; - options = mkAttrs - { - # TODO: more attributes - # https://html.spec.whatwg.org/multipage/semantics.html#the-link-element:concept-element-attributes - inherit (attrs) href; - } // { + options = mkAttrs { + # TODO: more attributes + # https://html.spec.whatwg.org/multipage/semantics.html#the-link-element:concept-element-attributes + inherit (attrs) href; # XXX: there are variants of `rel` for `link`, `a`/`area`, and `form` rel = mkOption { # https://html.spec.whatwg.org/multipage/semantics.html#attr-link-rel @@ -344,12 +346,13 @@ let # TODO: figure out how to make body-ok `link` elements # https://html.spec.whatwg.org/multipage/semantics.html#allowed-in-the-body config.categories = [ "metadata" ]; - config.__toString = self: ""; + config.__toString = self: ""; }; body = { name, ... }: { imports = [ element ]; options = { + attrs = mkAttrs { }; content = mkOption { type = with types; # HACK: bail out for now