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
require_relative 'typograph'
typograph = Typograph::MdashTypograph.new
p formatted_text = typograph.text("Текст — зафиксированная на носителе человеческая мысль.")
# => "<p>Текст — зафиксированная на носителе человеческая мысль.</p>"
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!