├── .rspec
├── .travis.yml
├── lib
├── pretty_strings
│ └── version.rb
└── pretty_strings.rb
├── spec
├── spec_helper.rb
└── pretty_strings_spec.rb
├── Gemfile
├── .gitignore
├── Rakefile
├── LICENSE.txt
├── pretty_strings.gemspec
└── README.md
/.rspec:
--------------------------------------------------------------------------------
1 | --format documentation
2 | --color
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 2.2.4
4 |
--------------------------------------------------------------------------------
/lib/pretty_strings/version.rb:
--------------------------------------------------------------------------------
1 | module PrettyStrings
2 | VERSION = "0.7.0"
3 | end
4 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2 | require 'pretty_strings'
3 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in pretty_strings.gemspec
4 | gemspec
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.bundle/
2 | /.yardoc
3 | /Gemfile.lock
4 | /_yardoc/
5 | /coverage/
6 | /doc/
7 | /pkg/
8 | /spec/reports/
9 | /tmp/
10 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require 'bundler/gem_tasks'
2 | require 'rspec/core/rake_task'
3 |
4 | RSpec::Core::RakeTask.new(:spec)
5 | task :default => :spec
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Kevin S. Dias
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/pretty_strings.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | lib = File.expand_path('../lib', __FILE__)
3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4 | require 'pretty_strings/version'
5 |
6 | Gem::Specification.new do |spec|
7 | spec.name = "pretty_strings"
8 | spec.version = PrettyStrings::VERSION
9 | spec.authors = ["Kevin S. Dias"]
10 | spec.email = ["diasks2@gmail.com"]
11 |
12 | spec.summary = %q{Take strings that have been abused in the wild and clean them up (for translation tools)}
13 | spec.description = %q{Clean up strings (html entities, html/xml code, unnecessary whitespace, etc.) to prep them to be better searched or analyzed.}
14 | spec.homepage = "https://github.com/diasks2/pretty_strings"
15 |
16 | spec.files = `git ls-files -z`.split("\x0")
17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19 | spec.require_paths = ["lib"]
20 |
21 | spec.add_development_dependency "bundler", "~> 1.9"
22 | spec.add_development_dependency "rake", "~> 10.0"
23 | spec.add_development_dependency "rspec"
24 | end
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Pretty Strings
2 |
3 | [](https://badge.fury.io/rb/pretty_strings) [](https://travis-ci.org/diasks2/pretty_strings) [](https://github.com/diasks2/pretty_strings/blob/master/LICENSE.txt)
4 |
5 | Some strings have been abused by being run through many a CAT tool (one too many times). When you only want text and you don't want any inline tags, triple-escaped HTML entities or the like then this gem is for you.
6 |
7 | ## Installation
8 |
9 | Add this line to your application's Gemfile:
10 |
11 | **Ruby**
12 | ```
13 | gem install pretty_strings
14 | ```
15 |
16 | **Ruby on Rails**
17 | Add this line to your application’s Gemfile:
18 | ```ruby
19 | gem 'pretty_strings'
20 | ```
21 |
22 | ## Usage
23 |
24 | ```ruby
25 | text = "<CharStyle:body copy>The Supe<cTracking:-75>r<cTracking:>Track system is easy to set up and use, providing real-time <SoftReturn>insight and stats."
26 | PrettyStrings::Cleaner.new(text).pretty
27 |
28 | # => "The SuperTrack system is easy to set up and use, providing real-time insight and stats."
29 | ```
30 |
31 | ## Contributing
32 |
33 | 1. Fork it ( https://github.com/diasks2/pretty_strings/fork )
34 | 2. Create your feature branch (`git checkout -b my-new-feature`)
35 | 3. Commit your changes (`git commit -am 'Add some feature'`)
36 | 4. Push to the branch (`git push origin my-new-feature`)
37 | 5. Create a new Pull Request
38 |
39 | ## License
40 |
41 | The MIT License (MIT)
42 |
43 | Copyright (c) 2016 Kevin S. Dias
44 |
45 | Permission is hereby granted, free of charge, to any person obtaining a copy
46 | of this software and associated documentation files (the "Software"), to deal
47 | in the Software without restriction, including without limitation the rights
48 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49 | copies of the Software, and to permit persons to whom the Software is
50 | furnished to do so, subject to the following conditions:
51 |
52 | The above copyright notice and this permission notice shall be included in
53 | all copies or substantial portions of the Software.
54 |
55 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
61 | THE SOFTWARE.
--------------------------------------------------------------------------------
/lib/pretty_strings.rb:
--------------------------------------------------------------------------------
1 | require "pretty_strings/version"
2 |
3 | module PrettyStrings
4 | class Cleaner
5 | attr_reader :text
6 | def initialize(text)
7 | @text = text
8 | end
9 |
10 | def pretty
11 | return '' if text.nil? || text.empty?
12 | remove_bracketed_numbers(
13 | remove_consecutive_dots(
14 | replace_symbol_with_bracket(
15 | remove_newlines(
16 | replace_tabs(
17 | remove_bracketed_code(
18 | remove_twb_tags(
19 | scan_for_code(
20 | escape_text(
21 | sanitize_text(
22 | replace_bracket_with_symbol(
23 | escape_text(
24 | sanitize_text(
25 | replace_bracket_with_symbol(
26 | text
27 | )))))))))))))).squeeze(" ").strip
28 | end
29 |
30 | private
31 |
32 | def remove_newlines(text)
33 | text.gsub!(/\n/, ' ') || text
34 | text.gsub!(/\r/, ' ') || text
35 | end
36 |
37 | def replace_tabs(text)
38 | text.gsub!(/\t/, ' ') || text
39 | end
40 |
41 | def remove_bracketed_code(text)
42 | text.gsub!(/(?<=\*\*)\{(?=date\}\*\*)/, '⚘') || text
43 | text.gsub!(/(?<=\*\*)\{(?=number\}\*\*)/, '⚘') || text
44 | text.gsub!(/(?<=\*\*)\{(?=email\}\*\*)/, '⚘') || text
45 | text.gsub!(/(?<=\*\*)\{(?=url\}\*\*)/, '⚘') || text
46 | text.gsub!(/(?<=\*\*\{date)\}(?=\*\*)/, '♚') || text
47 | text.gsub!(/(?<=\*\*\{number)\}(?=\*\*)/, '♚') || text
48 | text.gsub!(/(?<=\*\*\{email)\}(?=\*\*)/, '♚') || text
49 | text.gsub!(/(?<=\*\*\{url)\}(?=\*\*)/, '♚') || text
50 | text.gsub!(/\{.*?\}/, '') || text
51 | text.gsub!(/♚/, '}') || text
52 | text.gsub!(/⚘/, '{') || text
53 | end
54 |
55 | def remove_twb_tags(text)
56 | remove_twb_tags_post(
57 | remove_twb_tags_post(
58 | remove_twb_tags_post(
59 | remove_twb_tags_post(
60 | remove_twb_tags_pre(text)))))
61 | end
62 |
63 | def remove_twb_tags_post(text)
64 | text.gsub!(/({\\b )([^{}}]*)(}\\line)/, '\2') || text
65 | text.gsub!(/({\\\S+ )([^{}}]*)(})/, '\2') || text
66 | text.gsub!('\sectd\\linex0\\headery708\\footery708\\colsx708\\endnhere\\sectlinegrid360\\sectdefaultcl\\sftnbj ', '') || text
67 | end
68 |
69 | def remove_twb_tags_pre(text)
70 | text.gsub!(/\{\\super \d+}/, '') || text
71 | text.gsub!(/\{\\\*\\fldinst [^{}]*}/, '') || text
72 | end
73 |
74 | def remove_consecutive_dots(text)
75 | text.gsub!(/\.{5,}/, '') || text
76 | end
77 |
78 | def replace_bracket_with_symbol(text)
79 | text.gsub!(/<(?=\s*\d+)/, '♳') || text
80 | end
81 |
82 | def replace_symbol_with_bracket(text)
83 | text.gsub!(/♳/, '<') || text
84 | end
85 |
86 | def remove_bracketed_numbers(text)
87 | text.gsub!(/\<\d+\>/, '') || text
88 | end
89 |
90 | def escape_text(text)
91 | CGI.unescapeHTML(CGI.unescapeHTML(CGI.unescapeHTML(CGI.unescapeHTML(text))))
92 | end
93 |
94 | def sanitize_text(text)
95 | text.gsub!(/(<[^>\d\/][^>]*>)|\n\t/, '') || text
96 | text.gsub!(/(<\/[^>\d][^>]*>)|\n\t/, '') || text
97 | end
98 |
99 | def scan_for_code(text)
100 | text =~ /(?<=\{\\f23).*?(?=})/ ? text.scan(/(?<=\{\\f23).*?(?=})/).join(" ") : text
101 | end
102 | end
103 | end
104 |
--------------------------------------------------------------------------------
/spec/pretty_strings_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe PrettyStrings do
4 | it 'has a version number' do
5 | expect(PrettyStrings::VERSION).not_to be nil
6 | end
7 |
8 | it "prettifies example #001" do
9 | text = "Hello World. My name is Jonas."
10 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Hello World. My name is Jonas.")
11 | end
12 |
13 | it "prettifies example #002" do
14 | text = "{\cs6\f1\cf6\lang1024 <cf size="8" complexscriptssize="8">}Determination of time point of wound closure {\cs6\f1\cf6\lang1024 </cf><cf size="8" complexscriptssize="8" superscript="on">}K{\cs6\f1\cf6\lang1024 </cf>}"
15 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Determination of time point of wound closure K")
16 | end
17 |
18 | it "prettifies example #003" do
19 | text = "{\cs6\f1\cf6\lang1024 </cf><cf font="Arial" size="11" complexscriptsfont="Arial" complexscriptssize="11">}DermaPro{\cs6\f1\cf6\lang1024 </cf><cf font="Arial" size="11" complexscriptsfont="Arial" complexscriptssize="11" superscript="on">}®{\cs6\f1\cf6\lang1024 </cf><cf font="Arial" size="11" complexscriptsfont="Arial" complexscriptssize="11">} versus isotonic sodium chloride solution in patients with diabetic foot ulcers{\cs6\f1\cf6\lang1024 </cf>}"
20 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("DermaPro® versus isotonic sodium chloride solution in patients with diabetic foot ulcers")
21 | end
22 |
23 | it "prettifies example #004" do
24 | text = "HS will not refund any applied registration fees or backorder fees for a backordered domain that has been allocated into a Customer's ownership and account."
25 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("HS will not refund any applied registration fees or backorder fees for a backordered domain that has been allocated into a Customer's ownership and account.")
26 | end
27 |
28 | it "prettifies example #005" do
29 | text = "40 Hz nominal for a standard kit (48"/12"); >200 Hz for sensor alone"
30 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('40 Hz nominal for a standard kit (48"/12"); >200 Hz for sensor alone')
31 | end
32 |
33 | it "prettifies example #006" do
34 | text = "The Edwards SAPIEN transcatheter heart valve is indicated for use in patients with symptomatic aortic stenosis (aortic valve area &lt;0.8 cm2) requiring aortic valve replacement who have high risk for operative mortality, or are “non-operable”, as determined by either or both of the following risk assessments:"
35 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The Edwards SAPIEN transcatheter heart valve is indicated for use in patients with symptomatic aortic stenosis (aortic valve area <0.8 cm2) requiring aortic valve replacement who have high risk for operative mortality, or are “non-operable”, as determined by either or both of the following risk assessments:")
36 | end
37 |
38 | it "prettifies example #007" do
39 | text = "{\f23 3.2.1} {\f23 SCUF (Slow Continuous Ultra-filtration):}"
40 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("3.2.1 SCUF (Slow Continuous Ultra-filtration):")
41 | end
42 |
43 | it "prettifies example #008" do
44 | text = nil
45 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("")
46 | end
47 |
48 | it "prettifies example #009" do
49 | text = "&lt;CharStyle:&gt;&lt;CharStyle:credit&gt;Reuter et al&lt;cSize:6.000000&gt;&lt;cBaselineShift:4.000000&gt;5&lt;cBaselineShift:&gt;&lt;cSize:&gt;"
50 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Reuter et al5")
51 | end
52 |
53 | it "prettifies example #010" do
54 | text = "Lifesciences S.A. · Ch. du Glapin 6 · 1162 Saint-Prex · Switzerland · 41.21.823.4300&lt;SoftReturn&gt;Edwards"
55 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Lifesciences S.A. · Ch. du Glapin 6 · 1162 Saint-Prex · Switzerland · 41.21.823.4300Edwards")
56 | end
57 |
58 | it "prettifies example #011" do
59 | text = "&lt;CharStyle:legal&gt;5."
60 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("5.")
61 | end
62 |
63 | it "prettifies example #012" do
64 | text = "{0}No other express or implied warranty exists, including any warranty of merchantability or fitness for a particular purpose.{1}"
65 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("No other express or implied warranty exists, including any warranty of merchantability or fitness for a particular purpose.")
66 | end
67 |
68 | it "prettifies example #013" do
69 | text = "&lt;CharStyle:legal&gt;"
70 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("")
71 | end
72 |
73 | it "prettifies example #014" do
74 | text = "&lt;CharStyle:bullets&gt;&lt;cColor:PANTONE 561 C&gt;• &lt;cColor:&gt;Validated against the clinical gold-standard Swan-Ganz pulmonary artery catheter&lt;cSize:6.000000&gt;&lt;cBaselineShift:4.000000&gt;&lt;cLeading:14.000000&gt;1&lt;cLeading:&gt;&lt;cBaselineShift:&gt;&lt;cSize:&gt;"
75 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq( "• Validated against the clinical gold-standard Swan-Ganz pulmonary artery catheter1")
76 | end
77 |
78 | it "prettifies example #015" do
79 | text = "Hello\n\n\n\n\rWorld"
80 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Hello World")
81 | end
82 |
83 | it "prettifies example #016" do
84 | text = "{\f23 3.2.1}"
85 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("3.2.1")
86 | end
87 |
88 | it "prettifies example #017" do
89 | text = "<CharStyle:body copy>The Fl<cTracking:-75>o<cTracking:>Trac system is easy to set up and use, providing real-time <SoftReturn>hemodynamic insight from pre-op to the operating room and to the ICU."
90 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The FloTrac system is easy to set up and use, providing real-time hemodynamic insight from pre-op to the operating room and to the ICU.")
91 | end
92 |
93 | it "prettifies example #018" do
94 | text = "Tabulka 1 ukazuje počet pozorovaných časných komplikací (< 30 dnů u nežádoucích účinků týkajících se chlopně), linearizované počty pozdních komplikací (> 30 dnů po operaci) a počty komplikací 1, 5 a 8 let po operaci."
95 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Tabulka 1 ukazuje počet pozorovaných časných komplikací (< 30 dnů u nežádoucích účinků týkajících se chlopně), linearizované počty pozdních komplikací (> 30 dnů po operaci) a počty komplikací 1, 5 a 8 let po operaci.")
96 | end
97 |
98 | it "prettifies example #019" do
99 | text = "<z6cW>33 - 47 mL/beat/m<V>2"
100 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("33 - 47 mL/beat/m2")
101 | end
102 |
103 | it "prettifies example #020" do
104 | text = "Hello\t\tworld."
105 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Hello world.")
106 | end
107 |
108 | it "prettifies example #021" do
109 | text = "<CharStyle:body copy>The Supe<cTracking:-75>r<cTracking:>Track system is easy to set up and use, providing real-time <SoftReturn>insight and stats."
110 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The SuperTrack system is easy to set up and use, providing real-time insight and stats.")
111 | end
112 |
113 | it "prettifies example #022" do
114 | text = "The following tools are included: Déjà Vu X2 (Atril), memoQ (Kilgray), SDL Trados Studio 2009 (SDL) and Wordfast Pro (Wordfast)."
115 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The following tools are included: Déjà Vu X2 (Atril), memoQ (Kilgray), SDL Trados Studio 2009 (SDL) and Wordfast Pro (Wordfast).")
116 | end
117 |
118 | it "prettifies example #023" do
119 | text = "こんにちは、今日は土曜日。"
120 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("こんにちは、今日は土曜日。")
121 | end
122 |
123 | it "prettifies example #024" do
124 | text = "**{date}** **{number}** **{email}** **{url}** test"
125 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("**{date}** **{number}** **{email}** **{url}** test")
126 | end
127 |
128 | it "prettifies example #025" do
129 | text = "How satisfied were you with the way in which the car was handed over to you?<6>"
130 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("How satisfied were you with the way in which the car was handed over to you?")
131 | end
132 |
133 | it "prettifies example #026" do
134 | text = "hello..........................................................................................................................................................................................................................................................................................................................................................."
135 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("hello")
136 | end
137 |
138 | it "prettifies example #027" do
139 | text = "hello...what is your name."
140 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("hello...what is your name.")
141 | end
142 |
143 | it "prettifies example #028" do
144 | text = "hello <3 and 3 and the temp is <8 and >6...what is your name."
145 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("hello <3 and 3 and the temp is <8 and >6...what is your name.")
146 | end
147 |
148 | it "prettifies example #029" do
149 | text = "hello
This is HTML
."
150 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("hello This is HTML.")
151 | end
152 |
153 | it "prettifies example #030" do
154 | text = 'Para obtener noticias actualizadas, visite nuestro {\field {\*\fldinst HYPERLINK "http://example.com/default.aspx?clientid=-1"}{\cs37\ul\cf2 {\fldrslt newsroom}}}\sectd\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj o suscríbase a nuestro {\field {\*\fldinst HYPERLINK "http://example.com/content/newsfeeds.aspx" \\t "_blank"}{\cs37\ul\cf2 {\fldrslt news feed}}}\sectd\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj .'
155 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Para obtener noticias actualizadas, visite nuestro newsroom o suscríbase a nuestro news feed.")
156 | end
157 |
158 | it "prettifies example #031" do
159 | text = 'For ongoing news, please visit our {\field {\*\fldinst HYPERLINK "http://example.com/default.aspx?clientid=-1"}{\cs37\ul\cf2 {\fldrslt newsroom}}}\sectd\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj or subscribe to our {\field {\*\fldinst HYPERLINK "http://example.com/content/newsfeeds.aspx" \\t "_blank"}{\cs37\ul\cf2 {\fldrslt news feed}}}\sectd\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj .'
160 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq("For ongoing news, please visit our newsroom or subscribe to our news feed.")
161 | end
162 |
163 | it "prettifies example #032" do
164 | text = 'Tenemos el agrado de dirigirnos a ustedes a fin de formularles una oferta para la utilización de Pallets (según se define en el punto 1.1 (xi) {\i infra), }vinculados al negocio de las gaseosas, sujeta a las siguientes cláusulas y condiciones (la "{\ul Oferta}").'
165 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('Tenemos el agrado de dirigirnos a ustedes a fin de formularles una oferta para la utilización de Pallets (según se define en el punto 1.1 (xi) infra), vinculados al negocio de las gaseosas, sujeta a las siguientes cláusulas y condiciones (la "Oferta").')
166 | end
167 |
168 | it "prettifies example #033" do
169 | text = '"{\ul Alquiler}": {\expndtw-1 es la suma en pesos básica diaria que el Participante debe abonar a CHEP }durante ei tiempo que cada Pallet permanece en poder del Participante, según se detalla en el Anexo VIII.'
170 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('"Alquiler": es la suma en pesos básica diaria que el Participante debe abonar a CHEP durante ei tiempo que cada Pallet permanece en poder del Participante, según se detalla en el Anexo VIII.')
171 | end
172 |
173 | it "prettifies example #034" do
174 | text = 'Pacific Islander, Asian, African, Hispanice, {\highlight7 Pacific islander} or Native American ancestry'
175 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('Pacific Islander, Asian, African, Hispanice, Pacific islander or Native American ancestry')
176 | end
177 |
178 | it "prettifies example #035" do
179 | text = 'STIMULATORS OF INSULIN RELEASE (Insulin Secretagogues) \endash increase insulin secretion from the pancreas{\super 1}'
180 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('STIMULATORS OF INSULIN RELEASE (Insulin Secretagogues) \endash increase insulin secretion from the pancreas')
181 | end
182 |
183 | it "prettifies example #036" do
184 | text = '{\f32 náuseas, jaqueca, hipoglucemia (cuando se usa con secretagogos de la insulina)} '
185 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('náuseas, jaqueca, hipoglucemia (cuando se usa con secretagogos de la insulina)')
186 | end
187 |
188 | it "prettifies example #037" do
189 | text = '{\f32 goteo nasal, infección del tracto respiratorio superior, reacciones alérgicas severas raramente} {\f32 (inflamación de la lengua, garganta, rostro o cuerpo; sarpullido severo)\~}'
190 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('goteo nasal, infección del tracto respiratorio superior, reacciones alérgicas severas raramente (inflamación de la lengua, garganta, rostro o cuerpo; sarpullido severo)\~')
191 | end
192 |
193 | it "prettifies example #038" do
194 | text = '{\field {\*\fldinst HYPERLINK "" \\l "RANGE!a1c" }{\cs10 {\fldrslt A1c*}}}'
195 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('A1c*')
196 | end
197 |
198 | it "prettifies example #039" do
199 | text = 'The two most important pieces of information for the carbohydrate controlled diet is the {\cs11\b\cf17 serving size} and the grams of {\cs11\b\cf17 total carbohydrate}.'
200 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('The two most important pieces of information for the carbohydrate controlled diet is the serving size and the grams of total carbohydrate.')
201 | end
202 |
203 | it "prettifies example #040" do
204 | text = '{\b About ABC Solutions}\line ABC Solutions is a leading provider of mission-critical communication solutions and services for enterprise and government customers.'
205 | expect(PrettyStrings::Cleaner.new(text).pretty).to eq('About ABC Solutions ABC Solutions is a leading provider of mission-critical communication solutions and services for enterprise and government customers.')
206 | end
207 | end
208 |
--------------------------------------------------------------------------------