tagz 9.5.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/tagz.rb +8 -5
  2. data/tagz.gemspec +1 -1
  3. data/test/tagz_test.rb +10 -3
  4. metadata +3 -3
@@ -4,8 +4,10 @@ unless defined? Tagz
4
4
  # core tagz functions
5
5
  #
6
6
  module Tagz
7
+ require 'cgi'
8
+
7
9
  def Tagz.version()
8
- '9.5.0'
10
+ '9.6.0'
9
11
  end
10
12
 
11
13
  def Tagz.description
@@ -421,14 +423,12 @@ unless defined? Tagz
421
423
 
422
424
  NoEscapeKeyProc = lambda{|*values| values.join}
423
425
  Tagz.singleton_class{ define_method(:no_escape_key_proc){ Tagz.namespace(:NoEscapeKeyProc) } }
424
- #EscapeKeyProc = lambda{|*values| Tagz.xchar.escape(values.join).sub(/\Adata_/imox, 'data-') }
425
- EscapeKeyProc = lambda{|*values| values.join.sub(/\Adata_/imox, 'data-') }
426
+ EscapeKeyProc = lambda{|*values| Tagz.escapeAttribute(values).sub(/\Adata_/imox, 'data-') }
426
427
  Tagz.singleton_class{ define_method(:escape_key_proc){ Tagz.namespace(:EscapeKeyProc) } }
427
428
 
428
429
  NoEscapeValueProc = lambda{|*values| values.join}
429
430
  Tagz.singleton_class{ define_method(:no_escape_value_proc){ Tagz.namespace(:NoEscapeValueProc) } }
430
- #EscapeValueProc = lambda{|*values| Tagz.xchar.escape(values.join)}
431
- EscapeValueProc = lambda{|*values| values.join}
431
+ EscapeValueProc = lambda{|*values| Tagz.escapeAttribute(values)}
432
432
  Tagz.singleton_class{ define_method(:escape_value_proc){ Tagz.namespace(:EscapeValueProc) } }
433
433
 
434
434
  module Globally; include Tagz; end
@@ -447,6 +447,9 @@ unless defined? Tagz
447
447
  def Tagz.escape(*strings)
448
448
  Tagz.xchar.escape(strings.join)
449
449
  end
450
+ def Tagz.escapeAttribute(*strings)
451
+ CGI.escapeHTML(strings.join)
452
+ end
450
453
 
451
454
  # raw utils
452
455
  #
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "tagz"
6
- spec.version = "9.5.0"
6
+ spec.version = "9.6.0"
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"
@@ -475,11 +475,11 @@ class TagzTest < Test::Unit::TestCase
475
475
  end
476
476
 
477
477
  def test_390
478
- expected = '<div class="bar&foo>">foo&amp;bar&gt;</div>'
478
+ expected = '<div class="bar&amp;foo&gt;">foo&amp;bar&gt;</div>'
479
479
  actual = tagz{ div_(:class => 'bar&foo>'){ 'foo&bar>' } }
480
480
  assert_equal expected, actual
481
481
 
482
- expected = %|<div class="bar&foo>">#{ expected }</div>|
482
+ expected = %|<div class="bar&amp;foo&gt;">#{ expected }</div>|
483
483
  actual = tagz{ div_(:class => 'bar&foo>'){ actual } }
484
484
  assert_equal expected, actual
485
485
  end
@@ -561,7 +561,7 @@ class TagzTest < Test::Unit::TestCase
561
561
 
562
562
  actual = nil
563
563
  assert_nothing_raised{ actual=c.a}
564
- expected = %(<div a>b="a>b">content</div>)
564
+ expected = %(<div a&gt;b="a&gt;b">content</div>)
565
565
  assert_equal expected, actual
566
566
 
567
567
  Tagz.escape_keys!(false) do
@@ -723,4 +723,11 @@ class TagzTest < Test::Unit::TestCase
723
723
  }
724
724
  assert_equal expected, actual
725
725
  end
726
+
727
+
728
+ def test_550
729
+ assert_nothing_raised{
730
+ Tagz{ div_(:title => "foo' bar\""){ "foobar" } }
731
+ }
732
+ end
726
733
  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.5.0
4
+ version: 9.6.0
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: 2012-04-22 00:00:00.000000000 Z
12
+ date: 2012-11-22 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
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project: codeforpeople
61
- rubygems_version: 1.8.11
61
+ rubygems_version: 1.8.24
62
62
  signing_key:
63
63
  specification_version: 3
64
64
  summary: tagz