pipetext 0.2.6 → 0.2.7
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/bin/pipetext +1 -0
- data/lib/pipetext/pipetext.rb +12 -11
- data/lib/pipetext/substitute_emoji_names.rb +0 -0
- data/lib/pipetext/version.rb +1 -2
- data/lib/pipetext.rb +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa217b6ffbf3d726efa7e28c5f8e190d05f8f09da02995a4a2d575c372674bf4
|
|
4
|
+
data.tar.gz: a272e83e9336d39b158e0cc00467afb5f89d061cba70ce2ee6616ec2bafcd38d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef2b34b99b343908b04aedadcbb7c2c7c943c6430b414097c0f9cbdecffb483b1168f73b375c961f166660626db2dc838aa9fec94b69c5378cb08cd7ac224d67
|
|
7
|
+
data.tar.gz: 9e2dc194f697ba535339ed951534ce7c07eb426ef2ecf42597eefee63f0ee9a8cff3378af057742ab171a1af237a0b4379da07831abf6c4adc222681a9d35dbb
|
data/bin/pipetext
CHANGED
data/lib/pipetext/pipetext.rb
CHANGED
|
@@ -195,10 +195,11 @@ module PipeText
|
|
|
195
195
|
if(wide == true && wide_count >= 2)
|
|
196
196
|
if(character[0].ord == 147)
|
|
197
197
|
length += 1
|
|
198
|
+
else
|
|
199
|
+
length += 1
|
|
200
|
+
wide = false
|
|
201
|
+
wide_count = 0
|
|
198
202
|
end
|
|
199
|
-
length += 1
|
|
200
|
-
wide = false
|
|
201
|
-
wide_count = 0
|
|
202
203
|
end
|
|
203
204
|
end
|
|
204
205
|
end
|
|
@@ -228,20 +229,20 @@ module PipeText
|
|
|
228
229
|
attributes['end_capture'] = false
|
|
229
230
|
end
|
|
230
231
|
if(attributes['end_capture'] == true && character =~ /[0-9]/)
|
|
231
|
-
if(character == '0')
|
|
232
|
+
if(character == '0') # |10+
|
|
232
233
|
if(attributes['num'] > 0)
|
|
233
234
|
attributes['num'] *= 10
|
|
234
235
|
end
|
|
235
|
-
elsif(character >= '1' && character <= '9')
|
|
236
|
+
elsif(character >= '1' && character <= '9') # |1+ through |9+
|
|
236
237
|
if(attributes['num'] > 0)
|
|
237
238
|
attributes['num'] *= 10
|
|
238
239
|
end
|
|
239
240
|
attributes['num'] += character.to_i
|
|
240
241
|
end
|
|
241
242
|
elsif(character == ')' && attributes['variable_capture'] == true && attributes['escape'] == false)
|
|
242
|
-
if(attributes['variable'] =~ /=/ && attributes['variable'][0] != '#')
|
|
243
|
+
if(attributes['variable'] =~ /=/ && attributes['variable'][0] != '#') # Update
|
|
243
244
|
update_variable(attributes)
|
|
244
|
-
else
|
|
245
|
+
else # Display
|
|
245
246
|
emit_variable(new_text, attributes)
|
|
246
247
|
end
|
|
247
248
|
elsif(attributes['variable_capture'] == true)
|
|
@@ -421,7 +422,7 @@ module PipeText
|
|
|
421
422
|
end
|
|
422
423
|
|
|
423
424
|
def emit_variable(new_text, attributes)
|
|
424
|
-
if(attributes['variable'][0] == '#')
|
|
425
|
+
if(attributes['variable'][0] == '#') # We are manipulating attributes['num']
|
|
425
426
|
if(attributes['variable'][1..-1] =~ /(.*) \-= ?(.*)/ ||
|
|
426
427
|
attributes['variable'][1..-1] =~ /(.*)\-= ?(.*)/)
|
|
427
428
|
attributes['num'] = pipetext(escape_fix(attributes['variables'][$1]), attributes['box_mode'],
|
|
@@ -475,10 +476,10 @@ module PipeText
|
|
|
475
476
|
match_length = 0
|
|
476
477
|
value_length = 0
|
|
477
478
|
$substitute_emoji_names.each do |key, value|
|
|
478
|
-
if(attributes['emoji'] == key)
|
|
479
|
+
if(attributes['emoji'] == key) # Use the most precise match first
|
|
479
480
|
emoji = value
|
|
480
481
|
break
|
|
481
|
-
elsif(attributes['emoji'].length <= key.length)
|
|
482
|
+
elsif(attributes['emoji'].length <= key.length) # Otherwise use shortest match
|
|
482
483
|
match = abbreviated_match(attributes['emoji'], key)
|
|
483
484
|
if(match == 0 && key =~ /-/)
|
|
484
485
|
match = abbreviated_match(attributes['emoji'], key.sub(/-/, ' '))
|
|
@@ -491,7 +492,7 @@ module PipeText
|
|
|
491
492
|
end
|
|
492
493
|
end
|
|
493
494
|
end
|
|
494
|
-
if(emoji == String.new)
|
|
495
|
+
if(emoji == String.new) # No match, put copy input
|
|
495
496
|
new_text << "|[" + attributes['emoji'] + "]"
|
|
496
497
|
else
|
|
497
498
|
emoji.split(/\|U/).each do |e|
|
|
File without changes
|
data/lib/pipetext/version.rb
CHANGED
data/lib/pipetext.rb
CHANGED
|
File without changes
|