rage_flip 2.7.0 → 2.9.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: 1dd813996cd3fdb75c67e24b575b5d262b77fad86fca527b3beb2e401bd2be37
4
- data.tar.gz: 76520df4f90f31cf87b83d05bb58eec366554b3f30995e1be98ee3ec1f223248
3
+ metadata.gz: e2870c1ae19256f66650b3e1d1856309480d4cfe30a4c6939c46eba9659c743b
4
+ data.tar.gz: e806f88ad6b7f493052f843878e513e5b478968b920bb1dac3f6c13e356ccb8d
5
5
  SHA512:
6
- metadata.gz: 05dbaf5a3ed7d026703a8b5749d5081435ac29a80b7650f94e241d2455758543f5c5e7adc36de7af9b8555d59eb1c7d73ead91a796dd49dd8e788a533a6280d0
7
- data.tar.gz: 36d35d23d2d6ce6522efdd2650cf50ba5d391649354c5dd6822c056e9e6cf3142b60f5fb84464702f0d379da43cc2c55e93ed432f1b9e35d53ff14f1b5c9e8fc
6
+ metadata.gz: 13ea885d4de92c29dadec5ac521c8d72ae3feb204ca4c25df8ae29c169c8972c2eb42da38c78f17f471bc889add49b273e758729f2829066c8445f1c3c905e35
7
+ data.tar.gz: 44441a64540705f3188564210cd21ffbf689b06a41a54a3bc2c999e93acd3384df4da8dd2889e4f909907f2d1206aff04a6cdce6d261cd766898b5dccf8e7599
data/CHANGELOG.md CHANGED
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
  ### Added
11
+ - Interrobang substitution in every text transform (`flip`/`flip_text`, `rage_flip`, `table_flip`, `sarcasm`, `frustrated`, `confusable`, `strikethrough`, `underline`, `doubleunderline`, `italic`, `latex`, `chaos`): each `?!` or `!?` pair becomes ‽ (`?!?!` → `‽‽`, `!!?` → `!‽`). Available as `RageFlip::Interrobang.process`
12
+ - Flips turn `?` into `¿` and ‽ into the inverted interrobang ⸘
13
+ - `emote interrobangtext` (‽) and `latex '\interrobang'` (‽); `emote interrobang` still gives the ⁉️ emoji
11
14
  - `latex` command that replaces LaTeX-style markup (`\int`, `\sqrt{x}`, `x^2`, `a_{n+1}`, `\frac{1}{2}`, Greek letters, relations, arrows) with Unicode symbols
12
15
  - `emote` math symbols in a new `math` category: roots (`sqrt`/`radical` √, `cbrt` ∛, `fourthroot` ∜), integrals (`integral` ∫ and friends), `summation` ∑, `squared` ², `cubed` ³, `sup0`–`sup9`, `sub0`–`sub9`, and common relations like `plusminus` ±
13
16
  - `emote celsius`, `fahrenheit`, `kelvin`, and `rankine` temperature unit symbols (℃ ℉ K °R)
@@ -20,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
23
  - `table_flip` command with classic `(╯°□°)╯︵` and `┻━┻` emoticons
21
24
 
22
25
  ### Changed
26
+ - `latex` treats an unbraced run of digits after `^` or `_` as one script, so `2^1000` gives `2¹⁰⁰⁰` and `a_12` gives `a₁₂` (TeX would script only the first digit). Letters still take one character, and `\frac34` is unchanged.
27
+ - Text transforms now output ‽ where the input has `?!` or `!?`, and flips output `¿` for `?` (both used to pass through unchanged)
23
28
  - `emote plusminus` and `emote minusplus` now return ± and ∓ instead of the compound ➕➖ / ➖➕ (`emote plus-minus` still gives ➕➖)
24
29
 
25
30
  ### Fixed
