Skip to content

Commit

Permalink
Fix lexers, template and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaksv committed Mar 27, 2022
1 parent 874b5eb commit c1c735d
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
coverage.out
gendata
main
doc
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package main

import "github.com/nikitaksv/gendata/cmd"
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)?}}`),
Expand Down
2 changes: 1 addition & 1 deletion pkg/lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package service

import (
"context"
"html/template"
"os"
"path/filepath"
"strings"
"text/template"
"time"

"github.com/nikitaksv/gendata/pkg/generator"
Expand Down
6 changes: 3 additions & 3 deletions pkg/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class {{ Name }} extends BaseObject
`)
out := []byte(`TestGenClass.php
&lt;?php
<?php
namespace common\models;
Expand Down Expand Up @@ -111,7 +111,7 @@ class TestGenClass extends BaseObject
}
TestAddressesClass.php
&lt;?php
<?php
namespace common\models;
Expand Down Expand Up @@ -146,7 +146,7 @@ class TestAddressesClass extends BaseObject
}
TestCoordinatesClass.php
&lt;?php
<?php
namespace common\models;
Expand Down

0 comments on commit c1c735d

Please sign in to comment.