ltdtemplate 0.1.3 → 0.1.4

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.
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "sarah", "~> 0.0.2"
4
+ gem "htmlentities", "~> 4.3.1"
data/HISTORY.txt CHANGED
@@ -1,3 +1,7 @@
1
+ 2013-07-24 Version 0.1.4
2
+ Added String.html (HTML encoding) and String.pcte (percent encoding)
3
+ methods. Added RESOURCES.txt describing resource usage/limits.
4
+
1
5
  2013-07-13 Version 0.1.3
2
6
  Fix broken links and otherwise add some polish to TEMPLATE_MANUAL.html.
3
7
 
data/RESOURCES.txt ADDED
@@ -0,0 +1,28 @@
1
+ Resource Usage/Limit Summary
2
+
3
+ arrays
4
+ The total number of arrays created
5
+
6
+ array_size
7
+ The size of the largest array
8
+
9
+ call_depth
10
+ The current/maximum call depth
11
+
12
+ calls
13
+ The total number of calls made
14
+
15
+ iterations
16
+ The total number of loop iterations
17
+
18
+ string_length
19
+ The combined total length of strings created
20
+
21
+ subscript_depth
22
+ The maximum subsubscript depth
23
+
24
+ subscripts
25
+ The total number of subscripts
26
+
27
+ use
28
+ The total number of "$.use" calls
data/TEMPLATE_MANUAL.html CHANGED
@@ -160,7 +160,7 @@ Ruby double-quoted strings. Here is the full list:</p>
160
160
 
161
161
  <tr><td>\n</td><td>new-line/line-feed (ASCII LF)</td></tr>
162
162
 
163
- <tr><td>\r</td><td>carriage return (ASCII ESC)</td></tr>
163
+ <tr><td>\r</td><td>carriage return (ASCII CR)</td></tr>
164
164
 
165
165
  <tr><td>\s</td><td>space (ASCII SP)</td></tr>
166
166
 
@@ -749,6 +749,9 @@ for the nil value as follows:</p>
749
749
  <tr><td><code>flt</code>, <code>float</code></td>
750
750
  <td>Returns the floating-point value of the string</td></tr>
751
751
 
752
+ <tr><td><code>html</code></td>
753
+ <td>Returns the HTML encoding of the string</td></tr>
754
+
752
755
  <tr><td><code>idx(</code><i>target</i><code>,
753
756
  </code><i>offset</i><code>)</code>,
754
757
  <code>index(</code><i>target</i><code>,
@@ -763,6 +766,10 @@ for the nil value as follows:</p>
763
766
  <tr><td><code>len</code>, <code>length</code></td>
764
767
  <td>Returns the length of the string</td></tr>
765
768
 
769
+ <tr><td><code>pcte</code></td>
770
+ <td>Returns the "percent encoding" of the string
771
+ (for URI components)</td></tr>
772
+
766
773
  <tr><td><code>ridx(</code><i>string</i><code>,
767
774
  </code><i>offset</i><code>)</code>,
768
775
  <code>rindex(</code><i>string</i><code>,
@@ -23,8 +23,14 @@ class LtdTemplate::Value::String < LtdTemplate::Code
23
23
  when nil, 'call', 'str', 'string' then self
24
24
  when 'class' then @template.factory :string, 'String'
25
25
  when 'flt', 'float' then @template.factory :number, @value.to_f
26
+ when 'html'
27
+ require 'htmlentities'
28
+ @template.factory :string, HTMLEntities.new(:html4).
29
+ encode(@value, :basic, :named, :decimal)
26
30
  when 'int' then @template.factory :number, @value.to_i
27
31
  when 'len', 'length' then @template.factory :number, @value.length
32
+ when 'pcte' then @template.factory(:string,
33
+ @value.gsub(/[^a-z0-9]/i) { |c| sprintf "%%%2x", c.ord })
28
34
  when 'rng', 'range', 'slc', 'slice' then do_range_slice opts
29
35
  when 'type' then @template.factory :string, 'string'
30
36
  when '+' then do_add opts
data/ltdtemplate.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ltdtemplate"
3
- s.version = "0.1.3"
4
- s.date = "2013-07-13"
3
+ s.version = "0.1.4"
4
+ s.date = "2013-07-24"
5
5
  s.authors = ["Brian Katzung"]
6
6
  s.email = ["briank@kappacs.com"]
7
7
  s.homepage = "http://rubygems.org/gems/ltdtemplate"
@@ -10,7 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.license = "MIT"
11
11
 
12
12
  s.files = Dir.glob("lib/**/*") +
13
- %w{ltdtemplate.gemspec Gemfile .yardopts HISTORY.txt TEMPLATE_MANUAL.html}
13
+ %w{ltdtemplate.gemspec Gemfile .yardopts HISTORY.txt RESOURCES.txt
14
+ TEMPLATE_MANUAL.html}
14
15
  s.test_files = Dir.glob("test/**/[0-9]*.rb")
15
16
  s.require_path = 'lib'
16
17
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Katzung
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-07-13 00:00:00 -05:00
17
+ date: 2013-07-24 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -46,6 +46,7 @@ files:
46
46
  - Gemfile
47
47
  - .yardopts
48
48
  - HISTORY.txt
49
+ - RESOURCES.txt
49
50
  - TEMPLATE_MANUAL.html
50
51
  - test/00class.rb
51
52
  - test/04number.rb