Module: EvilFront::Russian
- Extended by:
- Typograph
- Defined in:
- lib/evil-front/russian.rb
Overview
Helpers to work with Russian text.
Class Method Summary collapse
-
.auto_flying_quotes(html) ⇒ Object
Find quotes in text and make them flying.
-
.capitalize_first(text) ⇒ Object
Capitalize only first letter (like titles in Russian).
-
.flying_quotes(text, options = { }) ⇒ Object
Mark quotes to move first quote before the text line.
Methods included from Typograph
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.(html) process_html(html) do |text| text.gsub(/\s«[^»]+»/) { |i| i[2..-2], space: i[0] }. gsub(/^«[^»]+»/) { |i| 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.(text, = { }) sp = [:space] || ' ' sp = "<span class=\"space-before-quote\">#{sp}</span>" if sp != '' "#{ sp }<span class=\"quotes\">«#{ text }»</span>" end |