html_tags 0.1.120
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.
Potentially problematic release.
This version of html_tags might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +110 -0
- data/USAGE.md +17 -0
- data/doc/README.gen +69 -0
- data/html_tags.gemspec +53 -0
- data/lib/html_tags/array_registered_html_tags.rb +125 -0
- data/lib/html_tags/autoinclude.rb +2 -0
- data/lib/html_tags/autoinclude_base_module.rb +7 -0
- data/lib/html_tags/base/README.md +3 -0
- data/lib/html_tags/base/base.rb +11 -0
- data/lib/html_tags/base/base_module.rb +224 -0
- data/lib/html_tags/base/prototype.rb +19 -0
- data/lib/html_tags/checks.rb +58 -0
- data/lib/html_tags/closing_tag/closing_tag.rb +76 -0
- data/lib/html_tags/constants/array_strip_newlines.rb +14 -0
- data/lib/html_tags/constants/misc.rb +21 -0
- data/lib/html_tags/constants.rb +26 -0
- data/lib/html_tags/html_closing_tags.rb +36 -0
- data/lib/html_tags/html_comment.rb +29 -0
- data/lib/html_tags/html_tags.rb +131 -0
- data/lib/html_tags/html_tags_constants.rb +14 -0
- data/lib/html_tags/individual_tags/a.rb +524 -0
- data/lib/html_tags/individual_tags/abbr.rb +44 -0
- data/lib/html_tags/individual_tags/audio.rb +32 -0
- data/lib/html_tags/individual_tags/b.rb +22 -0
- data/lib/html_tags/individual_tags/blockquote.rb +19 -0
- data/lib/html_tags/individual_tags/body.rb +19 -0
- data/lib/html_tags/individual_tags/br.rb +28 -0
- data/lib/html_tags/individual_tags/button.rb +30 -0
- data/lib/html_tags/individual_tags/canvas.rb +19 -0
- data/lib/html_tags/individual_tags/details.rb +69 -0
- data/lib/html_tags/individual_tags/div.rb +51 -0
- data/lib/html_tags/individual_tags/figure.rb +39 -0
- data/lib/html_tags/individual_tags/footer.rb +26 -0
- data/lib/html_tags/individual_tags/form.rb +93 -0
- data/lib/html_tags/individual_tags/h1.rb +36 -0
- data/lib/html_tags/individual_tags/h2.rb +42 -0
- data/lib/html_tags/individual_tags/h3.rb +73 -0
- data/lib/html_tags/individual_tags/h4.rb +36 -0
- data/lib/html_tags/individual_tags/h5.rb +36 -0
- data/lib/html_tags/individual_tags/h6.rb +40 -0
- data/lib/html_tags/individual_tags/head.rb +36 -0
- data/lib/html_tags/individual_tags/header.rb +29 -0
- data/lib/html_tags/individual_tags/html.rb +61 -0
- data/lib/html_tags/individual_tags/i.rb +14 -0
- data/lib/html_tags/individual_tags/img.rb +135 -0
- data/lib/html_tags/individual_tags/input.rb +32 -0
- data/lib/html_tags/individual_tags/label.rb +43 -0
- data/lib/html_tags/individual_tags/legend.rb +14 -0
- data/lib/html_tags/individual_tags/li.rb +44 -0
- data/lib/html_tags/individual_tags/main.rb +29 -0
- data/lib/html_tags/individual_tags/nav.rb +14 -0
- data/lib/html_tags/individual_tags/object.rb +18 -0
- data/lib/html_tags/individual_tags/ol.rb +50 -0
- data/lib/html_tags/individual_tags/p.rb +50 -0
- data/lib/html_tags/individual_tags/pre.rb +16 -0
- data/lib/html_tags/individual_tags/span.rb +60 -0
- data/lib/html_tags/individual_tags/strong.rb +17 -0
- data/lib/html_tags/individual_tags/style.rb +29 -0
- data/lib/html_tags/individual_tags/table.rb +33 -0
- data/lib/html_tags/individual_tags/tbody.rb +19 -0
- data/lib/html_tags/individual_tags/td.rb +24 -0
- data/lib/html_tags/individual_tags/textarea.rb +46 -0
- data/lib/html_tags/individual_tags/th.rb +14 -0
- data/lib/html_tags/individual_tags/thead.rb +14 -0
- data/lib/html_tags/individual_tags/title.rb +18 -0
- data/lib/html_tags/individual_tags/tr.rb +20 -0
- data/lib/html_tags/individual_tags/ul.rb +23 -0
- data/lib/html_tags/individual_tags/video.rb +54 -0
- data/lib/html_tags/module.rb +5 -0
- data/lib/html_tags/opening_tag/opening_tag.rb +288 -0
- data/lib/html_tags/project/project_base_directory.rb +23 -0
- data/lib/html_tags/requires/require_the_html_tags_project.rb +9 -0
- data/lib/html_tags/requires/require_the_img_tag.rb +7 -0
- data/lib/html_tags/shared.rb +23 -0
- data/lib/html_tags/stag.rb +54 -0
- data/lib/html_tags/toplevel_methods/add.rb +22 -0
- data/lib/html_tags/toplevel_methods/full_output.rb +33 -0
- data/lib/html_tags/toplevel_methods/newline_or_empty.rb +21 -0
- data/lib/html_tags/toplevel_methods/strip_newlines.rb +27 -0
- data/lib/html_tags/version/version.rb +17 -0
- data/lib/html_tags/yaml/valid_tags_in_a_head_tag.yml +16 -0
- data/lib/html_tags.rb +5 -0
- data/test/testing_html_tags.rb +158 -0
- data/test/testing_the_a_tag.rb +113 -0
- metadata +141 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d94c80b6faf2a9ce84bc5d028e244e3690369b19bf5be86bdad272195bea60d0
|
|
4
|
+
data.tar.gz: fad073d362656d9d3648e5436d54506a56ff5ecbaabdc7d97389144dd9ec8125
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 0a7b1adc827a08965a73d1c7e572dca9fe368fdb7073b658d641e6317113b0b059c0fb89988026b0be415cd341d1ae11e1259af2aaa9ca07093872f76220b11f
|
|
7
|
+
data.tar.gz: 7fe499252e1c779313d2f30a743759aba2ba1127ddfd37870e22d5cf86e5ddada70a19c2ddc7c6c9b439256c56c2aafe3d29537f1792e9d697c58b8261831fbc
|
data/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
|
|
2
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">02.10.2022</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">03:21:22</span> o'clock.
|
|
3
|
+
|
|
4
|
+
## New ideas (playground)
|
|
5
|
+
|
|
6
|
+
We could replace:
|
|
7
|
+
|
|
8
|
+
<button onclick="show_source()">Click me</button>
|
|
9
|
+
|
|
10
|
+
With:
|
|
11
|
+
|
|
12
|
+
button.text('Click me').onclick('show_source')
|
|
13
|
+
|
|
14
|
+
This is currently not implemented, though. Need to think
|
|
15
|
+
more about it first.
|
|
16
|
+
|
|
17
|
+
## Using HTML headers
|
|
18
|
+
|
|
19
|
+
The following example shows how to use the h1 tag:
|
|
20
|
+
|
|
21
|
+
HtmlTags.h1('Hello world!') # => "<h1>\nHello world!\n</h1>"
|
|
22
|
+
|
|
23
|
+
You can include the module HtmlTags. Then you can just type h1().
|
|
24
|
+
|
|
25
|
+
Another example:
|
|
26
|
+
|
|
27
|
+
puts HtmlTags.div("Hello, #{name}") # => <div>Hello, 2</div>
|
|
28
|
+
|
|
29
|
+
## HtmlTags.a
|
|
30
|
+
|
|
31
|
+
The HTML a tag is for hyperlinks; typically it contains a
|
|
32
|
+
**href** entry.
|
|
33
|
+
|
|
34
|
+
You can pass a Hash, too, including a few supported
|
|
35
|
+
JavaScript functions.
|
|
36
|
+
|
|
37
|
+
Example for the latter:
|
|
38
|
+
|
|
39
|
+
onclick: 'change_the_colour_to()'
|
|
40
|
+
|
|
41
|
+
Note that you still have to write the function somewhere and pull it
|
|
42
|
+
into the .html file (or .cgi file or whatever else you are using).
|
|
43
|
+
I added support for this in October 2021, as I needed to have clickable
|
|
44
|
+
links that change colour upon being clicked. I used that to memorize
|
|
45
|
+
which links I clicked, without having to depend on CSS.
|
|
46
|
+
|
|
47
|
+
## Objectified HTML Tags
|
|
48
|
+
|
|
49
|
+
This is mostly for clarification. An objectified HTML tag is
|
|
50
|
+
a HTML tag that can be used like an object.
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
|
|
54
|
+
Span.new('Hello world!') # => <span>Hello world!</span>
|
|
55
|
+
|
|
56
|
+
The html_tags gem currently does not support this, but support for this
|
|
57
|
+
may be added in the future, depending on whether that use case turns
|
|
58
|
+
out to be sufficiently useful.
|
|
59
|
+
|
|
60
|
+
## How to use HtmLTags.a()
|
|
61
|
+
|
|
62
|
+
Usage example:
|
|
63
|
+
|
|
64
|
+
HtmlTags.a(
|
|
65
|
+
remote_url: remote_url,
|
|
66
|
+
text: title?.to_s,
|
|
67
|
+
css_style: 'font-weight: bold; color: darkblue'
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Contact information and mandatory 2FA coming up in 2022
|
|
72
|
+
|
|
73
|
+
If your creative mind has ideas and specific suggestions to make this gem
|
|
74
|
+
more useful in general, feel free to drop me an email at any time, via:
|
|
75
|
+
|
|
76
|
+
shevy@inbox.lt
|
|
77
|
+
|
|
78
|
+
Before that email I used an email account at Google gmail, but in **2021** I
|
|
79
|
+
decided to slowly abandon gmail for various reasons. In order to limit this
|
|
80
|
+
explanation here, allow me to just briefly state that I do not feel as if I
|
|
81
|
+
want to promote any Google service anymore, for various reasons.
|
|
82
|
+
|
|
83
|
+
Do keep in mind that responding to emails may take some time, depending on
|
|
84
|
+
the amount of work I may have at that moment.
|
|
85
|
+
|
|
86
|
+
In 2022 rubygems.org decided to make 2FA mandatory for every gem owner:
|
|
87
|
+
see https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
|
|
88
|
+
|
|
89
|
+
As I can not use 2FA, for reasons I will skip explaining here (see
|
|
90
|
+
various github issue discussions in the past), this effectively means that
|
|
91
|
+
Betty Li and others who run the show at rubygems.org will perma-ban me
|
|
92
|
+
from using rubygems as a developer.
|
|
93
|
+
|
|
94
|
+
As I disagree with that decision completely, this will mean that all my
|
|
95
|
+
gems will be removed from rubygems.org prior to that sunset date, e. g.
|
|
96
|
+
before they permanently lock me out from the code that I used
|
|
97
|
+
to maintain. It is pointless to want to discuss this with them anymore -
|
|
98
|
+
they have made up their minds and decided that you can only use
|
|
99
|
+
the code if 2FA is in place, even though the code itself works just
|
|
100
|
+
fine. If you don't use 2FA you are effectively locked out from your
|
|
101
|
+
own code; I consider this a malicious attack. See also how they limited
|
|
102
|
+
discussions to people with mandatory 2FA on the ruby-bugtracker, thus
|
|
103
|
+
banning everyone permanently without 2FA:
|
|
104
|
+
|
|
105
|
+
https://bugs.ruby-lang.org/issues/18800
|
|
106
|
+
|
|
107
|
+
Guess it may indeed be time to finally abandon ruby - not because
|
|
108
|
+
ruby is a bad language, but there are people now in charge who
|
|
109
|
+
really should not be part of ruby in the first place.
|
|
110
|
+
|
data/USAGE.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
= Usage of this Library
|
|
2
|
+
|
|
3
|
+
== Requiring it
|
|
4
|
+
|
|
5
|
+
require 'html_tags'
|
|
6
|
+
|
|
7
|
+
== Using it in a project
|
|
8
|
+
|
|
9
|
+
puts HtmlTags.is_valid_html? '<br>'
|
|
10
|
+
puts HtmlTags.is_valid_html? '<div>'
|
|
11
|
+
puts HtmlTags.is_valid_html? '<dav>'
|
|
12
|
+
puts HtmlTags.string_contains_only_valid_html_tags? 'hello ruby </br>'
|
|
13
|
+
puts HtmlTags.string_contains_only_valid_html_tags? 'hello ruby<haha>'
|
|
14
|
+
|
|
15
|
+
include HtmlTags # Or simply include it, but be careful with this.
|
|
16
|
+
|
|
17
|
+
p 'hi there' # This now works - it has however redefined p().
|
data/doc/README.gen
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
ADD_TIME_STAMP
|
|
2
|
+
|
|
3
|
+
## New ideas (playground)
|
|
4
|
+
|
|
5
|
+
We could replace:
|
|
6
|
+
|
|
7
|
+
<button onclick="show_source()">Click me</button>
|
|
8
|
+
|
|
9
|
+
With:
|
|
10
|
+
|
|
11
|
+
button.text('Click me').onclick('show_source')
|
|
12
|
+
|
|
13
|
+
This is currently not implemented, though. Need to think
|
|
14
|
+
more about it first.
|
|
15
|
+
|
|
16
|
+
## Using HTML headers
|
|
17
|
+
|
|
18
|
+
The following example shows how to use the h1 tag:
|
|
19
|
+
|
|
20
|
+
HtmlTags.h1('Hello world!') # => "<h1>\nHello world!\n</h1>"
|
|
21
|
+
|
|
22
|
+
You can include the module HtmlTags. Then you can just type h1().
|
|
23
|
+
|
|
24
|
+
Another example:
|
|
25
|
+
|
|
26
|
+
puts HtmlTags.div("Hello, #{name}") # => <div>Hello, 2</div>
|
|
27
|
+
|
|
28
|
+
## HtmlTags.a
|
|
29
|
+
|
|
30
|
+
The HTML a tag is for hyperlinks; typically it contains a
|
|
31
|
+
**href** entry.
|
|
32
|
+
|
|
33
|
+
You can pass a Hash, too, including a few supported
|
|
34
|
+
JavaScript functions.
|
|
35
|
+
|
|
36
|
+
Example for the latter:
|
|
37
|
+
|
|
38
|
+
onclick: 'change_the_colour_to()'
|
|
39
|
+
|
|
40
|
+
Note that you still have to write the function somewhere and pull it
|
|
41
|
+
into the .html file (or .cgi file or whatever else you are using).
|
|
42
|
+
I added support for this in October 2021, as I needed to have clickable
|
|
43
|
+
links that change colour upon being clicked. I used that to memorize
|
|
44
|
+
which links I clicked, without having to depend on CSS.
|
|
45
|
+
|
|
46
|
+
## Objectified HTML Tags
|
|
47
|
+
|
|
48
|
+
This is mostly for clarification. An objectified HTML tag is
|
|
49
|
+
a HTML tag that can be used like an object.
|
|
50
|
+
|
|
51
|
+
Example:
|
|
52
|
+
|
|
53
|
+
Span.new('Hello world!') # => <span>Hello world!</span>
|
|
54
|
+
|
|
55
|
+
The html_tags gem currently does not support this, but support for this
|
|
56
|
+
may be added in the future, depending on whether that use case turns
|
|
57
|
+
out to be sufficiently useful.
|
|
58
|
+
|
|
59
|
+
## How to use HtmLTags.a()
|
|
60
|
+
|
|
61
|
+
Usage example:
|
|
62
|
+
|
|
63
|
+
HtmlTags.a(
|
|
64
|
+
remote_url: remote_url,
|
|
65
|
+
text: title?.to_s,
|
|
66
|
+
css_style: 'font-weight: bold; color: darkblue'
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
ADD_EMAIL
|
data/html_tags.gemspec
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# =========================================================================== #
|
|
2
|
+
# Gemspec for Project HtmlTags.
|
|
3
|
+
# =========================================================================== #
|
|
4
|
+
require 'html_tags/version/version.rb'
|
|
5
|
+
require 'roebe/toplevel_methods/misc.rb'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new { |s|
|
|
8
|
+
|
|
9
|
+
s.name = 'html_tags'
|
|
10
|
+
s.version = HtmlTags::VERSION
|
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
|
12
|
+
|
|
13
|
+
DESCRIPTION = <<-EOF
|
|
14
|
+
|
|
15
|
+
This library is called html_tags.
|
|
16
|
+
|
|
17
|
+
Its basic core idea is to collect all valid html tags into
|
|
18
|
+
a single project, and then make this data available to other
|
|
19
|
+
projects.
|
|
20
|
+
|
|
21
|
+
Other ideas are to autogenerate closing tags (helper
|
|
22
|
+
methods), and of course to generate string representations
|
|
23
|
+
of these html tags. This can then be used by other
|
|
24
|
+
web-projects.
|
|
25
|
+
|
|
26
|
+
A simple usage example follows:
|
|
27
|
+
|
|
28
|
+
require 'html_tags'
|
|
29
|
+
HtmlTags.p 'hello world!' # => "<p>\nhello world!\n</p>"
|
|
30
|
+
|
|
31
|
+
Since Version 0.0.10 (April 2014) we can also now query
|
|
32
|
+
whether a string contains only valid HTML tags or whether
|
|
33
|
+
it does not.
|
|
34
|
+
|
|
35
|
+
EOF
|
|
36
|
+
|
|
37
|
+
s.summary = DESCRIPTION
|
|
38
|
+
s.description = DESCRIPTION
|
|
39
|
+
|
|
40
|
+
s.extra_rdoc_files = %w()
|
|
41
|
+
|
|
42
|
+
s.authors = ['Robert A. Heiler']
|
|
43
|
+
s.email = Roebe.email?
|
|
44
|
+
s.files = Dir['**/*']
|
|
45
|
+
s.files << 'USAGE.md'
|
|
46
|
+
s.license = 'MIT'
|
|
47
|
+
s.homepage = 'https://rubygems.org/gems/html_tags'
|
|
48
|
+
|
|
49
|
+
s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
|
|
50
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
|
51
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
module HtmlTags # require 'html_tags/array_registered_html_tags.rb'
|
|
2
|
+
|
|
3
|
+
# ========================================================================= #
|
|
4
|
+
# === ARRAY_REGISTERED_HTML_TAGS
|
|
5
|
+
#
|
|
6
|
+
# Please also add to this array whenever you add a new html tag.
|
|
7
|
+
#
|
|
8
|
+
# Sort alphabetically.
|
|
9
|
+
#
|
|
10
|
+
# For references, look at the periodic table for HTML tags to find out
|
|
11
|
+
# which ones are available:
|
|
12
|
+
#
|
|
13
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
14
|
+
# https://developer.mozilla.org/de/docs/Web/HTML/Element
|
|
15
|
+
#
|
|
16
|
+
# In January 2014 it stated that 107 Elements are known. However, the
|
|
17
|
+
# mozilla reference in March 2015 listed 136 HTML elements.
|
|
18
|
+
#
|
|
19
|
+
# <b> is no longer valid in HTML5 it seems.
|
|
20
|
+
# ========================================================================= #
|
|
21
|
+
ARRAY_REGISTERED_HTML_TAGS = %w(
|
|
22
|
+
|
|
23
|
+
a
|
|
24
|
+
abbr
|
|
25
|
+
audio
|
|
26
|
+
|
|
27
|
+
b
|
|
28
|
+
blockquote
|
|
29
|
+
body
|
|
30
|
+
br
|
|
31
|
+
button
|
|
32
|
+
|
|
33
|
+
canvas
|
|
34
|
+
|
|
35
|
+
div
|
|
36
|
+
dd
|
|
37
|
+
dl
|
|
38
|
+
dt
|
|
39
|
+
|
|
40
|
+
fieldset
|
|
41
|
+
figure
|
|
42
|
+
form
|
|
43
|
+
|
|
44
|
+
head
|
|
45
|
+
html
|
|
46
|
+
h1
|
|
47
|
+
h2
|
|
48
|
+
h3
|
|
49
|
+
h4
|
|
50
|
+
h5
|
|
51
|
+
h6
|
|
52
|
+
hr
|
|
53
|
+
|
|
54
|
+
i
|
|
55
|
+
img
|
|
56
|
+
input
|
|
57
|
+
|
|
58
|
+
label
|
|
59
|
+
legend
|
|
60
|
+
li
|
|
61
|
+
|
|
62
|
+
nav
|
|
63
|
+
|
|
64
|
+
object
|
|
65
|
+
|
|
66
|
+
p
|
|
67
|
+
pre
|
|
68
|
+
|
|
69
|
+
q
|
|
70
|
+
|
|
71
|
+
strong
|
|
72
|
+
style
|
|
73
|
+
|
|
74
|
+
table
|
|
75
|
+
tbody
|
|
76
|
+
td
|
|
77
|
+
textarea
|
|
78
|
+
th
|
|
79
|
+
thead
|
|
80
|
+
tr
|
|
81
|
+
|
|
82
|
+
ul
|
|
83
|
+
|
|
84
|
+
)#+ # The following elements I did not yet think about much at all
|
|
85
|
+
# We may add these one after the other eventually though.
|
|
86
|
+
# %w(
|
|
87
|
+
# html head span title # meta rt base rp link noscript
|
|
88
|
+
# style script dfn abbr q cite em time var samp i b
|
|
89
|
+
# sub sup small strong mark ruby ins del bdi bdo s
|
|
90
|
+
# kbd wbr code br hr figcaption figure p ol ul li
|
|
91
|
+
# div pre blockquote fieldset metr legend
|
|
92
|
+
# label input textarea form select opgroup option
|
|
93
|
+
# output button body aside address datalist keygen
|
|
94
|
+
# progress h1 h2 h3 h4 h5 h6 section header nav
|
|
95
|
+
# article footer hgroup col colgroup caption menu
|
|
96
|
+
# command summary details table tr td th tbody thead
|
|
97
|
+
# tfoot img area map embed object param source iframe
|
|
98
|
+
# canvas track audio video
|
|
99
|
+
#)
|
|
100
|
+
|
|
101
|
+
# ========================================================================= #
|
|
102
|
+
# === ARRAY_TAGS_WITHOUT_CLOSING_TAG
|
|
103
|
+
#
|
|
104
|
+
# The following array keeps track of which tags have no closing tag.
|
|
105
|
+
# Please sort alphabetically.
|
|
106
|
+
# ========================================================================= #
|
|
107
|
+
# The <img> tag is no longer a part of the above Array since as
|
|
108
|
+
# of June 2016.
|
|
109
|
+
# ========================================================================= #
|
|
110
|
+
ARRAY_TAGS_WITHOUT_CLOSING_TAG = %w(
|
|
111
|
+
|
|
112
|
+
br
|
|
113
|
+
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# ========================================================================= #
|
|
117
|
+
# === registered_html_tags?
|
|
118
|
+
#
|
|
119
|
+
# Feedback all registered HTML tags next.
|
|
120
|
+
# ========================================================================= #
|
|
121
|
+
def registered_html_tags?
|
|
122
|
+
Kernel.p ARRAY_REGISTERED_HTML_TAGS
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'html_tags/base/base.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module HtmlTags
|
|
8
|
+
|
|
9
|
+
class Base
|
|
10
|
+
|
|
11
|
+
end; end
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# Note that not necessarily every HTML tag will be made available in
|
|
6
|
+
# HtmlTags::BaseModule for the time being. For now I will only add
|
|
7
|
+
# tags that I commonly need to re-use in other projects. In the long
|
|
8
|
+
# run, I may just batch-generate the required tags, though. (28.04.2019)
|
|
9
|
+
# =========================================================================== #
|
|
10
|
+
# require 'html_tags/base/base_module.rb'
|
|
11
|
+
# include HtmlTags::BaseModule
|
|
12
|
+
# =========================================================================== #
|
|
13
|
+
require 'html_tags/individual_tags/a.rb'
|
|
14
|
+
require 'html_tags/individual_tags/div.rb'
|
|
15
|
+
require 'html_tags/individual_tags/form.rb'
|
|
16
|
+
require 'html_tags/individual_tags/li.rb'
|
|
17
|
+
require 'html_tags/individual_tags/h1.rb'
|
|
18
|
+
require 'html_tags/individual_tags/h2.rb'
|
|
19
|
+
require 'html_tags/individual_tags/h3.rb'
|
|
20
|
+
require 'html_tags/individual_tags/h4.rb'
|
|
21
|
+
require 'html_tags/individual_tags/h5.rb'
|
|
22
|
+
require 'html_tags/individual_tags/h6.rb'
|
|
23
|
+
require 'html_tags/individual_tags/html.rb'
|
|
24
|
+
require 'html_tags/individual_tags/ol.rb'
|
|
25
|
+
require 'html_tags/individual_tags/p.rb'
|
|
26
|
+
require 'html_tags/individual_tags/pre.rb'
|
|
27
|
+
|
|
28
|
+
module HtmlTags
|
|
29
|
+
|
|
30
|
+
module BaseModule # === HtmlTags::BaseModule
|
|
31
|
+
|
|
32
|
+
# ========================================================================= #
|
|
33
|
+
# === HtmlTags::BaseModule.is_on_roebe?
|
|
34
|
+
# ========================================================================= #
|
|
35
|
+
def self.is_on_roebe?
|
|
36
|
+
ENV['IS_ROEBE'].to_s == '1'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# ========================================================================= #
|
|
40
|
+
# === pre
|
|
41
|
+
# ========================================================================= #
|
|
42
|
+
def pre(
|
|
43
|
+
i = '', css_class = '', the_id = '', css_style = '', &block
|
|
44
|
+
)
|
|
45
|
+
HtmlTags.pre(
|
|
46
|
+
i, css_class, the_id, css_style, &block
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# ========================================================================= #
|
|
51
|
+
# === li (li tag)
|
|
52
|
+
# ========================================================================= #
|
|
53
|
+
def li(
|
|
54
|
+
i = '', optional_css_class = '', optional_id = '', optional_css_style = '', &block
|
|
55
|
+
)
|
|
56
|
+
HtmlTags.li(
|
|
57
|
+
i, optional_css_class, optional_id, optional_css_style, &block
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# ========================================================================= #
|
|
62
|
+
# === ol (ol tag)
|
|
63
|
+
# ========================================================================= #
|
|
64
|
+
def ol(
|
|
65
|
+
i = '', optional_css_class = '', optional_id = '', optional_css_style = '', &block
|
|
66
|
+
)
|
|
67
|
+
HtmlTags.ol(
|
|
68
|
+
i, optional_css_class, optional_id, optional_css_style, &block
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# ========================================================================= #
|
|
73
|
+
# === h1
|
|
74
|
+
# ========================================================================= #
|
|
75
|
+
def h1(
|
|
76
|
+
i = '', css_class = '', the_id = '', css_style = '', javascript_code = '', &block
|
|
77
|
+
)
|
|
78
|
+
HtmlTags.h1(
|
|
79
|
+
i, css_class, the_id, css_style, javascript_code, &block
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# ========================================================================= #
|
|
84
|
+
# === h2
|
|
85
|
+
# ========================================================================= #
|
|
86
|
+
def h2(
|
|
87
|
+
i = '',
|
|
88
|
+
css_class = '',
|
|
89
|
+
the_id = '',
|
|
90
|
+
css_style = '',
|
|
91
|
+
javascript_code = '',
|
|
92
|
+
&block
|
|
93
|
+
)
|
|
94
|
+
HtmlTags.h2(
|
|
95
|
+
i, css_class, the_id, css_style, javascript_code, &block
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# ========================================================================= #
|
|
100
|
+
# === h3
|
|
101
|
+
# ========================================================================= #
|
|
102
|
+
def h3(
|
|
103
|
+
i = '', css_class = '', the_id = '', css_style = '', javascript_code = '', &block
|
|
104
|
+
)
|
|
105
|
+
HtmlTags.h3(
|
|
106
|
+
i, css_class, the_id, css_style, javascript_code, &block
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# ========================================================================= #
|
|
111
|
+
# === h4
|
|
112
|
+
# ========================================================================= #
|
|
113
|
+
def h4(
|
|
114
|
+
i = '', css_class = '', the_id = '', css_style = '', javascript_code = '', &block
|
|
115
|
+
)
|
|
116
|
+
HtmlTags.h4(
|
|
117
|
+
i, css_class, the_id, css_style, javascript_code, &block
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# ========================================================================= #
|
|
122
|
+
# === h5
|
|
123
|
+
# ========================================================================= #
|
|
124
|
+
def h5(
|
|
125
|
+
i = '', css_class = '', the_id = '', css_style = '', javascript_code = '', &block
|
|
126
|
+
)
|
|
127
|
+
HtmlTags.h5(
|
|
128
|
+
i, css_class, the_id, css_style, javascript_code, &block
|
|
129
|
+
)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# ========================================================================= #
|
|
133
|
+
# === h6
|
|
134
|
+
# ========================================================================= #
|
|
135
|
+
def h6(
|
|
136
|
+
i = '', css_class = '', the_id = '', css_style = '', javascript_code = '', &block
|
|
137
|
+
)
|
|
138
|
+
HtmlTags.h6(
|
|
139
|
+
i, css_class, the_id, css_style, javascript_code, &block
|
|
140
|
+
)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# ========================================================================= #
|
|
144
|
+
# === p
|
|
145
|
+
#
|
|
146
|
+
# This method can be used to create the html <p> tag.
|
|
147
|
+
# ========================================================================= #
|
|
148
|
+
def p(
|
|
149
|
+
i = '',
|
|
150
|
+
css_class = '',
|
|
151
|
+
the_id = '',
|
|
152
|
+
css_style = '',
|
|
153
|
+
&block
|
|
154
|
+
)
|
|
155
|
+
HtmlTags.p(i, css_class, the_id, css_style, &block)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# ========================================================================= #
|
|
159
|
+
# === div
|
|
160
|
+
#
|
|
161
|
+
# This method can be used to create the html <div> tag.
|
|
162
|
+
# ========================================================================= #
|
|
163
|
+
def div(
|
|
164
|
+
i = '',
|
|
165
|
+
css_class = '',
|
|
166
|
+
the_id = '',
|
|
167
|
+
css_style = '',
|
|
168
|
+
&block
|
|
169
|
+
)
|
|
170
|
+
HtmlTags.div(i, css_class, the_id, css_style, &block)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# ========================================================================= #
|
|
174
|
+
# === a (a tag)
|
|
175
|
+
# ========================================================================= #
|
|
176
|
+
def a(
|
|
177
|
+
i = '',
|
|
178
|
+
css_class = '',
|
|
179
|
+
the_id = '',
|
|
180
|
+
css_style = '',
|
|
181
|
+
javascript = '',
|
|
182
|
+
&block
|
|
183
|
+
)
|
|
184
|
+
HtmlTags.a(
|
|
185
|
+
i, css_class, the_id, css_style, javascript, &block
|
|
186
|
+
)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# ========================================================================= #
|
|
190
|
+
# === form (form tag)
|
|
191
|
+
# ========================================================================= #
|
|
192
|
+
def form(
|
|
193
|
+
i = '',
|
|
194
|
+
css_class = '',
|
|
195
|
+
the_id = '',
|
|
196
|
+
css_style = '',
|
|
197
|
+
&block
|
|
198
|
+
)
|
|
199
|
+
HtmlTags.form(
|
|
200
|
+
i, css_class, the_id, css_style, &block
|
|
201
|
+
)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# ========================================================================= #
|
|
205
|
+
# === br
|
|
206
|
+
# ========================================================================= #
|
|
207
|
+
def br
|
|
208
|
+
HtmlTags.br
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# ========================================================================= #
|
|
212
|
+
# === html
|
|
213
|
+
# ========================================================================= #
|
|
214
|
+
def html(
|
|
215
|
+
i = '',
|
|
216
|
+
css_class = '',
|
|
217
|
+
the_id = '',
|
|
218
|
+
css_style = '',
|
|
219
|
+
&block
|
|
220
|
+
)
|
|
221
|
+
HtmlTags.html(i, css_class, the_id, css_style, &block)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
end; end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'html_tags/base/prototype.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
require 'html_tags/base/base.rb'
|
|
8
|
+
require 'html_tags/constants/misc.rb'
|
|
9
|
+
|
|
10
|
+
module HtmlTags
|
|
11
|
+
|
|
12
|
+
# ========================================================================= #
|
|
13
|
+
# === HtmlTags.new
|
|
14
|
+
# ========================================================================= #
|
|
15
|
+
def self.new
|
|
16
|
+
HtmlTags::Base.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|