data/README.md CHANGED
@@ -238,6 +238,20 @@ latex '\alpha + \beta \to \gamma, \forall x \in \emptyset'
238
238
  - `\frac{1}{2}` → `½` when a vulgar fraction exists, otherwise `\frac{a+b}{c}` → `(a+b)/c`.
239
239
  - Spaces are kept as typed, `$` delimiters pass through, `\left`/`\right` are dropped, and `\{ \} \_ \^ \$ \% \& \# \\` output the escaped character.
240
240
 
241
+ ### Interrobang substitution
242
+
243
+ Every text transform (`rage_flip`, `table_flip`, `flip_text`, `sarcasm`, `frustrated`, `confusable`, `strikethrough`, `underline`, `doubleunderline`, `italic`, `latex`, `chaos`) first turns each `?!` or `!?` pair into the interrobang ‽. Pairs are matched left to right, so `?!?!` → `‽‽`, `?!?` → `‽?` and `!!?` → `!‽`; `??` and `!!` are left alone. Flips also turn `?` into `¿` and ‽ into the inverted interrobang ⸘:
244
+
245
+ ```bash
246
+ sarcasm "you did what?!"
247
+ # Output: YoU DiD WhAt‽
248
+
249
+ flip_text "really?!"
250
+ # Output: ⸘ʎʅʅɐǝɹ
251
+ ```
252
+
253
+ For a lone ‽, use `emote interrobangtext` or `latex '\interrobang'` (`emote interrobang` gives the ⁉️ emoji).
254
+
241
255
  ### chaos
242
256
 
243
257
  Adds random Unicode combining characters for a chaotic effect:
@@ -310,6 +324,7 @@ The gem includes an extensive collection of emotes organized into categories:
310
324
 
311
325
  ### Special Characters
312
326
  - `noevil` (🙈🙉🙊), `omw` ("On my way!"), `heresatable`, `kungfuhamster` (ASCII art), `unsee`
327
+ - `interrobangtext` (‽), next to the `interrobang` (⁉️) and `bangbang` (‼️) emoji
313
328
 
314
329
  Use `emote list` to see all available emotes with their outputs.
315
330
 
@@ -374,6 +389,10 @@ RageFlip::Italic.script("text")
374
389
  RageFlip::Latex.process("\\int_0^1 x^2 dx")
375
390
  # => "∫₀¹ x² dx"
376
391
 
392
+ # Interrobang (applied by every transform above)
393
+ RageFlip::Interrobang.process("what?! no!?")
394
+ # => "what‽ no‽"
395
+
377
396
  # Chaos
378
397
  RageFlip::Chaos.process("text", 5)
379
398
  # => "t̸e̷x̸t̷"
@@ -6,7 +6,7 @@ module RageFlip
6
6
  def self.process(text, chaos_level = nil)
7
7
  chaos_level ||= read_chaos_level
8
8
 
9
- text.each_char.map do |c|
9
+ Interrobang.process(text).each_char.map do |c|
10
10
  combining_chars = rand(1..chaos_level).times.map do
11
11
  "%c" % rand(0x300..0x36f)
12
12
  end
@@ -58,7 +58,7 @@ module RageFlip
58
58
  }.freeze
59
59
 
60
60
  def self.process(text)
61
- text.each_char.map { |c| CONFUSABLES[c]&.sample || c }.join
61
+ Interrobang.process(text).each_char.map { |c| CONFUSABLES[c]&.sample || c }.join
62
62
  end
63
63
  end
64
64
  end
@@ -1273,6 +1273,7 @@ module RageFlip
1273
1273
  "infinity" => "♾️",
1274
1274
  "bangbang" => "‼️",
1275
1275
  "interrobang" => "⁉️",
1276
+ "interrobangtext" => "‽", # ‽ INTERROBANG (text, unlike the ⁉️ "interrobang" emoji)
1276
1277
  "question" => "❓",
1277
1278
  "greyquestion" => "❔",
1278
1279
  "exclamation" => "❗",
@@ -1881,7 +1882,7 @@ module RageFlip
1881
1882
  "recordbutton", "ejectbutton", "cinema", "lowbrightness", "highbrightness",
