MultiTypograf
There are lot of Ruby libraries for typographing text. Instead of choosing a single implementation and forcing users of your library to be stuck with it, you can use MultiTypograf instead, which will simply choose the best available tipographer. Here's how to use it:
require 'multi_typograf'
MultiTypograf.process('тест') #=> 'тест'
The use
method, which sets the MultiTypograf adapter, takes either a symbol or a
class (to allow for custom CSS minifier) that responds to .process
at the class level.
MultiTypograf tries to have intelligent defaulting. That is, if you have any of the supported engines already loaded, it will utilize them before attempting to load any. It will load libraries in following order:
- art_typograf wrapper for http://www.artlebedev.ru/tools/typograf/
- TODO typographer
- TODO typographica
If no other library is available, MultiTypograf falls back to typograf wrapper for http://www.typograf.ru/.
HTML::Pipeline
pipeline = HTML::Pipeline.new [
MultiTypograf::Filter
]
pipeline.call('тест') #=> 'тест'
TODO
- map options
- HtmlPipeline filter
- Rails plugin
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request