standalone_typograf 2.0.2 → 3.0.0

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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +8 -0
  4. data/README.md +108 -72
  5. data/Rakefile +1 -9
  6. data/doc/fonts.md +1 -4
  7. data/doc/logo.png +0 -0
  8. data/doc/logo.psd +0 -0
  9. data/lib/standalone_typograf/dashes.rb +23 -0
  10. data/lib/standalone_typograf/ellipsis.rb +23 -0
  11. data/lib/standalone_typograf/fractions.rb +12 -28
  12. data/lib/standalone_typograf/mnemonics.rb +33 -0
  13. data/lib/standalone_typograf/nbspaces.rb +36 -0
  14. data/lib/standalone_typograf/quotes.rb +109 -77
  15. data/lib/standalone_typograf/version.rb +1 -1
  16. data/lib/standalone_typograf.rb +86 -42
  17. data/spec/processors/dashes_spec.rb +31 -0
  18. data/spec/processors/ellipsis_spec.rb +28 -0
  19. data/spec/processors/fractions_spec.rb +18 -0
  20. data/spec/processors/mnemonics_spec.rb +34 -0
  21. data/spec/processors/nbspaces_spec.rb +31 -0
  22. data/spec/processors/quotes_spec.rb +32 -0
  23. data/spec/spec_helper.rb +21 -0
  24. data/spec/standalone_typograf_spec.rb +12 -0
  25. data/spec/typograf_spec.rb +57 -0
  26. data/standalone_typograf.gemspec +6 -3
  27. metadata +76 -45
  28. data/.DS_Store +0 -0
  29. data/.rvmrc +0 -1
  30. data/lib/standalone_typograf/dasherize.rb +0 -12
  31. data/lib/standalone_typograf/dots.rb +0 -9
  32. data/lib/standalone_typograf/endash.rb +0 -9
  33. data/lib/standalone_typograf/nbspace.rb +0 -42
  34. data/lib/standalone_typograf/signs.rb +0 -26
  35. data/test/test_dash.rb +0 -24
  36. data/test/test_dots.rb +0 -24
  37. data/test/test_endash.rb +0 -12
  38. data/test/test_fractions.rb +0 -25
  39. data/test/test_nbspace.rb +0 -33
  40. data/test/test_prepare.rb +0 -34
  41. data/test/test_quotes.rb +0 -32
  42. data/test/test_signs.rb +0 -36
@@ -1,58 +1,102 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'standalone_typograf/version'
4
- require 'standalone_typograf/dasherize'
5
- require 'standalone_typograf/signs'
6
- require 'standalone_typograf/quotes'
7
- require 'standalone_typograf/dots'
8
- require 'standalone_typograf/endash'
9
- require 'standalone_typograf/nbspace'
10
- require 'standalone_typograf/fractions'
11
-
12
- module StandaloneTypograf
3
+ require 'active_support/all'
4
+
5
+ module StandaloneTypograf #:nodoc:
6
+ extend ActiveSupport::Autoload
7
+
8
+ @@processors = {}
9
+
10
+ class << self
11
+ # Processor registration like { :dasherize => StandaloneTypograf::Dasherize::Processor}
12
+ def register_processor(_module)
13
+ @@processors[_module.to_s.split('::').second.downcase.to_sym] = _module
14
+ end
15
+
16
+ def processors
17
+ @@processors
18
+ end
19
+ end
20
+
21
+ autoload :Version
22
+
23
+ eager_autoload do
24
+ autoload :Dashes
25
+ autoload :Mnemonics
26
+ autoload :Fractions
27
+ autoload :Nbspaces
28
+ autoload :Ellipsis
29
+ autoload :Quotes
30
+ end
31
+
32
+ include Dashes
33
+ include Mnemonics
34
+ include Fractions
35
+ include Nbspaces
36
+ include Ellipsis
37
+ include Quotes
38
+
39
+ ##
40
+ # === Options
41
+ # * mode [Symbol]
42
+ # typograf supports <b>html</b> and </b>utf</b> mods.
43
+ # The default one is UTF. It means all special symbols
44
+ # will be represents as UTF sequence.
45
+ #
13
46
  class Typograf
