No commit activity in last 3 years
No release in over 3 years
Allows to type design your text with the help of the mdash.ru's API (Russian language).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.8
 Project Readme

Build Status Gem Version

typograph-apiclient-ru

Allows to type design your text with the help of the mdash.ru's API (Russian language). Can be installed as a gem:

gem install typograph-apiclient-ru

How to use it

1. Initialize a class and type design your text

require_relative 'typograph'
typograph = Typograph::MdashTypograph.new
p formatted_text = typograph.text("Текст — зафиксированная на носителе человеческая мысль.")
# => "<p>Текст&nbsp;&mdash; зафиксированная на&nbsp;носителе человеческая мысль.</p>"

2. Set up your error handling

Warning: in case for any reason API is unavailable - the same text as passed will be returned (i.e. no error raised).

require_relative 'typograph'
typograph = Typograph::MdashTypograph.new
begin
  formatted_text = typograph.text(nil)
rescue ArgumentError => e
  puts "#{e.message}. Error message rescued!"
end
# => Incorrect argument given - NilClass. Must be String!. Error message rescued!