tml 5.6.4 → 5.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28b79b000f32fc2506faf178e1ee5aa2698d658d
4
- data.tar.gz: b73c45a3564d1ed704d5e93ea4d7ea34325a8ad4
3
+ metadata.gz: c34d0e6209b1b34c4143f0b16ecbc73aec7a5324
4
+ data.tar.gz: 20f9c409c786a9a67cb76e74eb3cdbe285f9eb3a
5
5
  SHA512:
6
- metadata.gz: c46fef311a0a7aab52e62a254792292e7dce66d9db03c2e809bd44b45a4c9d3287807642814d24273073c34299da2d158b5c66e8cff12eb1c248b3b6df80ac52
7
- data.tar.gz: 275625ecae6e94b25f8dba5687a92bad91fd43b73211e4013822e123bc79094ef0e6c5b7bfb4c2cedd129a955bbcabce12a20623b6a0cbeef33a41d476632f5d
6
+ metadata.gz: 8ee0f8b41b9d66d8d1f05172df2318eade8f05c408f299137fb45e791b3cd03b0ac20da55e8c28cda300faa08c736c8f0d9dfdec49fbae47dfc4094cef5bf2dc
7
+ data.tar.gz: 690f0c2581fcdc822a8e63c45265fdcce2eb2a4b9298a700dd9845b9429ef1911395acf1995946bbcd9aa7d91764e638277db9dc404d438421c16c9c3334e2af
@@ -156,7 +156,7 @@ module Tml
156
156
  regex: /(&[^;]*;)/
157
157
  },
158
158
  date: {
159
- enabled: true,
159
+ enabled: false,
160
160
  formats: [
161
161
  [/((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d+,\s+\d+)/, "{month} {day}, {year}"],
162
162
  [/((January|February|March|April|May|June|July|August|September|October|November|December)\s+\d+,\s+\d+)/, "{month} {day}, {year}"],
@@ -166,12 +166,12 @@ module Tml
166
166
  name: 'date'
167
167
  },
168
168
  rules: [
169
- {enabled: true, name: 'time', regex: /(\d{1,2}:\d{1,2}\s+([A-Z]{2,3}|am|pm|AM|PM)?)/},
170
- {enabled: true, name: 'phone', regex: /((\d{1}-)?\d{3}-\d{3}-\d{4}|\d?\(\d{3}\)\s*\d{3}-\d{4}|(\d.)?\d{3}.\d{3}.\d{4})/},
171
- {enabled: true, name: 'email', regex: /([-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|io|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?)/},
172
- {enabled: true, name: 'price', regex: /(\$\d*(,\d*)*(\.\d*)?)/},
173
- {enabled: true, name: 'fraction', regex: /(\d+\/\d+)/},
174
- {enabled: true, name: 'num', regex: /(\b\d*(,\d*)*(\.\d*)?%?\b)/}
169
+ {enabled: false, name: 'time', regex: /(\d{1,2}:\d{1,2}\s+([A-Z]{2,3}|am|pm|AM|PM)?)/},
170
+ {enabled: false, name: 'phone', regex: /((\d{1}-)?\d{3}-\d{3}-\d{4}|\d?\(\d{3}\)\s*\d{3}-\d{4}|(\d.)?\d{3}.\d{3}.\d{4})/},
171
+ {enabled: false, name: 'email', regex: /([-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|io|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?)/},
172
+ {enabled: false, name: 'price', regex: /(\$\d*(,\d*)*(\.\d*)?)/},
173
+ {enabled: false, name: 'fraction', regex: /(\d+\/\d+)/},
174
+ {enabled: false, name: 'num', regex: /(\b\d*(,\d*)*(\.\d*)?%?\b)/}
175
175
  ]
176
176
  }
177
177
  }
@@ -103,6 +103,8 @@ module Tml
103
103
 
104
104
  def translate_tml(tml)
105
105
  return tml if empty_string?(tml)
106
+ pp tml
107
+
106
108
  tml = generate_data_tokens(tml)
107
109
 
108
110
  if option('split_sentences')
@@ -147,9 +149,9 @@ module Tml
147
149
  value = sanitize_value(buffer)
148
150
 
149
151
  return '{' + token + '}' if self_closing_node?(node)
150
- return '[' + token + ': ' + value + ']' if short_token?(token, value)
152
+ # return '[' + token + ': ' + value + ']' if short_token?(token, value)
151
153
 
152
- '[' + token + ']' + value + '[/' + token + ']'
154
+ '<' + token + '>' + value + '</' + token + '>'
153
155
  end
154
156
 
155
157
  def option(name)
@@ -162,8 +164,12 @@ module Tml
162
164
  end
163
165
 
164
166
  def empty_string?(tml)
165
- tml = tml.gsub(/[\s\n\r\t]/, '')
166
- tml == ''
167
+ tml = tml.gsub(/[\s\n\r\t]/, '').gsub(/[\u0080-\u00ff]/, '')
168
+ return true if tml == ''
169
+ return true if tml.match(/\A\$\{[^\}]+\}\z/) # ignore variables ${var_name}
170
+ return true if tml.match(/\A\$?\d+\.?\d+\z/) # ignore prices and numbers
171
+
172
+ false
167
173
  end
168
174
 
169
175
  def reset_context
@@ -31,7 +31,7 @@
31
31
  #++
32
32
 
33
33
  module Tml
34
- VERSION = '5.6.4'
34
+ VERSION = '5.6.5'
35
35
 
36
36
  def self.full_version
37
37
  "tml-ruby v#{Tml::VERSION} (Faraday v#{Faraday::VERSION})"
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.6.4
4
+ version: 5.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-20 00:00:00.000000000 Z
11
+ date: 2017-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday