Textigniter

Follow us on twitter @textigniter

Textigniter uses the power of Textile (Markdown is optional…), Liquid, LESS CSS, and Coffee Script to create static websites.

Installation

It’s easy

gem install textigniter

The default parser gem’s will be downloaded as well.

Usage

textigniter init (directory)

Passing the init option initializes a new textigniter environment in your current directory. You can pass a second option to specify a directory that you want to install textigniter in. The textigniter environment is found under a hidden directory named .textigniter.

textigniter build (directory)

Passing the build option will make textigniter parse the .textigniter directory and output the static html alongside the .textigniter directory.

Passing the build option also creates a manifest (.textigniter/manifest/) for the system to key off of in the future. The manifest tells textigniter only to rebuild modified or new files.

textigniter list (directory)

This will print out a list all textigniter files unless you specify a directory. Passing the directory option will list only that directory (Duh?) This is the only textigniter command that requires you to be in the textigniter environment to work.

textignier scrub (directory)

WARNING: essentially an rm -r unix command at this point. If you run it with directory specified, it will remove the entire directory and not just textigniter content

When you pass the scrub option, all textigniter related files and folders will be removed (I’m rethinking the use of this. It will probably “scrub” the base folder of anything not found in the textigniter environment instead).

textigniter help

Passing help on the command line will print out usage of textigniter.

Configuration

You can add any key:value pair to ./textigniter/config.yml as long as it follows YAML format. Anything added to the config file is available as a variable in your templates.

If you have site_name: Textigniter in the config file, it would be available in your templates as {{ site_name }}

Content

Content is stored in text files instead of a database. You can find a default index.textile and about.textile under the .textigniter/content folder. Your folder structure will determine your site structure. If you wanted a link that was yoursite.com/articles/textigniter, your folder and file structure would be .textigniter/content/articles/textigniter.textile. If you decide to use markdown instead of textile, make sure to update config.yml with the correct text_parser and change your file extensions from .textile to .markdown.

These text files are broken down into a meta section and sections delimited by -- content, -- variable_name. The meta section is parsed with YAML and all other sections are parsed with Textile. You can use any variable name you want for the text section and they’ll be available to the template parser. This is true for the meta section as well. An example file could look something like this:

title: Textigniter slug: textigniter tags: static, content, html5 author: Kaleb Heitzman -- content h1. This is textigniter powered -- sidebar h3. This is some sidebar content

The following variables would be available in the template according to the code above: title }, slug }, tags }, author }, content }, sidebar }.

Plugins

Textigniter supports meta section plugins. You can add custom plugin code to .textigniter/plugins. Plugins are named after their meta keys found in .textile files.

For example, if you had a meta key named twitter, you would create a twitter.rb file inside of the plugins directory with a class declaration of class Textigniter::Plugins::Twitter. The plugin must have a parse(h) method and must return the parsed value, i.e return value. h is the entire text hash with things like title, handle, slug and etc. This allows you combine other meta key:value combinations. We use this functionality for our breadcrumbs plugin. We take the slug and the Title to create an html string that we store in h['breadcrumbs']

Here is a sample template:

class Textigniter::Plugins::Twitter def parse(h) value = h['twitter'] return twitter end end

Templates

Textigniter uses liquid templates. Anything that goes in liquid can go in textigniter. Checkout the liquid documentation.

Anything in .textigniter/config.yml and the textile(markdown) file is available to the template. For example, site_name is declared in the config file and is available in the template file as site_name }

Styles

Styles are parsed via less. You can create .less files under .textigniter/styles with a .less extension and they will automatically be parsed.

See the LESS usage documentation for more information.

Scripts

Scripts are parsed via coffeescript. You can create .coffeescript files under .textigniter/scripts with a .coffeescript extension and they will automatically be parsed.

See the CoffeeScript homepage for more information.

Philosophy

HTML5 is the rising up-comer and with it come many advantages that in my opinion make databases overused for a majority of websites (Bloggers/Brochure Sites). Most dynamic content doesn’t need pulled from a database anymore because it can processed with Javascript and XML, i.e Twitter feeds. Static Site Generators can really excel in this area. Static content mixed with the power of Javascript and HTML5 is more than enough for a majority of users who want easily maintainable websites.