1882
1883
  "signalstrength", "wireless", "vibration", "phoneoff", "female", "male", "transgender",
1883
1884
  "multiply", "plus", "minus", "divide", "heavyequals", "infinity", "bangbang",
1884
- "interrobang", "question", "greyquestion", "exclamation", "greyexclamation", "wavy",
1885
+ "interrobang", "interrobangtext", "question", "greyquestion", "exclamation", "greyexclamation", "wavy",
1885
1886
  "currencyexchange", "heavydollar", "medicalymbol", "recycle", "fleurdelis", "trident",
1886
1887
  "namebadge", "beginner", "hollowredcircle", "checkmark", "checkmarkbox", "checkmarkbtn",
1887
1888
  "crossmark", "crossbtn", "curlloop", "doublecurl", "partalt", "eightspoke",
@@ -3,7 +3,15 @@ module RageFlip
3
3
  FORWARD = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-=!@#$%^&*()_+ "
4
4
  BACKSIDEDOWN = " +‾()*⅋^%$#{@¡}=-068𝘓95ߤƐᘔ⇂zʎxʍʌnʇsɹbdouɯʅʞɾᴉɥƃⅎǝpɔqɐZ⅄XϺɅՈꓕSꓤÒԀONƜ⅂ꓘᒋIH⅁ᖵƎᗡϽꓭ∀"
5
5
 
6
+ # Characters outside FORWARD that still have an upside-down form.
7
+ EXTRA_FLIPS = {
8
+ "?" => "¿", # ¿
9
+ "‽" => "⸘" # ‽ → ⸘ (inverted interrobang)
10
+ }.freeze
11
+
6
12
  def self.flip(word)
13
+ word = Interrobang.process(word)
14
+
7
15
  # Create the upside down map by reversing the backsidedown string
8
16
  upsidedown = BACKSIDEDOWN.reverse
9
17
 
@@ -12,6 +20,7 @@ module RageFlip
12
20
  FORWARD.each_char.with_index do |char, index|
13
21
  upsidedownmap[char] = upsidedown[index] if upsidedown[index]
14
22
  end
23
+ upsidedownmap.merge!(EXTRA_FLIPS)
15
24
 
16
25
  # Flip the word: reverse the string and map each character
17
26
  flipped = ""
@@ -1,7 +1,7 @@
1
1
  module RageFlip
2
2
  class Frustrated
3
3
  def self.process(text)
4
- text.split.map(&:upcase).join(". ") + "."
4
+ Interrobang.process(text).split.map(&:upcase).join(". ") + "."
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,15 @@
1
+ module RageFlip
2
+ # Every text transform runs its input through this first, so `?!` and `!?`
3
+ # come out as the interrobang ‽ (U+203D).
4
+ class Interrobang
5
+ INTERROBANG = "‽" # ‽
6
+ PAIR = /\?!|!\?/
7
+
8
+ # Each `?!` or `!?` pair becomes one ‽, scanning left to right without
9
+ # overlap: `?!?!` → `‽‽`, `?!?` → `‽?`, `!!?` → `!‽`. `??` and `!!` are
10
+ # left alone.
11
+ def self.process(text)
12
+ text.gsub(PAIR, INTERROBANG)
13
+ end
14
+ end
15
+ end
@@ -35,7 +35,7 @@ module RageFlip
35
35
  # Characters without an alternative (digits, punctuation, accented
36
36
  # letters) pass through unchanged.
37
37
  def self.process(text, script: false)
38
- text.gsub(/[A-Za-z]/, script ? SCRIPT_MAP : SLANTED_MAP)
38
+ Interrobang.process(text).gsub(/[A-Za-z]/, script ? SCRIPT_MAP : SLANTED_MAP)
39
39
  end
40
40
 
41
41
  def self.slanted(text)
@@ -4,7 +4,8 @@ module RageFlip
4
4
  # - `\name` commands from SYMBOLS (Greek letters, operators, relations,
