diff --git a/.gitignore b/.gitignore index 14599fd..7b7d180 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ coverage.out gendata main +doc diff --git a/README.md b/README.md index dd0a032..19f28b0 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ Template Data Generator +## Wiki + +[Doc](https://github.com/nikitaksv/gendata/wiki) +[Syntax](https://github.com/nikitaksv/gendata/wiki/Syntax) +[Examples](https://github.com/nikitaksv/gendata/wiki/Examples) + ## Installation Follow those steps to install the library: diff --git a/main.go b/main.go index 6167b01..e3fb748 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,3 @@ -/* -Copyright © 2022 NAME HERE - -*/ package main import "github.com/nikitaksv/gendata/cmd" diff --git a/pkg/generator/generator.go b/pkg/generator/generator.go index 5ab6e65..9c3a944 100644 --- a/pkg/generator/generator.go +++ b/pkg/generator/generator.go @@ -3,8 +3,8 @@ package generator import ( "bytes" "context" - "html/template" "io" + "text/template" "github.com/nikitaksv/gendata/pkg/generator/meta" "github.com/nikitaksv/gendata/pkg/syntax" diff --git a/pkg/lexer/lexer.go b/pkg/lexer/lexer.go index 1b66199..5cef4ea 100644 --- a/pkg/lexer/lexer.go +++ b/pkg/lexer/lexer.go @@ -39,7 +39,7 @@ var ( } LexNameKebabCase = &Lexer{ Token: regexp.MustCompile(`(?i){{([\s]+)?Name.KebabCase([\s]+)?}}`), - replace: []byte(`{{ .Key.CamelCase }}`), + replace: []byte(`{{ .Key.KebabCase }}`), } LexNameDotCase = &Lexer{ Token: regexp.MustCompile(`(?i){{([\s]+)?Name.DotCase([\s]+)?}}`), diff --git a/pkg/lexer/lexer_test.go b/pkg/lexer/lexer_test.go index 3907865..05c903f 100644 --- a/pkg/lexer/lexer_test.go +++ b/pkg/lexer/lexer_test.go @@ -31,7 +31,7 @@ LexNameAsIsCase -> {{ .Key.String }};{{ .Key.String }} LexNameCamelCase -> {{ .Key.CamelCase }};{{ .Key.CamelCase }} LexNamePascalCase -> {{ .Key.PascalCase }};{{ .Key.PascalCase }} LexNameSnakeCase -> {{ .Key.SnakeCase }};{{ .Key.SnakeCase }} -LexNameKebabCase -> {{ .Key.CamelCase }};{{ .Key.CamelCase }} +LexNameKebabCase -> {{ .Key.KebabCase }};{{ .Key.KebabCase }} LexNameDotCase -> {{ .Key.DotCase }};{{ .Key.DotCase }} LexBeginProps -> {{- range .Properties }};{{- range .Properties }} diff --git a/pkg/service/service.go b/pkg/service/service.go index a761388..7bf78e8 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -2,10 +2,10 @@ package service import ( "context" - "html/template" "os" "path/filepath" "strings" + "text/template" "time" "github.com/nikitaksv/gendata/pkg/generator" diff --git a/pkg/service/service_test.go b/pkg/service/service_test.go index 3bcb608..255c8bf 100644 --- a/pkg/service/service_test.go +++ b/pkg/service/service_test.go @@ -64,7 +64,7 @@ class {{ Name }} extends BaseObject `) out := []byte(`TestGenClass.php -<?php +