scriptify 0.1.1 → 0.2.0
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 +4 -4
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +5 -1
- data/lib/scriptify.rb +15 -7
- data/lib/scriptify/scriptify_catalog.rb +29 -0
- data/lib/scriptify/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae47b5f22d47ae4bcb320755b375cf2d33b67ade
|
4
|
+
data.tar.gz: 9241f79b6320f3c8ce198b30844c7629321fb379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7d30f97ea1098ee39a58b7317d56bf8d62ae8131f81e89fdd46c036cd8f45b0a4091fdbaa0b8ef412263c271fce81c88796138b368eee5edceafbe193f5d566
|
7
|
+
data.tar.gz: 67bfac0882076f81b26faf66dd3f9fba35158a324f7ead13bc2814dd92b568c031427bb797fa209f4dafdef12b1b45b33598a4823d30f4c8e80b74ae7b92b1f9
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at vicente.plata@points.com . All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
[](https://travis-ci.org/xnt/scriptify)
|
4
4
|
[](https://badge.fury.io/rb/scriptify)
|
5
5
|
[](https://codeclimate.com/github/xnt/scriptify/maintainability)
|
6
|
+
[](http://makeapullrequest.com)
|
7
|
+
[](https://www.firsttimersonly.com/)
|
6
8
|
|
7
9
|
Transforms a text/string into a reasonably accurate uppercase representation.
|
8
10
|
|
@@ -64,10 +66,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
64
66
|
|
65
67
|
Bug reports and pull requests are welcome on GitHub at https://github.com/xnt/scriptify. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
66
68
|
|
69
|
+
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
|
70
|
+
|
67
71
|
## License
|
68
72
|
|
69
73
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
70
74
|
|
71
75
|
## Code of Conduct
|
72
76
|
|
73
|
-
Everyone interacting in the Scriptify project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
77
|
+
Everyone interacting in the Scriptify project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/xnt/scriptify/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/scriptify.rb
CHANGED
@@ -8,19 +8,27 @@ module Scriptify
|
|
8
8
|
}
|
9
9
|
|
10
10
|
def superscript(opts = {})
|
11
|
+
scriptify(ScriptifyCatalog.superscripts, opts)
|
12
|
+
end
|
13
|
+
|
14
|
+
def subscript(opts = {})
|
15
|
+
scriptify(ScriptifyCatalog.subscripts, opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def scriptify(catalog, opts)
|
11
20
|
opts.merge(DEFAULT_OPTS)
|
12
|
-
|
21
|
+
scripted = ""
|
13
22
|
self.to_s.split("").each do |c|
|
14
|
-
|
23
|
+
scripted += char_script(catalog, c, opts)
|
15
24
|
end
|
16
|
-
|
25
|
+
scripted
|
17
26
|
end
|
18
27
|
|
19
|
-
|
20
|
-
def char_superscript(char, opts)
|
28
|
+
def char_script(catalog, char, opts)
|
21
29
|
sym = char.to_sym
|
22
|
-
return
|
23
|
-
return
|
30
|
+
return catalog[sym] if catalog.key?(sym)
|
31
|
+
return char_script(catalog, char.downcase, opts) if opts[:fallback_lower] && upcase?(char)
|
24
32
|
return opts[:replace_unknown] if opts[:replace_unknown]
|
25
33
|
char
|
26
34
|
end
|
@@ -49,7 +49,36 @@ class ScriptifyCatalog
|
|
49
49
|
:z => 'ᶻ'
|
50
50
|
}.freeze
|
51
51
|
|
52
|
+
@@SubScripts = {
|
53
|
+
:A => 'ₐ',
|
54
|
+
:E => 'ₑ',
|
55
|
+
:G => 'ᴳ',
|
56
|
+
:H => 'ᴴ',
|
57
|
+
:I => 'ᵢ',
|
58
|
+
:J => 'ⱼ',
|
59
|
+
:O => 'ₒ',
|
60
|
+
:R => 'ᵣ',
|
61
|
+
:U => 'ᵤ',
|
62
|
+
:V => 'ᵥ',
|
63
|
+
:X => 'ₓ',
|
64
|
+
:a => 'ₐ',
|
65
|
+
:e => 'ₑ',
|
66
|
+
:g => 'ᴳ',
|
67
|
+
:h => 'ᴴ',
|
68
|
+
:i => 'ᵢ',
|
69
|
+
:j => 'ⱼ',
|
70
|
+
:o => 'ₒ',
|
71
|
+
:r => 'ᵣ',
|
72
|
+
:u => 'ᵤ',
|
73
|
+
:v => 'ᵥ',
|
74
|
+
:x => 'ₓ'
|
75
|
+
}.freeze
|
76
|
+
|
52
77
|
def self.superscripts
|
53
78
|
@@SuperScripts
|
54
79
|
end
|
80
|
+
|
81
|
+
def self.subscripts
|
82
|
+
@@SubScripts
|
83
|
+
end
|
55
84
|
end
|
data/lib/scriptify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scriptify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vicente Plata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.6.14
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Generates subscript and superscript versions of a string.
|