pagebuilder 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gems.rb +6 -0
- data/lib/pagebuilder.rb +11 -0
- data/lib/pagebuilder/document.rb +31 -0
- data/lib/pagebuilder/elements.rb +8 -0
- data/lib/pagebuilder/elements/anchor.rb +31 -0
- data/lib/pagebuilder/elements/basic.rb +38 -0
- data/lib/pagebuilder/elements/input.rb +44 -0
- data/lib/pagebuilder/elements/inputs.rb +13 -0
- data/lib/pagebuilder/elements/inputs/checkbox.rb +19 -0
- data/lib/pagebuilder/elements/inputs/email.rb +18 -0
- data/lib/pagebuilder/elements/inputs/file.rb +18 -0
- data/lib/pagebuilder/elements/inputs/hidden.rb +18 -0
- data/lib/pagebuilder/elements/inputs/password.rb +18 -0
- data/lib/pagebuilder/elements/inputs/radio_button.rb +19 -0
- data/lib/pagebuilder/elements/inputs/search.rb +18 -0
- data/lib/pagebuilder/elements/inputs/submit_button.rb +18 -0
- data/lib/pagebuilder/elements/inputs/text.rb +18 -0
- data/lib/pagebuilder/tag_helpers.rb +23 -0
- data/lib/pagebuilder/tag_helpers/embeds.rb +65 -0
- data/lib/pagebuilder/tag_helpers/forms.rb +90 -0
- data/lib/pagebuilder/tag_helpers/lists.rb +33 -0
- data/lib/pagebuilder/tag_helpers/miscellaneous.rb +59 -0
- data/lib/pagebuilder/tag_helpers/page_structure.rb +69 -0
- data/lib/pagebuilder/tag_helpers/pagebuilder_prefixed_helpers.rb +28 -0
- data/lib/pagebuilder/tag_helpers/tables.rb +49 -0
- data/lib/pagebuilder/tag_helpers/text_markup.rb +165 -0
- data/lib/pagebuilder/version.rb +4 -0
- data/pagebuilder.gemspec +34 -0
- metadata +170 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PageBuilder
|
4
|
+
module TagHelpers
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
# Helper for configuring a basic PageBuilder element
|
9
|
+
def pagebuilder_basic_element(tag_name, content, **attributes)
|
10
|
+
Elements::Basic.new(tag_name, pagebuilder_document).configure(content, attributes)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Helper for configuring a PageBuilder element type
|
14
|
+
def pagebuilder_configured_element(klass, content, **attributes)
|
15
|
+
klass.new(pagebuilder_document).configure(content, attributes)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Defaults to a new document set to the html5 doctype
|
19
|
+
def pagebuilder_document
|
20
|
+
@pagebuilder_document ||= PageBuilder::Document.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def pagebuilder_document=(doc)
|
24
|
+
@pagebuilder_document = doc
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PageBuilder
|
4
|
+
module TagHelpers
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def caption(content = nil, **attributes)
|
9
|
+
pagebuilder_basic_element('caption', content, attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
def col(content = nil, **attributes)
|
13
|
+
pagebuilder_basic_element('col', content, attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def colgroup(content = nil, **attributes)
|
17
|
+
pagebuilder_basic_element('colgroup', content, attributes)
|
18
|
+
end
|
19
|
+
|
20
|
+
def table(content = nil, **attributes)
|
21
|
+
pagebuilder_basic_element('table', content, attributes)
|
22
|
+
end
|
23
|
+
|
24
|
+
def tbody(content = nil, **attributes)
|
25
|
+
pagebuilder_basic_element('tbody', content, attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def td(content = nil, **attributes)
|
29
|
+
pagebuilder_basic_element('td', content, attributes)
|
30
|
+
end
|
31
|
+
|
32
|
+
def tfoot(content = nil, **attributes)
|
33
|
+
pagebuilder_basic_element('tfoot', content, attributes)
|
34
|
+
end
|
35
|
+
|
36
|
+
def th(content = nil, **attributes)
|
37
|
+
pagebuilder_basic_element('th', content, attributes)
|
38
|
+
end
|
39
|
+
|
40
|
+
def thead(content = nil, **attributes)
|
41
|
+
pagebuilder_basic_element('thead', content, attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
def tr(content = nil, **attributes)
|
45
|
+
pagebuilder_basic_element('tr', content, attributes)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PageBuilder
|
4
|
+
module TagHelpers
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def abbr(content = nil, **attributes)
|
9
|
+
pagebuilder_basic_element('abbr', content, attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
def address(content = nil, **attributes)
|
13
|
+
pagebuilder_basic_element('address', content, attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def b(content = nil, **attributes)
|
17
|
+
pagebuilder_basic_element('b', content, attributes)
|
18
|
+
end
|
19
|
+
|
20
|
+
def bdi(content = nil, **attributes)
|
21
|
+
pagebuilder_basic_element('bdi', content, attributes)
|
22
|
+
end
|
23
|
+
|
24
|
+
def bdo(content = nil, **attributes)
|
25
|
+
pagebuilder_basic_element('bdo', content, attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def blockquote(content = nil, **attributes)
|
29
|
+
pagebuilder_basic_element('blockquote', content, attributes)
|
30
|
+
end
|
31
|
+
|
32
|
+
def cite(content = nil, **attributes)
|
33
|
+
pagebuilder_basic_element('cite', content, attributes)
|
34
|
+
end
|
35
|
+
|
36
|
+
def code(content = nil, **attributes)
|
37
|
+
pagebuilder_basic_element('code', content, attributes)
|
38
|
+
end
|
39
|
+
|
40
|
+
def data(content = nil, **attributes)
|
41
|
+
pagebuilder_basic_element('data', content, attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
def del(content = nil, **attributes)
|
45
|
+
pagebuilder_basic_element('del', content, attributes)
|
46
|
+
end
|
47
|
+
|
48
|
+
def details(content = nil, **attributes)
|
49
|
+
pagebuilder_basic_element('details', content, attributes)
|
50
|
+
end
|
51
|
+
|
52
|
+
def dfn(content = nil, **attributes)
|
53
|
+
pagebuilder_basic_element('dfn', content, attributes)
|
54
|
+
end
|
55
|
+
|
56
|
+
def em(content = nil, **attributes)
|
57
|
+
pagebuilder_basic_element('em', content, attributes)
|
58
|
+
end
|
59
|
+
|
60
|
+
def i(content = nil, **attributes)
|
61
|
+
pagebuilder_basic_element('i', content, attributes)
|
62
|
+
end
|
63
|
+
|
64
|
+
def ins(content = nil, **attributes)
|
65
|
+
pagebuilder_basic_element('ins', content, attributes)
|
66
|
+
end
|
67
|
+
|
68
|
+
def kbd(content = nil, **attributes)
|
69
|
+
pagebuilder_basic_element('kbd', content, attributes)
|
70
|
+
end
|
71
|
+
|
72
|
+
def mark(content = nil, **attributes)
|
73
|
+
pagebuilder_basic_element('mark', content, attributes)
|
74
|
+
end
|
75
|
+
|
76
|
+
def meter(content = nil, **attributes)
|
77
|
+
pagebuilder_basic_element('meter', content, attributes)
|
78
|
+
end
|
79
|
+
|
80
|
+
def output(content = nil, **attributes)
|
81
|
+
pagebuilder_basic_element('output', content, attributes)
|
82
|
+
end
|
83
|
+
|
84
|
+
def p(content = nil, **attributes)
|
85
|
+
pagebuilder_basic_element('p', content, attributes)
|
86
|
+
end
|
87
|
+
|
88
|
+
def pre(content = nil, **attributes)
|
89
|
+
pagebuilder_basic_element('pre', content, attributes)
|
90
|
+
end
|
91
|
+
|
92
|
+
def q(content = nil, **attributes)
|
93
|
+
pagebuilder_basic_element('q', content, attributes)
|
94
|
+
end
|
95
|
+
|
96
|
+
def rb(content = nil, **attributes)
|
97
|
+
pagebuilder_basic_element('rb', content, attributes)
|
98
|
+
end
|
99
|
+
|
100
|
+
def rp(content = nil, **attributes)
|
101
|
+
pagebuilder_basic_element('rp', content, attributes)
|
102
|
+
end
|
103
|
+
|
104
|
+
def rt(content = nil, **attributes)
|
105
|
+
pagebuilder_basic_element('rt', content, attributes)
|
106
|
+
end
|
107
|
+
|
108
|
+
def rtc(content = nil, **attributes)
|
109
|
+
pagebuilder_basic_element('rtc', content, attributes)
|
110
|
+
end
|
111
|
+
|
112
|
+
def ruby(content = nil, **attributes)
|
113
|
+
pagebuilder_basic_element('ruby', content, attributes)
|
114
|
+
end
|
115
|
+
|
116
|
+
def s(content = nil, **attributes)
|
117
|
+
pagebuilder_basic_element('s', content, attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
def samp(content = nil, **attributes)
|
121
|
+
pagebuilder_basic_element('samp', content, attributes)
|
122
|
+
end
|
123
|
+
|
124
|
+
def small(content = nil, **attributes)
|
125
|
+
pagebuilder_basic_element('small', content, attributes)
|
126
|
+
end
|
127
|
+
|
128
|
+
def span(content = nil, **attributes)
|
129
|
+
pagebuilder_basic_element('span', content, attributes)
|
130
|
+
end
|
131
|
+
|
132
|
+
def strong(content = nil, **attributes)
|
133
|
+
pagebuilder_basic_element('strong', content, attributes)
|
134
|
+
end
|
135
|
+
|
136
|
+
def sub(content = nil, **attributes)
|
137
|
+
pagebuilder_basic_element('sub', content, attributes)
|
138
|
+
end
|
139
|
+
|
140
|
+
def summary(content = nil, **attributes)
|
141
|
+
pagebuilder_basic_element('summary', content, attributes)
|
142
|
+
end
|
143
|
+
|
144
|
+
def sup(content = nil, **attributes)
|
145
|
+
pagebuilder_basic_element('sup', content, attributes)
|
146
|
+
end
|
147
|
+
|
148
|
+
def time(content = nil, **attributes)
|
149
|
+
pagebuilder_basic_element('time', content, attributes)
|
150
|
+
end
|
151
|
+
|
152
|
+
def u(content = nil, **attributes)
|
153
|
+
pagebuilder_basic_element('u', content, attributes)
|
154
|
+
end
|
155
|
+
|
156
|
+
def var(content = nil, **attributes)
|
157
|
+
pagebuilder_basic_element('var', content, attributes)
|
158
|
+
end
|
159
|
+
|
160
|
+
def wbr(content = nil, **attributes)
|
161
|
+
pagebuilder_basic_element('wbr', content, attributes)
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
data/pagebuilder.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "pagebuilder/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'pagebuilder'
|
8
|
+
spec.version = PageBuilder::VERSION
|
9
|
+
spec.authors = ['Rob Widmer']
|
10
|
+
spec.email = ['rdwidmer@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{PageBuilder provides helpers for building html5 pages with Nokogiri}
|
13
|
+
spec.description = %q{PageBuilder is a utility library to make building html5 pages easier. It has two parts. The first is some classes that provide an interface for dealing with common html element attributes. The second is a module, that can be mixed into your presenters, that provides helpers for generating html nodes with less code than using Nokogiri directly. }
|
14
|
+
spec.homepage = 'https://github.com/rdubya/pagebuilder'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs
|
26
|
+
|
27
|
+
spec.add_dependency 'nokogiri', '>= 1.8.0'
|
28
|
+
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
30
|
+
spec.add_development_dependency 'faker', '> 1.8'
|
31
|
+
spec.add_development_dependency 'rake', '> 12.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
|
+
spec.add_development_dependency 'yard', '~> 0.9.3'
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pagebuilder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rob Widmer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faker
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '12.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.3
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.3
|
97
|
+
description: 'PageBuilder is a utility library to make building html5 pages easier.
|
98
|
+
It has two parts. The first is some classes that provide an interface for dealing
|
99
|
+
with common html element attributes. The second is a module, that can be mixed into
|
100
|
+
your presenters, that provides helpers for generating html nodes with less code
|
101
|
+
than using Nokogiri directly. '
|
102
|
+
email:
|
103
|
+
- rdwidmer@gmail.com
|
104
|
+
executables: []
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- ".rspec"
|
110
|
+
- ".travis.yml"
|
111
|
+
- CODE_OF_CONDUCT.md
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/setup
|
117
|
+
- gems.rb
|
118
|
+
- lib/pagebuilder.rb
|
119
|
+
- lib/pagebuilder/document.rb
|
120
|
+
- lib/pagebuilder/elements.rb
|
121
|
+
- lib/pagebuilder/elements/anchor.rb
|
122
|
+
- lib/pagebuilder/elements/basic.rb
|
123
|
+
- lib/pagebuilder/elements/input.rb
|
124
|
+
- lib/pagebuilder/elements/inputs.rb
|
125
|
+
- lib/pagebuilder/elements/inputs/checkbox.rb
|
126
|
+
- lib/pagebuilder/elements/inputs/email.rb
|
127
|
+
- lib/pagebuilder/elements/inputs/file.rb
|
128
|
+
- lib/pagebuilder/elements/inputs/hidden.rb
|
129
|
+
- lib/pagebuilder/elements/inputs/password.rb
|
130
|
+
- lib/pagebuilder/elements/inputs/radio_button.rb
|
131
|
+
- lib/pagebuilder/elements/inputs/search.rb
|
132
|
+
- lib/pagebuilder/elements/inputs/submit_button.rb
|
133
|
+
- lib/pagebuilder/elements/inputs/text.rb
|
134
|
+
- lib/pagebuilder/tag_helpers.rb
|
135
|
+
- lib/pagebuilder/tag_helpers/embeds.rb
|
136
|
+
- lib/pagebuilder/tag_helpers/forms.rb
|
137
|
+
- lib/pagebuilder/tag_helpers/lists.rb
|
138
|
+
- lib/pagebuilder/tag_helpers/miscellaneous.rb
|
139
|
+
- lib/pagebuilder/tag_helpers/page_structure.rb
|
140
|
+
- lib/pagebuilder/tag_helpers/pagebuilder_prefixed_helpers.rb
|
141
|
+
- lib/pagebuilder/tag_helpers/tables.rb
|
142
|
+
- lib/pagebuilder/tag_helpers/text_markup.rb
|
143
|
+
- lib/pagebuilder/version.rb
|
144
|
+
- pagebuilder.gemspec
|
145
|
+
homepage: https://github.com/rdubya/pagebuilder
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata:
|
149
|
+
yard.run: yri
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 2.6.14
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: PageBuilder provides helpers for building html5 pages with Nokogiri
|
170
|
+
test_files: []
|