builtin_import.go (397B)
1 package tplc 2 3 import ( 4 "go.lair.cx/go-core/net/htmlx" 5 ) 6 7 func TagImport(_ *Builder, w *Writer, t *htmlx.Tokenizer) error { 8 if t.CurrentType() == htmlx.SelfClosingTagToken { 9 return nil 10 } 11 body, err := getBodyFromTextOnlyTag(t, "import", true) 12 if err != nil { 13 return err 14 } 15 if len(body) > 0 { 16 w.WriteGoCode("import (") 17 w.WriteGoCodeBytes(body) 18 w.WriteGoCode(")\n\n") 19 } 20 return nil 21 }