pagebuilder 0.2.0 → 0.3.0

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: 51d84eaa6a8c99b58ffa772ef728558664807621
4
- data.tar.gz: 9a8a4132818392034585b56d92df9df08b4792b1
3
+ metadata.gz: e22fa4996aba5d6fd85d5c5b7b393ec21ff89b6e
4
+ data.tar.gz: a1f949885738308496b02c5cce8b3790214070ba
5
5
  SHA512:
6
- metadata.gz: 4b83526debea27688251aa6979a007051482be1b4db77e12ba6ae189372fe584b5495fc2cc1079ba716e3ddc9bee4504871ee9f8467706241805259ca047f60b
7
- data.tar.gz: 28d3214fd7cc49fb355322cd62e452c70d6b479398fbe4f8296685007d17037f70731b5fe79ddcae0754cb5bb554dbb47430d50685ad40bad11e80c090d61835
6
+ metadata.gz: 07c552ea2368aa32e5a0a51f651a71427e5c654b6cf785f7bdf8b9dedd6cb00d1fcd62fb88d52c83710e90a5a8b9e2e3fec346953847e57fa504a0087d8c3885
7
+ data.tar.gz: 22f6d4efb5412bc881120e4bd74d2dc2f5393d6938b2797e130558dc6f546a33961335239527732f3c92d4da32f0a39d039cfb8863e4ea998079d9ef96929797
@@ -1,3 +1,7 @@
1
+ ## v0.3.0
2
+ ### Changed
3
+ * Made it so that the body and head tags on a PageBuilder::Document are PageBuilder::Elements::Basic objects
4
+
1
5
  ## v0.2.0
2
6
  ### Added
3
7
  * :>> as an alias of Node#append_child to allow for cleaner nesting
@@ -5,7 +5,7 @@ require 'pagebuilder/script_manager'
5
5
  module PageBuilder
6
6
 
7
7
  # Adds helper methods to the standard Nokogiri HTML document and
8
- # forces an html5 doctype
8
+ # forces an html5 doctype.
9
9
  class Document < Nokogiri::HTML::Document
10
10
  extend Forwardable
11
11
 
@@ -17,33 +17,34 @@ module PageBuilder
17
17
 
18
18
  def self.new
19
19
  # This is the only way I've found so far to force the html5 doctype
20
- parse('<!DOCTYPE html><html><head></head><body></body></html>')
20
+ # It unfortunately also makes it so the initializer doesn't get called for JRuby
21
+ parse('<!DOCTYPE html><html></html>')
21
22
  end
22
23
 
23
24
  # Returns the base uri set for the document if there is one
24
25
  # @return [String|nil]
25
26
  def base_uri
26
- head.at('base')&.attr('href')
27
+ @base&.attr('href')
27
28
  end
28
29
 
29
30
  # Sets the base uri for the document, reuses the same <base> tag if one exists
30
31
  # @param uri [String]
31
32
  # @return [void]
32
33
  def base_uri=(uri)
33
- base_tag = head.at('base') || head.add_child(Elements::Basic.new('base', self))
34
- base_tag['href'] = uri
34
+ @base ||= head.add_child(Elements::Basic.new('base', self))
35
+ @base['href'] = uri
35
36
  end
36
37
 
37
38
  # Gets the body node for the document
38
- # @return [Nokogiri::XML::Node]
39
+ # @return [PageBuilder::Elements::Basic]
39
40
  def body
40
- @body ||= at('/html/body')
41
+ @body ||= head.add_next_sibling(Elements::Basic.new('body', self))
41
42
  end
42
43
 
43
44
  # Gets the head node for the document
44
- # @return [Nokogiri::XML::Node]
45
+ # @return [PageBuilder::Elements::Basic]
45
46
  def head
46
- @head ||= at('/html/head')
47
+ @head ||= at('/html').add_child(Elements::Basic.new('head', self))
47
48
  end
48
49
 
49
50
  # Add managed nodes and then convert to html
@@ -1,4 +1,4 @@
1
1
  module PageBuilder
2
2
  # Current version of the gem
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/rdubya/pagebuilder'
15
15
  spec.license = 'MIT'
16
16
 
17
+ spec.required_ruby_version = '>= 2.0'
18
+
17
19
  # Specify which files should be added to the gem when it is released.
18
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
21
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagebuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Widmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- version: '0'
160
+ version: '2.0'
161
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - ">="