indent -> indentme
add details & summary html tag
This commit is contained in:
parent
531ad3342b
commit
61758622ef
2 changed files with 12 additions and 4 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue