html_gen 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb23eaf1beeeb5185218fa5ff1ece26dcc1fc113
4
- data.tar.gz: 0a2a3bd1ec7ba41097cb7b81ffd2016da5f14876
3
+ metadata.gz: 7a747c815086290d2b657486ddfb6a472a6d5ebf
4
+ data.tar.gz: 87c34444008c15a6762523b11be1013824aca6fc
5
5
  SHA512:
6
- metadata.gz: 7e28483112aec14975e32e89a17ecd51f625a366786414962affe3f726006a120c858dd0ed429df8586282690607974c71a501db9e9692902e8df41458d4dd10
7
- data.tar.gz: b8c4814a4f6849da9d5efad5305b86cc5a921160b529d06a6f6b5bdabebbc40cc057f4cca3056b69b4f3c3b317ee5f0934f3f7ca0fc8c03b070c257545cdfe1c
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.10
1
+ 0.0.11
@@ -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.10 ruby lib
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.10"
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-20"
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.2.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
@@ -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
- level = if args[:level]
115
- args[:level]
116
- else
117
- 0
114
+ if args[:level]
115
+ level = args[:level]
116
+ else
117
+ level = 0
118
118
  end
119
119
 
120
- pretty = if args.key?(:pretty)
121
- args[:pretty]
122
- else
123
- true
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
- str = if args[:str]
134
- args[:str]
135
- else
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
- str << HtmlGen.escape_html(@str)
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.10
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-20 00:00:00.000000000 Z
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.2.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.