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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/pagebuilder/document.rb +10 -9
- data/lib/pagebuilder/version.rb +1 -1
- data/pagebuilder.gemspec +2 -0
- 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: e22fa4996aba5d6fd85d5c5b7b393ec21ff89b6e
|
4
|
+
data.tar.gz: a1f949885738308496b02c5cce8b3790214070ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07c552ea2368aa32e5a0a51f651a71427e5c654b6cf785f7bdf8b9dedd6cb00d1fcd62fb88d52c83710e90a5a8b9e2e3fec346953847e57fa504a0087d8c3885
|
7
|
+
data.tar.gz: 22f6d4efb5412bc881120e4bd74d2dc2f5393d6938b2797e130558dc6f546a33961335239527732f3c92d4da32f0a39d039cfb8863e4ea998079d9ef96929797
|
data/CHANGELOG.md
CHANGED
data/lib/pagebuilder/document.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
34
|
-
|
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 [
|
39
|
+
# @return [PageBuilder::Elements::Basic]
|
39
40
|
def body
|
40
|
-
@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 [
|
45
|
+
# @return [PageBuilder::Elements::Basic]
|
45
46
|
def head
|
46
|
-
@head ||= at('/html
|
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
|
data/lib/pagebuilder/version.rb
CHANGED
data/pagebuilder.gemspec
CHANGED
@@ -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.
|
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-
|
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
|
- - ">="
|