14
- include StandaloneTypograf::Dasherize
15
- include StandaloneTypograf::Signs
16
- include StandaloneTypograf::Quotes
17
- include StandaloneTypograf::Dots
18
- include StandaloneTypograf::Endash
19
- include StandaloneTypograf::Nbspace
20
- include StandaloneTypograf::Fractions
47
+ attr_accessor :text
48
+ attr_reader :mode
21
49
 
22
50
  def initialize(text, options={})
23
- options[:signs] ||= SIGNS
24
- options[:signs_ru] ||= SIGNS_RU
25
- options[:quotes] ||= QUOTES
26
- # except - массив с названием методов, которые необходимо исключить при выполнении
27
- # *prepare*
28
- @except = options[:except]
29
- @signs, @signs_ru = SIGNS.merge(options[:signs]), SIGNS_RU.merge(options[:signs_ru])
30
- @quotes = QUOTES.merge(options[:quotes])
51
+ options.assert_valid_keys(:mode, :exclude)
31
52
  @text = text
53
+ @mode = validate_option(options[:mode].try(:to_sym), in: [:html, :utf]) || :utf
54
+ exclude(options[:exclude]) if options[:exclude].present?
55
+ end
56
+
57
+ # Call a <b>separate</b> processor or <b>several</b> processors
58
+ # @return [String]
59
+ def processor(*names)
60
+ names.each do |name|
61
+ validate_option(name, in: processors.keys)
62
+ processors[name].send(:compile, text, mode)
63
+ end
64
+ return text
65
+ end
66
+
67
+ # @return [Hash]
68
+ def processors
69
+ @processors ||= StandaloneTypograf.processors.deep_dup
32
70
  end
33
71
 
72
+ # @return [String]
34
73
  def prepare
35
- call_method :dasherize
36
- call_method :signs
37
- call_method :quotes
38
- call_method :dots
39
- call_method :endash
40
- call_method :nbspace
41
- call_method :fractions
42
- @text
74
+ processor(*processors.keys)
75
+ end
76
+
77
+ def exclude(list)
78
+ list = Array(list) unless list.is_a?(Array)
79
+ list.each do |name|
80
+ validate_option(name, in: processors.keys)
81
+ processors.delete(name)
82
+ end
43
83
  end
44
84
 
45
- # PRIVATE
46
- #
47
85
  private
48
86
 
49
- # Выполняет метод только если он не был передан в параметре 'except'
50
- # при создании объекта.
51
- #
52
- def call_method(name)
53
- if @except.nil? || !@except.include?(name)
54
- self.send(name)
87
+ # Validate initialization options that have been passed thought the params.
88
+ #
89
+ # Available validations:
90
+ # * in [Array]
91
+ # provided param should be in array, for example:
92
+ # `validate_option(:hello, in: [:hello, :world])`
93
+ #
94
+ def validate_option(param, options={})
95
+ return unless param.present?
96
+ if options[:in].present?
97
+ raise ArgumentError.new("Wrong argument `#{param}`, should be in `#{options[:in].join(', ')}`") unless options[:in].include?(param)
98
+ end
99
+ return param
55
100
  end
56
- end
57
101
  end
