Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
fallsimply committed Mar 13, 2020
1 parent fa092d7 commit 637cb81
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 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)]()
[![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)]() ![GitHub](https://img.shields.io/github/license/simplycodin/bilit?style=for-the-badge)

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)
Expand All @@ -25,6 +25,4 @@ func main() {
// map[City:Dallas from_state:TX name:John]
}
```
Open [Example Folder](./example)

## Special Thanks
Open [Example Folder](./example)
2 changes: 1 addition & 1 deletion example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module github.com/SimplyCodin/bilit/example

go 1.12

require github.com/SimplyCodin/bilit v0.0.0-20190826050318-5ab9e1694da9
require github.com/SimplyCodin/bilit v0.3.0

replace github.com/SimplyCodin/bilit => ../
2 changes: 0 additions & 2 deletions example/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
github.com/SimplyCodin/bilit v0.0.0-20190826050318-5ab9e1694da9 h1:ujak2uXt2JyPxtlDayZKvvaV+mOOrpzecmz1hez00Go=
github.com/SimplyCodin/bilit v0.0.0-20190826050318-5ab9e1694da9/go.mod h1:fUMSmukB2OQxFkWOZG9LpoYogb+IaBdQVQ2uKHzk2gA=
20 changes: 14 additions & 6 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package main

import (
//"encoding/json"
"fmt"

"github.com/SimplyCodin/bilit"
)

func main() {
str := bilit.Populate("Hello, I'm {{name}} from {{City}}, {{from_state}}", bilit.Data{
bilit.Debug = true
const template = "Hello, I'm {{name}} from ${City}, {{from_state}}"
var dataSrc = map[string]string{
"name": "John",
"City": "Dallas",
"from_state": "TX",
})
print(str)
popstr := "Hello, I'm John from Dallas, TX"
test := bilit.Pull("Hello, I'm {{name}} from {{City}}, {{from_state}}", popstr)
print(test)
}

var str = bilit.Populate(template, dataSrc)
fmt.Println(str, "end")
var data = bilit.Pull(template, str)
fmt.Println(data)
// bts, _ := json.Marshal(data)
// fmt.Println(string(bts))
}

0 comments on commit 637cb81

Please sign in to comment.