5
5
  # arrows, sets and logic). Unknown commands are left as typed.
6
6
  # - `^x`, `^{...}`, `_x`, `_{...}` become superscripts/subscripts when every
7
- # character has one; otherwise they're left as typed.
7
+ # character has one; otherwise they're left as typed. Unlike TeX, an
8
+ # unbraced run of digits is one argument: `2^1000` -> `2¹⁰⁰⁰`.
8
9
  # - `\sqrt{x}` -> `√x`, `\sqrt{x+1}` -> `√(x+1)`, `\sqrt[3]{x}` -> `∛x`.
9
10
  # - `\frac{a}{b}` -> `a/b` (or a vulgar fraction like ½), with parentheses
10
11
  # around multi-character parts.
@@ -47,6 +48,7 @@ module RageFlip
47
48
  # Letterlike and miscellaneous
48
49
  "hbar" => "ℏ", "ell" => "ℓ", "Re" => "ℜ", "Im" => "ℑ", "aleph" => "ℵ", "wp" => "℘",
49
50
  "angle" => "∠", "degree" => "°", "prime" => "′", "cdots" => "⋯", "ldots" => "…",
51
+ "interrobang" => "‽",
50
52
  "dots" => "…", "vdots" => "⋮", "ddots" => "⋱",
51
53
  # Sizing commands with no plain-text equivalent
52
54
  "left" => "", "right" => ""
@@ -86,7 +88,7 @@ module RageFlip
86
88
  WHITESPACE = [" ", "\t", "\n", "\r"].freeze
87
89
 
88
90
  def self.process(text)
89
- convert(text.chars)
91
+ Interrobang.process(convert(text.chars))
90
92
  end
91
93
 
92
94
  # `chars` is an array of single-codepoint strings.
@@ -116,7 +118,7 @@ module RageFlip
116
118
  i += 1 + name.length
117
119
  end
118
120
  elsif c == "^" || c == "_"
119
- arg = argument_at(chars, i + 1)
121
+ arg = argument_at(chars, i + 1, digit_run: true)
120
122
  if arg
121
123
  inner, raw, i = arg
122
124
  converted = convert(inner)
@@ -146,8 +148,10 @@ module RageFlip
146
148
  private_class_method :letters_at
147
149
 
148
150
  # The argument starting at `i`: a {braced group}, a \command, or one
149
- # non-space character. Returns [inner_chars, braced?, next_index] or nil.
150
- def self.argument_at(chars, i)
151
+ # non-space character; with `digit_run`, a run of digits instead of just
152
+ # the first (scripts only: `\frac34` stays ¾).
153
+ # Returns [inner_chars, braced?, next_index] or nil.
154
+ def self.argument_at(chars, i, digit_run: false)
151
155
  return nil if i >= chars.length
152
156
  c = chars[i]
153
157
  return nil if WHITESPACE.include?(c) || c == "}"
@@ -160,12 +164,21 @@ module RageFlip
160
164
  [chars[i, 1 + name.length], false, i + 1 + name.length]
161
165
  elsif c == "\\" && ESCAPABLE.include?(chars[i + 1])
162
166
  [chars[i, 2], false, i + 2]
167
+ elsif digit_run && digit?(c)
168
+ stop = i
169
+ stop += 1 while stop < chars.length && digit?(chars[stop])
170
+ [chars[i...stop], false, stop]
163
171
  else
164
172
  [[c], false, i + 1]
165
173
  end
166
174
  end
167
175
  private_class_method :argument_at
168
176
 
177
+ def self.digit?(c)
178
+ c.match?(/\A[0-9]\z/)
179
+ end
180
+ private_class_method :digit?
181
+
169
182
  def self.matching_brace(chars, open)
170
183
  depth = 0
171
184
  i = open
@@ -2,7 +2,7 @@ module RageFlip
2
2
  class Sarcasm
3
3
  def self.process(text)
