Module: EvilFront::Russian

Extended by:
Typograph
Defined in:
lib/evil-front/russian.rb

Overview

Helpers to work with Russian text.

Class Method Summary collapse

Methods included from Typograph

typograph, typograph_html

Class Method Details

.auto_flying_quotes(html) ⇒ Object

Find quotes in text and make them flying



19
20
21
22
23
24
# File 'lib/evil-front/russian.rb', line 19

def self.auto_flying_quotes(html)
  process_html(html) do |text|
    text.gsub(/\s«[^»]+»/) { |i| flying_quotes i[2..-2], space: i[0] }.
         gsub(/^«[^»]+»/)  { |i| flying_quotes i[1..-2], space: '' }
  end
end

.capitalize_first(text) ⇒ Object

Capitalize only first letter (like titles in Russian).

= EvilFront::Russian.capitalize_first(title)


14
15
16
# File 'lib/evil-front/russian.rb', line 14

def self.capitalize_first(text)
  UnicodeUtils.upcase(text[0]) + text[1..-1]
end

.flying_quotes(text, options = { }) ⇒ Object

Mark quotes to move first quote before the text line.



27
28
29
30
31
# File 'lib/evil-front/russian.rb', line 27

def self.flying_quotes(text, options = { })
  sp = options[:space] || ' '
  sp = "<span class=\"space-before-quote\">#{sp}</span>" if sp != ''
  "#{ sp }<span class=\"quotes\">«#{ text }»</span>"
end