tml 5.4.2 → 5.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tml/api/client.rb +1 -1
- data/lib/tml/cache.rb +3 -1
- data/lib/tml/tokenizers/dom.rb +2 -2
- data/lib/tml/tokens/data.rb +1 -1
- data/lib/tml/tokens/method.rb +1 -1
- data/lib/tml/tokens/transform.rb +1 -1
- data/lib/tml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feaf6bc2570ce5c1991d67c9b235f507b2c58f2f
|
4
|
+
data.tar.gz: f809be2ed64e60c5c40bf3c3cbb5bd66e28e0969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c459edbe540afa5dc514a56febae091f6a1f4176fef03c1d531c12e6336000d9bb3c7e6b002b0a5221334c077cefe8aaf4746ee435d29f053e0bb3a0d64f401
|
7
|
+
data.tar.gz: 0b0a89113b6ee5279557891fce239e941e83c0e9bdb070cf9430e3b73e23b283ecb39f41993cc5bf0232dd76175ac69e5b2174614dea1921f9407c8e6af2727c
|
data/lib/tml/api/client.rb
CHANGED
@@ -168,7 +168,7 @@ class Tml::Api::Client < Tml::Base
|
|
168
168
|
# should the API go to live server
|
169
169
|
def live_api_request?
|
170
170
|
# if no access token, never use live mode
|
171
|
-
return false if access_token.
|
171
|
+
return false if access_token.nil?
|
172
172
|
|
173
173
|
# if block is specifically asking for it or inline mode is activated
|
174
174
|
Tml.session.inline_mode? or Tml.session.block_option(:live)
|
data/lib/tml/cache.rb
CHANGED
@@ -41,7 +41,9 @@ module Tml
|
|
41
41
|
def self.cache
|
42
42
|
@cache ||= begin
|
43
43
|
if Tml.config.cache_enabled?
|
44
|
-
|
44
|
+
# .capitalize is not ideal, but .camelcase is not available in pure ruby.
|
45
|
+
# This works for the current class names.
|
46
|
+
klass = Tml::CacheAdapters.const_get(Tml.config.cache[:adapter].to_s.capitalize)
|
45
47
|
klass.new
|
46
48
|
else
|
47
49
|
# blank implementation
|
data/lib/tml/tokenizers/dom.rb
CHANGED
@@ -109,7 +109,7 @@ module Tml
|
|
109
109
|
sentences = Tml::Utils.split_sentences(tml)
|
110
110
|
translation = tml
|
111
111
|
sentences.each do |sentence|
|
112
|
-
sentence_translation = option('debug') ? debug_translation(sentence) : Tml.session.current_language.translate(sentence, tokens, options)
|
112
|
+
sentence_translation = option('debug') ? debug_translation(sentence) : Tml.session.current_language.translate(sentence, tokens, options.dup)
|
113
113
|
translation = translation.gsub(sentence, sentence_translation)
|
114
114
|
end
|
115
115
|
reset_context
|
@@ -118,7 +118,7 @@ module Tml
|
|
118
118
|
|
119
119
|
tml = tml.gsub(/[\n]/, '').gsub(/\s\s+/, ' ').strip
|
120
120
|
|
121
|
-
translation = option('debug') ? debug_translation(tml) : Tml.session.target_language.translate(tml, tokens, options)
|
121
|
+
translation = option('debug') ? debug_translation(tml) : Tml.session.target_language.translate(tml, tokens, options.dup)
|
122
122
|
reset_context
|
123
123
|
translation
|
124
124
|
end
|
data/lib/tml/tokens/data.rb
CHANGED
@@ -37,7 +37,7 @@ module Tml
|
|
37
37
|
attr_reader :label, :full_name, :short_name, :case_keys, :context_keys
|
38
38
|
|
39
39
|
def self.expression
|
40
|
-
/(%?\{{1,2}\s*\w
|
40
|
+
/(%?\{{1,2}\s*\w+\s*(:\s*\w+)*\s*(::\s*\w+)*\s*\}{1,2})/
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.parse(label, opts = {})
|
data/lib/tml/tokens/method.rb
CHANGED
data/lib/tml/tokens/transform.rb
CHANGED
@@ -57,7 +57,7 @@ class Tml::Tokens::Transform < Tml::Tokens::Data
|
|
57
57
|
attr_reader :pipe_separator, :piped_params
|
58
58
|
|
59
59
|
def self.expression
|
60
|
-
/(%?\{{1,2}\s*[\w]
|
60
|
+
/(%?\{{1,2}\s*[\w]+\s*(:\s*\w+)*\s*\|\|?[^\{\}\|]+\}{1,2})/
|
61
61
|
end
|
62
62
|
|
63
63
|
def parse_elements
|
data/lib/tml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.
|
4
|
+
version: 5.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|