58
102
  end
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Dashes::Processor do
6
+
7
+ def typograf(text, mode)
8
+ described_class::compile(text, mode)
9
+ end
10
+
11
+ texts = {
12
+ :utf => [
13
+ ['Сушка - процесс удаления влаги', 'Сушка — процесс удаления влаги'],
14
+ ['- А что Казбич? - спросил я', '— А что Казбич? — спросил я'],
15
+ ],
16
+ :html => [
17
+ ['Вода - бинарное неорганическое соединение', 'Вода &mdash; бинарное неорганическое соединение'],
18
+ ['- Как пройти в библиотеку?', '&mdash; Как пройти в библиотеку?'],
19
+ ['1-1=0', '1-1=0'], # no changes
20
+ ['-1', '-1'], # no changes
21
+ ]
22
+ }
23
+
24
+ it 'works' do
25
+ texts.each_pair do |mode, array|
26
+ array.each do|text_pair|
27
+ typograf(text_pair[0], mode).should == text_pair[1]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Ellipsis::Processor do
6
+
7
+ def typograf(text, mode)
8
+ described_class::compile(text, mode)
9
+ end
10
+
11
+ texts = {
12
+ :utf => [
13
+ ['He was sleeping... Hey! You..', 'He was sleeping… Hey! You..']
14
+ ],
15
+ :html => [
16
+ ['Он молчал... ', 'Он молчал&hellip; '],
17
+ ['1...3', '1...3'], # should not work with digits
18
+ ]
19
+ }
20
+
21
+ it 'works' do
22
+ texts.each_pair do |mode, array|
23
+ array.each do|text_pair|
24
+ typograf(text_pair[0], mode).should == text_pair[1]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Fractions::Processor do
6
+
7
+ it 'works on Html mode' do
8
+ described_class.compile(' 134/334', :html).should == ' <sup>134</sup>&frasl;<sub>334</sub>'
9
+ end
10
+
11
+ it 'does not on Utf mode' do
12
+ described_class.compile('2/4', :utf).should == '2/4'
13
+ end
14
+
15
+ it 'does not when last char is not space' do
16
+ described_class.compile('2/4*', :html).should == '2/4*'
17
+ end
18
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Mnemonics::Processor do
6
+
7
+ def typograf(text, mode)
8
+ described_class::compile(text, mode)
9
+ end
10
+
11
+ texts = {
12
+ # in <b>utf</b> section please test signs on English
13
+ :utf => [
14
+ ['Cafero (c) 2013', 'Cafero © 2013'],
15
+ ['iPhone (r)', 'iPhone ®'],
16
+ ['Право -> там', 'Право → там'],
17
+ ['Температура ~= 10', 'Температура ≈ 10'],
18
+ ],
19
+ # in <b>html</b> section please test signs on Russian
20
+ :html => [
21
+ ['(tm) Windows', '&trade; Windows'],
22
+ ['Принеси +- 1 штуку', 'Принеси &plusmn; 1 штуку'],
23
+ ['Лево <- там', 'Лево &larr; там'],
24
+ ]
25
+ }
26
+
27
+ it 'works' do
28
+ texts.each_pair do |mode, array|
29
+ array.each do|text_pair|
30
+ typograf(text_pair[0], mode).should == text_pair[1]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Nbspaces::Processor do
6
+
7
+ def typograf(text, mode)
8
+ described_class::compile(text, mode)
9
+ end
10
+
11
+ texts = {
12
+ :utf => [
13
+ ['В Украине', 'В Украине']
14
+ ],
15
+ :html => [
16
+ ['Форточка в окне', 'Форточка в&nbsp;окне'],
17
+ ['Иди по краю', 'Иди по&nbsp;краю'],
18
+ ['Исключительно Великолепно', 'Исключительно&nbsp;Великолепно'],
19
+ ['Пить - здоровью предить', 'Пить&nbsp;- здоровью предить'],
20
+ ['Лес &mdash; источник древесины', 'Лес&nbsp;&mdash; источник древесины'],
21
+ ]
22
+ }
23
+
24
+ it 'works' do
25
+ texts.each_pair do |mode, array|
26
+ array.each do|text_pair|
27
+ typograf(text_pair[0], mode).should == text_pair[1]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Quotes::Processor do
6
+
7
+ def typograf(text, mode)
8
+ described_class::compile(text, mode)
9
+ end
10
+
11
+ texts = {
12
+ :utf => [
13
+ ['Он сказал: "Привет, Михалыч"', 'Он сказал: «Привет, Михалыч»'],
14
+ [' "Михась! Или "Мишаня", а?!",- крикнул он ', ' «Михась! Или „Мишаня“, а?!»,- крикнул он '],
15
+ ['"Привет тебе, "Путник""', '«Привет тебе, „Путник“»'],
16
+ ['""Гномы", - вскрикнул Бильбо", - сказал Толкиен', '«„Гномы“, - вскрикнул Бильбо», - сказал Толкиен'],
17
+ ['"Один", "Два", "Три"', '«Один», «Два», «Три»']
18
+ ],
19
+ :html => [
20
+ ['"Привет"', '&laquo;Привет&raquo;' ],
21
+ ['"Два "вида" "кавычек"" "Жесть"', '&laquo;Два &bdquo;вида&ldquo; &bdquo;кавычек&ldquo;&raquo; &laquo;Жесть&raquo;' ],
22
+ ]
23
+ }
24
+
25
+ it 'works' do
26
+ texts.each_pair do |mode, array|
27
+ array.each do|text_pair|
28
+ typograf(text_pair[0], mode).should == text_pair[1]
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'standalone_typograf'
4
+
5
+ # This file was generated by the `rspec --init` command. Conventionally, all
6
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
+ # Require this file using `require "spec_helper"` to ensure that it is only
8
+ # loaded once.
9
+ #
10
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+
16
+ # Run specs in random order to surface order dependencies. If you find an
17
+ # order dependency and want to debug it, you can fix the order by providing
18
+ # the seed, which is printed after each run.
19
+ # --seed 1234
20
+ config.order = 'random'
21
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf do
6
+
7
+ describe 'implementation' do
8
+ it 'registers processors' do
9
+ described_class.processors.length.should > 0
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,57 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StandaloneTypograf::Typograf do
6
+
7
+ context 'argument errors' do
8
+ describe 'options validation' do
9
+ def with_otion(key, value)
10
+ described_class.new('', key => value)
11
+ end
12
+
13
+ it { expect { with_otion(:mode, :stub) }.to raise_error(ArgumentError) }
14
+ it { expect { with_otion(:exclude, :stub) }.to raise_error(ArgumentError) }
15
+ end
16
+ end
17
+
18
+ context 'arguments' do
19
+ describe 'modes' do
20
+ it 'has UTF-mode by default' do
21
+ t = described_class.new('')
22
+ t.mode.should == :utf
23
+ end
24
+
25
+ it 'can be passed as param' do
26
+ t = described_class.new('', mode: :html)
27
+ t.mode.should == :html
28
+ end
29
+ end
30
+
31
+ describe 'exclude' do
32
+ it 'excludes processor' do
33
+ t = described_class.new('', exclude: :dashes)
34
+ t.processors.include?(:dashes).should be_false
35
+ end
36
+ end
37
+ end
38
+
39
+ context 'implementation' do
40
+ describe '.processors' do
41
+ it 'raises an error on unknown processor' do
42
+ t = described_class.new('')
43
+ expect { t.processor(:unknown) }.to raise_error(ArgumentError)
44
+ end
45
+
46
+ it 'response on separate processor' do
47
+ t = described_class.new('Типограф - это круто, +-', mode: :html)
48
+ t.processor(:mnemonics).should == 'Типограф - это круто, &plusmn;'
49
+ end
50
+
51
+ it 'response on several processors' do
52
+ t = described_class.new('Типограф - это круто, +-', mode: :html)
53
+ t.processor(:mnemonics, :dashes).should == 'Типограф &mdash; это круто, &plusmn;'
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,5 +1,4 @@
1
- #encoding: UTF-8
2
-
1
+ # coding: utf-8
3
2
  lib = File.expand_path('../lib', __FILE__)
