rage_flip 2.5.2 → 2.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aba53959f80e42aea3bad97b53270a8a94f919a454041f608a3b5254c9a81960
4
- data.tar.gz: 339c8ec100a6af097943c5dd2da01ad0ead2560965ab409e2234fe37362f3af6
3
+ metadata.gz: 3e5814ed80482929c686ad95a1a51d3fc2b56fe62bc56d469d44841fc6601f66
4
+ data.tar.gz: 939c6f910ada84f9e035b1c983fd24f9d4d9547dd2d8e247f9d74cd8a2f90a08
5
5
  SHA512:
6
- metadata.gz: ab33ecbad214b3aa56885fe4a5f2a97926d1484f0dc1411adad7494af114be791cc398e5230387b80f3e0720fd08f669d549d9f2899278617841162273f8c6f8
7
- data.tar.gz: 1187dca4e5f08e748112fab921efe45ec732e7a2e2a573d2d8dacb8356e5769206026ef549688a80d6c1b6fa8da79cee1c0f4def99793dfc0c5eee9f4e0c42ef
6
+ metadata.gz: 473b551e8fc88390d3f5117ee4a540913eccf119e69b6fe16ddb111db916ac785909480784d4a6075d6ab4a717e3e4afcd83fdf8d4c842955a9457adb514e3ac
7
+ data.tar.gz: e1e96548beb53e6d08245d1a4cfbec010a583be7e75ccbf553334d7441def7e548e4c4057ab8ca09dc919eda32461cc69d320732d90416999090d30821d7ba11
data/CHANGELOG.md CHANGED
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
  ### Added
11
+ - `italic` command that swaps letters for slanted Unicode alternatives, or script ones with `--script`
11
12
  - `flip_text` command for flipping text without any emoticons
12
13
  - `emote` command system with disapproval and animal+poop combinations
13
14
  - `emote disapproval` outputs `(ಠ_ಠ)`
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  `rage_flip` is a comprehensive Ruby gem that provides text manipulation utilities with clipboard integration. It flips text upside down with rage table flip emoticons, includes extensive text formatting tools, and features a rich collection of emotes and text substitutions for enhanced communication.
4
4
 
