pagebuilder 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +3 -1
- data/lib/pagebuilder/document.rb +36 -3
- data/lib/pagebuilder/elements/basic.rb +6 -1
- data/lib/pagebuilder/script_manager.rb +49 -0
- data/lib/pagebuilder/tag_helpers/embeds.rb +30 -12
- data/lib/pagebuilder/tag_helpers/forms.rb +55 -26
- data/lib/pagebuilder/tag_helpers/lists.rb +18 -6
- data/lib/pagebuilder/tag_helpers/miscellaneous.rb +19 -8
- data/lib/pagebuilder/tag_helpers/page_structure.rb +21 -2
- data/lib/pagebuilder/tag_helpers/tables.rb +30 -14
- data/lib/pagebuilder/tag_helpers/text_markup.rb +45 -2
- data/lib/pagebuilder/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51d84eaa6a8c99b58ffa772ef728558664807621
|
4
|
+
data.tar.gz: 9a8a4132818392034585b56d92df9df08b4792b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b83526debea27688251aa6979a007051482be1b4db77e12ba6ae189372fe584b5495fc2cc1079ba716e3ddc9bee4504871ee9f8467706241805259ca047f60b
|
7
|
+
data.tar.gz: 28d3214fd7cc49fb355322cd62e452c70d6b479398fbe4f8296685007d17037f70731b5fe79ddcae0754cb5bb554dbb47430d50685ad40bad11e80c090d61835
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
## v0.2.0
|
2
|
+
### Added
|
3
|
+
* :>> as an alias of Node#append_child to allow for cleaner nesting
|
4
|
+
* helpers for setting the base uri for a document
|
5
|
+
* helpers to the document for managing a list of javascript files to be
|
6
|
+
output at the end of the body
|
7
|
+
### Changed
|
8
|
+
* Removed the `content` argument from tag helpers for tags that shouldn't have text content
|
9
|
+
* Added better documentation of the available tags
|
10
|
+
### Removed
|
11
|
+
* #menu_item since the tag is essentially dead
|
12
|
+
|
13
|
+
## v0.1.0
|
14
|
+
Initial release
|
data/README.md
CHANGED
@@ -20,7 +20,9 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
Include `PageBuilder::
|
23
|
+
Include `PageBuilder::TagHelpers` in the class where you want to build out pages. It will add helper methods for most HTML 5 tags. As an example, you can then call `a 'click here', href: 'http://www.example.com'` to generate an anchor node that links to `http://www.example.com` with "click here" as the text.
|
24
|
+
|
25
|
+
For a list of currently supported tags see [TagHelpers Docs](https://www.rubydoc.info/gems/pagebuilder/PageBuilder/TagHelpers)
|
24
26
|
|
25
27
|
### Available helpers
|
26
28
|
|
data/lib/pagebuilder/document.rb
CHANGED
@@ -1,19 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'pagebuilder/script_manager'
|
4
|
+
|
3
5
|
module PageBuilder
|
4
6
|
|
5
7
|
# Adds helper methods to the standard Nokogiri HTML document and
|
6
8
|
# forces an html5 doctype
|
7
9
|
class Document < Nokogiri::HTML::Document
|
10
|
+
extend Forwardable
|
8
11
|
|
9
|
-
#
|
10
|
-
#
|
12
|
+
# @!method add_script(uri, **attributes)
|
13
|
+
# @see ScriptManager#add_script
|
14
|
+
# @!method remove_script(uri)
|
15
|
+
# @see ScriptManager#remove_script
|
16
|
+
def_delegators :script_manager, :add_script, :remove_script
|
11
17
|
|
12
18
|
def self.new
|
13
|
-
# This is the only way I've found so far to force the html5
|
19
|
+
# This is the only way I've found so far to force the html5 doctype
|
14
20
|
parse('<!DOCTYPE html><html><head></head><body></body></html>')
|
15
21
|
end
|
16
22
|
|
23
|
+
# Returns the base uri set for the document if there is one
|
24
|
+
# @return [String|nil]
|
25
|
+
def base_uri
|
26
|
+
head.at('base')&.attr('href')
|
27
|
+
end
|
28
|
+
|
29
|
+
# Sets the base uri for the document, reuses the same <base> tag if one exists
|
30
|
+
# @param uri [String]
|
31
|
+
# @return [void]
|
32
|
+
def base_uri=(uri)
|
33
|
+
base_tag = head.at('base') || head.add_child(Elements::Basic.new('base', self))
|
34
|
+
base_tag['href'] = uri
|
35
|
+
end
|
36
|
+
|
17
37
|
# Gets the body node for the document
|
18
38
|
# @return [Nokogiri::XML::Node]
|
19
39
|
def body
|
@@ -26,6 +46,19 @@ module PageBuilder
|
|
26
46
|
@head ||= at('/html/head')
|
27
47
|
end
|
28
48
|
|
49
|
+
# Add managed nodes and then convert to html
|
50
|
+
# @see Nokogiri::HTML::Document#to_html
|
51
|
+
def to_html(*options)
|
52
|
+
@script_manager.append_tags(body) if @script_manager
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def script_manager
|
59
|
+
@script_manager ||= ScriptManager.new
|
60
|
+
end
|
61
|
+
|
29
62
|
end
|
30
63
|
|
31
64
|
end
|
@@ -5,6 +5,11 @@ module PageBuilder
|
|
5
5
|
# we can add extra helpers
|
6
6
|
class Basic < Nokogiri::XML::Element
|
7
7
|
|
8
|
+
# Create a shorthand way to add multiple children and return the last one.
|
9
|
+
# With helpers this could be `ul >> li >> a(href: 'example.com')`
|
10
|
+
# (see Nokogiri::XML::Element#add_child)
|
11
|
+
alias_method :>>, :add_child
|
12
|
+
|
8
13
|
# Helper to easily set the content and attributes for this element
|
9
14
|
# @param content [String] text for the content of the element
|
10
15
|
# @param attributes [] keyword arguments for the attributes that should be set
|
@@ -24,7 +29,7 @@ module PageBuilder
|
|
24
29
|
end
|
25
30
|
|
26
31
|
# Helper to set data attributes as a single call instead of
|
27
|
-
# an individual line for each
|
32
|
+
# an individual line for each attribute
|
28
33
|
# @param attributes [Hash] data attributes that should be set (minus the "data-" prefix)
|
29
34
|
# @return void
|
30
35
|
def data_attributes=(attributes)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PageBuilder
|
4
|
+
|
5
|
+
# Used to keep track of added/removed javascript
|
6
|
+
# and to generate script tags in the correct order
|
7
|
+
class ScriptManager
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@index = []
|
12
|
+
@scripts = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Adds a script to be loaded if it doesn't exist
|
16
|
+
# or updates stored tag attributes if it does
|
17
|
+
# @param uri [String] the src of the script
|
18
|
+
# @return [Boolean] true if script is added, false if uri already existed
|
19
|
+
def add_script(uri, **attributes)
|
20
|
+
uri_for_index = uri.downcase
|
21
|
+
if attrs = @scripts[uri_for_index]
|
22
|
+
attrs.merge!(attributes)
|
23
|
+
false
|
24
|
+
else
|
25
|
+
attributes[:src] = uri
|
26
|
+
@scripts[uri_for_index] = attributes
|
27
|
+
@index << uri_for_index
|
28
|
+
true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Creates the script tags requested in the correct order
|
33
|
+
# @param [Nokogiri::XML::Node] node to append script tags to
|
34
|
+
def append_tags(node)
|
35
|
+
document = node.document
|
36
|
+
@index.each do |i|
|
37
|
+
node << Elements::Basic.new('script', document).configure(@scripts[i])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Removes a script that was previously added so that it won't be output
|
42
|
+
# @param uri [String] the uri of the script to remove
|
43
|
+
def remove_script(uri)
|
44
|
+
uri_for_index = uri.downcase
|
45
|
+
@index.delete(uri_for_index)
|
46
|
+
@scripts.delete(uri_for_index)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -5,61 +5,79 @@ module PageBuilder
|
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
# @!group Available Tags
|
9
|
+
|
10
|
+
# @!visibility public
|
11
|
+
def area(**attributes)
|
12
|
+
pagebuilder_basic_element('area', nil, attributes)
|
10
13
|
end
|
11
14
|
|
15
|
+
# @!visibility public
|
12
16
|
def audio(content = nil, **attributes)
|
13
17
|
pagebuilder_basic_element('audio', content, attributes)
|
14
18
|
end
|
15
19
|
|
20
|
+
# @!visibility public
|
16
21
|
def canvas(content = nil, **attributes)
|
17
22
|
pagebuilder_basic_element('canvas', content, attributes)
|
18
23
|
end
|
19
24
|
|
20
|
-
|
21
|
-
|
25
|
+
# @!visibility public
|
26
|
+
def embed(**attributes)
|
27
|
+
pagebuilder_basic_element('embed', nil, attributes)
|
22
28
|
end
|
23
29
|
|
30
|
+
# @!visibility public
|
24
31
|
def figcaption(content = nil, **attributes)
|
25
32
|
pagebuilder_basic_element('figcaption', content, attributes)
|
26
33
|
end
|
27
34
|
|
35
|
+
# @!visibility public
|
28
36
|
def figure(content = nil, **attributes)
|
29
37
|
pagebuilder_basic_element('figure', content, attributes)
|
30
38
|
end
|
31
39
|
|
40
|
+
# @!visibility public
|
32
41
|
def iframe(content = nil, **attributes)
|
33
42
|
pagebuilder_basic_element('iframe', content, attributes)
|
34
43
|
end
|
35
44
|
|
36
|
-
|
37
|
-
|
45
|
+
# @!visibility public
|
46
|
+
def img(**attributes)
|
47
|
+
pagebuilder_basic_element('img', nil, attributes)
|
38
48
|
end
|
39
49
|
|
50
|
+
# @!visibility public
|
40
51
|
def map(content = nil, **attributes)
|
41
52
|
pagebuilder_basic_element('map', content, attributes)
|
42
53
|
end
|
43
54
|
|
55
|
+
# @!visibility public
|
44
56
|
def object(content = nil, **attributes)
|
45
57
|
pagebuilder_basic_element('object', content, attributes)
|
46
58
|
end
|
47
59
|
|
48
|
-
|
49
|
-
|
60
|
+
# @!visibility public
|
61
|
+
def param(**attributes)
|
62
|
+
pagebuilder_basic_element('param', nil, attributes)
|
50
63
|
end
|
51
64
|
|
52
|
-
|
53
|
-
|
65
|
+
# @!visibility public
|
66
|
+
def source(**attributes)
|
67
|
+
pagebuilder_basic_element('source', nil, attributes)
|
54
68
|
end
|
55
69
|
|
56
|
-
|
57
|
-
|
70
|
+
# @!visibility public
|
71
|
+
def track(**attributes)
|
72
|
+
pagebuilder_basic_element('track', nil, attributes)
|
58
73
|
end
|
59
74
|
|
75
|
+
# @!visibility public
|
60
76
|
def video(content = nil, **attributes)
|
61
77
|
pagebuilder_basic_element('video', content, attributes)
|
62
78
|
end
|
63
79
|
|
80
|
+
# @!endgroup Available Tags
|
81
|
+
|
64
82
|
end
|
65
83
|
end
|
@@ -5,86 +5,115 @@ module PageBuilder
|
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
+
# @!group Available Tags
|
9
|
+
|
10
|
+
# @!visibility public
|
8
11
|
def button(content = nil, **attributes)
|
9
12
|
pagebuilder_basic_element('button', content, attributes)
|
10
13
|
end
|
11
14
|
|
12
|
-
|
13
|
-
|
15
|
+
# @!visibility public
|
16
|
+
def checkbox(**attributes)
|
17
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::Checkbox, nil, attributes)
|
14
18
|
end
|
15
19
|
|
16
|
-
|
17
|
-
|
20
|
+
# @!visibility public
|
21
|
+
def email_input(**attributes)
|
22
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::Email, nil, attributes)
|
18
23
|
end
|
19
24
|
|
25
|
+
# @!visibility public
|
20
26
|
def fieldset(content = nil, **attributes)
|
21
27
|
pagebuilder_basic_element('fieldset', content, attributes)
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
|
30
|
+
# @!visibility public
|
31
|
+
def file_input(**attributes)
|
32
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::File, nil, attributes)
|
26
33
|
end
|
27
34
|
|
35
|
+
# @!visibility public
|
28
36
|
def form(content = nil, **attributes)
|
29
37
|
pagebuilder_basic_element('form', content, attributes)
|
30
38
|
end
|
31
39
|
|
32
|
-
|
33
|
-
|
40
|
+
# @!visibility public
|
41
|
+
def hidden_input(**attributes)
|
42
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::Hidden, nil, attributes)
|
34
43
|
end
|
35
44
|
|
36
|
-
|
37
|
-
|
45
|
+
# @!visibility public
|
46
|
+
def input(**attributes)
|
47
|
+
pagebuilder_configured_element(PageBuilder::Elements::Input, nil, attributes)
|
38
48
|
end
|
39
49
|
|
40
|
-
|
41
|
-
|
50
|
+
# @!visibility public
|
51
|
+
def keygen(**attributes)
|
52
|
+
pagebuilder_basic_element('keygen', nil, attributes)
|
42
53
|
end
|
43
54
|
|
44
55
|
# TODO add helpers for things like labeled_input
|
56
|
+
|
57
|
+
# @!visibility public
|
45
58
|
def label(content = nil, **attributes)
|
46
59
|
pagebuilder_basic_element('label', content, attributes)
|
47
60
|
end
|
48
61
|
|
62
|
+
# @!visibility public
|
49
63
|
def legend(content = nil, **attributes)
|
50
64
|
pagebuilder_basic_element('legend', content, attributes)
|
51
65
|
end
|
52
66
|
|
53
|
-
|
54
|
-
|
67
|
+
# TODO make optgroup take an array of options as the first argument
|
68
|
+
|
69
|
+
# @!visibility public
|
70
|
+
def optgroup(**attributes)
|
71
|
+
pagebuilder_basic_element('optgroup', nil, attributes)
|
55
72
|
end
|
56
73
|
|
74
|
+
# @!visibility public
|
57
75
|
def option(content = nil, **attributes)
|
58
76
|
pagebuilder_basic_element('option', content, attributes)
|
59
77
|
end
|
60
78
|
|
61
|
-
|
62
|
-
|
79
|
+
# @!visibility public
|
80
|
+
def password_input(**attributes)
|
81
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::Password, nil, attributes)
|
63
82
|
end
|
64
83
|
|
65
|
-
|
66
|
-
|
84
|
+
# @!visibility public
|
85
|
+
def radio_button(**attributes)
|
86
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::RadioButton, nil, attributes)
|
67
87
|
end
|
68
88
|
|
69
|
-
|
70
|
-
|
89
|
+
# @!visibility public
|
90
|
+
def search_input(**attributes)
|
91
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::Search, nil, attributes)
|
71
92
|
end
|
72
93
|
|
73
|
-
|
74
|
-
|
94
|
+
# TODO Make select take an array of options/optgroups
|
95
|
+
|
96
|
+
# @!visibility public
|
97
|
+
def select(**attributes)
|
98
|
+
pagebuilder_basic_element('select', nil, attributes)
|
75
99
|
end
|
76
100
|
|
77
|
-
|
78
|
-
|
101
|
+
# @!visibility public
|
102
|
+
def submit_button(**attributes)
|
103
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::SubmitButton, nil, attributes)
|
79
104
|
end
|
80
105
|
|
81
|
-
|
82
|
-
|
106
|
+
# @!visibility public
|
107
|
+
def text_input(**attributes)
|
108
|
+
pagebuilder_configured_element(PageBuilder::Elements::Inputs::Text, nil, attributes)
|
83
109
|
end
|
84
110
|
|
111
|
+
# @!visibility public
|
85
112
|
def textarea(content = nil, **attributes)
|
86
113
|
pagebuilder_basic_element('textarea', content, attributes)
|
87
114
|
end
|
88
115
|
|
116
|
+
# @!endgroup Available Tags
|
117
|
+
|
89
118
|
end
|
90
119
|
end
|
@@ -3,31 +3,43 @@
|
|
3
3
|
module PageBuilder
|
4
4
|
module TagHelpers
|
5
5
|
|
6
|
+
# TODO Make the containers (ol/ul) take arrays of list items
|
7
|
+
|
6
8
|
private
|
7
9
|
|
10
|
+
# @!group Available Tags
|
11
|
+
|
12
|
+
# @!visibility public
|
8
13
|
def dd(content = nil, **attributes)
|
9
14
|
pagebuilder_basic_element('dd', content, attributes)
|
10
15
|
end
|
11
16
|
|
12
|
-
|
13
|
-
|
17
|
+
# @!visibility public
|
18
|
+
def dl(**attributes)
|
19
|
+
pagebuilder_basic_element('dl', nil, attributes)
|
14
20
|
end
|
15
21
|
|
22
|
+
# @!visibility public
|
16
23
|
def dt(content = nil, **attributes)
|
17
24
|
pagebuilder_basic_element('dt', content, attributes)
|
18
25
|
end
|
19
26
|
|
27
|
+
# @!visibility public
|
20
28
|
def li(content = nil, **attributes)
|
21
29
|
pagebuilder_basic_element('li', content, attributes)
|
22
30
|
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
# @!visibility public
|
33
|
+
def ol(**attributes)
|
34
|
+
pagebuilder_basic_element('ol', nil, attributes)
|
26
35
|
end
|
27
36
|
|
28
|
-
|
29
|
-
|
37
|
+
# @!visibility public
|
38
|
+
def ul(**attributes)
|
39
|
+
pagebuilder_basic_element('ul', nil, attributes)
|
30
40
|
end
|
31
41
|
|
42
|
+
# @!endgroup Available Tags
|
43
|
+
|
32
44
|
end
|
33
45
|
end
|
@@ -7,53 +7,64 @@ module PageBuilder
|
|
7
7
|
# public method space for the class these are included in
|
8
8
|
private
|
9
9
|
|
10
|
+
# @!group Available Tags
|
11
|
+
|
12
|
+
# @!visibility public
|
10
13
|
def a(content = nil, **attributes)
|
11
14
|
pagebuilder_configured_element(Elements::Anchor, content, attributes)
|
12
15
|
end
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
# @!visibility public
|
18
|
+
def br(**attributes)
|
19
|
+
pagebuilder_basic_element('br', nil, attributes)
|
16
20
|
end
|
17
21
|
|
22
|
+
# @!visibility public
|
18
23
|
def datalist(content = nil, **attributes)
|
19
24
|
pagebuilder_basic_element('datalist', content, attributes)
|
20
25
|
end
|
21
26
|
|
27
|
+
# @!visibility public
|
22
28
|
def dialog(content = nil, **attributes)
|
23
29
|
pagebuilder_basic_element('dialog', content, attributes)
|
24
30
|
end
|
25
31
|
|
26
|
-
|
27
|
-
|
32
|
+
# @!visibility public
|
33
|
+
def hr(**attributes)
|
34
|
+
pagebuilder_basic_element('hr', nil, attributes)
|
28
35
|
end
|
29
36
|
|
37
|
+
# @!visibility public
|
30
38
|
def menu(content = nil, **attributes)
|
31
39
|
pagebuilder_basic_element('menu', content, attributes)
|
32
40
|
end
|
33
41
|
|
34
|
-
|
35
|
-
pagebuilder_basic_element('menuitem', content, attributes)
|
36
|
-
end
|
37
|
-
|
42
|
+
# @!visibility public
|
38
43
|
def noscript(content = nil, **attributes)
|
39
44
|
pagebuilder_basic_element('noscript', content, attributes)
|
40
45
|
end
|
41
46
|
|
47
|
+
# @!visibility public
|
42
48
|
def progress(content = nil, **attributes)
|
43
49
|
pagebuilder_basic_element('progress', content, attributes)
|
44
50
|
end
|
45
51
|
|
52
|
+
# @!visibility public
|
46
53
|
def script(content = nil, **attributes)
|
47
54
|
pagebuilder_basic_element('script', content, attributes)
|
48
55
|
end
|
49
56
|
|
57
|
+
# @!visibility public
|
50
58
|
def style(content = nil, **attributes)
|
51
59
|
pagebuilder_basic_element('style', content, attributes)
|
52
60
|
end
|
53
61
|
|
62
|
+
# @!visibility public
|
54
63
|
def template(content = nil, **attributes)
|
55
64
|
pagebuilder_basic_element('template', content, attributes)
|
56
65
|
end
|
57
66
|
|
67
|
+
# @!endgroup Available Tags
|
68
|
+
|
58
69
|
end
|
59
70
|
end
|
@@ -5,65 +5,84 @@ module PageBuilder
|
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
+
# @!group Available Tags
|
9
|
+
|
10
|
+
# @!visibility public
|
8
11
|
def article(content = nil, **attributes)
|
9
12
|
pagebuilder_basic_element('article', content, attributes)
|
10
13
|
end
|
11
14
|
|
15
|
+
# @!visibility public
|
12
16
|
def aside(content = nil, **attributes)
|
13
17
|
pagebuilder_basic_element('aside', content, attributes)
|
14
18
|
end
|
15
19
|
|
20
|
+
# @!visibility public
|
16
21
|
def div(content = nil, **attributes)
|
17
22
|
pagebuilder_basic_element('div', content, attributes)
|
18
23
|
end
|
19
24
|
|
25
|
+
# @!visibility public
|
20
26
|
def footer(content = nil, **attributes)
|
21
27
|
pagebuilder_basic_element('footer', content, attributes)
|
22
28
|
end
|
23
29
|
|
30
|
+
# @!visibility public
|
24
31
|
def h1(content = nil, **attributes)
|
25
32
|
pagebuilder_basic_element('h1', content, attributes)
|
26
33
|
end
|
27
34
|
|
35
|
+
# @!visibility public
|
28
36
|
def h2(content = nil, **attributes)
|
29
37
|
pagebuilder_basic_element('h2', content, attributes)
|
30
38
|
end
|
31
39
|
|
40
|
+
# @!visibility public
|
32
41
|
def h3(content = nil, **attributes)
|
33
42
|
pagebuilder_basic_element('h3', content, attributes)
|
34
43
|
end
|
35
44
|
|
45
|
+
# @!visibility public
|
36
46
|
def h4(content = nil, **attributes)
|
37
47
|
pagebuilder_basic_element('h4', content, attributes)
|
38
48
|
end
|
39
49
|
|
50
|
+
# @!visibility public
|
40
51
|
def h5(content = nil, **attributes)
|
41
52
|
pagebuilder_basic_element('h5', content, attributes)
|
42
53
|
end
|
43
54
|
|
55
|
+
# @!visibility public
|
44
56
|
def h6(content = nil, **attributes)
|
45
57
|
pagebuilder_basic_element('h6', content, attributes)
|
46
58
|
end
|
47
59
|
|
60
|
+
# @!visibility public
|
48
61
|
def header(content = nil, **attributes)
|
49
62
|
pagebuilder_basic_element('header', content, attributes)
|
50
63
|
end
|
51
64
|
|
52
|
-
|
53
|
-
|
65
|
+
# @!visibility public
|
66
|
+
def hgroup(**attributes)
|
67
|
+
pagebuilder_basic_element('hgroup', nil, attributes)
|
54
68
|
end
|
55
69
|
|
70
|
+
# @!visibility public
|
56
71
|
def main(content = nil, **attributes)
|
57
72
|
pagebuilder_basic_element('main', content, attributes)
|
58
73
|
end
|
59
74
|
|
75
|
+
# @!visibility public
|
60
76
|
def nav(content = nil, **attributes)
|
61
77
|
pagebuilder_basic_element('nav', content, attributes)
|
62
78
|
end
|
63
79
|
|
80
|
+
# @!visibility public
|
64
81
|
def section(content = nil, **attributes)
|
65
82
|
pagebuilder_basic_element('section', content, attributes)
|
66
83
|
end
|
67
84
|
|
85
|
+
# @!endgroup Available Tags
|
86
|
+
|
68
87
|
end
|
69
88
|
end
|
@@ -5,45 +5,61 @@ module PageBuilder
|
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
+
# @!group Available Tags
|
9
|
+
|
10
|
+
# @!visibility public
|
8
11
|
def caption(content = nil, **attributes)
|
9
12
|
pagebuilder_basic_element('caption', content, attributes)
|
10
13
|
end
|
11
14
|
|
12
|
-
|
13
|
-
|
15
|
+
# @!visibility public
|
16
|
+
def col(**attributes)
|
17
|
+
pagebuilder_basic_element('col', nil, attributes)
|
14
18
|
end
|
15
19
|
|
16
|
-
|
17
|
-
|
20
|
+
# @!visibility public
|
21
|
+
def colgroup(**attributes)
|
22
|
+
pagebuilder_basic_element('colgroup', nil, attributes)
|
18
23
|
end
|
19
24
|
|
20
|
-
|
21
|
-
|
25
|
+
# @!visibility public
|
26
|
+
def table(**attributes)
|
27
|
+
pagebuilder_basic_element('table', nil, attributes)
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
|
30
|
+
# TODO allow this to take an array of trs
|
31
|
+
|
32
|
+
# @!visibility public
|
33
|
+
def tbody(**attributes)
|
34
|
+
pagebuilder_basic_element('tbody', nil, attributes)
|
26
35
|
end
|
27
36
|
|
37
|
+
# @!visibility public
|
28
38
|
def td(content = nil, **attributes)
|
29
39
|
pagebuilder_basic_element('td', content, attributes)
|
30
40
|
end
|
31
41
|
|
32
|
-
|
33
|
-
|
42
|
+
# @!visibility public
|
43
|
+
def tfoot(**attributes)
|
44
|
+
pagebuilder_basic_element('tfoot', nil, attributes)
|
34
45
|
end
|
35
46
|
|
47
|
+
# @!visibility public
|
36
48
|
def th(content = nil, **attributes)
|
37
49
|
pagebuilder_basic_element('th', content, attributes)
|
38
50
|
end
|
39
51
|
|
40
|
-
|
41
|
-
|
52
|
+
# @!visibility public
|
53
|
+
def thead(**attributes)
|
54
|
+
pagebuilder_basic_element('thead', nil, attributes)
|
42
55
|
end
|
43
56
|
|
44
|
-
|
45
|
-
|
57
|
+
# @!visibility public
|
58
|
+
def tr(**attributes)
|
59
|
+
pagebuilder_basic_element('tr', nil, attributes)
|
46
60
|
end
|
47
61
|
|
62
|
+
# @!endgroup Available Tags
|
63
|
+
|
48
64
|
end
|
49
65
|
end
|
@@ -5,161 +5,204 @@ module PageBuilder
|
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
+
# @!group Available Tags
|
9
|
+
|
10
|
+
# @!visibility public
|
8
11
|
def abbr(content = nil, **attributes)
|
9
12
|
pagebuilder_basic_element('abbr', content, attributes)
|
10
13
|
end
|
11
14
|
|
15
|
+
# @!visibility public
|
12
16
|
def address(content = nil, **attributes)
|
13
17
|
pagebuilder_basic_element('address', content, attributes)
|
14
18
|
end
|
15
19
|
|
20
|
+
# @!visibility public
|
16
21
|
def b(content = nil, **attributes)
|
17
22
|
pagebuilder_basic_element('b', content, attributes)
|
18
23
|
end
|
19
24
|
|
25
|
+
# @!visibility public
|
20
26
|
def bdi(content = nil, **attributes)
|
21
27
|
pagebuilder_basic_element('bdi', content, attributes)
|
22
28
|
end
|
23
29
|
|
30
|
+
# @!visibility public
|
24
31
|
def bdo(content = nil, **attributes)
|
25
32
|
pagebuilder_basic_element('bdo', content, attributes)
|
26
33
|
end
|
27
34
|
|
35
|
+
# @!visibility public
|
28
36
|
def blockquote(content = nil, **attributes)
|
29
37
|
pagebuilder_basic_element('blockquote', content, attributes)
|
30
38
|
end
|
31
39
|
|
40
|
+
# @!visibility public
|
32
41
|
def cite(content = nil, **attributes)
|
33
42
|
pagebuilder_basic_element('cite', content, attributes)
|
34
43
|
end
|
35
44
|
|
45
|
+
# @!visibility public
|
36
46
|
def code(content = nil, **attributes)
|
37
47
|
pagebuilder_basic_element('code', content, attributes)
|
38
48
|
end
|
39
49
|
|
50
|
+
# @!visibility public
|
40
51
|
def data(content = nil, **attributes)
|
41
52
|
pagebuilder_basic_element('data', content, attributes)
|
42
53
|
end
|
43
54
|
|
55
|
+
# @!visibility public
|
44
56
|
def del(content = nil, **attributes)
|
45
57
|
pagebuilder_basic_element('del', content, attributes)
|
46
58
|
end
|
47
59
|
|
60
|
+
# @!visibility public
|
48
61
|
def details(content = nil, **attributes)
|
49
62
|
pagebuilder_basic_element('details', content, attributes)
|
50
63
|
end
|
51
64
|
|
65
|
+
# @!visibility public
|
52
66
|
def dfn(content = nil, **attributes)
|
53
67
|
pagebuilder_basic_element('dfn', content, attributes)
|
54
68
|
end
|
55
69
|
|
70
|
+
# @!visibility public
|
56
71
|
def em(content = nil, **attributes)
|
57
72
|
pagebuilder_basic_element('em', content, attributes)
|
58
73
|
end
|
59
74
|
|
75
|
+
# @!visibility public
|
60
76
|
def i(content = nil, **attributes)
|
61
77
|
pagebuilder_basic_element('i', content, attributes)
|
62
78
|
end
|
63
79
|
|
80
|
+
# @!visibility public
|
64
81
|
def ins(content = nil, **attributes)
|
65
82
|
pagebuilder_basic_element('ins', content, attributes)
|
66
83
|
end
|
67
84
|
|
85
|
+
# @!visibility public
|
68
86
|
def kbd(content = nil, **attributes)
|
69
87
|
pagebuilder_basic_element('kbd', content, attributes)
|
70
88
|
end
|
71
89
|
|
90
|
+
# @!visibility public
|
72
91
|
def mark(content = nil, **attributes)
|
73
92
|
pagebuilder_basic_element('mark', content, attributes)
|
74
93
|
end
|
75
94
|
|
95
|
+
# @!visibility public
|
76
96
|
def meter(content = nil, **attributes)
|
77
97
|
pagebuilder_basic_element('meter', content, attributes)
|
78
98
|
end
|
79
99
|
|
100
|
+
# @!visibility public
|
80
101
|
def output(content = nil, **attributes)
|
81
102
|
pagebuilder_basic_element('output', content, attributes)
|
82
103
|
end
|
83
104
|
|
105
|
+
# @!visibility public
|
84
106
|
def p(content = nil, **attributes)
|
85
107
|
pagebuilder_basic_element('p', content, attributes)
|
86
108
|
end
|
87
109
|
|
110
|
+
# @!visibility public
|
88
111
|
def pre(content = nil, **attributes)
|
89
112
|
pagebuilder_basic_element('pre', content, attributes)
|
90
113
|
end
|
91
114
|
|
115
|
+
# @!visibility public
|
92
116
|
def q(content = nil, **attributes)
|
93
117
|
pagebuilder_basic_element('q', content, attributes)
|
94
118
|
end
|
95
119
|
|
120
|
+
# @!visibility public
|
96
121
|
def rb(content = nil, **attributes)
|
97
122
|
pagebuilder_basic_element('rb', content, attributes)
|
98
123
|
end
|
99
124
|
|
125
|
+
# @!visibility public
|
100
126
|
def rp(content = nil, **attributes)
|
101
127
|
pagebuilder_basic_element('rp', content, attributes)
|
102
128
|
end
|
103
129
|
|
130
|
+
# @!visibility public
|
104
131
|
def rt(content = nil, **attributes)
|
105
132
|
pagebuilder_basic_element('rt', content, attributes)
|
106
133
|
end
|
107
134
|
|
135
|
+
# @!visibility public
|
108
136
|
def rtc(content = nil, **attributes)
|
109
137
|
pagebuilder_basic_element('rtc', content, attributes)
|
110
138
|
end
|
111
139
|
|
140
|
+
# @!visibility public
|
112
141
|
def ruby(content = nil, **attributes)
|
113
142
|
pagebuilder_basic_element('ruby', content, attributes)
|
114
143
|
end
|
115
144
|
|
145
|
+
# @!visibility public
|
116
146
|
def s(content = nil, **attributes)
|
117
147
|
pagebuilder_basic_element('s', content, attributes)
|
118
148
|
end
|
119
149
|
|
150
|
+
# @!visibility public
|
120
151
|
def samp(content = nil, **attributes)
|
121
152
|
pagebuilder_basic_element('samp', content, attributes)
|
122
153
|
end
|
123
154
|
|
155
|
+
# @!visibility public
|
124
156
|
def small(content = nil, **attributes)
|
125
157
|
pagebuilder_basic_element('small', content, attributes)
|
126
158
|
end
|
127
159
|
|
160
|
+
# @!visibility public
|
128
161
|
def span(content = nil, **attributes)
|
129
162
|
pagebuilder_basic_element('span', content, attributes)
|
130
163
|
end
|
131
164
|
|
165
|
+
# @!visibility public
|
132
166
|
def strong(content = nil, **attributes)
|
133
167
|
pagebuilder_basic_element('strong', content, attributes)
|
134
168
|
end
|
135
169
|
|
170
|
+
# @!visibility public
|
136
171
|
def sub(content = nil, **attributes)
|
137
172
|
pagebuilder_basic_element('sub', content, attributes)
|
138
173
|
end
|
139
174
|
|
175
|
+
# @!visibility public
|
140
176
|
def summary(content = nil, **attributes)
|
141
177
|
pagebuilder_basic_element('summary', content, attributes)
|
142
178
|
end
|
143
179
|
|
180
|
+
# @!visibility public
|
144
181
|
def sup(content = nil, **attributes)
|
145
182
|
pagebuilder_basic_element('sup', content, attributes)
|
146
183
|
end
|
147
184
|
|
185
|
+
# @!visibility public
|
148
186
|
def time(content = nil, **attributes)
|
149
187
|
pagebuilder_basic_element('time', content, attributes)
|
150
188
|
end
|
151
189
|
|
190
|
+
# @!visibility public
|
152
191
|
def u(content = nil, **attributes)
|
153
192
|
pagebuilder_basic_element('u', content, attributes)
|
154
193
|
end
|
155
194
|
|
195
|
+
# @!visibility public
|
156
196
|
def var(content = nil, **attributes)
|
157
197
|
pagebuilder_basic_element('var', content, attributes)
|
158
198
|
end
|
159
199
|
|
160
|
-
|
161
|
-
|
200
|
+
# @!visibility public
|
201
|
+
def wbr(**attributes)
|
202
|
+
pagebuilder_basic_element('wbr', nil, attributes)
|
162
203
|
end
|
163
204
|
|
205
|
+
# @!endgroup Available Tags
|
206
|
+
|
164
207
|
end
|
165
208
|
end
|
data/lib/pagebuilder/version.rb
CHANGED
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.2.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
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- ".gitignore"
|
109
109
|
- ".rspec"
|
110
110
|
- ".travis.yml"
|
111
|
+
- CHANGELOG.md
|
111
112
|
- CODE_OF_CONDUCT.md
|
112
113
|
- LICENSE.txt
|
113
114
|
- README.md
|
@@ -131,6 +132,7 @@ files:
|
|
131
132
|
- lib/pagebuilder/elements/inputs/search.rb
|
132
133
|
- lib/pagebuilder/elements/inputs/submit_button.rb
|
133
134
|
- lib/pagebuilder/elements/inputs/text.rb
|
135
|
+
- lib/pagebuilder/script_manager.rb
|
134
136
|
- lib/pagebuilder/tag_helpers.rb
|
135
137
|
- lib/pagebuilder/tag_helpers/embeds.rb
|
136
138
|
- lib/pagebuilder/tag_helpers/forms.rb
|