Git Product home page Git Product logo

documents's Introduction

Documents

Documents is a simple template engine built on top of Jinja2 and built with Click. It turns your templates into interactive cli applications and returns a rendered document ready to be saved.

Installation

  1. Clone the repository
  2. Run python setup.py install

Usage

You can use Documents as a cli appliaction or as a module.

Cli app

Simply run documents from you command line. For additional information run documents --help.

Options

--temp_dir The path to the template directory. Default is ./templates --extensions Limit the template files by listing extensions --template The name of the templat)

Module

If you want to integrate Documents into your app or you simpy want to play with the module, just import documents.

Example:

>>> from documents import get_env, get_templates >>> get_templates(get_env()) # Returns a list of templates in the templates dir

Developers

What the app does is it looks into your templates directory - the default directory is ./templates - and returns the list of your templates.

Templates can be HTML, md, rst or any text files you wish, regardless of their markup. What makes them templates is the use of the Jinja2 markup language. The basic idea is that variables are encapsulated with curly brackets {{ }}.

There is of course a lot more to it, and tons of options, like template inheritance, so I encourage you to read Jinja2's documentation.

When the app get's a template it looks for its variables and turns them into "prompts" (click.prompt() methods to be exact). Once the user enters all the variables, the app crates a dict and renders the template with it.

TODO: saving

For now the app has no save option. But one will be added soon. Till then I recomend using a pipe.

MISC

I'll be doing a Flask app and a Flask Rest API with a simple JS frontend in the future, so you won't be stuck with the cli version.

If you have any suggestions or just feel like talking, find me on Twtitter: @dasdachs_.

Cheers!

documents's People

Contributors

dasdachs 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.