HtmlCodeCleaner 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/HtmlCodeCleaner.rb +40 -38
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dabb9906289938ac0a08ff460fd8ed60eb7d6737
4
- data.tar.gz: fd8484eb4bfac09ca85bcfe7d24981f652e3f33f
3
+ metadata.gz: aa1e6237d9a69a735ae0741013117ddec55435e5
4
+ data.tar.gz: 1610dc07c4759e3016d4782948a97193eb48d38a
5
5
  SHA512:
6
- metadata.gz: 041f0dcaea6bbbeba1aeea3206c26da7b387767d320b1e4afc3b26347586d48fc7e897d7cd75dd9d076d0f0e15b2b652bf9d48989d813c11b04b6d7b9c35f1bf
7
- data.tar.gz: 4e4bf9d219b8e3ffca8b985bf7a61211c0ccb91cb227ac2a975723cc06003eebcf155403c3e0370d9ff7f448192b17dd915d0318bfd3c00898044aab917f6ec4
6
+ metadata.gz: 238965586873679aad3ca665fad9ddb397afa6d6e5cf61a963448847ef180e2adf6eedf268ca59fd3532c6c0d5a86d2732845baea32119b23eb8ca0bc2531906
7
+ data.tar.gz: 2a4ad41549e35e17e61f6a5786f17077cbbf742c9ec7d3f1dcd405b2a2db255aca7609b21b72f71e81eff5fa41f70c0134f4d4842648a69bfad180e32c476759
@@ -10,12 +10,14 @@ class HtmlCodeCleaner
10
10
  def self.clean_string(string)
11
11
  if (string != nil)
12
12
  # This is the dictionary containing the html code and it's replacement symbol.
13
- dict = [ ['!',"!"],
14
- ['"','"'],
13
+ dict = [
14
+ [' '," "],
15
+ ['!',"!"],
16
+ ['"','"'], ['"','"'],
15
17
  ['#','#'],
16
18
  ['$',"$"],
17
19
  ['%',"%"],
18
- ['&',"&"],
20
+ ['&',"&"], ['&',"&"],
19
21
  [''',"'"],
20
22
  ['(',"("],
21
23
  [')',")"],
@@ -37,9 +39,9 @@ class HtmlCodeCleaner
37
39
  ['9',"9"],
38
40
  [':',":"],
39
41
  ['&#59;',";"],
40
- ['&#60;',"<"],
42
+ ['&#60;',"<"], ['&lt;',"<"],
41
43
  ['&#61;',"="],
42
- ['&#62;',">"],
44
+ ['&#62;',">"], ['&gt;',">"],
43
45
  ['&#63;',"?"],
44
46
  ['&#64;',"@"],
45
47
  ['&#65;',"A"], ['&#97;',"a"],
@@ -110,38 +112,38 @@ class HtmlCodeCleaner
110
112
  ['&#157;'," "],
111
113
  ['&#158;',"ž"],
112
114
  ['&#159;',"Ÿ"],
113
- ['&#160;'," "],
114
- ['&#161;',"¡"],
115
- ['&#162;',"¢"],
116
- ['&#163;',"£"],
117
- ['&#164;',"¤"],
118
- ['&#165;',"¥"],
119
- ['&#166;',"¦"],
120
- ['&#167;',"§"],
121
- ['&#168;',"¨"],
122
- ['&#169;',"©"],
123
- ['&#170;',"ª"],
124
- ['&#171;',"«"],
125
- ['&#172;',"¬"],
126
- ['&#173;',""],
127
- ['&#174;',"®"],
128
- ['&#175;',"¯"],
129
- ['&#176;',"°"],
130
- ['&#177;',"±"],
131
- ['&#178;',"²"],
132
- ['&#179;',"³"],
133
- ['&#180;',"´"],
134
- ['&#181;',"µ"],
135
- ['&#182;',"¶"],
136
- ['&#183;',"·"],
137
- ['&#184;',"¸"],
138
- ['&#185;',"¹"],
139
- ['&#186;',"º"],
140
- ['&#187;',"»"],
141
- ['&#188;',"¼"],
142
- ['&#189;',"½"],
143
- ['&#190;',"¾"],
144
- ['&#191;',"¿"],
115
+ ['&#160;'," "], ['&nbsp;'," "],
116
+ ['&#161;',"¡"], ['&iexcl;',"¡"],
117
+ ['&#162;',"¢"], ['&cent;',"¢"],
118
+ ['&#163;',"£"], ['&pound;',"£"],
119
+ ['&#164;',"¤"], ['&curren;',"¤"],
120
+ ['&#165;',"¥"], ['&yen;',"¥"],
121
+ ['&#166;',"¦"], ['&brvbar;',"¦"],
122
+ ['&#167;',"§"], ['&sect;',"§"],
123
+ ['&#168;',"¨"], ['&uml;',"¨"],
124
+ ['&#169;',"©"], ['&copy;',"©"],
125
+ ['&#170;',"ª"], ['&ordf;',"ª"],
126
+ ['&#171;',"«"], ['&laquo;',"«"],
127
+ ['&#172;',"¬"], ['&not;',"¬"],
128
+ ['&#173;',""], ['&shy;',""],
129
+ ['&#174;',"®"], ['&reg;',"®"],
130
+ ['&#175;',"¯"], ['&macr;',"¯"],
131
+ ['&#176;',"°"], ['&deg;',"°"],
132
+ ['&#177;',"±"], ['&plusmn;',"±"],
133
+ ['&#178;',"²"], ['&sup2;',"²"],
134
+ ['&#179;',"³"], ['&sup3;',"³"],
135
+ ['&#180;',"´"], ['&acute;',"´"],
136
+ ['&#181;',"µ"], ['&micro;',"µ"],
137
+ ['&#182;',"¶"], ['&para;',"¶"],
138
+ ['&#183;',"·"], ['&middot;',"·"],
139
+ ['&#184;',"¸"], ['&cedil;',"¸"],
140
+ ['&#185;',"¹"], ['&sup1;',"¹"],
141
+ ['&#186;',"º"], ['&ordm;',"º"],
142
+ ['&#187;',"»"], ['&raquo;',"»"],
143
+ ['&#188;',"¼"], ['&frac14;',"¼"],
144
+ ['&#189;',"½"], ['&frac12;',"½"],
145
+ ['&#190;',"¾"], ['&frac34;',"¾"],
146
+ ['&#191;',"¿"], ['&iquest;',"¿"],
145
147
  ['&#192;',"À"],
146
148
  ['&#193;',"Á"],
147
149
  ['&#194;',"Â"],
@@ -225,7 +227,7 @@ class HtmlCodeCleaner
225
227
  ['&#8226;',"•"],
226
228
  ['&#8230;',"…"],
227
229
  ['&#8240;',"‰"],
228
- ['&#8364;',"€"],
230
+ ['&#8364;',"€"], ['&euro;',"€"],
229
231
  ['&#8482;',"™"] ]
230
232
  # Parse the string of the html code and make the replacement
231
233
  dict.each { |x| string = string.gsub(x.first, x.last) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HtmlCodeCleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hiland
@@ -42,7 +42,7 @@ requirements: []
42
42
  rubyforge_project:
43
43
  rubygems_version: 2.2.2
44
44
  signing_key:
45
- specification_version: 3
45
+ specification_version: 4
46
46
  summary: Replace Html code with symbol
47
47
  test_files:
48
48
  - test/test_hcc.rb