tagz 9.9.0 → 9.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/tagz.rb +51 -7
- data/tagz.gemspec +1 -1
- metadata +5 -7
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Yzc5ZTc2NTRlNjhiNGFkOWZiMzMwM2Y4OWJhOWIyN2ZlMTY0MzkyNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzI3NTM5ZWYzMjg2NjhiM2M1MjE4ODUxZmM3ZDQzNjNiMzgxYzc1Yg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGJlZWJkODY5ZTIzYjgwYmNhYTg0Nzg5NzgxMTUzMGU3YzA2YTcwNDBmNTUw
|
10
|
+
ZmVkNzAwYzE3NDk5MjBiZjk2MTY3ZWY3YjFjNjg1NTkxODMwNGYzZjM5ZmYy
|
11
|
+
MDk0NDc5NzA5OGRkMTM5YTFkMDg0Y2Q4YTdkYjE5ZDRiZmI4MjY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjcyMWFmNDU2YzU1MTM1YzYwZDdlNWJmMGU3YzBkYTUzYjc1NTdkNWM0NjNj
|
14
|
+
YzJjMDJjNWVlMjM2YTdiMWFkOTM5ZjEzNWViNWY3ZGZhMjM1N2RjNDQ3ZWQw
|
15
|
+
Mzc5OGJhMDk2YmExNzJkZTliM2M3YmIwZjQ5NWQ1MTVlMzY5ZWU=
|
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.9.
|
10
|
+
'9.9.1'
|
11
11
|
end
|
12
12
|
|
13
13
|
def Tagz.description
|
@@ -35,10 +35,20 @@ unless defined? Tagz
|
|
35
35
|
|
36
36
|
if block
|
37
37
|
@tagz ||= (Tagz.document.for(document) || Tagz.document.new)
|
38
|
+
|
38
39
|
begin
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
previous_size = @tagz.size
|
41
|
+
|
42
|
+
content = instance_eval(&block)
|
43
|
+
|
44
|
+
current_size = @tagz.size
|
45
|
+
|
46
|
+
content_was_added = current_size > previous_size
|
47
|
+
|
48
|
+
unless content_was_added
|
49
|
+
@tagz << content
|
50
|
+
end
|
51
|
+
|
42
52
|
@tagz
|
43
53
|
ensure
|
44
54
|
@tagz = previous
|
@@ -362,14 +372,40 @@ unless defined? Tagz
|
|
362
372
|
|
363
373
|
# escape utils
|
364
374
|
#
|
375
|
+
def Tagz.escape_html_map
|
376
|
+
@escape_html_map ||= { '&' => '&', '>' => '>', '<' => '<', '"' => '"', "'" => ''' }
|
377
|
+
end
|
378
|
+
|
379
|
+
def Tagz.escape_html_once_regexp
|
380
|
+
@escape_html_once_regexp ||= /["><']|&(?!([a-zA-Z]+|(#\d+));)/
|
381
|
+
end
|
382
|
+
|
383
|
+
def Tagz.escape_html(s)
|
384
|
+
s = s.to_s
|
385
|
+
|
386
|
+
if Tagz.html_safe?(s)
|
387
|
+
s
|
388
|
+
else
|
389
|
+
Tagz.html_safe(s.gsub(/[&"'><]/, Tagz.escape_html_map))
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
def Tagz.escape_html_once(s)
|
394
|
+
result = s.to_s.gsub(Tagz.html_escape_once_regexp){|_| Tagz.escape_html_map[_]}
|
395
|
+
|
396
|
+
Tagz.html_safe?(s) ? Tagz.html_safe(result) : result
|
397
|
+
end
|
398
|
+
|
365
399
|
def Tagz.escapeHTML(*strings)
|
366
|
-
|
400
|
+
Tagz.escape_html(strings.join)
|
367
401
|
end
|
402
|
+
|
368
403
|
def Tagz.escape(*strings)
|
369
|
-
|
404
|
+
Tagz.escape_html(strings.join)
|
370
405
|
end
|
406
|
+
|
371
407
|
def Tagz.escapeAttribute(*strings)
|
372
|
-
|
408
|
+
Tagz.escape_html(strings.join)
|
373
409
|
end
|
374
410
|
|
375
411
|
# raw utils
|
@@ -397,10 +433,18 @@ unless defined? Tagz
|
|
397
433
|
end
|
398
434
|
end
|
399
435
|
|
436
|
+
def Tagz.html_safe?(string)
|
437
|
+
string.html_safe? rescue false
|
438
|
+
end
|
439
|
+
|
400
440
|
def Tagz.raw(*args, &block)
|
401
441
|
Tagz.html_safe(*args, &block)
|
402
442
|
end
|
403
443
|
|
444
|
+
def Tagz.h(string)
|
445
|
+
Tagz.escape_html(string)
|
446
|
+
end
|
447
|
+
|
404
448
|
# generate code for escape configuration
|
405
449
|
#
|
406
450
|
%w( key value content ).each do |type|
|
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.9.
|
6
|
+
spec.version = "9.9.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"
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.9.
|
5
|
-
prerelease:
|
4
|
+
version: 9.9.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ara T. Howard
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: ! "\n tagz.rb is generates html, xml, or any sgml variant like
|
15
14
|
a small ninja\n running across the backs of a herd of giraffes swatting of
|
@@ -40,26 +39,25 @@ files:
|
|
40
39
|
- test/tagz_test.rb
|
41
40
|
homepage: http://github.com/ahoward/tagz
|
42
41
|
licenses: []
|
42
|
+
metadata: {}
|
43
43
|
post_install_message:
|
44
44
|
rdoc_options: []
|
45
45
|
require_paths:
|
46
46
|
- lib
|
47
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
48
|
requirements:
|
50
49
|
- - ! '>='
|
51
50
|
- !ruby/object:Gem::Version
|
52
51
|
version: '0'
|
53
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
53
|
requirements:
|
56
54
|
- - ! '>='
|
57
55
|
- !ruby/object:Gem::Version
|
58
56
|
version: '0'
|
59
57
|
requirements: []
|
60
58
|
rubyforge_project: codeforpeople
|
61
|
-
rubygems_version:
|
59
|
+
rubygems_version: 2.0.3
|
62
60
|
signing_key:
|
63
|
-
specification_version:
|
61
|
+
specification_version: 4
|
64
62
|
summary: tagz
|
65
63
|
test_files: []
|