rutils 1.1.1 → 1.1.3

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/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ === 1.1.3 - 15.10.2010
2
+
3
+ * Добавлена лицензия
4
+
5
+ === 1.1.2 - 15.10.2010
6
+
7
+ * Убраны остатки модуля Gilenson
8
+
1
9
  === 1.1.1 - 15.10.2010
2
10
 
3
11
  * rutils довольно-таки старая штука. Для тех кто пользуется Gilenson мы теперь сервируем его отдельно и используем его из rutils. В связи с этим
data/MIT_LICENSE.txt ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2004-2010 Julik Tarkhanov, Danil Ivanov, Yaroslav Markin and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ Данная лицензия разрешает, безвозмездно, лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми "Программное Обеспечение"), использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий:
23
+
24
+ Вышеупомянутый копирайт и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения.
25
+
26
+ ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ ЛЮБОГО ВИДА ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И НЕНАРУШЕНИЯ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.
data/Manifest.txt CHANGED
@@ -1,4 +1,5 @@
1
1
  History.txt
2
+ MIT_LICENSE.txt
2
3
  Manifest.txt
3
4
  README.txt
4
5
  Rakefile.rb
@@ -7,12 +8,7 @@ bin/rutilize
7
8
  init.rb
8
9
  lib/countries/countries.rb
9
10
  lib/datetime/datetime.rb
10
- lib/gilenson/bluecloth_extra.rb
11
11
  lib/gilenson/gilenson_stub.rb
12
- lib/gilenson/helper.rb
13
- lib/gilenson/maruku_extra.rb
14
- lib/gilenson/rdiscount_extra.rb
15
- lib/gilenson/redcloth_extra.rb
16
12
  lib/integration/integration.rb
17
13
  lib/integration/rails_date_helper_override.rb
18
14
  lib/integration/rails_pre_filter.rb
@@ -22,14 +18,9 @@ lib/transliteration/bidi.rb
22
18
  lib/transliteration/simple.rb
23
19
  lib/transliteration/transliteration.rb
24
20
  lib/version.rb
25
- test/extras/integration_bluecloth.rb
26
- test/extras/integration_maruku.rb
27
21
  test/extras/integration_rails_filter.rb
28
22
  test/extras/integration_rails_gilenson_helpers.rb
29
23
  test/extras/integration_rails_helpers.rb
30
- test/extras/integration_rdiscount.rb
31
- test/extras/integration_redcloth3.rb
32
- test/extras/integration_redcloth4.rb
33
24
  test/run_tests.rb
34
25
  test/test_datetime.rb
35
26
  test/test_integration.rb
data/README.txt CHANGED
@@ -10,9 +10,6 @@ RuTils - простой обработчик русского текста на
10
10
 
