diff --git a/tests/html.xgo b/tests/html.xgo
new file mode 100644
index 0000000..8d52e75
--- /dev/null
+++ b/tests/html.xgo
@@ -0,0 +1,15 @@
+fmt := import("fmt")
+html := import("html").new_render()
+
+fmt.println(
+ html.html({
+ lang: "en"
+ }).body(
+ html.head(),
+ html.body().body(
+ html.p().body(
+ ">>>shit"
+ )
+ )
+ )
+)
diff --git a/htmlx/element.go b/xmodules/htmlx/element.go
similarity index 100%
rename from htmlx/element.go
rename to xmodules/htmlx/element.go
diff --git a/htmlx/html.go b/xmodules/htmlx/html.go
similarity index 73%
rename from htmlx/html.go
rename to xmodules/htmlx/html.go
index 00219a3..8576612 100644
--- a/htmlx/html.go
+++ b/xmodules/htmlx/html.go
@@ -1,11 +1,39 @@
package htmlx
import "github.com/d5/tengo/v2"
+import "log"
+
+var Module = map[string] tengo.Object{
+ "new_render" : &tengo.UserFunction{
+ Name: "new_render",
+ Value: func(args ...tengo.Object) (tengo.Object, error){
+ ret := &HTML{}
+ return ret, nil
+ },
+ },
+}
type HTML struct{
tengo.ObjectImpl
}
+func (html *HTML) Import(moduleName string) (any, error) {
+ log.Println("import:", moduleName)
+ switch moduleName {
+ case "html":
+ return html, nil
+ }
+ return nil, nil
+}
+
+func (html *HTML) TypeName() string {
+ return "blablabla"
+}
+
+func (html *HTML) String() (string) {
+ return "HTML{...}"
+}
+
/*
html.div({
diff --git a/xmodules/modules.go b/xmodules/modules.go
index 00a6e07..a8954a1 100644
--- a/xmodules/modules.go
+++ b/xmodules/modules.go
@@ -5,6 +5,7 @@ import "surdeus.su/core/xgo/xmodules/cjson"
import "surdeus.su/core/xgo/xmodules/logx"
import "surdeus.su/core/xgo/xmodules/paths"
import "surdeus.su/core/xgo/xmodules/httpx"
+import "surdeus.su/core/xgo/xmodules/htmlx"
import "github.com/d5/tengo/v2"
// The main map to import all the implemented modules.
@@ -14,5 +15,6 @@ var Modules = func() *tengo.ModuleMap {
ret.AddBuiltinModule("log", logx.Module)
ret.AddBuiltinModule("paths", paths.Module)
ret.AddBuiltinModule("http", httpx.Module)
+ ret.AddBuiltinModule("html", htmlx.Module)
return ret
}()