4
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
4
  require 'standalone_typograf/version'
@@ -11,7 +10,7 @@ Gem::Specification.new do |spec|
11
10
  spec.email = 'sashapashamasha@gmail.com'
12
11
  spec.description = "Standalone (offline) client of the ArtLebedev's Studio Typograf service. http://typograf.herokuapp.com"
13
12
  spec.summary = 'Very Fast&Simple Typograf fot the Russian text.'
14
- spec.homepage = 'https://github.com/shlima/StandaloneTypograf'
13
+ spec.homepage = 'https://github.com/shlima/standalone_typograf'
15
14
  spec.license = 'MIT'
16
15
 
17
16
  spec.files = `git ls-files`.split($/)
@@ -21,4 +20,8 @@ Gem::Specification.new do |spec|
21
20
 
22
21
  spec.add_development_dependency 'bundler', '~> 1.3'
23
22
  spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'fuubar'
25
+
26
+ spec.add_runtime_dependency 'activesupport'
24
27
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standalone_typograf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
4
+ version: 3.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alex Shilov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-20 00:00:00.000000000 Z
11
+ date: 2013-11-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,17 +27,57 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fuubar
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
44
81
  - !ruby/object:Gem::Version
45
82
  version: '0'
46
83
  description: Standalone (offline) client of the ArtLebedev's Studio Typograf service.
@@ -50,9 +87,9 @@ executables: []
50
87
  extensions: []
51
88
  extra_rdoc_files: []
52
89
  files:
53
- - .DS_Store
54
90
  - .gitignore
55
- - .rvmrc
91
+ - .rspec
92
+ - .travis.yml
56
93
  - Gemfile
57
94
  - LICENSE.txt
58
95
  - README.md
@@ -61,60 +98,54 @@ files:
61
98
  - doc/logo.png
62
99
  - doc/logo.psd
63
100
  - lib/standalone_typograf.rb