11
11
  Разработчики RuTils - {Julik}[http://julik.nl], {Mash}[http://imfo.ru], {Yaroslav Markin}[http://markin.net/]
12
12
 
13
- Большое спасибо Роману Иванову aka Kukutz и Николаю Яремко aka Kuso Mendokuzee за
14
- реализацию большинства алгоритмов на PHP.
15
-
16
13
  = Как воспользоваться
17
14
 
18
15
  Просто включите rutils в свою программу как библиотеку
@@ -61,10 +58,7 @@ RuTils на данный момент реализует простейший т
61
58
 
62
59
  == Обработка русской типографики в HTML
63
60
 
64
- Gilenson - порт Typografica[http://pixel-apes.com/typografica] от Pixel Apes.
65
- Тыпографица - механизм автоматической расстановки подстановок в тексте перед его
66
- выводом в HTML, оформляющий неразрывные пробелы, типографские кавычки и тому
67
- подобные "украшательства".
61
+ rutils автоматически использует Gilenson (http://github.com/julik/gilenson) - улучшайзер типографики в русском наборе.
68
62
 
69
63
  Gilenson расставит в тексте "умные" правильные кавычки (русские - для кириллицы,
70
64
  английские - для латиницы), заменит "хитрые" пунктуационные символы на entities и
@@ -73,14 +67,6 @@ Gilenson расставит в тексте "умные" правильные к
73
67
  %q{"И это называется языком?", -- таков был его вопрос}.gilensize => "«И
74
68
  это называется языком?», — таков был его вопрос"
75
69
 
76
- Более подробная документация по Gilenson доступна в документах к
77
- RuTils::Gilenson::Formatter
78
-
79
- В комплекте также есть скрипт gilensize, которым можно поточно обрабатывать
80
- Unicode-тексты в среде UNIX пользуясь стандартным выводом
81
-
82
- $ cat myfile.txt | gilensize > myfile.html
83
-
84
70
  == Даты
85
71
 
86
72
  В класс Date введены следующие константы:
@@ -110,21 +96,9 @@ Unicode-тексты в среде UNIX пользуясь стандартны
110
96
  == Интеграция с RedCloth и BlueCloth
111
97
 
112
98
  RuTils в первую очередь задумывался как максимально "прозрачный" механизм
113
- обработки русского текста в контексте Rails-приложения.
114
-
115
- Если вы используете RuTils в одном приложении со стандартными форматтерами (RedCloth, BlueCloth...) воспользуйтесь
116
- дополнительными модулями которые выводят отформатированный Гиленсоном результат работы форматтеров
117
-
118
- Gilenson определяет следующие дополнительные форматтеры (они работают так же как и их базовые классы)
119
-
120
- * RuTils::Gilenson::RedClothExtra
121
- * RuTils::Gilenson::BlueClothExtra
122
- * RuTils::Gilenson::RDiscountExtra
123
- * RuTils::Gilenson::MarukuExtra
124
-
125
- В этих классах Gilenson будет обрабатывать типографику во всех текстах, пропускаемых через
126
- них. Эти классы при включенном флаге RuTils.overrides автоматически подключаются в хелперы
127
- +markdown+ и +textilize+.
99
+ обработки русского текста в контексте Rails-приложения. Вывод стандартных рельсовых
100
+ хелперов +markdown+ и +textilize+ будет автоматически (при включенных overrides) пропускаться через
101
+ Гиленсон.
128
102
 
129
103
  == Интеграция с Rails версии 2.2.2 и выше
130
104
 
@@ -194,16 +168,15 @@ RubyKanjiCode в своем httpd.conf.
194
168
 
195
169
  == Если вы все сделали правильно но что-то не работает
196
170
 
197
- Сообщите об ошибке на странице проекта на RubyForge[http://rubyforge.org/projects/rutils]
171
+ Сообщите об ошибке на странице проекта на github[http://github.com/julik/rutils/issues]
198
172
  Не забудьте указать версию, ее всегда можно узнать в константе
199
173
 
200
174
  RuTils::VERSION
201
175
 
202
176
  == Как ускорить реализацию новых функций
203
177
 
204
- Воспользуйтесь трекером на RubyForge. Опишите нужный вам функционал и приложите
205
- тесты, которым этот функционал должен удовлетворять. Схему организации тестов вы
206
- можете скопировать из собственных тестов RuTils.
178
+ Опишите нужный вам функционал и приложите тесты, которым этот функционал должен удовлетворять.
179
+ Схему организации тестов вы можете скопировать из собственных тестов RuTils.
207
180
 
208
181
  Если вы пишете исходный код, который войдет в RuTils или в тестовые наборы,
209
182
  пожалуйста следуйте следующим правилам оформления кода:
@@ -227,4 +200,8 @@ RubyKanjiCode в своем httpd.conf.
227
200
 
228
201
  Если вы хотите участвовать в разработке RuTils - fork us on GitHub
229
202
 
230
- git clone git://github.com/julik/rutils.git
203
+ git clone git://github.com/julik/rutils.git
204
+
205
+ == Лицензия
206
+
207
+ Поставляется под лицензией MIT (см. MIT_LICENSE.txt)
data/Rakefile.rb CHANGED
@@ -26,7 +26,7 @@ begin
26
26
  p.email = ['me@julik.nl', 'yaroslav@markin.net']
27
27
  p.description = 'Simple processing of russian strings'
28
28
  p.summary = 'Simple processing of russian strings'
29
- p.extra_deps = {"gilenson" => ">=0"}
29
+ p.extra_deps = {"gilenson" => ">=1.1.0"}
30
30
  p.remote_rdoc_dir = ''
31
31
  p.need_zip = true # ненвижу
32
32
  end
data/init.rb CHANGED
@@ -25,4 +25,4 @@ else
25
25
  end
26
26
 
27
27
  # textilize и markdown
28
- ::ActionController::Base.send(:helper, RuTils::Gilenson::Helper)
28
+ ::ActionController::Base.send(:helper, RuTils::GilensonStub::Helper)
@@ -1,21 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require "gilenson"
2
4
 
3
- # -*- encoding: utf-8 -*-
4
5
  module RuTils
5
- module Gilenson
6
+ module GilensonStub
7
+
6
8
  # Позволяет возвращать класс форматтера при вызове
7
9
  # RuTils::Gilenson.new
8
10
  def self.new(*args) #:nodoc:
9
- ::Gilenson.new(*args)
11
+ Gilenson.new(*args)
10
12
  end
11
13
 
12
- autoload :BlueClothExtra, File.dirname(__FILE__) + '/bluecloth_extra'
13
- autoload :RedClothExtra, File.dirname(__FILE__) + '/redcloth_extra'
14
- autoload :RDiscountExtra, File.dirname(__FILE__) + '/rdiscount_extra'
15
- autoload :MarukuExtra, File.dirname(__FILE__) + '/maruku_extra'
16
- autoload :Helper, File.dirname(__FILE__) + '/helper'
14
+ # Включается на правах хелпера в Rails-приложение
15
+ module Helper
16
+
17
+ # Возвращает текст обработанный Гиленсоном
18
+ def gilensize(text, options = {})
19
+ return "" if text.blank?
20
+ Gilenson.new.process(text, options)
21
+ end
22
+
23
+ # Возвращает текст обработанный Текстилем и Гиленсоном
24
+ # <i>Метод доступен только при включенном RedCloth</i>
25
+ def textilize(text)
26
+ return "" if text.blank?
27
+ require 'redcloth'
28
+ if RuTils.overrides_enabled?
29
+ Gilenson::RedClothExtra.new(text, [ :hard_breaks ]).to_html
30
+ else
31
+ super(text)
32
+ end
33
+ end
34
+
35
+ # Возвращает текст с кодом Markdown превращенным в HTML, попутно обработанный Гиленсоном
36
+ # <i>Метод доступен только при наличии BlueCloth</i>.
37
+ def markdown(text)
38
+ return "" if text.blank?
39
+ require 'bluecloth'
40
+ RuTils.overrides_enabled? ? Gilenson.new(super(text)).to_html : super
41
+ end
42
+ end
17
43
  end
18
- end
19
-
20
- # Этот класс теперь живет в геме gilenson.
21
- RuTils::Gilenson::Formatter = ::Gilenson
44
+ end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module RuTils
3
3
  # Версия RuTils
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.3'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 3
10
+ version: 1.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julian 'Julik' Tarkhanov
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-08-15 00:00:00 +02:00
20
+ date: 2010-11-03 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -28,10 +28,12 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- hash: 3
31
+ hash: 19
32
32
  segments:
33
+ - 1
34
+ - 1
33
35
  - 0
34
- version: "0"
36
+ version: 1.1.0
35
37
  type: :runtime
36
38
  version_requirements: *id001
37
39
  - !ruby/object:Gem::Dependency
@@ -76,11 +78,13 @@ extensions: []
76
78
 
77
79
  extra_rdoc_files:
78
80
  - History.txt
81
+ - MIT_LICENSE.txt
79
82
  - Manifest.txt
80
83
  - README.txt
81
84
  - TODO.txt
82
85
  files:
83
86
  - History.txt
87
+ - MIT_LICENSE.txt
84
88
  - Manifest.txt
85
89
  - README.txt
86
90
  - Rakefile.rb
@@ -89,12 +93,7 @@ files:
89
93
  - init.rb
90
94
  - lib/countries/countries.rb
91
95
  - lib/datetime/datetime.rb
92
- - lib/gilenson/bluecloth_extra.rb
93
96
  - lib/gilenson/gilenson_stub.rb
94
- - lib/gilenson/helper.rb
95
- - lib/gilenson/maruku_extra.rb
96
- - lib/gilenson/rdiscount_extra.rb
97
- - lib/gilenson/redcloth_extra.rb
98
97
  - lib/integration/integration.rb
99
98
  - lib/integration/rails_date_helper_override.rb
100
99
  - lib/integration/rails_pre_filter.rb
@@ -104,14 +103,9 @@ files:
104
103
  - lib/transliteration/simple.rb
105
104
  - lib/transliteration/transliteration.rb
106
105
  - lib/version.rb
107
- - test/extras/integration_bluecloth.rb
108
- - test/extras/integration_maruku.rb
109
106
  - test/extras/integration_rails_filter.rb
110
107
  - test/extras/integration_rails_gilenson_helpers.rb
111
108
  - test/extras/integration_rails_helpers.rb
112
- - test/extras/integration_rdiscount.rb
113
- - test/extras/integration_redcloth3.rb
114
- - test/extras/integration_redcloth4.rb
115
109
  - test/run_tests.rb
116
110
  - test/test_datetime.rb
117
111
  - test/test_integration.rb
@@ -1,7 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # BlueCloth с поддержкой Gilenson
3
- class RuTils::Gilenson::BlueClothExtra < BlueCloth
4
- def to_html(*opts)
5
- RuTils::Gilenson::Formatter.new(super(*opts)).to_html
6
- end
7
- end
@@ -1,34 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # Включается на правах хелпера в Rails-приложение
3
- module RuTils::Gilenson::Helper
4
-
5
- # Возвращает текст обработанный Гиленсоном
6
- def gilensize(text, options = {})
7
- return "" if text.blank?
8
- f = RuTils::Gilenson::Formatter.new
9
- f.configure!(options)
10
- f.process(text)
11
- end
12
-
13
- # Возвращает текст обработанный Текстилем и Гиленсоном
14
- # <i>Метод доступен только при включенном RedCloth</i>
15
- def textilize(text)
16
- return "" if text.blank?
17
- if RuTils.overrides_enabled?
18
- RuTils::Gilenson::RedClothExtra.new(text, [ :hard_breaks ]).to_html
19
- else
20
- super(text)
21
- end
22
- end
23
-
24
- # Возвращает текст с кодом Markdown превращенным в HTML, попутно обработанный Гиленсоном
25
- # <i>Метод доступен только при наличии BlueCloth</i>.
26
- def markdown(text)
27
- return "" if text.blank?
28
- if RuTils.overrides_enabled?
29
- RuTils::Gilenson::BlueClothExtra.new(text).to_html
30
- else
31
- super(text)
32
- end
33
- end
34
- end
@@ -1,19 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # Maruku с поддержкой Gilenson
3
- class RuTils::Gilenson::MarukuExtra < Maruku
4
- def to_html(*anything)
5
- suspended = super
6
-
7
- # Return quotes to original state
8
- [187, 171, 8220, 8221].map do |e|
9
- suspended.gsub! /&\##{e};/, '"'
10
- end
11
-
12
- # Return spaces to original state
13
- [160].map do |e|
14
- suspended.gsub! /&\##{e};/, ' '
15
- end
16
-
17
- suspended.gilensize
18
- end
19
- end
@@ -1,7 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # RDiscount с поддержкой Gilenson
3
- class RuTils::Gilenson::RDiscountExtra < RDiscount
4
- def to_html(*opts)
5
- RuTils::Gilenson::Formatter.new(super(*opts)).to_html
6
- end
7
- end
@@ -1,42 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- if RedCloth.class == Module
3
- # RedCloth 4 - частичная поддержка
4
- class RuTils::Gilenson::RedClothExtra < RedCloth::TextileDoc
5
- def to_html(*anything)
6
- suspended = super(*anything)
7
-
8
- # Return quotes to original state
9
- [187, 171, 8220, 8221].map do |e|
10
- suspended.gsub! /&\##{e};/, '"'
11
- end
12
-
13
- # Return spaces to original state
14
- [160].map do |e|
15
- suspended.gsub! /&\##{e};/, ' '
16
- end
17
-
18
- suspended.gilensize
19
- end
20
- end
21
- else
22
- # RedCloth 3 - RuTils выполняет перегрузку Textile Glyphs в RedCloth, перенося форматирование спецсимволов на Gilenson.
23
- # Применять как стандартный RedCloth
24
- # RuTils::Gilenson::RedClothExtra.new(some_text).to_html
25
- class RuTils::Gilenson::RedClothExtra < RedCloth
26
- # Этот метод в RedCloth при наличии Гиленсона становится заглушкой
27
- def htmlesc(text, mode=0)
28
- text
29
- end
30
-
31
- # А этот метод обрабатывает Textile Glyphs - ту самую типографицу.
32
- # Вместо того чтобы влезать в чужие таблицы мы просто заменим Textile Glyphs на Gilenson - и все будут рады.
33
- def pgl(text) #:nodoc:
34
- # Подвешиваем пробелы в начале и в конце каждого блока. Тряпка требует чтобы эти пробелы приехали
35
- # назад нетронутыми.
36
- spaces = Array.new(2,'')
37
- text.gsub!(/\A([\s]+)/) { spaces[0] = $1; '' }
38
- text.gsub!(/(\s+)\Z/) { spaces[1] = $1; '' }
39
- text.replace(spaces[0].to_s + RuTils::Gilenson::Formatter.new(text).to_html + spaces[1].to_s)
40
- end
41
- end
42
- end
@@ -1,13 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'bluecloth'
3
-
4
- # Интеграция с BlueCloth - Markdown
5
- # Сам Markdown никакой обработки типографики не производит (это делает RubyPants, но вряд ли его кто-то юзает на практике)
6
- class BlueclothIntegrationTest < Test::Unit::TestCase
7
- C = RuTils::Gilenson::BlueClothExtra
8
-
9
- def test_integration_markdown
10
- assert_equal "<p>И вот&#160;&#171;они пошли туда&#187;, и&#160;шли шли&#160;шли</p>",
11
- C.new('И вот "они пошли туда", и шли шли шли').to_html
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'maruku'
3
-
4
- # Интеграция с BlueCloth - Markdown
5
- # Сам Markdown никакой обработки типографики не производит (это делает RubyPants, но вряд ли его кто-то юзает на практике)
6
- class MarukuIntegrationTest < Test::Unit::TestCase
7
- C = RuTils::Gilenson::MarukuExtra
8
-
9
- def test_integration_maruku
10
-
11
- assert_equal "<p>И вот&#160;&#171;они пошли туда&#187;, и&#160;шли шли&#160;шли</p>",
12
- C.new('И вот "они пошли туда", и шли шли шли').to_html
13
-
14
- end
15
- end
@@ -1,14 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'rdiscount'
3
-
4
- # Интеграция с BlueCloth - Markdown
5
- # Сам Markdown никакой обработки типографики не производит (это делает RubyPants, но вряд ли его кто-то юзает на практике)
6
- class RdiscountIntegrationTest < Test::Unit::TestCase
7
- C = RuTils::Gilenson::RDiscountExtra
8
-
9
- def test_integration_markdown
10
-
11
- assert_equal "<p>И вот&#160;&#171;они пошли туда&#187;, и&#160;шли шли&#160;шли</p>",
12
- C.new('И вот "они пошли туда", и шли шли шли').to_html
13
- end
14
- end
@@ -1,18 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'redcloth'
3
- raise LoadError, "need RedCloth 3.x" unless RedCloth::VERSION.to_s =~ /^3/
4
-
5
- # Интеграция с RedCloth - Textile.
6
- # Нужно иметь в виду что Textile осуществляет свою обработку типографики, которую мы подменяем!
7
- class Redcloth3IntegrationTest < Test::Unit::TestCase
8
- C = RuTils::Gilenson::RedClothExtra
9
- def test_integration_with_redcloth_3
10
-
11
- assert_equal "<p>И&#160;вот &#171;они пошли туда&#187;, и&#160;шли шли&#160;шли</p>",
12
- C.new('И вот "они пошли туда", и шли шли шли').to_html
13
-
14
- assert_equal '<p><strong>strong text</strong> and <em>emphasized text</em></p>',
15
- C.new("*strong text* and _emphasized text_").to_html,
16
- "Spaces should be preserved"
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'redcloth'
3
- raise LoadError, "need RedCloth 4.x" unless RedCloth::VERSION.to_s =~ /^4/
4
-
5
- # Интеграция с RedCloth 4 - Textile.
6
- class Redcloth4IntegrationTest < Test::Unit::TestCase
7
- C = RuTils::Gilenson::RedClothExtra
8
-
9
- def test_integration_with_redcloth_4
10
-
11
- assert_equal "<p>И вот&#160;&#171;они пошли туда&#187;, и&#160;шли шли&#160;шли</p>",
12
- C.new('И вот "они пошли туда", и шли шли шли').to_html
13
-
14
- assert_equal '<p><strong>strong text</strong> and&#160;<em>emphasized text</em></p>',
15
- C.new("*strong text* and _emphasized text_").to_html,
16
- "Spaces should be preserved"
17
-
18
- end
19
- end