Skip to content

h3rald/glyph

Repository files navigation

Glyph is a Rapid Document Authoring Framework.

With Glyph, creating and maintaining any kind of document becomes as easy as… programming. Glyph enables you to minimize text duplication, focus on content rather than presentation, manage references seamlessly and automate tedious tasks through a simple but effective macro language, specifically geared towards customization and extensibility.

Main Features

Command Line Interface

Glyph is 100% command line. Its interface resambles Git’s for its simplicity and power (thanks to the gli gem). Here are some example commands:

  • glyph init — to initialize a new Glyph project in the current (empty) directory.
  • glyph add introduction.textile — to create a new file called introduction.textile.
  • glyph compile — to compile the current document into a single HTML file.
  • glyph compile --auto — to keep recompiling the current document every time a file is changed.
  • glyph compile -f pdf — to compile the current document into HTML and then transform it into PDF.
  • glyph compile readme.glyph — to compile a readme.glyph located in the current directory into a single HTML file.
  • glyph outline -l 2 — Display the document outline, up to second-level headers.
  • glyph stats — Display project statistics.

Minimalist Syntax

Glyph syntax rules can be explained using Glyph itself:

 1section[
2 @title[Something about Glyph]
3 txt[
4You can use Glyph macros in conjunction
5with Textile or Markdown to
6produce HTML files effortlessly.
7 ]
8 p[Alternatively, you can just use em[Glyph itself] to generate HTML tags.]
9 section[
10 @title[What about PDFs?]
11 @id[pdf]
12 p[
13Once you have a single, well-formatted HTML
14file, converting it to PDF is
15extremely easy with a free 3rd-party
16renderer like =>[http://www.princexml.com|Prince]
17or =>[http://code.google.com/p/wkhtmltopdf/|wkhtmltopdf].
18 ]
19 ]
20]

The Glyph code above corresponds to the following HTML code:

 1<div class="section">
2 <h2 id="h_10">Something about Glyph</h2>
3 <p>
4 You can use Glyph macros in conjunction with
5 <em>Textile</em> or <em>Markdown</em> to
6 produce HTML files effortlessly.
7 </p>
8 <p>
9 Alternatively, you can just use <em>Glyph itself</em>
10 to generate HTML tags.
11 </p>
12 <div class="section">
13 <h3 id="pdf">What about PDFs?</h3>
14 <p>
15 Once you have a single, well-formatted HTML
16 file, converting it to PDF is
17 extremely easy with a free 3rd-party renderer
18 like <a href="http://www.princexml.com">Prince</a>
19 or <a href="http://code.google.com/p/wkhtmltopdf/">wkhtmltopdf</a>.
20 </p>
21 </div>
22</div>

Content Reuse

Finding yourself repeating the same sentence over an over? Glyph allows you to create snippets. Within snippets. Within other snippets (and so on, for a long long time…) as long as you don’t define a snippet by defining itself, which would be kinda nasty (and Glyph would complain!):

1snippet:[entities|snippets and macros]
2snippet:[custom_definitions|
3 p[Glyph allows you to define your own &[entities].]
4]
5&[custom_definitions]

…which results in:

1<p>Glyph allows you to define your own snippets and macros.</p>

If yourself dreaming about parametric snippets, just create your own macros (see the source of Glyph’s changelog, just to have an idea).

Automation of Common Tasks

If you’re writing a book, you shouldn’t have to worry about pagination, headers, footers, table of contents, section numbering or similar. Glyph understands you, and will take care of everything for you (with a little help from CSS3, sometimes).

Reference Validation

Feel free to add plenty of links, snippets, bookmarks, … if Glyph doesn’t find something, it will definitely complain. Broken references are a thing on the past, and you don’t need to worry about it.

Extreme Extensibility

  • You miss a !!! macro to format really, really important things? Create it. In under 3 seconds, in Ruby or Glyph itself. And yes, you can use special characters, too.
  • You want your own, very special special glyph create --everything command to create all you need in a Glyph project? You can do it. Using your own Rake tasks, too.
  • You want Glyph to output ODF files? You can do it, and you’ll be able to run glyph generate -f odf. This would probably require a little more time, but it’s trivial, from a technical point of view.

Convention over Configuration

Put your text files in /text, your images in /images, add custom macros in a macro folder within your /lib folder… you get the picture: Glyph has its special places.

Nonetheless, you also have 1 (one) configuration file to customize to your heart’s content (with smart defaults).

Free and Open Source

Glyph is 100% Open Source Software, developed using the Ruby Programming Language and licensed under the very permissive terms of the MIT License.

If you have Ruby installed, just run gem install glyph. That’s all it takes.