5
+ Prefer an app? The same functionality is also available [on the App Store](https://apps.apple.com/app/id6827749145).
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -181,6 +183,18 @@ doubleunderline "double underlined"
181
183
  # Output: d̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳d̳
182
184
  ```
183
185
 
186
+ ### italic
187
+
188
+ Swaps letters for slanted Unicode alternatives, or script ones with `--script`. Digits, punctuation, and accented letters are left unchanged:
189
+
190
+ ```bash
191
+ italic "italic text"
192
+ # Output: 𝑖𝑡𝑎𝑙𝑖𝑐 𝑡𝑒𝑥𝑡
193
+
194
+ italic --script "script text"
195
+ # Output: 𝓈𝒸𝓇𝒾𝓅𝓉 𝓉ℯ𝓍𝓉
196
+ ```
197
+
184
198
  ### chaos
185
199
 
186
200
  Adds random Unicode combining characters for a chaotic effect:
@@ -296,6 +310,13 @@ RageFlip::Underline.single_underline("text")
296
310
  RageFlip::Underline.double_underline("text")
297
311
  # => "t̳e̳x̳t̳"
298
312
 
313
+ # Italic (slanted or script)
314
+ RageFlip::Italic.slanted("text")
315
+ # => "𝑡𝑒𝑥𝑡"
316
+
317
+ RageFlip::Italic.script("text")
318
+ # => "𝓉ℯ𝓍𝓉"
319
+
299
320
  # Chaos
300
321
  RageFlip::Chaos.process("text", 5)
301
322
  # => "t̸e̷x̸t̷"
data/exe/italic ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/rage_flip"
4
+
5
+ script = ARGV.first == "--script"
6
+ text = ARGV.drop(script ? 1 : 0).join(" ")
7
+
8
+ if text.empty?
9
+ puts "Usage: italic [--script] <text_to_italicize>"
10
+ exit 1
11
+ end
12
+
13
+ result = RageFlip::Italic.process(text, script: script)
14
+
15
+ if RageFlip::Clipboard.copy(result)
16
+ else
17
+ puts "Failed to copy to clipboard, but here's your italic text:"
18
+ end
19
+ puts result
@@ -0,0 +1,49 @@
1
+ module RageFlip
2
+ class Italic
3
+ # Unicode leaves holes in these alphabets for letters that were already
4
+ # encoded in the Letterlike Symbols block, so those are mapped explicitly.
5
+ SLANTED_EXCEPTIONS = {
6
+ "h" => "ℎ"
7
+ }.freeze
8
+
9
+ SCRIPT_EXCEPTIONS = {
10
+ "B" => "ℬ",
11
+ "E" => "ℰ",
12
+ "F" => "ℱ",
13
+ "H" => "ℋ",
14
+ "I" => "ℐ",
15
+ "L" => "ℒ",
16
+ "M" => "ℳ",
17
+ "R" => "ℛ",
18
+ "e" => "ℯ",
19
+ "g" => "ℊ",
20
+ "o" => "ℴ"
21
+ }.freeze
22
+
23
+ def self.build_map(upper_start, lower_start, exceptions)
24
+ upper = ("A".."Z").each_with_index.to_h { |c, i| [c, [upper_start + i].pack("U")] }
25
+ lower = ("a".."z").each_with_index.to_h { |c, i| [c, [lower_start + i].pack("U")] }
26
+ upper.merge(lower).merge(exceptions).freeze
27
+ end
28
+ private_class_method :build_map
29
+
30
+ # Mathematical Italic
31
+ SLANTED_MAP = build_map(0x1D434, 0x1D44E, SLANTED_EXCEPTIONS)
32
+ # Mathematical Script
33
+ SCRIPT_MAP = build_map(0x1D49C, 0x1D4B6, SCRIPT_EXCEPTIONS)
34
+
35
+ # Characters without an alternative (digits, punctuation, accented
36
+ # letters) pass through unchanged.
37
+ def self.process(text, script: false)
38
+ text.gsub(/[A-Za-z]/, script ? SCRIPT_MAP : SLANTED_MAP)
39
+ end
40
+
41
+ def self.slanted(text)
42
+ process(text, script: false)
43
+ end
44
+
45
+ def self.script(text)
46
+ process(text, script: true)
47
+ end
48
+ end
49
+ end
@@ -1,3 +1,3 @@
1
1
  module RageFlip
2
- VERSION = "2.5.2"
2
+ VERSION = "2.6.0"
3
3
  end
data/lib/rage_flip.rb CHANGED
@@ -3,6 +3,7 @@ require_relative "rage_flip/flipper"
3
3
  require_relative "rage_flip/sarcasm"
4
4
  require_relative "rage_flip/strikethrough"
5
5
  require_relative "rage_flip/underline"
6
+ require_relative "rage_flip/italic"
6
7
  require_relative "rage_flip/chaos"
7
8
  require_relative "rage_flip/clipboard"
8
9
  require_relative "rage_flip/emote"
@@ -112,6 +112,44 @@ RSpec.describe RageFlip do
112
112
  end
113
113
  end
114
114
 
115
+ describe RageFlip::Italic do
116
+ describe ".slanted" do
117
+ it "swaps letters for mathematical italic characters" do
118
+ expect(RageFlip::Italic.slanted("Az")).to eq("\u{1D434}\u{1D467}")
119
+ end
120
+
121
+ it "uses the Letterlike Symbols character for h" do
122
+ expect(RageFlip::Italic.slanted("h")).to eq("\u210E")
123
+ end
124
+ end
125
+
126
+ describe ".script" do
127
+ it "swaps letters for mathematical script characters" do
128
+ expect(RageFlip::Italic.script("Az")).to eq("\u{1D49C}\u{1D4CF}")
129
+ end
130
+
131
+ it "uses the Letterlike Symbols characters for letters missing from the script block" do
132
+ expect(RageFlip::Italic.script("BEFHILMRego")).to eq("\u212C\u2130\u2131\u210B\u2110\u2112\u2133\u211B\u212F\u210A\u2134")
133
+ end
134
+ end
135
+
136
+ describe ".process" do
137
+ it "maps every ASCII letter to a distinct, assigned character" do
138
+ letters = [*"A".."Z", *"a".."z"]
139
+ [false, true].each do |script|
140
+ mapped = letters.map { |c| RageFlip::Italic.process(c, script: script) }
141
+ expect(mapped.uniq.length).to eq(52)
142
+ expect(mapped).to all(match(/\A\p{Assigned}\z/))
143
+ end
144
+ end
145
+
146
+ it "leaves digits, punctuation, whitespace and accented letters unchanged" do
147
+ expect(RageFlip::Italic.process("1 2, é!")).to eq("1 2, é!")
148
+ expect(RageFlip::Italic.process("1 2, é!", script: true)).to eq("1 2, é!")
149
+ end
150
+ end
151
+ end
152
+
115
153
  describe RageFlip::Chaos do
116
154
  let(:chaos_file) { File.expand_path("~/.chaos_level.txt") }
117
155
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rage_flip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Powell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-27 00:00:00.000000000 Z
11
+ date: 2026-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -52,6 +52,7 @@ executables:
52
52
  - flip
53
53
  - flip_text
54
54
  - frustrated
55
+ - italic
55
56
  - rage_flip
56
57
  - sarcasm
57
58
  - strikethrough
@@ -77,6 +78,7 @@ files:
77
78
  - exe/flip
78
79
  - exe/flip_text
79
80
  - exe/frustrated
81
+ - exe/italic
80
82
  - exe/rage_flip
81
83
  - exe/sarcasm
82
84
  - exe/strikethrough
@@ -89,6 +91,7 @@ files:
89
91
  - lib/rage_flip/emote.rb
90
92
  - lib/rage_flip/flipper.rb
91
93
  - lib/rage_flip/frustrated.rb
94
+ - lib/rage_flip/italic.rb
92
95
  - lib/rage_flip/sarcasm.rb
93
96
  - lib/rage_flip/strikethrough.rb
94
97
  - lib/rage_flip/text_substitution.rb