Giter Club home page Giter Club logo

scribe's Introduction

Scribe

Templater written in Golang based on sprig functions

Inspiriration from https://github.com/tsg/gotpl

Installation

make

Getting Started

Ex:

Given there is a file input.yaml of the form,

bread:
  title: "bread_preferences.md"
  sourdough:
    - name: rye
      prefer: eat
    - name: wheat
      prefer: bake
coffee:
  title: "coffee_tasting.md"
  beans:
    - name: ethiopian
      taste: berries
    - name: columbian
      taste: chocolate

and a template in path mytemplates/{{ .bread.title }} of the form,

# My Sourdough Bread Preferences
{{ range $bread := .bread.sourdough }}
{{- if eq $bread.prefer "eat" }}
- I like to eat {{ $bread.name }} bread.
{{- end }}
{{- if eq $bread.prefer "bake" }}
- I prefer to bake {{ $bread.name }} bread.
{{- end }}
{{- end }}

and a template in path mytemplates/{{ .coffee.title }} of the form,

# My Impressions of Various Coffee
{{ range $coffee := .coffee.beans }}
{{- if eq $coffee.taste "berries" }}
- The {{ $coffee.name | title }} coffee tastes of berries.
{{- end }}
{{- if eq $coffee.taste "chocolate" }}
- The {{ $coffee.name | title }} coffee tastes of chocolate.
{{- end }}
{{- end }}

execution of scribe,

scribe -in=input.yaml -templates=mytemplates -out=myoutput

produces a file at path myoutput/bread_preferences.md with the content

# My Sourdough Bread Preferences

- I like to eat rye bread.
- I prefer to bake wheat bread.

and produces a file at path myoutput/coffee_tasting.md with the content

# My Impressions of Various Coffee

- The Ethiopian coffee tastes of berries.
- The Columbian coffee tastes of chocolate.

scribe's People

Contributors

bdrich avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.