tagz 9.6.0 → 9.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tagz.rb +8 -4
- data/tagz.gemspec +1 -1
- data/test/tagz_test.rb +16 -0
- metadata +2 -2
data/lib/tagz.rb
CHANGED
@@ -7,7 +7,7 @@ unless defined? Tagz
|
|
7
7
|
require 'cgi'
|
8
8
|
|
9
9
|
def Tagz.version()
|
10
|
-
'9.6.
|
10
|
+
'9.6.1'
|
11
11
|
end
|
12
12
|
|
13
13
|
def Tagz.description
|
@@ -207,6 +207,7 @@ unless defined? Tagz
|
|
207
207
|
\A selected \Z |
|
208
208
|
\A disabled \Z |
|
209
209
|
\A readonly \Z |
|
210
|
+
\A autofocus \Z |
|
210
211
|
\A multiple \Z |
|
211
212
|
\A ismap \Z |
|
212
213
|
\A defer \Z |
|
@@ -217,20 +218,23 @@ unless defined? Tagz
|
|
217
218
|
\A compact \Z
|
218
219
|
]iomx
|
219
220
|
|
220
|
-
|
221
|
+
class HtmlSafe < ::String
|
221
222
|
def html_safe() @html_safe ||= true end
|
222
223
|
def html_safe?() html_safe end
|
223
224
|
def html_safe=(value) @html_safe = !!value end
|
224
225
|
end
|
225
226
|
|
226
227
|
def Tagz.html_safe(*args, &block)
|
228
|
+
if args.size == 1 and args.first.respond_to?(:html_safe?)
|
229
|
+
return args.first
|
230
|
+
end
|
231
|
+
|
227
232
|
if args.empty? and block.nil?
|
228
233
|
Tagz.namespace(:HtmlSafe)
|
229
234
|
else
|
230
235
|
string = args.join
|
231
236
|
string += block.call.to_s if block
|
232
|
-
|
233
|
-
string
|
237
|
+
HtmlSafe.new(string)
|
234
238
|
end
|
235
239
|
end
|
236
240
|
|
data/tagz.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "tagz"
|
6
|
-
spec.version = "9.6.
|
6
|
+
spec.version = "9.6.1"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "tagz"
|
9
9
|
spec.description = "\n tagz.rb is generates html, xml, or any sgml variant like a small ninja\n running across the backs of a herd of giraffes swatting of heads like\n a mark-up weedwacker. weighing in at less than 300 lines of code\n tagz.rb adds an html/xml/sgml syntax to ruby that is both unobtrusive,\n safe, and available globally to objects without the need for any\n builder or superfluous objects. tagz.rb is designed for applications\n that generate html to be able to do so easily in any context without\n heavyweight syntax or scoping issues, like a ninja sword through\n butter.\n\n"
|
data/test/tagz_test.rb
CHANGED
@@ -730,4 +730,20 @@ class TagzTest < Test::Unit::TestCase
|
|
730
730
|
Tagz{ div_(:title => "foo' bar\""){ "foobar" } }
|
731
731
|
}
|
732
732
|
end
|
733
|
+
|
734
|
+
def test_600
|
735
|
+
value = '<>'
|
736
|
+
html_safe = Tagz.html_safe(value)
|
737
|
+
assert_equal(value, html_safe)
|
738
|
+
assert_equal(false, value.respond_to?(:html_safe?))
|
739
|
+
assert_equal(false, value.respond_to?(:html_safe))
|
740
|
+
assert_equal(true, html_safe.respond_to?(:html_safe?))
|
741
|
+
assert_equal(true, html_safe.respond_to?(:html_safe))
|
742
|
+
end
|
743
|
+
|
744
|
+
def test_610
|
745
|
+
value = Tagz.html_safe.new('foobar')
|
746
|
+
html_safe = Tagz.html_safe(value)
|
747
|
+
assert_equal value.object_id, html_safe.object_id
|
748
|
+
end
|
733
749
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.6.
|
4
|
+
version: 9.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! "\n tagz.rb is generates html, xml, or any sgml variant like
|
15
15
|
a small ninja\n running across the backs of a herd of giraffes swatting of
|