HTML-AutoTag 1.0.9 → 1.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3f7f20c8b6b393cb32ad4f2aef7b9d761c1966a
4
- data.tar.gz: 08eb49e1fa0adda239699aeb4dffcd0722bfadbf
3
+ metadata.gz: af60a3d9a911eb1f9fbf20babfe7b3c979261d60
4
+ data.tar.gz: c6b38f9df68b21cc2cac31d6067d6fa3e6d6091d
5
5
  SHA512:
6
- metadata.gz: 58e4faf780fd21c4d4190408acf52b9c46cb9fd04df2f409072c83b7132b7233c4f3cae380b5e8a7835f417df29e4919c6fac9cf885ff2a206d989ed39958569
7
- data.tar.gz: b2b228a03864af30bab9f6fe9e371f074846a01eda5a10574c0e95411d1eb323ced122ff946203768cb8dd2371b2e376296248cc20d09e0a9c6e45b3e0449dde
6
+ metadata.gz: b544423814918504c3a4ad2eceeb8bdf8e1b51519307a3b8ff9f88a1255e44c8ae2d84c2d77aa7b3c71f528cb60211b8bdf68f8c4ee630ed8da10f90e8e94aae
7
+ data.tar.gz: 84a95136b85adbee5082b41ae3069e6dc2ac41313042d029fcee617aee87a901d39e5821326f4fd6d0af3dced36cd788272f9a7860ab731008cc46869fa103c9
data/.travis.yml CHANGED
@@ -1,7 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1.0
4
- - jruby-19mode
5
4
  - 1.9.3
6
- - jruby-18mode
7
- - 1.8.7
data/Changes CHANGED
@@ -1,5 +1,8 @@
1
1
  Revision history for html-autotag-ruby
2
2
 
3
+ 1.0.10
4
+ - minor code refactoring
5
+
3
6
  1.0.9
4
7
  - update ALL copyright dates ;)
5
8
 
data/lib/HTML/AutoAttr.rb CHANGED
@@ -95,6 +95,6 @@ Jeff Anderson, <jeffa at cpan.org>
95
95
 
96
96
  == LICENSE AND COPYRIGHT
97
97
 
98
- Copyright 2016 Jeff Anderson. (See License.md shipped with distro)
98
+ Copyright 2017 Jeff Anderson. (See License.md shipped with distro)
99
99
 
100
100
  =end
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class AutoTag
3
- VERSION = "1.0.9"
3
+ VERSION = "1.0.10"
4
4
  end
5
5
  end
data/lib/HTML/AutoTag.rb CHANGED
@@ -36,8 +36,8 @@ module HTML
36
36
  return ( @indent * @level ) + '<' + tag + attr.to_s + ' />' + @newline
37
37
  end
38
38
 
39
- rendered = ''
40
- no_post_indent = 0
39
+ rendered = ''
40
+ no_indent = 0
41
41
 
42
42
  if cdata.kind_of?( Array )
43
43
 
@@ -46,7 +46,7 @@ module HTML
46
46
  rendered = @newline
47
47
 
48
48
  cdata.each do |hash|
49
- rendered += tag( 'tag' => hash['tag'], 'attr' => hash['attr'], 'cdata' => hash['cdata'] )
49
+ rendered += tag( hash )
50
50
  end
51
51
  @level -= 1
52
52
  else
@@ -59,17 +59,17 @@ module HTML
59
59
 
60
60
  elsif cdata.kind_of?( Hash )
61
61
  @level += 1
62
- rendered = @newline + tag( 'tag' => cdata['tag'], 'attr' => cdata['attr'], 'cdata' => cdata['cdata'] )
62
+ rendered = @newline + tag( cdata )
63
63
  @level -= 1
64
64
 
65
65
  else
66
66
  rendered = @encode ? @encoder.encode( cdata, @encodes ) : cdata
67
- no_post_indent = 1
67
+ no_indent = 1
68
68
  end
69
69
 
70
70
  return (@indent * @level) \
71
71
  + '<' + tag + attr.to_s + '>' \
72
- + rendered.to_s + ( no_post_indent == 1 ? '' : ( @indent * @level ) ) \
72
+ + rendered.to_s + ( no_indent == 1 ? '' : ( @indent * @level ) ) \
73
73
  + '</' + tag + '>' + @newline
74
74
 
75
75
  end
@@ -86,6 +86,6 @@ Jeff Anderson, <jeffa at cpan.org>
86
86
 
87
87
  == LICENSE AND COPYRIGHT
88
88
 
89
- Copyright 2016 Jeff Anderson. (See License.md shipped with distro)
89
+ Copyright 2017 Jeff Anderson. (See License.md shipped with distro)
90
90
 
91
91
  =end
@@ -177,6 +177,6 @@ Jeff Anderson, <jeffa at cpan.org>
177
177
 
178
178
  == LICENSE AND COPYRIGHT
179
179
 
180
- Copyright 2016 Jeff Anderson. (See License.md shipped with distro)
180
+ Copyright 2017 Jeff Anderson. (See License.md shipped with distro)
181
181
 
182
182
  =end
data/lib/HTML/Encoder.rb CHANGED
@@ -179,6 +179,6 @@ Jeff Anderson, <jeffa at cpan.org>
179
179
 
180
180
  == LICENSE AND COPYRIGHT
181
181
 
182
- Copyright 2016 Jeff Anderson. (See License.md shipped with distro)
182
+ Copyright 2017 Jeff Anderson. (See License.md shipped with distro)
183
183
 
184
184
  =end
data/readme.md CHANGED
@@ -10,7 +10,7 @@ Synopsis
10
10
  --------
11
11
  ```ruby
12
12
  require 'HTML/AutoTag'
13
- auto = HTML::AutoTag.new
13
+ auto = HTML::AutoTag.new( 'indent' => ' ' )
14
14
 
15
15
  puts auto.tag( 'tag' => 'hr' )
16
16
  puts auto.tag( 'tag' => 'h1', 'cdata' => 'heading' )
data/t/02-tag.rb CHANGED
@@ -21,7 +21,9 @@ class TestTag < Test::Unit::TestCase
21
21
 
22
22
  def test_empty
23
23
  auto = HTML::AutoTag.new
24
- assert_equal( '<hr />', auto.tag( 'tag' => 'hr' ), "empty tag correct" )
24
+ assert_equal( '<hr />', auto.tag( 'tag' => 'hr' ), "no cdata correct" )
25
+ #assert_equal( '<hr />', auto.tag( 'tag' => 'hr', 'cdata' => '' ), "empty cdata correct" )
26
+ #assert_equal( '<hr />', auto.tag( 'tag' => 'hr', 'cdata' => ' ' ), "whitespace cdata correct" )
25
27
  end
26
28
 
27
29
  def test_nonempty
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HTML-AutoTag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - jeffa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-30 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler