rutils 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/bin/gilensize +1 -2
- data/lib/datetime/datetime.rb +5 -22
- data/lib/gilenson/gilenson.rb +1 -1
- data/lib/gilenson/gilenson_port.rb +15 -7
- data/lib/integration/blue_cloth_override.rb +1 -1
- data/lib/integration/red_cloth_override.rb +4 -3
- data/lib/rutils.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/bin/gilensize
CHANGED
data/lib/datetime/datetime.rb
CHANGED
@@ -2,8 +2,11 @@ require 'date'
|
|
2
2
|
|
3
3
|
module RuTils
|
4
4
|
module DateTime
|
5
|
-
ABBR_MONTHNAMES = %w{ Янв Фев Мар Апр Май Июн Июл Авг Сен Окт Ноя Дек }
|
6
|
-
MONTHNAMES = %w{ Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь }
|
5
|
+
ABBR_MONTHNAMES = [nil] + %w{ Янв Фев Мар Апр Май Июн Июл Авг Сен Окт Ноя Дек }
|
6
|
+
MONTHNAMES = [nil] + %w{ Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь }
|
7
|
+
DAYNAMES = %w(Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота)
|
8
|
+
ABBR_DAYNAMES = %w(Вск Пн Вт Ср Чт Пт Сб)
|
9
|
+
|
7
10
|
def self.distance_of_time_in_words(from_time, to_time = 0, include_seconds = false, absolute = false) #nodoc
|
8
11
|
from_time = from_time.to_time if from_time.respond_to?(:to_time)
|
9
12
|
to_time = to_time.to_time if to_time.respond_to?(:to_time)
|
@@ -34,26 +37,6 @@ module RuTils
|
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
37
|
-
class RuTils::DateTime::RussianDate < Date
|
38
|
-
# Full month names, in English. Months count from 1 to 12; a
|
39
|
-
# month's numerical representation indexed into this array
|
40
|
-
# gives the name of that month (hence the first element is nil).
|
41
|
-
MONTHNAMES = [nil] + %w(Январь Февраль Март Апрель Май Июнь Июль
|
42
|
-
Август Сентябрь Октябрь Ноябрь Декабрь)
|
43
|
-
|
44
|
-
# Full names of days of the week, in English. Days of the week
|
45
|
-
# count from 0 to 6 (except in the commercial week); a day's numerical
|
46
|
-
# representation indexed into this array gives the name of that day.
|
47
|
-
DAYNAMES = %w(Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота)
|
48
|
-
|
49
|
-
# Abbreviated month names, in English.
|
50
|
-
ABBR_MONTHNAMES = [nil] + %w(Янв Фев Мар Апр Май Июнь
|
51
|
-
Июль Авг Сен Окт Ноя Дек)
|
52
|
-
# Abbreviated day names, in English.
|
53
|
-
ABBR_DAYNAMES = %w(Вск Пн Вт Ср Чт Пт Сб)
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
40
|
class Date
|
58
41
|
def ru_strftime(*args)
|
59
42
|
RuTils::DateTime::RussianDate.new(self).strftime(*args)
|
data/lib/gilenson/gilenson.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
module RuTils
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module Gilenson
|
4
|
+
module StringFormatting
|
5
|
+
# Форматирует строку с помощью Gilenson. Всп дополнительные опции передаются форматтеру.
|
6
|
+
def gilensize(*args)
|
7
|
+
args = {} unless args.is_a?(Hash)
|
8
|
+
RuTils::Gilenson::Formatter.new(self, *args).to_html
|
9
|
+
end
|
10
|
+
end
|
8
11
|
end
|
9
12
|
|
10
13
|
# Это - прямой порт Тыпографицы от pixelapes.
|
@@ -14,7 +17,7 @@ module RuTils
|
|
14
17
|
# typ.html = false => "false"
|
15
18
|
# typ.dash = true => "true"
|
16
19
|
# typ.to_html => 'Эти «так называемые» великие деятели'
|
17
|
-
class Gilenson
|
20
|
+
class Gilenson::Typografica
|
18
21
|
def initialize(text, *args)
|
19
22
|
@_text = text
|
20
23
|
@skip_tags = true;
|
@@ -327,6 +330,11 @@ module RuTils
|
|
327
330
|
|
328
331
|
end #end RuTils
|
329
332
|
|
333
|
+
unless defined?(RuTils::Gilenson::Formatter)
|
334
|
+
class RuTils::Gilenson::Formatter < RuTils::Gilenson::Typografica
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
330
338
|
class String
|
331
|
-
include RuTils::
|
339
|
+
include RuTils::Gilenson::StringFormatting
|
332
340
|
end
|
@@ -2,7 +2,7 @@ if defined?(BlueCloth)
|
|
2
2
|
class BlueCloth < String #:nodoc:
|
3
3
|
alias_method :old_to_html, :to_html
|
4
4
|
def to_html(*opts)
|
5
|
-
RuTils::overrides_enabled? ? RuTils::Gilenson.new(old_to_html(*opts)).to_html : old_to_html(*opts)
|
5
|
+
RuTils::overrides_enabled? ? RuTils::Gilenson::Formatter.new(old_to_html(*opts)).to_html : old_to_html(*opts)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,16 +2,17 @@ if defined?(RedCloth)
|
|
2
2
|
# RuTils выполняет перегрузку Textile Glyphs в RedCloth, перенося форматирование спецсимволов на Gilenson.
|
3
3
|
class RedCloth < String #:nodoc:
|
4
4
|
# Этот метод в RedCloth эскейпит слишком много HTML, нам ничего не оставляет :-)
|
5
|
+
alias_method :stock_htmlesc, :htmlesc
|
5
6
|
def htmlesc(text, mode=0) #:nodoc:
|
6
|
-
|
7
|
+
RuTils::overrides_enabled? ? text : stock_htmlesc(text, mode)
|
7
8
|
end
|
8
9
|
|
9
10
|
# А этот метод обрабатывает Textile Glyphs - ту самую типографицу.
|
10
11
|
# Вместо того чтобы влезать в таблицы мы просто заменим Textile Glyphs - и все будут рады.
|
11
12
|
alias_method :stock_pgl, :pgl
|
12
13
|
def pgl(text) #:nodoc:
|
13
|
-
|
14
|
-
text.replace(RuTils::Gilenson.new(text).to_html)
|
14
|
+
RuTils::overrides_enabled? ? text.replace(RuTils::Gilenson::Formatter.new(text).to_html) : stock_pgl(text)
|
15
|
+
#text.replace(RuTils::Gilenson.new(text).to_html)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
data/lib/rutils.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rutils
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2005-10-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2005-10-20 00:00:00 +02:00
|
8
8
|
summary: Simple processing of russian strings
|
9
9
|
require_paths:
|
10
10
|
- lib
|