From fa092d72abe9cd14294fb7e2af8848be16741e84 Mon Sep 17 00:00:00 2001 From: fall simply Date: Fri, 13 Mar 2020 00:13:36 -0500 Subject: [PATCH] chore: add license and update readme --- LICENSE | 9 +++++++++ README.md | 25 ++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..62cd612 --- /dev/null +++ b/LICENSE @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index 0e52d02..19170ba 100644 --- a/README.md +++ b/README.md @@ -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] } -``` \ No newline at end of file +``` +Open [Example Folder](./example) + +## Special Thanks