Skip to content
This repository

Fast Aleck is a fast HTML-aware typographical enhancement library that lets your text use proper ellipses, smart quotes, proper dashes and more.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 include
Octocat-spinner-32 src
Octocat-spinner-32 .hgtags
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CMakeLists.txt
Octocat-spinner-32 README.md
README.md

Fast Aleck Build Status

Fast Aleck is a tool for making text look smarter by using proper Unicode characters. For example, ... becomes … (…) and -- becomes — (—). Its goal is to be the fastest text cleaning tool out there. It is HTML-aware and also supports UTF-8.

Status

Fast Aleck is alpha quality. Expect things to break. If it breaks, please do let me know! Crash reports and examples of incorrect output are greatly appreciated!

How fast is it really?

Here are the results of a benchmark in which a copy of Alice's Adventures in Wonderland is typographically enhanced (see ruby/bench.rb):

                                   user     system      total        real
alice-rubypants (x10)         14.620000   0.470000  15.090000 ( 15.088082)
alice-typogruby (x100)        32.820000   0.120000  32.940000 ( 32.957644)
alice-fast-aleck-all-options  36.110000   5.040000  41.150000 ( 42.310613)
alice-fast-aleck-no-options   12.880000   1.940000  14.820000 ( 14.932533)

Fast Aleck runs 5000 times, Rubypants 500 times and Typogruby 50 times (hence the x10 and x100 indicators).

no-options has the same features as Rubypants, while all-options has the same features as Typogruby. These benchmarks indicate that Fast Aleck in its current state is about one order of magnitude faster than Rubypants, and about two orders of magnitude faster than Typogruby.

No development time has been spent on optimising Fast Aleck yet, but this will hopefully happen Soon™.

Features

  • ... → …
  • -- → —
  • --- → —
  • '' → ‘’
  • "" → “”
  • Skips text inside code, kbd, pre and script elements
  • Optionally wraps &amp; in <span class="amp"> so you can pick the font with the prettiest ampersand
  • Optionally wraps ' in a span with class quo
  • Optionally wraps " in a span with class dquo
  • Optionally replaces last significant whitespace in a block with a non-breaking space (Widon’t)
  • Optionally wraps sequences of capitals in <span class="caps"> so you can use small caps.

Example input:

This... CANNOT be true--it's impossible! "I had five EC2 instances!"

Example output:

This… <span class="caps">CANNOT</span> be true&mdash;it’s impossible! “I had
five <span class="caps">EC2</span>&nbsp;instances!”

Installation

Building Fast Aleck requires CMake. Once you have that:

% mkdir build
% cd build
% cmake ..
% make

There will be three executables in the build directory once that is finished:

  • fast-aleck is the commandline tool (try fast-aleck --help for help)
  • libfast-aleck.so is the shared library (the exact name might differ depending on the OS)
  • fast-aleck-test is a tool that runs the tests

If you intend to use the Ruby bindings, copy libfast-aleck.so to a public location (such as /usr/local/lib) or into the directory where you are executing Ruby from. For instance, if you want to use Fast Aleck with nanoc, you can copy libfast-aleck.so into the site directory (not in ./lib).

Related Projects

Something went wrong with that request. Please try again.