HTML-AutoTag 0.0.1 → 0.0.2
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -2
- data/Changes +7 -0
- data/HTML-AutoTag.gemspec +1 -0
- data/lib/HTML/AutoAttr.rb +1 -1
- data/lib/HTML/AutoTag.rb +4 -3
- data/lib/HTML/AutoTag/version.rb +1 -1
- data/t/02-tag.rb +7 -3
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc31c05d334bd5d82c998c2d2c0888e46f1320e
|
4
|
+
data.tar.gz: 27001fd038878125cde27b92c8097b3607a0e64f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e99692edea1c4119f7e2252e8ffee650fff90048bc7a4f9d194eb724406fcb9d6a8bf93bec72322d9bf326d97f865525e590070726831b1280dcaeb85c866e2
|
7
|
+
data.tar.gz: 56d17d0d3c9dd5ae2c46561b1c79cb18646fb110cb468bfd0fdaa89fdff283656b4cda9c88d1855d4a1b27d015bd1044e20d29bdfe980c7afc0e98308c8a4c99
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Changes
ADDED
data/HTML-AutoTag.gemspec
CHANGED
data/lib/HTML/AutoAttr.rb
CHANGED
data/lib/HTML/AutoTag.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "HTML/AutoTag/version"
|
2
2
|
require "HTML/AutoAttr"
|
3
|
+
require "htmlentities"
|
3
4
|
|
4
5
|
module HTML
|
5
6
|
|
@@ -8,12 +9,12 @@ module HTML
|
|
8
9
|
attr_accessor 'encodes', 'indent', 'level', 'sorted', 'newline'
|
9
10
|
|
10
11
|
def initialize( params = {} )
|
11
|
-
@encodes = params['encodes']
|
12
|
+
@encodes = params['encodes'] ? 1 : 0
|
12
13
|
@indent = params['indent'] || ''
|
13
14
|
@level = params['level'] || 0
|
14
15
|
@sorted = params['sorted'] || 0
|
15
16
|
@newline = params['indent'] ? "\n" : ''
|
16
|
-
|
17
|
+
@encoder = HTMLEntities.new
|
17
18
|
end
|
18
19
|
|
19
20
|
def tag( params = {} )
|
@@ -53,8 +54,8 @@ module HTML
|
|
53
54
|
@level -= 1
|
54
55
|
|
55
56
|
else
|
56
|
-
# do encoding here
|
57
57
|
cdata = params['cdata']
|
58
|
+
@encoder.encode( cdata ) if @encodes == 1
|
58
59
|
no_post_indent = 1
|
59
60
|
end
|
60
61
|
|
data/lib/HTML/AutoTag/version.rb
CHANGED
data/t/02-tag.rb
CHANGED
@@ -5,14 +5,14 @@ class TestTag < Test::Unit::TestCase
|
|
5
5
|
|
6
6
|
def test_init
|
7
7
|
auto = HTML::AutoTag.new
|
8
|
-
assert_equal(
|
8
|
+
assert_equal( 0, auto.encodes, "no args encodes correct" )
|
9
9
|
assert_equal( '', auto.indent, "no args indent correct" )
|
10
10
|
assert_equal( 0, auto.level, "no args level correct" )
|
11
11
|
assert_equal( 0, auto.sorted, "no args sorted correct" )
|
12
12
|
assert_equal( '', auto.newline, "no args newline correct" )
|
13
13
|
|
14
|
-
auto = HTML::AutoTag.new( 'encodes' =>
|
15
|
-
assert_equal(
|
14
|
+
auto = HTML::AutoTag.new( 'encodes' => 1, 'indent' => ' ' )
|
15
|
+
assert_equal( 1, auto.encodes, "encodes set correct" )
|
16
16
|
assert_equal( ' ', auto.indent, "indent set correct" )
|
17
17
|
assert_equal( "\n", auto.newline, "newline set correct" )
|
18
18
|
end
|
@@ -43,4 +43,8 @@ class TestTag < Test::Unit::TestCase
|
|
43
43
|
assert_equal( " <ol>\n <li>1</li>\n <li>2</li>\n</ol>\n", auto.tag( 'tag' => 'ol', 'cdata' => [{ 'tag' => 'li', 'cdata' => 1 }, { 'tag' => 'li', 'cdata' => 2 }] ), "ol tag correct" )
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_encodes
|
47
|
+
auto = HTML::AutoTag.new( 'encodes' => 1 )
|
48
|
+
assert_equal( '<p><0></p>', auto.tag( 'tag' => 'p', 'cdata' => '<0>' ), "paragraph tag correct" )
|
49
|
+
end
|
46
50
|
end
|
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: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jeffa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: htmlentities
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Just another HTML tag generator for ruby.
|
42
56
|
email:
|
43
57
|
- jeffa@cpan.org
|
@@ -47,6 +61,7 @@ extra_rdoc_files: []
|
|
47
61
|
files:
|
48
62
|
- ".gitignore"
|
49
63
|
- ".travis.yml"
|
64
|
+
- Changes
|
50
65
|
- Gemfile
|
51
66
|
- HTML-AutoTag.gemspec
|
52
67
|
- License.md
|