html_gen 0.0.10 → 0.0.11
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/Gemfile +2 -2
- data/VERSION +1 -1
- data/html_gen.gemspec +4 -4
- data/lib/html_gen/element.rb +19 -13
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a747c815086290d2b657486ddfb6a472a6d5ebf
|
|
4
|
+
data.tar.gz: 87c34444008c15a6762523b11be1013824aca6fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13e2f51c6c04c3f8fcb0889f5f13832fb9082306c1427a33cc42286a30ed3bea73cbb165740c007bdab635f51b105d8fd3612ff811a41aba31025151222a19e4
|
|
7
|
+
data.tar.gz: 6a36c009954756c2516e56d6fcd558bf50d9b55a82014a41a5b6dc510eb3f1b32be59f8ac699e7fefa7167967ab53a36b083af0b172ba40129916f202516cc0b
|
data/Gemfile
CHANGED
|
@@ -13,6 +13,6 @@ group :development do
|
|
|
13
13
|
gem "rdoc", "~> 3.12"
|
|
14
14
|
gem "bundler", ">= 1.0.0"
|
|
15
15
|
gem "jeweler", "~> 1.8.4"
|
|
16
|
-
gem "best_practice_project", github: "kaspernj/best_practice_project"
|
|
17
|
-
gem "rubocop"
|
|
16
|
+
gem "best_practice_project", github: "kaspernj/best_practice_project", require: false
|
|
17
|
+
gem "rubocop", require: false
|
|
18
18
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.11
|
data/html_gen.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: html_gen 0.0.
|
|
5
|
+
# stub: html_gen 0.0.11 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "html_gen"
|
|
9
|
-
s.version = "0.0.
|
|
9
|
+
s.version = "0.0.11"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib"]
|
|
13
13
|
s.authors = ["Kasper Johansen"]
|
|
14
|
-
s.date = "2016-01-
|
|
14
|
+
s.date = "2016-01-21"
|
|
15
15
|
s.description = "A small framework for generating HTML."
|
|
16
16
|
s.email = "k@spernj.org"
|
|
17
17
|
s.extra_rdoc_files = [
|
|
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
|
|
|
41
41
|
]
|
|
42
42
|
s.homepage = "http://github.com/kaspernj/html_gen"
|
|
43
43
|
s.licenses = ["MIT"]
|
|
44
|
-
s.rubygems_version = "2.
|
|
44
|
+
s.rubygems_version = "2.4.0"
|
|
45
45
|
s.summary = "A small framework for generating HTML."
|
|
46
46
|
|
|
47
47
|
if s.respond_to? :specification_version then
|
data/lib/html_gen/element.rb
CHANGED
|
@@ -111,16 +111,16 @@ class HtmlGen::Element
|
|
|
111
111
|
# To avoid indentation and newlines you can use the 'pretty'-argument:
|
|
112
112
|
# element.html(pretty: false)
|
|
113
113
|
def html(args = {})
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
if args[:level]
|
|
115
|
+
level = args[:level]
|
|
116
|
+
else
|
|
117
|
+
level = 0
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
if args.key?(:pretty)
|
|
121
|
+
pretty = args[:pretty]
|
|
122
|
+
else
|
|
123
|
+
pretty = true
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
# Used for keeping 'pretty'-value and correct indentation according to parent elements.
|
|
@@ -130,10 +130,10 @@ class HtmlGen::Element
|
|
|
130
130
|
attr = @attr.clone
|
|
131
131
|
|
|
132
132
|
# Start generating the string with HTML (possible go give a custom 'str'-variable where the content should be pushed to).
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
if args[:str]
|
|
134
|
+
str = args[:str]
|
|
135
|
+
else
|
|
136
|
+
str = ""
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
str << @inden * level if pretty && level > 0
|
|
@@ -191,7 +191,13 @@ class HtmlGen::Element
|
|
|
191
191
|
|
|
192
192
|
unless @str.empty?
|
|
193
193
|
str << @inden * (level + 1) if pretty
|
|
194
|
-
|
|
194
|
+
|
|
195
|
+
if @str.respond_to?(:html_safe?) && @str.html_safe?
|
|
196
|
+
str << @str
|
|
197
|
+
else
|
|
198
|
+
str << HtmlGen.escape_html(@str)
|
|
199
|
+
end
|
|
200
|
+
|
|
195
201
|
str << @nl if pretty
|
|
196
202
|
end
|
|
197
203
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html_gen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kasper Johansen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-01-
|
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: string-cases
|
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
155
155
|
version: '0'
|
|
156
156
|
requirements: []
|
|
157
157
|
rubyforge_project:
|
|
158
|
-
rubygems_version: 2.
|
|
158
|
+
rubygems_version: 2.4.0
|
|
159
159
|
signing_key:
|
|
160
160
|
specification_version: 4
|
|
161
161
|
summary: A small framework for generating HTML.
|