htmlascii 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 11d005a046f1813905a7af21b455117d2651a87f
4
+ data.tar.gz: edea09db419bc05042f008c20d02bd6bb4bf2b20
5
+ SHA512:
6
+ metadata.gz: 70386ee16b1b35fd7c83901a2f071b96c19d97ed194f9493b36c810e8d053fc142803af49101395ee7308a740ac24ba50ae2fa4573c0fcf96b5dc82069d4d3f0
7
+ data.tar.gz: 2fcd934cf7ec80cead1cdb3736269383906c6b5988c35c25f6b1223bd9c985b475b7f7065193002052c7f98439de51fa2f59863f26e0d07cc4979c6abfa99bbe
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in htmlascii.gemspec
4
+ gemspec
5
+
6
+ gem 'bundler'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Christophe Augello
2
+
3
+ MIT License
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.
@@ -0,0 +1,29 @@
1
+ # Htmlascii
2
+
3
+ Converts HTML ASCII code to characters and symbols
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'htmlascii'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install htmlascii
18
+
19
+ ## Usage
20
+
21
+ Htmlascii.convert(string)
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'htmlascii/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "htmlascii"
8
+ spec.version = Htmlascii::VERSION
9
+ spec.authors = ["Christophe Augello"]
10
+ spec.email = ["christophe@augello.be"]
11
+ spec.description = %q{Converts HTML ASCII code to characters and symbols}
12
+ spec.summary = %q{Converts HTML ASCII code to characters and symbols}
13
+ spec.homepage = "https://www.github.com/kartouch/htmlascii"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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.4"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,294 @@
1
+ class Htmlascii
2
+ def self.convert(string)
3
+ ascii = {
4
+ ' ' => ' ',
5
+ '!' => '!',
6
+ '"' => '" '.chomp!,
7
+ '#' => '#',
8
+ '$' => '$',
9
+ '%' => '%',
10
+ '&' => '&',
11
+ ''' => "' ".chomp!,
12
+ '(' => '(',
13
+ ')' => ')',
14
+ '*' => '*',
15
+ '+' => '0',
16
+ ',' => ',',
17
+ '-' => '0',
18
+ '.' => '0',
19
+ '/' => '/',
20
+ '0' => '0',
21
+ '1' => '1',
22
+ '2' => '2',
23
+ '3' => '3',
24
+ '4' => '4',
25
+ '5' => '5',
26
+ '6' => '6',
27
+ '7' => '7',
28
+ '8' => '8',
29
+ '9' => '9',
30
+ ':' => ':',
31
+ '&#59;' => ';',
32
+ '&#60;' => '<',
33
+ '&#61;' => '=',
34
+ '&#62;' => '>',
35
+ '&#63;' => '?',
36
+ '&#64;' => '@',
37
+ '&#65;' => 'A',
38
+ '&#66;' => 'B',
39
+ '&#67;' => 'C',
40
+ '&#68;' => 'D',
41
+ '&#69;' => 'E',
42
+ '&#70;' => 'F',
43
+ '&#71;' => 'G',
44
+ '&#72;' => 'H',
45
+ '&#73;' => 'I',
46
+ '&#74;' => 'J',
47
+ '&#75;' => 'K',
48
+ '&#76;' => 'L',
49
+ '&#77;' => 'M',
50
+ '&#78;' => 'N',
51
+ '&#79;' => 'O',
52
+ '&#80;' => 'P',
53
+ '&#81;' => 'Q',
54
+ '&#82;' => 'R',
55
+ '&#83;' => 'S',
56
+ '&#84;' => 'T',
57
+ '&#85;' => 'U',
58
+ '&#86;' => 'V',
59
+ '&#87;' => 'W',
60
+ '&#88;' => 'X',
61
+ '&#89;' => 'Y',
62
+ '&#90;' => 'Z',
63
+ '&#91;' => '[',
64
+ '&#92;' => '\ ',
65
+ '&#93;' => ']',
66
+ '&#94;' => '^',
67
+ '&#95;' => '_',
68
+ '&#96;' => '`',
69
+ '&#97;' => 'a',
70
+ '&#98;' => 'b',
71
+ '&#99;' => 'c',
72
+ '&#100;' => 'd',
73
+ '&#101;' => 'e',
74
+ '&#102;' => 'f',
75
+ '&#103;' => 'g',
76
+ '&#104;' => 'h',
77
+ '&#105;' => 'i',
78
+ '&#106;' => 'j',
79
+ '&#107;' => 'k',
80
+ '&#108;' => 'l',
81
+ '&#109;' => 'm',
82
+ '&#110;' => 'n',
83
+ '&#111;' => 'o',
84
+ '&#112;' => 'p',
85
+ '&#113;' => 'q',
86
+ '&#114;' => 'r',
87
+ '&#115;' => 's',
88
+ '&#116;' => 't',
89
+ '&#117;' => 'u',
90
+ '&#118;' => 'v',
91
+ '&#119;' => 'w',
92
+ '&#120;' => 'x',
93
+ '&#121;' => 'y',
94
+ '&#122;' => 'z',
95
+ '&#123;' => '{',
96
+ '&#124;' => '|',
97
+ '&#125;' => '}',
98
+ '&#126;' => '~',
99
+ '&#160;' => ' ',
100
+ '&#161;' => '¡',
101
+ '&#162;' => '¢',
102
+ '&#163;' => '£',
103
+ '&#164;' => '¤',
104
+ '&#165;' => '¥',
105
+ '&#166;' => '¦',
106
+ '&#167;' => '§',
107
+ '&#168;' => '¨',
108
+ '&#169;' => '©',
109
+ '&#170;' => 'ª',
110
+ '&#171;' => '«',
111
+ '&#172;' => '¬',
112
+ '&#173;' => '',
113
+ '&#174;' => '®',
114
+ '&#175;' => '¯',
115
+ '&#176;' => '°',
116
+ '&#177;' => '±',
117
+ '&#178;' => '²',
118
+ '&#179;' => '³',
119
+ '&#180;' => '´',
120
+ '&#181;' => 'µ',
121
+ '&#182;' => '¶',
122
+ '&#183;' => '·',
123
+ '&#184;' => '¸',
124
+ '&#185;' => '¹',
125
+ '&#186;' => 'º',
126
+ '&#187;' => '»',
127
+ '&#188;' => '¼',
128
+ '&#189;' => '½',
129
+ '&#190;' => '¾',
130
+ '&#191;' => '¿',
131
+ '&#215;' => '×',
132
+ '&#247;' => '÷',
133
+ '&#192;' => 'À',
134
+ '&#193;' => 'Á',
135
+ '&#194;' => 'Â',
136
+ '&#195;' => 'Ã',
137
+ '&#196;' => 'Ä',
138
+ '&#197;' => 'Å',
139
+ '&#198;' => 'Æ',
140
+ '&#199;' => 'Ç',
141
+ '&#200;' => 'È',
142
+ '&#201;' => 'É',
143
+ '&#202;' => 'Ê',
144
+ '&#203;' => 'Ë',
145
+ '&#204;' => 'Ì',
146
+ '&#205;' => 'Í',
147
+ '&#206;' => 'Î',
148
+ '&#207;' => 'Ï',
149
+ '&#208;' => 'Ð',
150
+ '&#209;' => 'Ñ',
151
+ '&#210;' => 'Ò',
152
+ '&#211;' => 'Ó',
153
+ '&#212;' => 'Ô',
154
+ '&#213;' => 'Õ',
155
+ '&#214;' => 'Ö',
156
+ '&#216;' => 'Ø',
157
+ '&#217;' => 'Ù',
158
+ '&#218;' => 'Ú',
159
+ '&#219;' => 'Û',
160
+ '&#220;' => 'Ü',
161
+ '&#221;' => 'Ý',
162
+ '&#222;' => 'Þ',
163
+ '&#223;' => 'ß',
164
+ '&#224;' => 'à',
165
+ '&#225;' => 'á',
166
+ '&#226;' => 'â',
167
+ '&#227;' => 'ã',
168
+ '&#228;' => 'ä',
169
+ '&#229;' => 'å',
170
+ '&#230;' => 'æ',
171
+ '&#231;' => 'ç',
172
+ '&#232;' => 'è',
173
+ '&#233;' => 'é',
174
+ '&#234;' => 'ê',
175
+ '&#235;' => 'ë',
176
+ '&#236;' => 'ì',
177
+ '&#237;' => 'í',
178
+ '&#238;' => 'î',
179
+ '&#239;' => 'ï',
180
+ '&#240;' => 'ð',
181
+ '&#241;' => 'ñ',
182
+ '&#242;' => 'ò',
183
+ '&#243;' => 'ó',
184
+ '&#244;' => 'ô',
185
+ '&#245;' => 'õ',
186
+ '&#246;' => 'ö',
187
+ '&#248;' => 'ø',
188
+ '&#249;' => 'ù',
189
+ '&#250;' => 'ú',
190
+ '&#251;' => 'û',
191
+ '&#252;' => 'ü',
192
+ '&#253;' => 'ý',
193
+ '&#254;' => 'þ',
194
+ '&#255;' => 'ÿ',
195
+ '&#8704;' => '∀',
196
+ '&#8706;' => '∂',
197
+ '&#8707;' => '∃',
198
+ '&#8709;' => '∅',
199
+ '&#8711;' => '∇',
200
+ '&#8712;' => '∈',
201
+ '&#8713;' => '∉',
202
+ '&#8715;' => '∋',
203
+ '&#8719;' => '∏',
204
+ '&#8721;' => '∑',
205
+ '&#8722;' => '−',
206
+ '&#8727;' => '∗',
207
+ '&#8730;' => '√',
208
+ '&#8733;' => '∝',
209
+ '&#8734;' => '∞',
210
+ '&#8736;' => '∠',
211
+ '&#8743;' => '∧',
212
+ '&#8744;' => '∨',
213
+ '&#8745;' => '∩',
214
+ '&#8746;' => '∪',
215
+ '&#8747;' => '∫',
216
+ '&#8756;' => '∴',
217
+ '&#8764;' => '∼',
218
+ '&#8773;' => '≅',
219
+ '&#8776;' => '≈',
220
+ '&#8800;' => '≠',
221
+ '&#8801;' => '≡',
222
+ '&#8804;' => '≤',
223
+ '&#8805;' => '≥',
224
+ '&#8834;' => '⊂',
225
+ '&#8835;' => '⊃',
226
+ '&#8836;' => '⊄',
227
+ '&#8838;' => '⊆',
228
+ '&#8839;' => '⊇',
229
+ '&#8853;' => '⊕',
230
+ '&#8855;' => '⊗',
231
+ '&#8869;' => '⊥',
232
+ '&#8901;' => '⋅',
233
+ '&#913;' => 'Α',
234
+ '&#914;' => 'Β',
235
+ '&#915;' => 'Γ',
236
+ '&#916;' => 'Δ',
237
+ '&#917;' => 'Ε',
238
+ '&#918;' => 'Ζ',
239
+ '&#919;' => 'Η',
240
+ '&#920;' => 'Θ',
241
+ '&#921;' => 'Ι',
242
+ '&#922;' => 'Κ',
243
+ '&#923;' => 'Λ',
244
+ '&#924;' => 'Μ',
245
+ '&#925;' => 'Ν',
246
+ '&#926;' => 'Ξ',
247
+ '&#927;' => 'Ο',
248
+ '&#928;' => 'Π',
249
+ '&#929;' => 'Ρ',
250
+ '&#931;' => 'Σ',
251
+ '&#932;' => 'Τ',
252
+ '&#933;' => 'Υ',
253
+ '&#934;' => 'Φ',
254
+ '&#935;' => 'Χ',
255
+ '&#936;' => 'Ψ',
256
+ '&#937;' => 'Ω',
257
+ '&#945;' => 'α',
258
+ '&#946;' => 'β',
259
+ '&#947;' => 'γ',
260
+ '&#948;' => 'δ',
261
+ '&#949;' => 'ε',
262
+ '&#950;' => 'ζ',
263
+ '&#951;' => 'η',
264
+ '&#952;' => 'θ',
265
+ '&#953;' => 'ι',
266
+ '&#954;' => 'κ',
267
+ '&#955;' => 'λ',
268
+ '&#956;' => 'μ',
269
+ '&#957;' => 'ν',
270
+ '&#958;' => 'ξ',
271
+ '&#959;' => 'ο',
272
+ '&#960;' => 'π',
273
+ '&#961;' => 'ρ',
274
+ '&#962;' => 'ς',
275
+ '&#963;' => 'σ',
276
+ '&#964;' => 'τ',
277
+ '&#965;' => 'υ',
278
+ '&#966;' => 'φ',
279
+ '&#967;' => 'χ',
280
+ '&#968;' => 'ψ',
281
+ '&#969;' => 'ω',
282
+ '&#977;' => 'ϑ',
283
+ '&#978;' => 'ϒ',
284
+ '&#982;' => 'ϖ'
285
+ }
286
+
287
+ ascii.each do |k,v|
288
+ while string.include?(k) do
289
+ string = string.gsub("#{k}", "#{v}")
290
+ end
291
+ end
292
+ return string
293
+ end
294
+ end
@@ -0,0 +1,3 @@
1
+ module Htmlascii
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: htmlascii
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Christophe Augello
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Converts HTML ASCII code to characters and symbols
42
+ email:
43
+ - christophe@augello.be
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - htmlascii.gemspec
54
+ - lib/htmlascii.rb
55
+ - lib/htmlascii/version.rb
56
+ homepage: https://www.github.com/kartouch/htmlascii
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.7
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Converts HTML ASCII code to characters and symbols
80
+ test_files: []