sanscript 0.4.1 → 0.4.3

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
  SHA1:
3
- metadata.gz: a3a0e34eb01c4a5d8e016b323a192fb6de6f82e8
4
- data.tar.gz: db4799dc5bf50b86724b19ff139105f307706720
3
+ metadata.gz: 978f081a49e46e4cade8a7cdef95ebdb89f7daac
4
+ data.tar.gz: e46caf2df596e745398a6a5ac86d2c11ed0c666d
5
5
  SHA512:
6
- metadata.gz: 4e13bc3d149f056346bd61ebcfd4abc0798af91998b9f89440b780f6c1ee9f0e79319f157d60e0831a1521e95ffecd0fdc4edb1bf6010da0c5f0a0b8cf36a618
7
- data.tar.gz: 4a4f770e5dc1d8c637814b5fb21a5fbbb14c0512d228235d7b8f5cf02b94f9b27112e79758e63306f182d74016dc51cae1b2a0b37ad6d68bab3da3ca83a38af2
6
+ metadata.gz: e0f01c0322755e57c5690799660e810cc7d85271c5b6ef185ce21b13f516c396f1ae8e090529ecbfa8fd8a9bfcce8519f15d4d3291188d6bc1f83279c0b59071
7
+ data.tar.gz: f87954bc573383f2ddf530274ef69dbe32e67ab49d3f49e6db90790abafef51e51c8596c22d044ae40b4907921c38fc26182342f0c96008492aec938e56afbc9
@@ -240,8 +240,8 @@ module Sanscript
240
240
  token_buffer << data.slice!(0, map[:max_token_length] - token_buffer.length)
241
241
 
242
242
  # Match all token substrings to our map.
243
- (0...map[:max_token_length]).each do |j|
244
- token = token_buffer[0, map[:max_token_length] - j]
243
+ map[:max_token_length].downto(1) do |j|
244
+ token = token_buffer[0, j]
245
245
 
246
246
  if !control_char && token == "##"
247
247
  transliteration_enabled = !transliteration_enabled
@@ -280,17 +280,15 @@ module Sanscript
280
280
  end
281
281
  had_consonant = map[:consonants].key?(token)
282
282
  end
283
- token_buffer.slice!(0, map[:max_token_length] - j)
283
+ token_buffer.slice!(0, j)
284
284
  break
285
- elsif j == map[:max_token_length] - 1
285
+ elsif j == 1 # Last iteration
286
286
  if had_consonant
287
287
  had_consonant = false
288
288
  buf << map[:virama] unless options[:syncope]
289
289
  end
290
290
  buf << token
291
291
  token_buffer.slice!(0, 1)
292
- # 'break' is redundant here, "j == ..." is true only on
293
- # the last iteration.
294
292
  end
295
293
  end
296
294
  end
@@ -313,6 +311,10 @@ module Sanscript
313
311
  until data.empty?
314
312
  token = data.slice(0, 2)
315
313
  if !control_char && token == "##"
314
+ if had_roman_consonant
315
+ buf << "a" if transliteration_enabled
316
+ had_roman_consonant = false
317
+ end
316
318
  transliteration_enabled = !transliteration_enabled
317
319
  data.slice!(0, 2)
318
320
  next
@@ -323,6 +325,10 @@ module Sanscript
323
325
  data.slice!(0, 2)
324
326
  next
325
327
  elsif transliteration_enabled && token == "{#"
328
+ if had_roman_consonant
329
+ buf << "a"
330
+ had_roman_consonant = false
331
+ end
326
332
  transliteration_enabled = false
327
333
  control_char = true
328
334
  buf << token
@@ -25,7 +25,7 @@ module Sanscript
25
25
  # 'va' and 'ba' are both rendered as ব.
26
26
  #
27
27
  bengali: {
28
- vowels: "অ আ ই ঈ উ ঊ ঋ ৠ ঌ ৡ এ ঐ ও ঔ".w_split,
28
+ vowels: "অ আ ই ঈ উ ঊ ঋ ৠ ঌ ৡ এ ঐ ও ঔ".w_split,
29
29
  vowel_marks: "া ি ী ু ূ ৃ ৄ ৢ ৣ ে ৈ ো ৌ".w_split,
30
30
  other_marks: "ং ঃ ঁ".w_split,
31
31
  virama: ["্"],
@@ -107,7 +107,7 @@ module Sanscript
107
107
  vowel_marks: "ਾ ਿ ੀ ੁ ੂ ੇ ੈ ੋ ੌ".w_split,
108
108
  other_marks: "ਂ ਃ ਁ".w_split,
109
109
  virama: ["੍"],
110
- consonants: "ਕ ਖ ਗ ਘ ਙ ਚ ਛ ਜ ਝ ਞ ਟ ਠ ਡ ਢ ਣ ਤ ਥ ਦ ਧ ਨ ਪ ਫ ਬ ਭ ਮ ਯ ਰ ਲ ਵ ਸ ਹ ਕ੍ਸ਼ ਜ੍ਞ".w_split,
110
+ consonants: "ਕ ਖ ਗ ਘ ਙ ਚ ਛ ਜ ਝ ਞ ਟ ਠ ਡ ਢ ਣ ਤ ਥ ਦ ਧ ਨ ਪ ਫ ਬ ਭ ਮ ਯ ਰ ਲ ਵ ਸ਼ ਸ਼ ਸ ਹ ਲ਼ ਕ੍ਸ਼ ਜ੍ਞ".w_split,
111
111
  symbols: "੦ ੧ ੨ ੩ ੪ ੫ ੬ ੭ ੮ ੯ ॐ ऽ । ॥".w_split,
112
112
  other: " ਖ ਗ ਜ ਡ ਫ ".w_split,
113
113
  },
@@ -258,7 +258,7 @@ module Sanscript
258
258
  vowels: "a aa i ii u uu .r .rr .li .ll e ai o au".w_split,
259
259
  other_marks: ".m .h ".w_split,
260
260
  virama: [""],
261
- consonants: 'k kh g gh "n c ch j jh ~n .t .th .d .d .n t th d dh n p ph b bh m y r l v ~s .s s h L k.s j~n'.w_split,
261
+ consonants: 'k kh g gh "n c ch j jh ~n .t .th .d .dh .n t th d dh n p ph b bh m y r l v ~s .s s h L k.s j~n'.w_split,
262
262
  symbols: "0 1 2 3 4 5 6 7 8 9 o.m ' | ||".w_split,
263
263
  },
264
264
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Sanscript
3
3
  # The version number
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Bellefleur
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-22 00:00:00.000000000 Z
11
+ date: 2016-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler