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



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

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)


16
17
18
# File 'lib/evil-front/russian.rb', line 16

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.



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

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