HtmlCodeCleaner 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18c6d91ada1fc1458278180b195e742e2d743d7a
4
- data.tar.gz: 72280347646b01fba97d98db660d4542e117cad2
3
+ metadata.gz: dabb9906289938ac0a08ff460fd8ed60eb7d6737
4
+ data.tar.gz: fd8484eb4bfac09ca85bcfe7d24981f652e3f33f
5
5
  SHA512:
6
- metadata.gz: 99c8d99c21b7e94bc6de5ca30672887fcbfd8a24cdd199dadac33f4344fe341974e424d479d65f741e8c21d5f917a50c2a02bc002ada31fc93831ea75bb60a31
7
- data.tar.gz: e615a840ca997cc620981a37843ce58b9b367f08db08b053ee07fb42373fb106e222d00964e3c1b6f0e39469e7fe6b73fff43c51d3ecacaf0b9c37cb84c04402
6
+ metadata.gz: 041f0dcaea6bbbeba1aeea3206c26da7b387767d320b1e4afc3b26347586d48fc7e897d7cd75dd9d076d0f0e15b2b652bf9d48989d813c11b04b6d7b9c35f1bf
7
+ data.tar.gz: 4e4bf9d219b8e3ffca8b985bf7a61211c0ccb91cb227ac2a975723cc06003eebcf155403c3e0370d9ff7f448192b17dd915d0318bfd3c00898044aab917f6ec4
@@ -1,10 +1,15 @@
1
-
1
+ # HtmlCodeCleaner
2
+ #
3
+ # This class has a single dictionary of html code and its corresponding symbol.
4
+ # The code takes a string as input, and removes any html code and inserts the corresponding symbol.
5
+ # The output is a string.
6
+ #
2
7
  class HtmlCodeCleaner
3
-
4
8
  # removes character codes from string
5
9
  # must be defined in the dictionary
6
10
  def self.clean_string(string)
7
11
  if (string != nil)
12
+ # This is the dictionary containing the html code and it's replacement symbol.
8
13
  dict = [ ['!',"!"],
9
14
  ['"','"'],
10
15
  ['#','#'],
@@ -200,10 +205,32 @@ class HtmlCodeCleaner
200
205
  ['ü',"ü"],
201
206
  ['ý',"ý"],
202
207
  ['þ',"þ"],
203
- ['ÿ',"ÿ"] ]
208
+ ['ÿ',"ÿ"],
209
+ ['Œ',"Œ"],
210
+ ['œ',"œ"],
211
+ ['Š',"Š"],
212
+ ['š',"š"],
213
+ ['Ÿ',"Ÿ"],
214
+ ['ƒ',"ƒ"],
215
+ ['–',"–"],
216
+ ['—',"—"],
217
+ ['‘',"‘"],
218
+ ['’',"’"],
219
+ ['‚',"‚"],
220
+ ['“',"“"],
221
+ ['”',"”"],
222
+ ['„',"„"],
223
+ ['†',"†"],
224
+ ['‡',"‡"],
225
+ ['•',"•"],
226
+ ['…',"…"],
227
+ ['‰',"‰"],
228
+ ['€',"€"],
229
+ ['™',"™"] ]
230
+ # Parse the string of the html code and make the replacement
204
231
  dict.each { |x| string = string.gsub(x.first, x.last) }
232
+ # return the string
205
233
  string
206
234
  end
207
235
  end
208
-
209
236
  end
data/test/test_hcc.rb CHANGED
@@ -1,8 +1,8 @@
1
- require 'test/unit'
2
- require 'HtmlCodeCleaner'
3
1
  require 'minitest/autorun'
2
+ require 'HtmlCodeCleaner'
3
+
4
4
 
5
- class HtmlCodeCleanerTest < Test::Unit::TestCase
5
+ class HtmlCodeCleanerTest < Minitest::Test
6
6
  def test_1
7
7
  assert_equal "X", HtmlCodeCleaner.clean_string("&#88;")
8
8
  end
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hiland
@@ -10,7 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-11-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Parse a string of html code, replace code with ascii symbol
13
+ description: Parse a string of the html number, replace code with the corresponding
14
+ symbol
14
15
  email: g2c9@ugrad.cs.ubc.ca
15
16
  executables: []
16
17
  extensions: []
@@ -19,7 +20,7 @@ files:
19
20
  - Rakefile
20
21
  - lib/HtmlCodeCleaner.rb
21
22
  - test/test_hcc.rb
22
- homepage: http://rubygems.org/gems/HtmlCodeCleaner
23
+ homepage: https://github.com/mhiland/HtmlCodeCleaner
23
24
  licenses:
24
25
  - GPL-3.0
25
26
  metadata: {}
@@ -45,3 +46,4 @@ specification_version: 3
45
46
  summary: Replace Html code with symbol
46
47
  test_files:
47
48
  - test/test_hcc.rb
49
+ has_rdoc: