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 CHANGED
@@ -1,3 +1,6 @@
1
+ Версия 0.04 - 20.10.2005
2
+ * Чистка документации
3
+
1
4
  Версия 0.03 - 18.10.2005
2
5
  * Легкий рефакторинг и чистка документации, добавлена реализация BiDi-транслита
3
6
 
data/bin/gilensize CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  $KCODE = 'u'
3
- require 'rubygems'
4
- require_gem 'rutils'
3
+ require File.dirname(__FILE__) + '/../lib/rutils'
5
4
 
6
5
  while st = gets do
7
6
  puts RuTils::Gilenson::Formatter.new(st).to_html
@@ -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)
@@ -1,5 +1,5 @@
1
1
  module RuTils
2
- class Gilenson < String #:nodoc:
2
+ class Gilenson::New < String #:nodoc:
3
3
 
4
4
  def initialize(*args)
5
5
  # Задача (вкратце) состоит в том чтобы все ступени разработки развести в отдельные методы
@@ -1,10 +1,13 @@
1
1
  module RuTils
2
2
 
3
- module GilensonMixin
4
- # Форматирует строку с помощью Gilensize
5
- def gilensize(*args)
6
- RuTils::Gilenson.new(self, *args).to_html
7
- end
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 => 'Эти &laquo;так называемые&raquo; великие деятели'
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::GilensonMixin
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
- text
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
- # RuTils::overrides_enabled? ? text.replace(RuTils::Gilenson.new(text).to_html) : stock_pgl(text)
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
@@ -3,7 +3,7 @@ require 'jcode'
3
3
 
4
4
  # Главный контейнер модуля
5
5
  module RuTils
6
- VERSION = '0.0.3'
6
+ VERSION = '0.0.4'
7
7
  end
8
8
 
9
9
  require File.dirname(__FILE__) + '/pluralizer/pluralizer'
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.3
7
- date: 2005-10-19 00:00:00 +02:00
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