fix <hgroup> rendering

This commit is contained in:
Valentin Gagarin 2024-11-13 15:24:41 +01:00 committed by Valentin Gagarin
parent 27a7ba84bd
commit 555974a3af

View file

@ -536,7 +536,7 @@ let
# setting to an attribute set will wrap the section in `<hgroup>` # setting to an attribute set will wrap the section in `<hgroup>`
hgroup.attrs = mkOption { hgroup.attrs = mkOption {
type = with types; nullOr (submodule { options = global-attrs; }); type = with types; nullOr (submodule { options = global-attrs; });
default = with lib; mkIf (!isNull config.before || !isNull config.after) { }; default = with lib; if (config.before == [ ] && config.after == [ ]) then null else { };
}; };
# https://html.spec.whatwg.org/multipage/sections.html#the-hgroup-element # https://html.spec.whatwg.org/multipage/sections.html#the-hgroup-element
before = mkOption { before = mkOption {
@ -578,8 +578,10 @@ let
${heading} ${heading}
${optionalString (!isNull self.heading.after) (toString-unwrap self.heading.after)} ${optionalString (!isNull self.heading.after) (toString-unwrap self.heading.after)}
''); '');
content = if isNull self.heading.hgroup.attrs then heading else hgroup content =
+ join "\n" (map toString-unwrap self.content); (if isNull self.heading.hgroup.attrs then heading else hgroup)
+
join "\n" (map toString-unwrap self.content);
in in
if !isNull self.attrs if !isNull self.attrs
then print-element name self.attrs content then print-element name self.attrs content