4
4
  cycle_enum = [:upcase, :downcase].cycle
5
- text.each_char.map { |c| c.send(cycle_enum.next) }.join
5
+ Interrobang.process(text).each_char.map { |c| c.send(cycle_enum.next) }.join
6
6
  end
7
7
  end
8
8
  end
@@ -3,7 +3,7 @@ module RageFlip
3
3
  STRIKETHROUGH_CHAR = "\u0336"
4
4
 
5
5
  def self.process(text)
6
- text.each_char.map { |c| [c, STRIKETHROUGH_CHAR] }.join
6
+ Interrobang.process(text).each_char.map { |c| [c, STRIKETHROUGH_CHAR] }.join
7
7
  end
8
8
  end
9
9
  end
@@ -5,7 +5,7 @@ module RageFlip
5
5
 
6
6
  def self.process(text, double: false)
7
7
  underline_char = double ? DOUBLE_UNDERLINE_CHAR : UNDERLINE_CHAR
8
- text.each_char.map { |c| [c, underline_char] }.join
8
+ Interrobang.process(text).each_char.map { |c| [c, underline_char] }.join
9
9
  end
10
10
 
11
11
  def self.single_underline(text)
@@ -1,3 +1,3 @@
1
1
  module RageFlip
2
- VERSION = "2.7.0"
2
+ VERSION = "2.9.0"
3
3
  end
data/lib/rage_flip.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative "rage_flip/version"
2
+ require_relative "rage_flip/interrobang"
2
3
  require_relative "rage_flip/flipper"
3
4
  require_relative "rage_flip/sarcasm"
4
5
  require_relative "rage_flip/strikethrough"
@@ -7,6 +7,11 @@ RSpec.describe RageFlip do
7
7
  result = RageFlip::Flipper.flip("Hello")
8
8
  expect(result).to eq("oʅʅǝH")
9
9
  end
10
+
11
+ it "turns ? into ¿ and the interrobang into ⸘" do
12
+ expect(RageFlip::Flipper.flip("why?")).to eq("¿ʎɥʍ")
13
+ expect(RageFlip::Flipper.flip("‽")).to eq("⸘")
14
+ end
10
15
  end
11
16
 
12
17
  describe ".rage_flip" do
@@ -36,6 +41,41 @@ RSpec.describe RageFlip do
36
41
  end
37
42
  end
38
43
 
44
+ describe RageFlip::Interrobang do
45
+ describe ".process" do
46
+ it "replaces ?! and !? with an interrobang" do
47
+ expect(RageFlip::Interrobang.process("what?! really!?")).to eq("what‽ really‽")
48
+ end
49
+
50
+ it "makes one interrobang per pair, left to right" do
51
+ expect(RageFlip::Interrobang.process("?!?!")).to eq("‽‽")
52
+ expect(RageFlip::Interrobang.process("?!?")).to eq("‽?")
53
+ expect(RageFlip::Interrobang.process("!!?")).to eq("!‽")
54
+ expect(RageFlip::Interrobang.process("!!??")).to eq("!‽?")
55
+ end
56
+
57
+ it "leaves repeated ? or ! alone" do
58
+ expect(RageFlip::Interrobang.process("?? !!")).to eq("?? !!")
59
+ end
60
+ end
61
+
62
+ it "is applied by every text transform" do
63
+ expect(RageFlip::Flipper.flip_text("a?!")).to eq("⸘ɐ")
64
+ expect(RageFlip::Flipper.rage_flip("?!")).to eq("(ノಠ益ಠ)ノ彡┻⸘┻")
65
+ expect(RageFlip::Flipper.table_flip("!?")).to eq("(╯°□°)╯︵┻⸘ ┻")
66
+ expect(RageFlip::Sarcasm.process("no?!")).to eq("No‽")
67
+ expect(RageFlip::Frustrated.process("why?! no")).to eq("WHY‽. NO.")
68
+ expect(RageFlip::Strikethrough.process("?!")).to eq("‽̶")
69
+ expect(RageFlip::Underline.single_underline("?!")).to eq("‽̲")
70
+ expect(RageFlip::Underline.double_underline("?!")).to eq("‽̳")
71
+ expect(RageFlip::Italic.slanted("a?!")).to eq("𝑎‽")
72
+ expect(RageFlip::Italic.script("a?!")).to eq("𝒶‽")
73
+ expect(RageFlip::Confusable.process("?!")).to eq("‽")
74
+ expect(RageFlip::Latex.process("x^2?!")).to eq("x²‽")
75
+ expect(RageFlip::Chaos.process("?!", 1)).to start_with("‽")
76
+ end
77
+ end
78
+
39
79
  describe RageFlip::Sarcasm do
