Skip to content
/ glyph Public
forked from h3rald/glyph

A Ruby-powered Rapid Document Authoring Framework

License

Notifications You must be signed in to change notification settings

rkj/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:


section[
  @title[Something about Glyph]
  txt[
You can use Glyph macros in conjunction 
with _Textile_ or _Markdown_ to
produce HTML files effortlessly.
  ]
  p[Alternatively, you can just use em[Glyph itself] to generate HTML tags.]
  section[
    @title[What about PDFs?]
    @id[pdf]
    p[
Once you have a single, well-formatted HTML 
file, converting it to PDF is
extremely easy with a free 3rd-party 
renderer like =>[http://www.princexml.com|Prince] 
or =>[http://code.google.com/p/wkhtmltopdf/|wkhtmltopdf].
    ]
  ]   
]

The Glyph code above corresponds to the following HTML code:


<div class="section">
  <h2 id="h_10">Something about Glyph</h2>
  <p>
    You can use Glyph macros in conjunction with 
    <em>Textile</em> or <em>Markdown</em> to
    produce HTML files effortlessly.
  </p>
  <p>
    Alternatively, you can just use <em>Glyph itself</em>
    to generate HTML tags.
  </p>
  <div class="section">
   <h3 id="pdf">What about PDFs?</h3>
   <p>
     Once you have a single, well-formatted HTML 
     file, converting it to PDF is
     extremely easy with a free 3rd-party renderer 
     like <a href="http://www.princexml.com">Prince</a> 
     or <a href="http://code.google.com/p/wkhtmltopdf/\">wkhtmltopdf</a>.
   </p>
  </div>
</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!):


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

…which results in:


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

About

A Ruby-powered Rapid Document Authoring Framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%