From 61758622ef5db6659552af4e9578d6f9c7f59fff Mon Sep 17 00:00:00 2001 From: maddalax Date: Fri, 25 Oct 2024 07:07:35 -0500 Subject: [PATCH] indent -> indentme add details & summary html tag --- framework/h/tag.go | 8 ++++++++ .../internal/adapters/services/formatter/indent.go | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/framework/h/tag.go b/framework/h/tag.go index 5682e87..86d2d2a 100644 --- a/framework/h/tag.go +++ b/framework/h/tag.go @@ -38,6 +38,14 @@ func TextF(format string, args ...interface{}) *TextContent { return Text(fmt.Sprintf(format, args...)) } +func Details(children ...Ren) *Element { + return Tag("details", children...) +} + +func Summary(children ...Ren) *Element { + return Tag("summary", children...) +} + func Text(text string) *TextContent { return NewTextContent(text) } diff --git a/tools/html-to-htmgo/internal/adapters/services/formatter/indent.go b/tools/html-to-htmgo/internal/adapters/services/formatter/indent.go index f6e9b13..fdffc5f 100644 --- a/tools/html-to-htmgo/internal/adapters/services/formatter/indent.go +++ b/tools/html-to-htmgo/internal/adapters/services/formatter/indent.go @@ -31,11 +31,11 @@ func Indent(input string) string { switch arg.(type) { // If the first argument is another node, add an indent case *ast.CallExpr: - newChildren = append(newChildren, ast.NewIdent("INDENT")) + newChildren = append(newChildren, ast.NewIdent("INDENTME")) } } newChildren = append(newChildren, arg) - newChildren = append(newChildren, ast.NewIdent("INDENT")) + newChildren = append(newChildren, ast.NewIdent("INDENTME")) } n.Args = newChildren return true @@ -51,8 +51,8 @@ func Indent(input string) string { } // Output the formatted code - indented := strings.ReplaceAll(buf.String(), "INDENT,", "\n\t\t") - indented = strings.ReplaceAll(indented, ", INDENT", ", \n\t\t") + indented := strings.ReplaceAll(buf.String(), "INDENTME,", "\n\t\t") + indented = strings.ReplaceAll(indented, ", INDENTME", ", \n\t\t") return indented }