40
80
  describe ".process" do
41
81
  it "alternates case of characters" do
@@ -77,7 +117,7 @@ RSpec.describe RageFlip do
77
117
  end
78
118
 
79
119
  it "leaves non-letters untouched" do
80
- expect(RageFlip::Confusable.process("123 !?")).to eq("123 !?")
120
+ expect(RageFlip::Confusable.process("123 !!?")).to eq("123 !‽")
81
121
  end
82
122
 
83
123
  it "has confusables for every ASCII letter" do
@@ -159,6 +199,10 @@ RSpec.describe RageFlip do
159
199
  expect(latex("\\forall x \\in \\emptyset, x \\neq \\infty")).to eq("∀ x ∈ ∅, x ≠ ∞")
160
200
  end
161
201
 
202
+ it "supports \\interrobang" do
203
+ expect(latex("what\\interrobang")).to eq("what‽")
204
+ end
205
+
162
206
  it "converts superscripts and subscripts" do
163
207
  expect(latex("\\int_0^1 x^2 dx")).to eq("∫₀¹ x² dx")
164
208
  expect(latex("x_{n+1} = x_n^2")).to eq("xₙ₊₁ = xₙ²")
@@ -166,6 +210,13 @@ RSpec.describe RageFlip do
166
210
  expect(latex("H_2O and E = mc^2")).to eq("H₂O and E = mc²")
167
211
  end
168
212
 
213
+ it "treats an unbraced run of digits as one script" do
214
+ expect(latex("2^1000")).to eq("2¹⁰⁰⁰")
215
+ expect(latex("10^23 and a_12")).to eq("10²³ and a₁₂")
216
+ expect(latex("e^2x")).to eq("e²x")
217
+ expect(latex("x^ab")).to eq("xᵃb")
218
+ end
219
+
169
220
  it "leaves scripts as typed when a character has no Unicode script form" do
170
221
  expect(latex("e^{i\\pi}")).to eq("e^{iπ}")
171
222
  expect(latex("x^{q}")).to eq("x^{q}")
@@ -271,6 +322,11 @@ RSpec.describe RageFlip do
271
322
  expect(result).to eq("(ಠ_ಠ)")
272
323
  end
273
324
 
325
+ it "returns the text interrobang for interrobangtext and keeps the emoji for interrobang" do
326
+ expect(RageFlip::Emote.process("interrobangtext")).to eq("‽")
327
+ expect(RageFlip::Emote.process("interrobang")).to eq("⁉️")
328
+ end
329
+
274
330
  it "returns correct emote for bullshit" do
275
331
  result = RageFlip::Emote.process("bullshit")
276
332
  expect(result).to eq("🐄💩")
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.7.0
4
+ version: 2.9.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-11-11 00:00:00.000000000 Z
11
+ date: 2026-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -93,6 +93,7 @@ files:
93
93
  - lib/rage_flip/emote.rb
94
94
  - lib/rage_flip/flipper.rb
95
95
  - lib/rage_flip/frustrated.rb
96
+ - lib/rage_flip/interrobang.rb
96
97
  - lib/rage_flip/italic.rb
97
98
  - lib/rage_flip/latex.rb
98
99
  - lib/rage_flip/sarcasm.rb