html_gen 0.0.6 → 0.0.7

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: c67d70ec80e15b84be9ffb5d38c994877a9fe8cb
4
- data.tar.gz: cb4312924ea5936e3e85504d8242724267cdd297
3
+ metadata.gz: c9753960ad1d9d4235acd59b7e1ccd83655ac7ca
4
+ data.tar.gz: 3dbb63796e2e4596c36e72d24b12adf513cbe214
5
5
  SHA512:
6
- metadata.gz: 3fc3b7aa1ad97434106efc26ee97df3c0fa83ea693aa839be8301b7f076ec984d7785fd853df413c6eea1b3b38cb0ffe7e0f22ce23a14f63ca54e7f4d1830d2c
7
- data.tar.gz: 7da0053e8d31c33098cfdeae5749b0ded911349a7cec7f7b4eb5a216b81ef63845f301da52dadcb902e1697cab5ad434c6712e58579a55d11b40735f2fece8c6
6
+ metadata.gz: 14e3119b2fa1b40980901d12d32abab0e4ddfc64dce190f1917180d461ce79e70fb90a94ea25358ba0f725d2576e026ac7bd4e1ce9c77e805165a716f153de98
7
+ data.tar.gz: 2421cc2f43cb78eee2a63338b4911a46ede4025f7c96ba83dd28cb1e9ea5d1980dccda4e728afd85b70a95f9d248c8cc1ea19e5ef471d7966efc92b5f9530f11
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- [![Build Status](https://api.shippable.com/projects/540e7b9b3479c5ea8f9ec21c/badge?branchName=master)](https://app.shippable.com/projects/540e7b9b3479c5ea8f9ec21c/builds/latest)
2
1
  [![Code Climate](https://codeclimate.com/github/kaspernj/html_gen/badges/gpa.svg)](https://codeclimate.com/github/kaspernj/html_gen)
3
2
  [![Test Coverage](https://codeclimate.com/github/kaspernj/html_gen/badges/coverage.svg)](https://codeclimate.com/github/kaspernj/html_gen)
3
+ [![Build Status](https://img.shields.io/shippable/540e7b9b3479c5ea8f9ec21c.svg)](https://app.shippable.com/projects/540e7b9b3479c5ea8f9ec21c/builds/latest)
4
4
 
5
5
  # HtmlGen
6
6
 
@@ -41,6 +41,7 @@ title = head.eles.first
41
41
  title.html #=> "Test"
42
42
  title.attr #=> {}
43
43
  title.css #=> {}
44
+ title.data #=> {}
44
45
  ```
45
46
 
46
47
  ## Contributing to html_gen
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
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.6 ruby lib
5
+ # stub: html_gen 0.0.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "html_gen"
9
- s.version = "0.0.6"
9
+ s.version = "0.0.7"
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 = "2015-02-13"
14
+ s.date = "2016-01-17"
15
15
  s.description = "A small framework for generating HTML."
16
16
  s.email = "k@spernj.org"
17
17
  s.extra_rdoc_files = [
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
39
39
  ]
40
40
  s.homepage = "http://github.com/kaspernj/html_gen"
41
41
  s.licenses = ["MIT"]
42
- s.rubygems_version = "2.4.0"
42
+ s.rubygems_version = "2.2.2"
43
43
  s.summary = "A small framework for generating HTML."
44
44
 
45
45
  if s.respond_to? :specification_version then
@@ -100,6 +100,13 @@ class HtmlGen::Element
100
100
  return ele
101
101
  end
102
102
 
103
+ #Add a text-element to the element.
104
+ def add_html(html)
105
+ ele = HtmlGen::TextEle.new(html: html, inden: @inden, nl: @nl)
106
+ @eles << ele
107
+ return ele
108
+ end
109
+
103
110
  # Returns the HTML for the element.
104
111
  # To avoid indentation and newlines you can use the 'pretty'-argument:
105
112
  # element.html(pretty: false)
@@ -3,6 +3,7 @@ class HtmlGen::TextEle
3
3
 
4
4
  def initialize(args)
5
5
  @str = args[:str]
6
+ @html = args[:html]
6
7
  @inden = args[:inden]
7
8
  @nl = args[:nl]
8
9
  end
@@ -28,7 +29,13 @@ class HtmlGen::TextEle
28
29
 
29
30
  str = ""
30
31
  str << @inden * level if pretty
31
- str << HtmlGen.escape_html(@str)
32
+
33
+ if @str
34
+ str << HtmlGen.escape_html(@str)
35
+ else
36
+ str << @html
37
+ end
38
+
32
39
  str << @nl if pretty
33
40
 
34
41
  return str
@@ -44,6 +44,16 @@ describe "HtmlGen" do
44
44
  html.should eq "<div><br />This is a test</div>"
45
45
  end
46
46
 
47
+ it "#add_html" do
48
+ div_ele = HtmlGen::Element.new(:div)
49
+ div_ele.add_ele(:br)
50
+ div_ele.add_str("This is a test")
51
+ div_ele.add_html("<b>test</b>")
52
+
53
+ html = div_ele.html(pretty: false)
54
+ html.should eq "<div><br />This is a test<b>test</b></div>"
55
+ end
56
+
47
57
  it "supports data attributes" do
48
58
  div_ele = HtmlGen::Element.new(:div, str: "Test", data: {test: "value"})
49
59
  end
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string-cases
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.4.0
128
+ rubygems_version: 2.2.2
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: A small framework for generating HTML.