Glyph 0.2.0 Released

Featuring single-file compilation, programmatic usage and auto-regeneration, and more

I am very pleased to announce the second release of the Glyph Document Authoring Framework. For those who don't know, Glyph is a pure-Ruby, extensible solution to author documents like books or articles using a simple, fully-customizable markup language.

Since the first release, came out, last month, a lot happened. Plenty of bugs were fixed and new features implemented, as shown by the changelog. Here's a brief rundown of the most notable changes.

What Glyph code looks like

Earlier this week I blogged about my new Glyph vim syntax file. I've been using it for a while, and all I can say is that it really helps! Here's what it looks like:

I'm sorry for the Emacs and TextMate folks, but I only use Vim, so I only made a Vim syntax file. Anyhow, Glyph grammar is very simple, so rolling out your own syntax file for your favorite editor shouldn't be too hard.

Notable features

Single-file compilation

Perhaps the most life-changing feature in this release is the possibility of compiling a single Glyph source file into an HTML or PDF file. This means you no longer need to create a full-blown project for writing a short article: just create a file anywhere and run glyph compile filename.glyphon it!

The good thing is that with this new release you can also define snippets, configuration settings, and even macros right into your Glyph files, so you can do almost anything without having to create a project or fiddle with YAML files.

Programmatic usage

The second most notable feature is the possibility to use Glyph as a Ruby library, i.e. as you'd use a filter like RedCloth or MarkDown. Additionally, it is also possible to compile single files programmatically, so you can, for example, create PDF files for your articles from the same source file. Don't believe me? Feel free to click the Download PDF and View Source links on this very page to see for yourself…

For those of you using the awesome nanoc static site generator, here's a few source files you may want to take a look at:

Auto-regeneration

Another very interesting feature is the possibility to auto-regenerate your output files automatically whenever a source file is changed. Just run glyph compile --auto and you're away. I'd like to thank Sebastian Staudt for proposing, implementing, and testing this feature.

Conditional macros

Finally, although it may worry some, I added the possibility to evaluate conditional expressions directly in Glyph. The syntax is a bit verbose due to the extreme simplicity of Glyph parser, but it does the job:

?[and[ eq[$[document.output]|pdf]| eq[$[tools.pdf_generator]|prince] ]| style[pagination.css]]

The snippet above can be used to include the pagination.css stylesheet only when generating a PDF file with Prince XML.

What's next?

Release 0.3.0 is currently being planned, and so are its features. For now, I'd like to thank the following individuals for contributing to Glyph:

  • Jamie Atkinson (Jabbslad), for spotting and fixing some bugs and providing feedback.
  • Sebastian Staudt (koraktor), for spotting and fixing some bugs, proposing and implementing new features.

In particular, Sebastian is working on bibliogaphy support for Glyph, looking forward to it!

Although still in its infancy, Glyph is becoming more and more usable everyday. If you are interested, you can contribute in many different ways to the project, such as:

  • By participating to discussions on the user group (it's a bit quiet of there for now…)
  • By spreading the word on Twitter, on your blog, or wherever you like.
  • By installing it, using it, reporting bugs and proposing new features (it's just a gem install glyph away!).
  • By actually contributing to its development (it's easy!).

Additionally, if you don't like coding:

  • feedback on the current documentation and on the Glyph book is appreciated
  • if you are good with CSS, I'm looking for some nice new CSS styles to include in the standard Glyph distribution.
  • if you're good with graphics, Glyph needs a good-looking logo…

Any form of contribution will be credited in some way, e.g. by links and tweets.