art_typograph 0.1.0 → 0.1.1

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.
@@ -1,4 +1,4 @@
1
- Клиент для [веб-сервиса «Типографа»](http://www.artlebedev.ru/tools/typograf/webservice/), код частично позаимствован из [als_typograf](https://github.com/alsemyonov/als_typograf).
1
+ Клиент для [веб-сервиса «Типографа»](http://www.artlebedev.ru/tools/typograf/webservice/) студии Лебедева, код частично позаимствован из [als_typograf](https://github.com/alsemyonov/als_typograf) и [art_typograf](https://github.com/stereobooster/art_typograf).
2
2
 
3
3
  ```ruby
4
4
  ArtTypograph.process('- Это "Типограф"?')
@@ -15,8 +15,7 @@ ArtTypograph.process('- Это "Типограф"?', :use_p => false)
15
15
  :entity_type => :no, # :html, :xml, :no, :mixed
16
16
  :use_br => false,
17
17
  :use_p => true,
18
- :max_nobr => 3,
19
- :encoding => 'UTF-8'
18
+ :max_nobr => 3
20
19
  }
21
20
  ```
22
21
 
@@ -14,8 +14,7 @@ module ArtTypograph
14
14
  :entity_type => :no,
15
15
  :use_br => false,
16
16
  :use_p => true,
17
- :max_nobr => 3,
18
- :encoding => 'UTF-8'
17
+ :max_nobr => 3
19
18
  }
20
19
 
21
20
  def initialize(options = {})
@@ -30,7 +29,7 @@ module ArtTypograph
30
29
  'SOAPAction' => '"http://typograf.artlebedev.ru/webservices/ProcessText"'
31
30
  })
32
31
  request.body = <<-END_SOAP
33
- <?xml version="1.0" encoding="#{options[:encoding]}" ?>
32
+ <?xml version="1.0" encoding="UTF-8" ?>
34
33
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
35
34
  <soap:Body>
36
35
  <ProcessText xmlns="http://typograf.artlebedev.ru/webservices/">
@@ -51,7 +50,7 @@ END_SOAP
51
50
  case response
52
51
  when Net::HTTPSuccess
53
52
  result = if /<ProcessTextResult>\s*((.|\n)*?)\s*<\/ProcessTextResult>/m =~ response.body
54
- $1.gsub(/&gt;/, '>').gsub(/&lt;/, '<').gsub(/&amp;/, '&').gsub(/(\t|\n)$/, '')
53
+ $1.gsub(/&gt;/, '>').gsub(/&lt;/, '<').gsub(/&amp;/, '&').gsub(/(\t|\n)$/, '').force_encoding("UTF-8").chomp
55
54
  else
56
55
  text
57
56
  end
@@ -1,3 +1,3 @@
1
1
  module ArtTypograph
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -17,7 +17,7 @@ describe ArtTypograph::Request do
17
17
  subject { req.new(options) }
18
18
 
19
19
  it 'merges default options' do
20
- subject.options.should include(:use_br, :use_p, :entity_type, :encoding, :max_nobr)
20
+ subject.options.should include(:use_br, :use_p, :entity_type, :max_nobr)
21
21
  end
22
22
 
23
23
  it 'processes options' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: art_typograph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: