tagz 9.6.2 → 9.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/tagz.rb +5 -65
  2. data/tagz.gemspec +1 -1
  3. 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.2'
10
+ '9.7.0'
11
11
  end
12
12
 
13
13
  def Tagz.description
@@ -271,7 +271,7 @@ unless defined? Tagz
271
271
 
272
272
  def escape(string)
273
273
  return string if string.respond_to?(:html_safe)
274
- Tagz.xchar.escape(string)
274
+ Tagz.escape(string)
275
275
  end
276
276
  alias_method 'h', 'escape'
277
277
 
@@ -360,69 +360,9 @@ unless defined? Tagz
360
360
  end
361
361
  Tagz.singleton_class{ define_method(:element){ Tagz.namespace(:Element) } }
362
362
 
363
- module XChar
364
- # http://intertwingly.net/stories/2004/04/14/i18n.html#CleaningWindows
365
- #
366
- CP1252 = {
367
- 128 => 8364, # euro sign
368
- 130 => 8218, # single low-9 quotation mark
369
- 131 => 402, # latin small letter f with hook
370
- 132 => 8222, # double low-9 quotation mark
371
- 133 => 8230, # horizontal ellipsis
372
- 134 => 8224, # dagger
373
- 135 => 8225, # double dagger
374
- 136 => 710, # modifier letter circumflex accent
375
- 137 => 8240, # per mille sign
376
- 138 => 352, # latin capital letter s with caron
377
- 139 => 8249, # single left-pointing angle quotation mark
378
- 140 => 338, # latin capital ligature oe
379
- 142 => 381, # latin capital letter z with caron
380
- 145 => 8216, # left single quotation mark
381
- 146 => 8217, # right single quotation mark
382
- 147 => 8220, # left double quotation mark
383
- 148 => 8221, # right double quotation mark
384
- 149 => 8226, # bullet
385
- 150 => 8211, # en dash
386
- 151 => 8212, # em dash
387
- 152 => 732, # small tilde
388
- 153 => 8482, # trade mark sign
389
- 154 => 353, # latin small letter s with caron
390
- 155 => 8250, # single right-pointing angle quotation mark
391
- 156 => 339, # latin small ligature oe
392
- 158 => 382, # latin small letter z with caron
393
- 159 => 376} # latin capital letter y with diaeresis
394
-
395
- # http://www.w3.org/TR/REC-xml/#dt-chardata
396
- #
397
- PREDEFINED = {
398
- 38 => '&', # ampersand
399
- 60 => '<', # left angle bracket
400
- 62 => '>'} # right angle bracket
401
-
402
- # http://www.w3.org/TR/REC-xml/#charsets
403
- #
404
- VALID = [[0x9, 0xA, 0xD], (0x20..0xD7FF), (0xE000..0xFFFD), (0x10000..0x10FFFF)]
405
-
406
- def XChar.escape(string)
407
- return string if string.respond_to?(:html_safe)
408
- string.unpack('U*').map{|n| xchr(n)}.join # ASCII, UTF-8
409
- rescue
410
- string.unpack('C*').map{|n| xchr(n)}.join # ISO-8859-1, WIN-1252
411
- end
412
-
413
- def XChar.xchr(n)
414
- (@xchr ||= {})[n] ||= ((
415
- n = XChar::CP1252[n] || n
416
- n = 42 unless XChar::VALID.find{|range| range.include? n}
417
- XChar::PREDEFINED[n] or (n<128 ? n.chr : "&##{n};")
418
- ))
419
- end
420
- end
421
- Tagz.singleton_class{ define_method(:xchar){ Tagz.namespace(:XChar) } }
422
-
423
363
  NoEscapeContentProc = lambda{|*contents| contents.join}
424
364
  Tagz.singleton_class{ define_method(:no_escape_content_proc){ Tagz.namespace(:NoEscapeContentProc) } }
425
- EscapeContentProc = lambda{|*contents| Tagz.xchar.escape(contents.join)}
365
+ EscapeContentProc = lambda{|*contents| Tagz.escapeHTML(contents.join)}
426
366
  Tagz.singleton_class{ define_method(:escape_content_proc){ Tagz.namespace(:EscapeContentProc) } }
427
367
 
428
368
  NoEscapeKeyProc = lambda{|*values| values.join}
@@ -446,10 +386,10 @@ unless defined? Tagz
446
386
  # escape utils
447
387
  #
448
388
  def Tagz.escapeHTML(*strings)
449
- Tagz.xchar.escape(strings.join)
389
+ CGI.escapeHTML(strings.join)
450
390
  end
451
391
  def Tagz.escape(*strings)
452
- Tagz.xchar.escape(strings.join)
392
+ CGI.escapeHTML(strings.join)
453
393
  end
454
394
  def Tagz.escapeAttribute(*strings)
455
395
  CGI.escapeHTML(strings.join)
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.2"
6
+ spec.version = "9.7.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"
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.2
4
+ version: 9.7.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: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-06-09 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