supersub 0.0.0 → 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/supersub.rb +229 -32
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8154c33036126d9013714de5e02c33f919b7c16b03996f7300082677bb1a5fa9
4
- data.tar.gz: 8e2601e4254fe78787e62b8facb47c86ff349569f9805dfeeec3edece2d26f59
3
+ metadata.gz: 35fc24ccda1a842d17c9a50348f3b43a14b726d2025b91789355c1a20743c477
4
+ data.tar.gz: bfa3eef6fd9ed12099d25e8d681169254216dfbbfc5de85a1dc44a6eaa24b12a
5
5
  SHA512:
6
- metadata.gz: 8bf5d772df287b624f2afa6066278955e57b128d6c5445b352f295f1e0f93be280fb3c21e4aeffcbe2cdcd1b2b5dc45de8aa8f4f09d4e3f9f023c9f4a8ff1b02
7
- data.tar.gz: 8455ebb603058cf998242ae390e093c6ab2850bcd41a990771a5a2f64bbc05aa5ca64ce794f819dc54a2b12cb2889a02c8c03b1d064799e8ecbf0fdb1e5c989b
6
+ metadata.gz: 27e38eb221d0a8c7ca9b90084eb96ba833353e959aabc9945e936d07d71ee85ce4036e705ab155e19cac93895529485b41470f94957c0ff7086c6c90c4759abc
7
+ data.tar.gz: b66f96e9c65cb11345172d00e7598537912c93b169281107b774843ddd2c0768f6be6558b8c8a2f3a135afd4f04ffb93b9ec5bf02b00b3beb0c9036730bc73df
@@ -1,13 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SuperSub
4
- def c(y)
5
- x = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!'
6
- x.split('').each_with_index do |a, i|
7
- puts "\"#{a}\" => \"#{y.split('')[i]}\","
8
- end
9
- end
10
-
11
4
  SUPERSCRIPT = {
12
5
  'a' => 'ᵃ',
13
6
  'b' => 'ᵇ',
@@ -321,8 +314,35 @@ module SuperSub
321
314
  '7' => '7',
322
315
  '8' => '8',
323
316
  '9' => '9',
317
+ '.' => '.',
318
+ ',' => ',',
324
319
  '?' => '?',
325
- '!' => '!'
320
+ '!' => '!',
321
+ '@' => '@',
322
+ '#' => '#',
323
+ '$' => '$',
324
+ '%' => '%',
325
+ '^' => '^',
326
+ '&' => '&',
327
+ '*' => '*',
328
+ '(' => '(',
329
+ ')' => ')',
330
+ '=' => '=',
331
+ '+' => '+',
332
+ '-' => '-',
333
+ '_' => '_',
334
+ '[' => '[',
335
+ ']' => ']',
336
+ '{' => '{',
337
+ '}' => '}',
338
+ '<' => '<',
339
+ '>' => '>',
340
+ '/' => '/',
341
+ '\\' => '\',
342
+ "'" => ''',
343
+ '"' => '"',
344
+ '`' => '`',
345
+ '~' => '~'
326
346
  }.freeze
327
347
 
328
348
  GOTHIC = {
@@ -435,6 +455,99 @@ module SuperSub
435
455
  'Z' => '𝖅'
436
456
  }.freeze
437
457
 
458
+ SANS = {
459
+ "a" => "𝖺",
460
+ "b" => "𝖻",
461
+ "c" => "𝖼",
462
+ "d" => "𝖽",
463
+ "e" => "𝖾",
464
+ "f" => "𝖿",
465
+ "g" => "𝗀",
466
+ "h" => "𝗁",
467
+ "i" => "𝗂",
468
+ "j" => "𝗃",
469
+ "k" => "𝗄",
470
+ "l" => "𝗅",
471
+ "m" => "𝗆",
472
+ "n" => "𝗇",
473
+ "o" => "𝗈",
474
+ "p" => "𝗉",
475
+ "q" => "𝗊",
476
+ "r" => "𝗋",
477
+ "s" => "𝗌",
478
+ "t" => "𝗍",
479
+ "u" => "𝗎",
480
+ "v" => "𝗏",
481
+ "w" => "𝗐",
482
+ "x" => "𝗑",
483
+ "y" => "𝗒",
484
+ "z" => "𝗓",
485
+ "A" => "𝖠",
486
+ "B" => "𝖡",
487
+ "C" => "𝖢",
488
+ "D" => "𝖣",
489
+ "E" => "𝖤",
490
+ "F" => "𝖥",
491
+ "G" => "𝖦",
492
+ "H" => "𝖧",
493
+ "I" => "𝖨",
494
+ "J" => "𝖩",
495
+ "K" => "𝖪",
496
+ "L" => "𝖫",
497
+ "M" => "𝖬",
498
+ "N" => "𝖭",
499
+ "O" => "𝖮",
500
+ "P" => "𝖯",
501
+ "Q" => "𝖰",
502
+ "R" => "𝖱",
503
+ "S" => "𝖲",
504
+ "T" => "𝖳",
505
+ "U" => "𝖴",
506
+ "V" => "𝖵",
507
+ "W" => "𝖶",
508
+ "X" => "𝖷",
509
+ "Y" => "𝖸",
510
+ "Z" => "𝖹",
511
+ "0" => "𝟢",
512
+ "1" => "𝟣",
513
+ "2" => "𝟤",
514
+ "3" => "𝟥",
515
+ "4" => "𝟦",
516
+ "5" => "𝟧",
517
+ "6" => "𝟨",
518
+ "7" => "𝟩",
519
+ "8" => "𝟪",
520
+ "9" => "𝟫",
521
+ "." => ".",
522
+ "," => ",",
523
+ "?" => "?",
524
+ "!" => "!",
525
+ "@" => "@",
526
+ "#" => "#",
527
+ "$" => "$",
528
+ "%" => "%",
529
+ "^" => "^",
530
+ "&" => "&",
531
+ "*" => "*",
532
+ "(" => "(",
533
+ ")" => ")",
534
+ "[" => "[",
535
+ "]" => "]",
536
+ "{" => "{",
537
+ "}" => "}",
538
+ "<" => "<",
539
+ ">" => ">",
540
+ "/" => "/",
541
+ "'" => "'",
542
+ "\"" => "\"",
543
+ "-" => "-",
544
+ "_" => "_",
545
+ "=" => "=",
546
+ "+" => "+",
547
+ "`" => "`",
548
+ "~" => "~"
549
+ }
550
+
438
551
  SANS_ITALIC = {
439
552
  'a' => '𝘢',
440
553
  'b' => '𝘣',
@@ -857,7 +970,16 @@ module SuperSub
857
970
  '6' => '⑥',
858
971
  '7' => '⑦',
859
972
  '8' => '⑧',
860
- '9' => '⑨'
973
+ '9' => '⑨',
974
+ '.' => '⨀',
975
+ '*' => '⊛',
976
+ '-' => '⊖',
977
+ '+' => '⊕',
978
+ '=' => '⊜',
979
+ '<' => '⧀',
980
+ '>' => '⧁',
981
+ '/' => '⊘',
982
+ '\\' => '⦸'
861
983
  }.freeze
862
984
 
863
985
  CIRCLED_NEGATIVE = {
@@ -977,7 +1099,13 @@ module SuperSub
977
1099
  'W' => '🅆',
978
1100
  'X' => '🅇',
979
1101
  'Y' => '🅈',
980
- 'Z' => '🅉'
1102
+ 'Z' => '🅉',
1103
+ '.' => '⊡',
1104
+ '*' => '⧆',
1105
+ '+' => '⊞',
1106
+ '-' => '⊟',
1107
+ '/' => '⧄',
1108
+ '\\' => '⧅'
981
1109
  }.freeze
982
1110
 
983
1111
  SQUARED_NEGATIVE = {
@@ -1154,48 +1282,117 @@ module SuperSub
1154
1282
  'Y' => 'ʎ',
1155
1283
  'Z' => 'z',
1156
1284
  '?' => '¿',
1157
- '!' => '¡'
1285
+ '!' => '¡',
1286
+ '&' => '⅋',
1287
+ '/' => '\\',
1288
+ '\\' => '/',
1289
+ '~' => '∽'
1290
+ }.freeze
1291
+
1292
+ FAUX_CYRILLIC = {
1293
+ 'a' => 'а',
1294
+ 'b' => 'ъ',
1295
+ 'c' => 'с',
1296
+ 'd' => 'd',
1297
+ 'e' => 'э',
1298
+ 'f' => 'f',
1299
+ 'g' => 'Б',
1300
+ 'h' => 'Ђ',
1301
+ 'i' => 'і',
1302
+ 'j' => 'ј',
1303
+ 'k' => 'к',
1304
+ 'l' => 'l',
1305
+ 'm' => 'м',
1306
+ 'n' => 'и',
1307
+ 'o' => 'о',
1308
+ 'p' => 'р',
1309
+ 'q' => 'q',
1310
+ 'r' => 'ѓ',
1311
+ 's' => 'ѕ',
1312
+ 't' => 'т',
1313
+ 'u' => 'ц',
1314
+ 'v' => 'v',
1315
+ 'w' => 'ш',
1316
+ 'x' => 'х',
1317
+ 'y' => 'Ў',
1318
+ 'z' => 'z',
1319
+ 'A' => 'Д',
1320
+ 'B' => 'Б',
1321
+ 'C' => 'Ҁ',
1322
+ 'D' => 'ↁ',
1323
+ 'E' => 'Є',
1324
+ 'F' => 'F',
1325
+ 'G' => 'Б',
1326
+ 'H' => 'Н',
1327
+ 'I' => 'І',
1328
+ 'J' => 'Ј',
1329
+ 'K' => 'Ќ',
1330
+ 'L' => 'L',
1331
+ 'M' => 'М',
1332
+ 'N' => 'И',
1333
+ 'O' => 'Ф',
1334
+ 'P' => 'Р',
1335
+ 'Q' => 'Q',
1336
+ 'R' => 'Я',
1337
+ 'S' => 'Ѕ',
1338
+ 'T' => 'Г',
1339
+ 'U' => 'Ц',
1340
+ 'V' => 'V',
1341
+ 'W' => 'Щ',
1342
+ 'X' => 'Ж',
1343
+ 'Y' => 'Ч',
1344
+ 'Z' => 'Z'
1158
1345
  }.freeze
1159
1346
 
1160
1347
  def self.convert(str, style)
1161
1348
  case style
1162
1349
  when :superscript, :super
1163
- str.gsub(/[a-zA-Z0-9]/, SUPERSCRIPT)
1350
+ convert_text(str, SUPERSCRIPT)
1164
1351
  when :subscript, :sub
1165
- str.gsub(/[a-zA-Z0-9]/, SUBSCRIPT)
1352
+ convert_text(str, SUBSCRIPT)
1166
1353
  when :script
1167
- str.gsub(/[a-zA-Z]/, SCRIPT)
1168
- when :script_bold, :bold_script, :bscript
1169
- str.gsub(/[a-zA-Z0-9]/, SCRIPT_BOLD)
1354
+ convert_text(str, SCRIPT)
1355
+ when :script_bold, :bold_script
1356
+ convert_text(str, SCRIPT_BOLD)
1170
1357
  when :fullwidth, :full_width
1171
- str.gsub(/[a-zA-Z0-9?!]/, FULLWIDTH)
1172
- when :gothic
1173
- str.gsub(/[a-zA-Z]/, GOTHIC)
1174
- when :gothic_bold, :bold_gothic, :bgothic
1175
- str.gsub(/[a-zA-Z]/, GOTHIC_BOLD)
1358
+ convert_text(str, FULLWIDTH)
1359
+ when :gothic, :fraktur
1360
+ convert_text(str, GOTHIC)
1361
+ when :gothic_bold, :bold_gothic, :fraktur_bold
1362
+ convert_text(str, GOTHIC_BOLD)
1363
+ when :sans, :math_sans
1364
+ convert_text(str, SANS)
1176
1365
  when :sans_italic, :italic_sans
1177
- str.gsub(/[a-zA-Z]/, SANS_ITALIC)
1366
+ convert_text(str, SANS_ITALIC)
1178
1367
  when :sans_bold, :bold_sans
1179
- str.gsub(/[a-zA-Z0-9]/, SANS_BOLD)
1368
+ convert_text(str, SANS_BOLD)
1180
1369
  when :sans_bold_italic
1181
- str.gsub(/[a-zA-Z]/, SANS_BOLD_ITALIC)
1370
+ convert_text(str, SANS_BOLD_ITALIC)
1182
1371
  when :serif_bold, :bold_serif
1183
- str.gsub(/[a-zA-Z0-9]/, SERIF_BOLD)
1372
+ convert_text(str, SERIF_BOLD)
1184
1373
  when :small_caps, :small
1185
- str.gsub(/[a-zA-Z]/, SMALL_CAPS)
1374
+ convert_text(str, SMALL_CAPS)
1186
1375
  when :circled
1187
- str.gsub(/[a-zA-Z0-9]/, CIRCLED)
1376
+ convert_text(str, CIRCLED)
1188
1377
  when :circled_negative
1189
- str.gsub(/[a-zA-Z0-9]/, CIRCLED_NEGATIVE)
1378
+ convert_text(str, CIRCLED_NEGATIVE)
1190
1379
  when :squared
1191
- str.gsub(/[a-zA-Z]/, SQUARED)
1380
+ convert_text(str, SQUARED)
1192
1381
  when :squared_negative
1193
- str.gsub(/[a-zA-Z]/, SQUARED_NEGATIVE)
1382
+ convert_text(str, SQUARED_NEGATIVE)
1194
1383
  when :double_struck
1195
- str.gsub(/[a-zA-Z0-9]/, DOUBLE_STRUCK)
1384
+ convert_text(str, DOUBLE_STRUCK)
1196
1385
  when :inverted, :invert, :upside_down
1197
1386
  # This one reverses the return to make it really "backwards"
1198
- str.gsub(/[a-zA-Z?!]/, INVERTED).reverse
1387
+ convert_text(str, INVERTED).reverse
1388
+ when :cyrillic, :russian
1389
+ convert_text(str, FAUX_CYRILLIC)
1199
1390
  end
1200
1391
  end
1392
+
1393
+ private
1394
+
1395
+ def self.convert_text(str, dictionary)
1396
+ str.gsub(/[\w\W]/) { |character| dictionary[character] ? dictionary[character] : character }
1397
+ end
1201
1398
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supersub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Rudnick-Aldridge