64
- - lib/standalone_typograf/dasherize.rb
65
- - lib/standalone_typograf/dots.rb
66
- - lib/standalone_typograf/endash.rb
101
+ - lib/standalone_typograf/dashes.rb
102
+ - lib/standalone_typograf/ellipsis.rb
67
103
  - lib/standalone_typograf/fractions.rb
68
- - lib/standalone_typograf/nbspace.rb
104
+ - lib/standalone_typograf/mnemonics.rb
105
+ - lib/standalone_typograf/nbspaces.rb
69
106
  - lib/standalone_typograf/quotes.rb
70
- - lib/standalone_typograf/signs.rb
71
107
  - lib/standalone_typograf/version.rb
108
+ - spec/processors/dashes_spec.rb
109
+ - spec/processors/ellipsis_spec.rb
110
+ - spec/processors/fractions_spec.rb
111
+ - spec/processors/mnemonics_spec.rb
112
+ - spec/processors/nbspaces_spec.rb
113
+ - spec/processors/quotes_spec.rb
114
+ - spec/spec_helper.rb
115
+ - spec/standalone_typograf_spec.rb
116
+ - spec/typograf_spec.rb
72
117
  - standalone_typograf.gemspec
73
- - test/test_dash.rb
74
- - test/test_dots.rb
75
- - test/test_endash.rb
76
- - test/test_fractions.rb
77
- - test/test_nbspace.rb
78
- - test/test_prepare.rb
79
- - test/test_quotes.rb
80
- - test/test_signs.rb
81
- homepage: https://github.com/shlima/StandaloneTypograf
118
+ homepage: https://github.com/shlima/standalone_typograf
82
119
  licenses:
83
120
  - MIT
121
+ metadata: {}
84
122
  post_install_message:
85
123
  rdoc_options: []
86
124
  require_paths:
87
125
  - lib
88
126
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
127
  requirements:
91
- - - ! '>='
128
+ - - '>='
92
129
  - !ruby/object:Gem::Version
93
130
  version: '0'
94
- segments:
95
- - 0
96
- hash: 1958121828042888037
97
131
  required_rubygems_version: !ruby/object:Gem::Requirement
98
- none: false
99
132
  requirements:
100
- - - ! '>='
133
+ - - '>='
101
134
  - !ruby/object:Gem::Version
102
135
  version: '0'
103
- segments:
104
- - 0
105
- hash: 1958121828042888037
106
136
  requirements: []
107
137
  rubyforge_project:
108
- rubygems_version: 1.8.25
138
+ rubygems_version: 2.0.6
109
139
  signing_key:
110
- specification_version: 3
140
+ specification_version: 4
111
141
  summary: Very Fast&Simple Typograf fot the Russian text.
112
142
  test_files:
113
- - test/test_dash.rb
114
- - test/test_dots.rb
115
- - test/test_endash.rb
116
- - test/test_fractions.rb
117
- - test/test_nbspace.rb
118
- - test/test_prepare.rb
119
- - test/test_quotes.rb
120
- - test/test_signs.rb
143
+ - spec/processors/dashes_spec.rb
144
+ - spec/processors/ellipsis_spec.rb
145
+ - spec/processors/fractions_spec.rb
146
+ - spec/processors/mnemonics_spec.rb
147
+ - spec/processors/nbspaces_spec.rb
148
+ - spec/processors/quotes_spec.rb
149
+ - spec/spec_helper.rb
150
+ - spec/standalone_typograf_spec.rb
151
+ - spec/typograf_spec.rb
data/.DS_Store DELETED
Binary file
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.3@standalone_typograf --create
@@ -1,12 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module StandaloneTypograf
4
- module Dasherize
5
- def dasherize
6
- # В ситуации, когда тире с отбивкой с обоих сторон,
7
- # левый пробел - неразрывный.
8
- @text = @text.gsub(/\s-\s/i, ' — ')
9
- @text = @text.gsub(/- /i, '— ')
10
- end
11
- end
12
- end
@@ -1,9 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module StandaloneTypograf
4
- module Dots
5
- def dots
6
- @text = @text.gsub(/[.][.][.]/i, '…')
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module StandaloneTypograf
4
- module Endash
5
- def endash
6
- @text = @text.gsub(/(\d+)([-])(\d+)/i, '\1'+'–'+'\3')
7
- end
8
- end
9
- end