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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/htmlascii.gemspec +23 -0
- data/lib/htmlascii.rb +294 -0
- data/lib/htmlascii/version.rb +3 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -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
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -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
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/htmlascii.gemspec
ADDED
@@ -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
|
data/lib/htmlascii.rb
ADDED
@@ -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
|
+
';' => ';',
|
32
|
+
'<' => '<',
|
33
|
+
'=' => '=',
|
34
|
+
'>' => '>',
|
35
|
+
'?' => '?',
|
36
|
+
'@' => '@',
|
37
|
+
'A' => 'A',
|
38
|
+
'B' => 'B',
|
39
|
+
'C' => 'C',
|
40
|
+
'D' => 'D',
|
41
|
+
'E' => 'E',
|
42
|
+
'F' => 'F',
|
43
|
+
'G' => 'G',
|
44
|
+
'H' => 'H',
|
45
|
+
'I' => 'I',
|
46
|
+
'J' => 'J',
|
47
|
+
'K' => 'K',
|
48
|
+
'L' => 'L',
|
49
|
+
'M' => 'M',
|
50
|
+
'N' => 'N',
|
51
|
+
'O' => 'O',
|
52
|
+
'P' => 'P',
|
53
|
+
'Q' => 'Q',
|
54
|
+
'R' => 'R',
|
55
|
+
'S' => 'S',
|
56
|
+
'T' => 'T',
|
57
|
+
'U' => 'U',
|
58
|
+
'V' => 'V',
|
59
|
+
'W' => 'W',
|
60
|
+
'X' => 'X',
|
61
|
+
'Y' => 'Y',
|
62
|
+
'Z' => 'Z',
|
63
|
+
'[' => '[',
|
64
|
+
'\' => '\ ',
|
65
|
+
']' => ']',
|
66
|
+
'^' => '^',
|
67
|
+
'_' => '_',
|
68
|
+
'`' => '`',
|
69
|
+
'a' => 'a',
|
70
|
+
'b' => 'b',
|
71
|
+
'c' => 'c',
|
72
|
+
'd' => 'd',
|
73
|
+
'e' => 'e',
|
74
|
+
'f' => 'f',
|
75
|
+
'g' => 'g',
|
76
|
+
'h' => 'h',
|
77
|
+
'i' => 'i',
|
78
|
+
'j' => 'j',
|
79
|
+
'k' => 'k',
|
80
|
+
'l' => 'l',
|
81
|
+
'm' => 'm',
|
82
|
+
'n' => 'n',
|
83
|
+
'o' => 'o',
|
84
|
+
'p' => 'p',
|
85
|
+
'q' => 'q',
|
86
|
+
'r' => 'r',
|
87
|
+
's' => 's',
|
88
|
+
't' => 't',
|
89
|
+
'u' => 'u',
|
90
|
+
'v' => 'v',
|
91
|
+
'w' => 'w',
|
92
|
+
'x' => 'x',
|
93
|
+
'y' => 'y',
|
94
|
+
'z' => 'z',
|
95
|
+
'{' => '{',
|
96
|
+
'|' => '|',
|
97
|
+
'}' => '}',
|
98
|
+
'~' => '~',
|
99
|
+
' ' => ' ',
|
100
|
+
'¡' => '¡',
|
101
|
+
'¢' => '¢',
|
102
|
+
'£' => '£',
|
103
|
+
'¤' => '¤',
|
104
|
+
'¥' => '¥',
|
105
|
+
'¦' => '¦',
|
106
|
+
'§' => '§',
|
107
|
+
'¨' => '¨',
|
108
|
+
'©' => '©',
|
109
|
+
'ª' => 'ª',
|
110
|
+
'«' => '«',
|
111
|
+
'¬' => '¬',
|
112
|
+
'­' => '',
|
113
|
+
'®' => '®',
|
114
|
+
'¯' => '¯',
|
115
|
+
'°' => '°',
|
116
|
+
'±' => '±',
|
117
|
+
'²' => '²',
|
118
|
+
'³' => '³',
|
119
|
+
'´' => '´',
|
120
|
+
'µ' => 'µ',
|
121
|
+
'¶' => '¶',
|
122
|
+
'·' => '·',
|
123
|
+
'¸' => '¸',
|
124
|
+
'¹' => '¹',
|
125
|
+
'º' => 'º',
|
126
|
+
'»' => '»',
|
127
|
+
'¼' => '¼',
|
128
|
+
'½' => '½',
|
129
|
+
'¾' => '¾',
|
130
|
+
'¿' => '¿',
|
131
|
+
'×' => '×',
|
132
|
+
'÷' => '÷',
|
133
|
+
'À' => 'À',
|
134
|
+
'Á' => 'Á',
|
135
|
+
'Â' => 'Â',
|
136
|
+
'Ã' => 'Ã',
|
137
|
+
'Ä' => 'Ä',
|
138
|
+
'Å' => 'Å',
|
139
|
+
'Æ' => 'Æ',
|
140
|
+
'Ç' => 'Ç',
|
141
|
+
'È' => 'È',
|
142
|
+
'É' => 'É',
|
143
|
+
'Ê' => 'Ê',
|
144
|
+
'Ë' => 'Ë',
|
145
|
+
'Ì' => 'Ì',
|
146
|
+
'Í' => 'Í',
|
147
|
+
'Î' => 'Î',
|
148
|
+
'Ï' => 'Ï',
|
149
|
+
'Ð' => 'Ð',
|
150
|
+
'Ñ' => 'Ñ',
|
151
|
+
'Ò' => 'Ò',
|
152
|
+
'Ó' => 'Ó',
|
153
|
+
'Ô' => 'Ô',
|
154
|
+
'Õ' => 'Õ',
|
155
|
+
'Ö' => 'Ö',
|
156
|
+
'Ø' => 'Ø',
|
157
|
+
'Ù' => 'Ù',
|
158
|
+
'Ú' => 'Ú',
|
159
|
+
'Û' => 'Û',
|
160
|
+
'Ü' => 'Ü',
|
161
|
+
'Ý' => 'Ý',
|
162
|
+
'Þ' => 'Þ',
|
163
|
+
'ß' => 'ß',
|
164
|
+
'à' => 'à',
|
165
|
+
'á' => 'á',
|
166
|
+
'â' => 'â',
|
167
|
+
'ã' => 'ã',
|
168
|
+
'ä' => 'ä',
|
169
|
+
'å' => 'å',
|
170
|
+
'æ' => 'æ',
|
171
|
+
'ç' => 'ç',
|
172
|
+
'è' => 'è',
|
173
|
+
'é' => 'é',
|
174
|
+
'ê' => 'ê',
|
175
|
+
'ë' => 'ë',
|
176
|
+
'ì' => 'ì',
|
177
|
+
'í' => 'í',
|
178
|
+
'î' => 'î',
|
179
|
+
'ï' => 'ï',
|
180
|
+
'ð' => 'ð',
|
181
|
+
'ñ' => 'ñ',
|
182
|
+
'ò' => 'ò',
|
183
|
+
'ó' => 'ó',
|
184
|
+
'ô' => 'ô',
|
185
|
+
'õ' => 'õ',
|
186
|
+
'ö' => 'ö',
|
187
|
+
'ø' => 'ø',
|
188
|
+
'ù' => 'ù',
|
189
|
+
'ú' => 'ú',
|
190
|
+
'û' => 'û',
|
191
|
+
'ü' => 'ü',
|
192
|
+
'ý' => 'ý',
|
193
|
+
'þ' => 'þ',
|
194
|
+
'ÿ' => 'ÿ',
|
195
|
+
'∀' => '∀',
|
196
|
+
'∂' => '∂',
|
197
|
+
'∃' => '∃',
|
198
|
+
'∅' => '∅',
|
199
|
+
'∇' => '∇',
|
200
|
+
'∈' => '∈',
|
201
|
+
'∉' => '∉',
|
202
|
+
'∋' => '∋',
|
203
|
+
'∏' => '∏',
|
204
|
+
'∑' => '∑',
|
205
|
+
'−' => '−',
|
206
|
+
'∗' => '∗',
|
207
|
+
'√' => '√',
|
208
|
+
'∝' => '∝',
|
209
|
+
'∞' => '∞',
|
210
|
+
'∠' => '∠',
|
211
|
+
'∧' => '∧',
|
212
|
+
'∨' => '∨',
|
213
|
+
'∩' => '∩',
|
214
|
+
'∪' => '∪',
|
215
|
+
'∫' => '∫',
|
216
|
+
'∴' => '∴',
|
217
|
+
'∼' => '∼',
|
218
|
+
'≅' => '≅',
|
219
|
+
'≈' => '≈',
|
220
|
+
'≠' => '≠',
|
221
|
+
'≡' => '≡',
|
222
|
+
'≤' => '≤',
|
223
|
+
'≥' => '≥',
|
224
|
+
'⊂' => '⊂',
|
225
|
+
'⊃' => '⊃',
|
226
|
+
'⊄' => '⊄',
|
227
|
+
'⊆' => '⊆',
|
228
|
+
'⊇' => '⊇',
|
229
|
+
'⊕' => '⊕',
|
230
|
+
'⊗' => '⊗',
|
231
|
+
'⊥' => '⊥',
|
232
|
+
'⋅' => '⋅',
|
233
|
+
'Α' => 'Α',
|
234
|
+
'Β' => 'Β',
|
235
|
+
'Γ' => 'Γ',
|
236
|
+
'Δ' => 'Δ',
|
237
|
+
'Ε' => 'Ε',
|
238
|
+
'Ζ' => 'Ζ',
|
239
|
+
'Η' => 'Η',
|
240
|
+
'Θ' => 'Θ',
|
241
|
+
'Ι' => 'Ι',
|
242
|
+
'Κ' => 'Κ',
|
243
|
+
'Λ' => 'Λ',
|
244
|
+
'Μ' => 'Μ',
|
245
|
+
'Ν' => 'Ν',
|
246
|
+
'Ξ' => 'Ξ',
|
247
|
+
'Ο' => 'Ο',
|
248
|
+
'Π' => 'Π',
|
249
|
+
'Ρ' => 'Ρ',
|
250
|
+
'Σ' => 'Σ',
|
251
|
+
'Τ' => 'Τ',
|
252
|
+
'Υ' => 'Υ',
|
253
|
+
'Φ' => 'Φ',
|
254
|
+
'Χ' => 'Χ',
|
255
|
+
'Ψ' => 'Ψ',
|
256
|
+
'Ω' => 'Ω',
|
257
|
+
'α' => 'α',
|
258
|
+
'β' => 'β',
|
259
|
+
'γ' => 'γ',
|
260
|
+
'δ' => 'δ',
|
261
|
+
'ε' => 'ε',
|
262
|
+
'ζ' => 'ζ',
|
263
|
+
'η' => 'η',
|
264
|
+
'θ' => 'θ',
|
265
|
+
'ι' => 'ι',
|
266
|
+
'κ' => 'κ',
|
267
|
+
'λ' => 'λ',
|
268
|
+
'μ' => 'μ',
|
269
|
+
'ν' => 'ν',
|
270
|
+
'ξ' => 'ξ',
|
271
|
+
'ο' => 'ο',
|
272
|
+
'π' => 'π',
|
273
|
+
'ρ' => 'ρ',
|
274
|
+
'ς' => 'ς',
|
275
|
+
'σ' => 'σ',
|
276
|
+
'τ' => 'τ',
|
277
|
+
'υ' => 'υ',
|
278
|
+
'φ' => 'φ',
|
279
|
+
'χ' => 'χ',
|
280
|
+
'ψ' => 'ψ',
|
281
|
+
'ω' => 'ω',
|
282
|
+
'ϑ' => 'ϑ',
|
283
|
+
'ϒ' => 'ϒ',
|
284
|
+
'ϖ' => 'ϖ'
|
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
|
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: []
|