GithubHelp home page GithubHelp logo

drudje's Introduction

drudje

Simple script for composing text files.

Installation

	gem install drudje

If you're using rbenv, you'll need to rehash:

	rbenv rehash

Usage

	drudje sourcedir destdir [extension]

sourcedir is a directory that holds source files that you'd like to process Note that it is not recursive

destdir is the directory that the processed files are written to

extension is an optional param and defaults to '.html' Only files in sourcedir with that extension will be processed.

Oftentimes, you'll want to continously re-run drudje when the template directory changes. I use rerun for this. To install re-run, go

gem install rerun
	rbenv rehash

Then, run it:

rerun -x -d sourcedir -- drudje sourcedir destdir

Template format

To call a template, place this in your source document:

	[[templatename]]

This will look for a file in the source directory with the name templatename.html (it'll use whatever extension specified by the extension command-line arg). You can also use templates from subfolders:

	[[controls/textbox]]

This will look for a template named controls/textbox.html under the source directory.

You can pass arguments to a template by specifying them as key-value pairs:

	[[templatename arg1=foo arg2="this is arg 2"]]

Arguments can be barewords, or wrapped in quotes if you want them to contain spaces.

You can use arguments in your template like this:

	[[=arg1]]

If the "arguments" aren't key-value pairs, then the entire blob of text after the template name is passed as an argument called "contents". This allows you to do things like wrapping

	[[paragraph Hello <strong>world!</strong>]]

And you can use the contents argument just like any other:

	<p>[[=contents]]</p>

drudje's People

Contributors

badjer avatar

Watchers

 avatar  avatar

drudje's Issues

Blocks containing inner ][ aren't expanded

ie,

given the template "small"

    <small>[[=contents]]</small>

And the input:

    [[small Hi [name] ]]

You'd expect the output

    <small>Hi [name]</small>

But instead get the untransformed input

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.