Git Product home page Git Product logo

gendoc's Introduction

gendoc

gendoc on crates.io Rust

Simple document generator with template yaml file

Usage

Run gendoc with gendoc.yaml file

$ cat gendoc.yaml
filename: test_<datetime>.rb
body: |
  # frozen_string_literal: true

  require 'json'

  puts JSON.parse("{}")
$ gendoc
Document generated: ./test_20200927023752.rb
$ cat test_20200927023752.rb
# frozen_string_literal: true

require 'json'

puts JSON.parse("{}")
$ ruby test_20200927023752.rb
{}

Settings

There are some setting parameters.

parameter info required
filename A filename of a generated document. โ—‹
body A body of a generated document. โ—‹
dir A directory of a generated document. It will be parsed as a relative path (ex: tmp -> ./tmp). gendoc does NOT create a new directory on generation time.

Meta tags

There are some meta tags which are converted on generation time.

meta tag info
<date> Converted to formatted date. Format is YYYYmmdd. (ex: <date> -> 19720719)
<date:_format_string_> Same as <date>, and you can pass an format string. (ex: <date:%Y-%m-%d> -> 1972-07-19)
<datetime> Converted to formatted datetime. Format is YYYYmmddHHMMSS. (ex: <datetime> -> 19720719000545)
<datetime:_format_string_> Same as <datetime>, and you can pass an format string. (ex: <datetime:%Y-%m-%d-%H%M%S> -> 1972-07-19-000545)
<input> Converted to input text. You should pass text from STDIN on generation time.

To get more info abount format string, see here.

Multiple settings

Here's a sample gendoc.yaml to set multiple settings.

sample1:
  filename: sample1.txt
  body: |
    this is a 1st setting
saple2:
  filename: sample2.txt
  body: |
    this is a 2nd setting

Run gendoc with a setting name.

$ gendoc sample2
Document generated: sample2.txt
$ cat sample2.txt
this is a 2nd setting

TODO

  • Be able to set argument to <input> tag. (<input> with the same argument will be filled with the same value.)

gendoc's People

Contributors

furuhama avatar

Stargazers

Nozomi Morimoto avatar  avatar

Watchers

James Cloos 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.