Skip to content

Commit

Permalink
chore: add license and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fallsimply committed Mar 13, 2020
1 parent f5960e6 commit fa092d7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2020 fall simply

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# Bilit
[![Try it on Go Playground](https://img.shields.io/static/v1?label=Go%20Playground&message=Try%20It&color=00addc&style=for-the-badge&logo=go)]()

Bilit (pronounced /ˈbilit/) is a bidirectional template library for golang.
Inspired by Javascript's Template Literals and [Nunjucks](https://mozilla.github.io/nunjucks/templating.html)

Powered by Regular Expressions

### Examples
Simple (map):
## Examples
### OLD API - Basic:
``` go
func main() {
const template = "Hello, I'm {{name}} from {{City}}, {{from_state}}"
const template = "Hello, I'm {{name}} from ${City}, {{from_state}}"
var dataSrc = map[string]string{
"name": "John",
"City": "Dallas",
"from_state": "TX"
"from_state": "TX",
}

var str = bilit.Populate(template, dataSrc) //"Hello, I'm John from Dallas, TX"

var data = billit.Pull(template, str) //{name: John, City: Dallas, from_state: TX}

var str = bilit.Populate(template, dataSrc)
fmt.Println(str)
// "Hello, I'm John from Dallas, TX"
var data = bilit.Pull(template, str)
fmt.Println(data)
// map[City:Dallas from_state:TX name:John]
}
```
```
Open [Example Folder](./example)

## Special Thanks

0 comments on commit fa092d7

Please sign in to comment.