alister 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e0d1ba1fe8f39f425a504f7e02454b0182b7ba51673c63482fc51ab9c28e6260
4
+ data.tar.gz: 4bb178fcfd4f5fc2c12347392e578db460f50924a158ed87518a451a9b43c677
5
+ SHA512:
6
+ metadata.gz: 2d3cf3db9d806285fdef30115824650ca7dfe74e5b6ec19482c6a0b0bbcacfd1c15cd44000a4924f5dd42bc1cf720328dcf1b76626f59f693b0346887a9ccbc0
7
+ data.tar.gz: cbfc01a0d65870d5648ec1377b4f05c36ceed89e26d41fdf352c5c11a3d35adda63a84633c79cadf51472a680e087959dd9d074aad55ab3368e174dc14d87d8d
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Released]
2
+
3
+ ## [1.0.0] - 2025-08-12
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Alister
2
+
3
+ A super minimal ruby solution to static site generation. This gem allows you to create a static site whilst writing almost purely ruby!
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ ```bash
10
+ bundle add alister
11
+ ```
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ ```bash
16
+ gem install alister
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lain62/alister. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/lain62/alister/blob/main/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the Alister project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/lain62/alister/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alister
4
+ VERSION = '1.0.0'
5
+ end
data/lib/alister.rb ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "alister/version"
4
+ require_relative 'html/html'
5
+ require_relative 'site'
6
+ require_relative 'assets'
7
+ require_relative 'self'
8
+
9
+ # An SSG (Static Site Generator) helper that allows you to easily create a site
10
+ # @example A simple site
11
+ # root_page = Alister.html do
12
+ # doctype
13
+ # html lang: "en" do
14
+ # head do
15
+ # meta charset: "utf-8"
16
+ # meta name: "viewport", content: "width=device-width, initial-scale=1"
17
+ # end
18
+ # body do
19
+ # div id: "app" do
20
+ # p "hello world"
21
+ # end
22
+ # end
23
+ # end
24
+ # s = Alister::Site.new
25
+ # s.route "/", root_page
26
+ # s.build "./build"
27
+ module Alister
28
+ class Error < StandardError; end
29
+ # Your code goes here...
30
+ end
data/lib/assets.rb ADDED
@@ -0,0 +1,195 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'webp-ffi'
5
+
6
+ module Alister
7
+ # @example Simple asset building
8
+ # a = Alister::Assets.new
9
+ # a.source "./assets/"
10
+ # a.file "**/*"
11
+ # a.build_to "./build/assets/"
12
+ # @example Convert all png to webp
13
+ # a = Alister::Assets.new
14
+ # a.source "./assets/"
15
+ # a.file "*.png"
16
+ # a.enable_webp_conversion
17
+ # a.build "./build/assets/gallery/"
18
+ # @example Multiple sources and specific files
19
+ # a = Alister::Assets.new
20
+ # a.source "./"
21
+ # a.files "robots.txt", "main.css"
22
+ # a.build_and_reset "./build/assets/gallery/"
23
+ # a.source "./assets/"
24
+ # a.file "*.png"
25
+ # a.enable_webp_conversion
26
+ # a.build_and_reset "./build/assets/gallery/"
27
+ # An asset builder that helps with putting website asset files into the correct place
28
+ class Assets
29
+ # All supported image filetype that can be converted to .webp
30
+ WEBP_EXTS = %w[.png .jpg .jpeg .tiff].freeze
31
+ def initialize
32
+ @source_path = nil
33
+ @build_path = nil
34
+ @webp_conversion = false
35
+ @excludes = nil
36
+ @files = nil
37
+ @source_files = nil
38
+ end
39
+
40
+ # Enables turning all suitable images into webp when building
41
+ # @return [void]
42
+ def enable_webp_conversion
43
+ @webp_conversion = true
44
+ end
45
+
46
+ # Exclude certain folders from being built
47
+ # @return [void]
48
+ def excludes(*args)
49
+ if args.size == 1
50
+ @excludes = args.first
51
+ nil
52
+ else
53
+ @excludes = args
54
+ end
55
+ end
56
+
57
+ alias exclude excludes
58
+
59
+ # Defines the files that will be included in the build
60
+ # @return [void]
61
+ def files(*args)
62
+ if args.size == 1
63
+ @files = args.first
64
+ nil
65
+ else
66
+ @files = args
67
+ end
68
+ end
69
+
70
+ alias file files
71
+
72
+ # Builds the assets
73
+ # @return [void]
74
+ def build_to(build_path)
75
+ raise '[ERROR] Files are empty' if @files.nil?
76
+ raise '[ERROR] Source is empty' if @source_path.nil?
77
+
78
+ @build_path = build_path
79
+
80
+ glob_source_files
81
+ remove_excludes unless @excludes.nil?
82
+ ensure_folders_are_built_first
83
+ build_da_thing
84
+ end
85
+
86
+ alias build build_to
87
+
88
+ # Defines the source of the files
89
+ # @return [void]
90
+ def source_from(source_path)
91
+ @source_path = source_path
92
+ end
93
+
94
+ alias source source_from
95
+
96
+ # Resets the builder for another building
97
+ # @return [void]
98
+ def reset
99
+ @source_path = nil
100
+ @build_path = nil
101
+ @webp_conversion = false
102
+ @excludes = nil
103
+ @files = nil
104
+ @source_files = nil
105
+ end
106
+
107
+ # Shorthand for building and resetting at the same time
108
+ # @return [void]
109
+ def build_to_and_reset(build_path)
110
+ build_to(build_path)
111
+ reset
112
+ end
113
+
114
+ alias build_and_reset build_to_and_reset
115
+
116
+ private
117
+
118
+ def build_da_thing
119
+ files = @source_files.select { |f| File.file? f }
120
+ if @webp_conversion
121
+ files.each do |file|
122
+ if WEBP_EXTS.include? File.extname(file)
123
+ convert_webp(file)
124
+ else
125
+ copy(file)
126
+ end
127
+ end
128
+ else
129
+ files.each do |file|
130
+ copy(file)
131
+ end
132
+ end
133
+ end
134
+
135
+ def convert_webp(file)
136
+ output = convert_output_to_webp(file)
137
+ WebP.encode(file, output)
138
+ puts "[Log] Converting #{file} to #{output}"
139
+ end
140
+
141
+ def convert_output_to_webp(file)
142
+ name = File.basename(file, File.extname(file))
143
+ new_file_path = change_starting_folders(file, @source_path, @build_path)
144
+ dir = File.dirname(new_file_path)
145
+ "#{File.join(dir, name)}.webp"
146
+ end
147
+
148
+ def copy(file)
149
+ name = File.basename(file)
150
+ path = change_starting_folders(file, @source_path, @build_path)
151
+ path = File.dirname path
152
+ FileUtils.cp(file, path)
153
+ puts "[Log] Copying #{file} to #{File.join(@build_path, name)}"
154
+ end
155
+
156
+ def glob_source_files
157
+ if @files.is_a? Array
158
+ @source_files = []
159
+ @files.each do |file|
160
+ files = Dir.glob(File.join(@source_path, file))
161
+ @source_files.concat(files).uniq!
162
+ end
163
+ else
164
+ @source_files = Dir.glob(File.join(@source_path, @files))
165
+ end
166
+ end
167
+
168
+ def remove_excludes
169
+ excludes = @excludes.map { |x| File.join(@source_path, x) }
170
+ @source_files.reject! { |x| x.start_with?(*excludes) }
171
+ end
172
+
173
+ def ensure_build_folder_is_empty
174
+ return unless File.directory? @build_path
175
+
176
+ FileUtils.rm_rf(@build_path, secure: true)
177
+ puts "[Log] #{@build_path} directory found, deleting"
178
+ end
179
+
180
+ def ensure_folders_are_built_first
181
+ folders = @source_files.select { |x| File.directory? x }
182
+
183
+ folders.each do |folder|
184
+ File.join(@build_path, File.join(*(folder.split('/') - @source_path.split('/'))))
185
+ path = change_starting_folders(folder, @source_path, @build_path)
186
+ FileUtils.mkdir_p(path)
187
+ puts "[Log] Creating folder #{path}"
188
+ end
189
+ end
190
+
191
+ def change_starting_folders(path, what_to_remove, what_to_insert)
192
+ File.join(what_to_insert, File.join(*(path.split('/') - what_to_remove.split('/'))))
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alister
4
+ module HTML
5
+ # All the html tags
6
+ # @note p is reserved by ruby, use para instead
7
+ TAGS = %i[html body div span applet object iframe
8
+ h1 h2 h3 h4 h5 h6 para blockquote pre
9
+ a abbr acronym address big cite code del
10
+ dfn em img ins kbd q s samp small
11
+ strike strong sub sup tt var b u i
12
+ center meta dl dt dd ol ul li fieldset
13
+ form label legend table caption tbody tfoot
14
+ thead tr th td article aside canvas details
15
+ embed figure figcaption footer header hgroup
16
+ menu nav output ruby section summary time
17
+ mark audio video script head title link].freeze
18
+
19
+ # An HTML Builder class
20
+ # @example Creating a simple html
21
+ # builder = Alister::Builder.new
22
+ # builder.start do
23
+ # doctype
24
+ # html lang: "en" do
25
+ # head do
26
+ # meta charset: "utf-8"
27
+ # meta name: "viewport", content: "width=device-width, initial-scale=1"
28
+ # end
29
+ # body do
30
+ # div id: "app"
31
+ # end
32
+ # end
33
+ # end
34
+ class Builder
35
+ # All the elements that has been collected
36
+ # @return [Array<Element>]
37
+ attr_reader :elements
38
+
39
+ def initialize
40
+ @elements = []
41
+ end
42
+
43
+ # @note only use if you're using {Builder} directly
44
+ # @yield Starts an html block
45
+ def start(&block)
46
+ block.call
47
+ end
48
+
49
+ TAGS.each do |tag|
50
+ define_method(tag) do |value = nil, **args, &block|
51
+ @elements << Element.new(id: Element::TAG_START, value: tag.to_s)
52
+ args&.each_key do |key|
53
+ @elements << Element.new(id: Element::ATTR, value: { key: key, value: args[key] })
54
+ end
55
+
56
+ if !block.nil?
57
+ @elements << Element.new(id: Element::VALUE_BLOCK)
58
+ block.call
59
+ @elements << Element.new(id: Element::TAG_END, value: tag.to_s)
60
+ elsif !value.nil?
61
+ @elements << Element.new(id: Element::VALUE_LIT, value: value)
62
+ @elements << Element.new(id: Element::TAG_END, value: tag.to_s)
63
+ else
64
+ @elements << Element.new(id: Element::VALUE_NIL, value: nil)
65
+ end
66
+ end
67
+ end
68
+
69
+ # Creates a <!DOCTYPE html> element and puts it to {#elements}.
70
+ # @return [void]
71
+ def doctype
72
+ @elements << Element.new(id: Element::DOCTYPE, value: nil)
73
+ end
74
+
75
+ # Adds a partial element and puts it to {#elements}
76
+ # @param element [Builder, Element, String, Array<Builder, Element, String>] Basically anything that can convert to string tbh
77
+ # @return [void]
78
+ def partial(element)
79
+ @elements << element.elements if element.is_a? Builder
80
+ @elements << element if element.is_a?(Element) || element.is_a?(String)
81
+
82
+ return unless element.is_a? Array
83
+
84
+ element.each do |el|
85
+ partial(el)
86
+ end
87
+ end
88
+
89
+ # Combines all elements, and turn it into a single string
90
+ # @return [String]
91
+ def to_s
92
+ @elements.flatten!
93
+ @elements.map(&:to_s).join
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alister
4
+ module HTML
5
+ # Create a part of an element like puzzle pieces
6
+ # @note this isn't meant to be used directly, you need multiple of these to create a full <p>foo</p>
7
+ class Element
8
+ # Creates "<tag" on {#to_s}
9
+ TAG_START = :tag_start
10
+ # Creates "</tag>\n" on {#to_s}
11
+ TAG_END = :tag_end
12
+ # Creates ">\n" on {#to_s}
13
+ VALUE_BLOCK = :value_block
14
+ # Creates ">value" on {#to_s}
15
+ VALUE_LIT = :value_lit
16
+ # Creates "/>\n" on {#to_s}
17
+ VALUE_NIL = :value_nil
18
+ # Creates "<!DOCTYPE html>\\n" on {#to_s}
19
+ DOCTYPE = :doctype
20
+ # Creates " key=\"value\"" on {#to_s}
21
+ ATTR = :attributes
22
+
23
+ # @note Look up {Element} Constants for the value of id
24
+ # @return [Symbol]
25
+ attr_accessor :id
26
+
27
+ # @return [String, void]
28
+ attr_accessor :value
29
+
30
+ # @param id [Symbol] Look up {Element} Constants for the value of id
31
+ # @param value [String, void]
32
+ def initialize(id:, value: nil)
33
+ @id = id
34
+ @value = value
35
+ @value = 'p' if [TAG_START, TAG_END].include?(id) && value == 'para'
36
+ end
37
+
38
+ # Creates a string from part of an element
39
+ # Depends on {#id} on what it will return
40
+ # Look for {Element} Constants for returns
41
+ # @return [String]
42
+ def to_s
43
+ case @id
44
+ when TAG_START
45
+ tag_start
46
+ when TAG_END
47
+ tag_end
48
+ when VALUE_BLOCK
49
+ value_block
50
+ when VALUE_LIT
51
+ value_lit
52
+ when VALUE_NIL
53
+ value_nil
54
+ when ATTR
55
+ attribute
56
+ end
57
+ end
58
+
59
+ private
60
+
61
+ def doctype
62
+ "<!DOCTYPE html>\n"
63
+ end
64
+
65
+ def value_nil
66
+ "/>\n"
67
+ end
68
+
69
+ def tag_start
70
+ "<#{@value}"
71
+ end
72
+
73
+ def tag_end
74
+ "</#{@value}>\n"
75
+ end
76
+
77
+ def value_block
78
+ ">\n"
79
+ end
80
+
81
+ def value_lit
82
+ ">#{@value}"
83
+ end
84
+
85
+ def attribute
86
+ key = @value[:key].to_s.gsub('_', '-')
87
+ " #{key}=\"#{@value[:value]}\""
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # THIS IS JUST TO GENERATE YARD TAGS, IGNORE
4
+
5
+ require_relative 'builder'
6
+
7
+ str = +"# frozen_string_literal: true\n\n"
8
+ str << "module Alister\n"
9
+ str << " module HTML\n"
10
+ str << " class Builder\n\n"
11
+ Alister::HTML::TAGS.each do |tag|
12
+ str << " # @!method #{tag}(value = nil, **args, &block)\n"
13
+ tag = :p if tag == :para
14
+ str << " # Creates a <#{tag}> element and puts it to {#elements}\n"
15
+ str << " # @param value [String] The value of the element\n"
16
+ str << " # @param args [Hash] The attributes of the element\n"
17
+ str << " # @return [void]\n"
18
+ str << " # @yield Create child elements of <#{tag}>\n"
19
+ str << "\n"
20
+ end
21
+ str << " end\n"
22
+ str << " end\n"
23
+ str << "end\n"
24
+
25
+ File.delete('./yard_tags.rb') if File.exist? './yard_tags.rb'
26
+ file = File.new('./yard_tags.rb', 'w+')
27
+ file.write(str)
28
+ file.close
29
+ puts '[LOG] Created yard_tags.rb'
data/lib/html/html.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'builder'
4
+ require_relative 'element'
5
+
6
+ module Alister
7
+ # Module for creating HTML strings using ruby methods
8
+ module HTML; end
9
+ end