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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
module HtmlTags
|
|
6
|
+
|
|
7
|
+
# ========================================================================= #
|
|
8
|
+
# === stag
|
|
9
|
+
#
|
|
10
|
+
# This method returns a proper HTML tag, including css class, possible
|
|
11
|
+
# javascript, id, and css style, and then return this as a string.
|
|
12
|
+
#
|
|
13
|
+
# By default we will use the <span> tag, hence why we have assigned
|
|
14
|
+
# the default argument "span" as the first argument to this method.
|
|
15
|
+
#
|
|
16
|
+
# "stag" is an alias to this method, a shortcut for "string_tag".
|
|
17
|
+
#
|
|
18
|
+
# Note that stag() itself will not return the closing tag.
|
|
19
|
+
#
|
|
20
|
+
# Specific Usage Examples for this method:
|
|
21
|
+
#
|
|
22
|
+
# HtmlTags.stag('span','marl1em')
|
|
23
|
+
# puts HtmlTags.stag('span','','','margin-left:0.92em; padding-left:6px')
|
|
24
|
+
#
|
|
25
|
+
# Would return:
|
|
26
|
+
#
|
|
27
|
+
# <span class="marl1em">
|
|
28
|
+
#
|
|
29
|
+
# ========================================================================= #
|
|
30
|
+
def stag(
|
|
31
|
+
name_of_the_tag = 'span',
|
|
32
|
+
optional_css_class = '',
|
|
33
|
+
optional_the_id = '',
|
|
34
|
+
optional_css_style = '',
|
|
35
|
+
optional_javascript = '',
|
|
36
|
+
&block
|
|
37
|
+
)
|
|
38
|
+
if optional_css_class.is_a? Hash
|
|
39
|
+
_ = otag(name_of_the_tag, optional_css_class) # otag() is defined in opening_tag.rb
|
|
40
|
+
else # We assume a string here.
|
|
41
|
+
optional_css_class = optional_css_class.to_s.chomp.dup
|
|
42
|
+
_ = otag(
|
|
43
|
+
name_of_the_tag,
|
|
44
|
+
css_class: optional_css_class,
|
|
45
|
+
id: optional_the_id,
|
|
46
|
+
css_style: optional_css_style,
|
|
47
|
+
javascript: optional_javascript,
|
|
48
|
+
&block
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
_.to_s
|
|
52
|
+
end; alias string_tag stag # === string_tag
|
|
53
|
+
|
|
54
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'html_tags/toplevel_methods/add.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module HtmlTags
|
|
8
|
+
|
|
9
|
+
require 'html_tags/toplevel_methods/full_output.rb'
|
|
10
|
+
# ========================================================================= #
|
|
11
|
+
# === HtmlTags.add (add tag)
|
|
12
|
+
#
|
|
13
|
+
# Add to the main string called @full_output, which is a String.
|
|
14
|
+
# ========================================================================= #
|
|
15
|
+
def self.add(*i)
|
|
16
|
+
i.each {|entry|
|
|
17
|
+
@full_output << entry.to_s
|
|
18
|
+
}
|
|
19
|
+
i.join(' ').strip # Return the input. This is very important, naturally.
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'html_tags/toplevel_methods/full_output.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module HtmlTags
|
|
8
|
+
|
|
9
|
+
# ========================================================================= #
|
|
10
|
+
# === @full_output
|
|
11
|
+
#
|
|
12
|
+
# The follow class-level instance variable stores all output from
|
|
13
|
+
# any of the various tags.
|
|
14
|
+
# ========================================================================= #
|
|
15
|
+
@full_output = ''.dup
|
|
16
|
+
|
|
17
|
+
# ========================================================================= #
|
|
18
|
+
# === HtmlTags[]
|
|
19
|
+
# ========================================================================= #
|
|
20
|
+
def self.[]
|
|
21
|
+
@full_output
|
|
22
|
+
end; self.instance_eval { alias output [] } # Next, we use 3 aliases.
|
|
23
|
+
self.instance_eval { alias output? [] }
|
|
24
|
+
self.instance_eval { alias string? [] }
|
|
25
|
+
|
|
26
|
+
# ========================================================================= #
|
|
27
|
+
# === HtmlTags.clear
|
|
28
|
+
# ========================================================================= #
|
|
29
|
+
def self.clear
|
|
30
|
+
@full_output = ''
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# =========================================================================== #
|
|
4
|
+
# require 'html_tags/toplevel_methods/newline_or_empty.rb'
|
|
5
|
+
# =========================================================================== #
|
|
6
|
+
module HtmlTags
|
|
7
|
+
|
|
8
|
+
# ========================================================================= #
|
|
9
|
+
# === HtmlTags.newline_or_empty
|
|
10
|
+
#
|
|
11
|
+
# Either return a newline or return an empty string.
|
|
12
|
+
# ========================================================================= #
|
|
13
|
+
def self.newline_or_empty(make_newline = true)
|
|
14
|
+
if make_newline
|
|
15
|
+
"\n"
|
|
16
|
+
else
|
|
17
|
+
''
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'html_tags/toplevel_methods/strip_newlines.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
module HtmlTags
|
|
8
|
+
|
|
9
|
+
require 'html_tags/constants/array_strip_newlines.rb'
|
|
10
|
+
|
|
11
|
+
# ========================================================================= #
|
|
12
|
+
# === HtmlTags.strip_newlines
|
|
13
|
+
#
|
|
14
|
+
# We use this method to strip away "\n" newlines.
|
|
15
|
+
# ========================================================================= #
|
|
16
|
+
def self.strip_newlines
|
|
17
|
+
ARRAY_STRIP_NEWLINES[0] = true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# ========================================================================= #
|
|
21
|
+
# === HtmlTags.strip_newlines?
|
|
22
|
+
# ========================================================================= #
|
|
23
|
+
def self.strip_newlines?
|
|
24
|
+
ARRAY_STRIP_NEWLINES.first
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
module HtmlTags
|
|
6
|
+
|
|
7
|
+
# ========================================================================= #
|
|
8
|
+
# === VERSION
|
|
9
|
+
# ========================================================================= #
|
|
10
|
+
VERSION = '0.1.120'
|
|
11
|
+
|
|
12
|
+
# ========================================================================= #
|
|
13
|
+
# === LAST_UPDATE
|
|
14
|
+
# ========================================================================= #
|
|
15
|
+
LAST_UPDATE = '02.10.2022'
|
|
16
|
+
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# =========================================================================== #
|
|
2
|
+
# The listing of allowed elements can be found here:
|
|
3
|
+
#
|
|
4
|
+
# http://www.w3schools.com/tags/tag_head.asp
|
|
5
|
+
#
|
|
6
|
+
# Do note that in HTML5, the <head> element can be omitted.
|
|
7
|
+
# =========================================================================== #
|
|
8
|
+
# The following elements can go inside the <head> element:
|
|
9
|
+
# =========================================================================== #
|
|
10
|
+
- title # This element is required in an HTML document.
|
|
11
|
+
- style
|
|
12
|
+
- base
|
|
13
|
+
- link
|
|
14
|
+
- meta
|
|
15
|
+
- script
|
|
16
|
+
- noscript
|
data/lib/html_tags.rb
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# =========================================================================== #
|
|
4
|
+
require 'cliner/autoinclude' # Make the Cliner module known automatically.
|
|
5
|
+
require 'colours/autoinclude'
|
|
6
|
+
require 'beautiful_url'
|
|
7
|
+
require 'html_tags'
|
|
8
|
+
begin
|
|
9
|
+
require 'colours'
|
|
10
|
+
rescue LoadError; end
|
|
11
|
+
N = "\n"
|
|
12
|
+
Cliner.set_colour 'lightblue'
|
|
13
|
+
|
|
14
|
+
# =========================================================================== #
|
|
15
|
+
# === _
|
|
16
|
+
#
|
|
17
|
+
# Simply colourize the input in a blue colour.
|
|
18
|
+
# =========================================================================== #
|
|
19
|
+
def _(i)
|
|
20
|
+
if Object.const_defined? :Colours
|
|
21
|
+
Colours.slateblue(i)
|
|
22
|
+
else
|
|
23
|
+
bold_blue(i)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# =========================================================================== #
|
|
28
|
+
# === orange
|
|
29
|
+
# =========================================================================== #
|
|
30
|
+
def orange(i)
|
|
31
|
+
Colours.orange(i.chomp)
|
|
32
|
+
end
|
|
33
|
+
cliner {
|
|
34
|
+
e _('Testing some closing tags next (note that '+
|
|
35
|
+
'we will keep trailing newlines:')
|
|
36
|
+
e HtmlTags.close 'p'
|
|
37
|
+
e HtmlTags.close 'div'
|
|
38
|
+
e 'Finished testing closing tags.'
|
|
39
|
+
}; e
|
|
40
|
+
# =========================================================================== #
|
|
41
|
+
# Include the HtmlTags namespace next.
|
|
42
|
+
# =========================================================================== #
|
|
43
|
+
include HtmlTags
|
|
44
|
+
cliner { # Test <p> paragraph next.
|
|
45
|
+
e _('Next testing some <p> paragraphs:')
|
|
46
|
+
e p 'Hello World', :css_style => 'border: 1px solid red'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
puts Colours.beautiful 'lightblue'
|
|
51
|
+
Cliner.set_colour 'lightblue'
|
|
52
|
+
|
|
53
|
+
# =========================================================================== #
|
|
54
|
+
# Next display all registered HTML tags:
|
|
55
|
+
# =========================================================================== #
|
|
56
|
+
e _('Registered Tags:')
|
|
57
|
+
registered_html_tags?
|
|
58
|
+
e p 'Good Bye', :css_class => 'border: 1px solid red',
|
|
59
|
+
:id => 'goodbye'
|
|
60
|
+
e; e
|
|
61
|
+
|
|
62
|
+
e 'Next, we test the String Good Bye, with a css class and an id.'
|
|
63
|
+
e p 'Good Bye', :css_class => 'border: 1px solid red',
|
|
64
|
+
:id => 'goodbye'
|
|
65
|
+
e
|
|
66
|
+
# =========================================================================== #
|
|
67
|
+
# Next, we will test the <a> tag.
|
|
68
|
+
# =========================================================================== #
|
|
69
|
+
cliner {
|
|
70
|
+
e _('Next we will test the <a> tag in various combinations.')
|
|
71
|
+
e orange(a('connect'))
|
|
72
|
+
e orange(a('connect', :no_newline))
|
|
73
|
+
e orange(a('connect', :make_newline))
|
|
74
|
+
e orange(a('LINUX_DESIGNING.cgi', :copy_description))
|
|
75
|
+
e orange(a('connect', 'marl1em','great_link','color: blue'))
|
|
76
|
+
e orange(a('/test', :description => 'Link to test'))
|
|
77
|
+
e orange(a('/test', css_style: 'margin-left:1em'))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
e N+N+_('Next testing the <tbody> tag.')
|
|
81
|
+
e HtmlTags.tbody 'testing','this'
|
|
82
|
+
e N+N+_('Now testing the output of the BR tag:')
|
|
83
|
+
e HtmlTags::BR
|
|
84
|
+
e N+N+_('Next, we try to find out whether ch4() works:')
|
|
85
|
+
e ch4.lstrip
|
|
86
|
+
e N+N+_('Next, testing whether cbody() and chtml() works:')
|
|
87
|
+
e orange(cbody+chtml)
|
|
88
|
+
pp cbody+chtml
|
|
89
|
+
HtmlTags.strip_newlines
|
|
90
|
+
e cbody+chtml
|
|
91
|
+
pp cbody+chtml
|
|
92
|
+
e N+N+_('Next checking whether <hr> and <bb> are valid HTML tags:')
|
|
93
|
+
e is_valid_html? '<hr>'
|
|
94
|
+
e is_valid_html? '<bb>'
|
|
95
|
+
e N+N+_('Next testing the method stag() for capturing HTML tags as strings:')
|
|
96
|
+
e stag('span', 'padl1em')
|
|
97
|
+
cliner {
|
|
98
|
+
e N+_('Next testing comments in .html files:')
|
|
99
|
+
e HtmlTags.html_comment('This is a comment.')
|
|
100
|
+
}
|
|
101
|
+
e N+_('Next testing <span> with a hash as second argument:')+N+N
|
|
102
|
+
e span('wget', :css_style => 'margin-left:2em')
|
|
103
|
+
e orange(HtmlTags.stag('h3', :javascript => 'on-click: { this.color = "blue" }'))
|
|
104
|
+
e orange(HtmlTags.stag('h2', 'ud mart10px'))
|
|
105
|
+
cliner
|
|
106
|
+
e N+N+_('Next, we will test whether we can use button() combined with blocks:')+N+N
|
|
107
|
+
e orange(button('Click me!', 'pad1em', 'yo', '', :on_click => 'go back in history'))
|
|
108
|
+
e orange(HtmlTags.link 'http://google.com')
|
|
109
|
+
e orange(HtmlTags.link 'http://google.com', :desc => 'Google')
|
|
110
|
+
# x = HtmlTags.stag( :button, 'pad1em', 'yo', '', :on_click => 'go back in history') {{ :value => 'yo man' }}
|
|
111
|
+
e orange(stag 'h3', id: 'yo')
|
|
112
|
+
e orange(stag 'h3', id: 'yo', css_class: 'ok')
|
|
113
|
+
e orange(stag 'h3', id: 'yo', css_class: 'blue', css_style: 'margin:5em')
|
|
114
|
+
e orange(stag 'h3', id: 'yo', css_class: 'blue', css_style: 'margin:5em', content: 'yo there')
|
|
115
|
+
e orange(h3 'oki doki', id: 'hmm')
|
|
116
|
+
e 'We will next test the storage-functionality of HtmlTags:'
|
|
117
|
+
e 'First we clear the old entries.'
|
|
118
|
+
HtmlTags.clear
|
|
119
|
+
e
|
|
120
|
+
e 'Now we run three <h2> statements.'
|
|
121
|
+
h2 'Test'
|
|
122
|
+
h2 'Yo'
|
|
123
|
+
h2 'Hello world!'
|
|
124
|
+
e 'Next we show these:'
|
|
125
|
+
e orange(HtmlTags[])
|
|
126
|
+
e 'Now we clear it again. Then we run HtmlTags.clear'
|
|
127
|
+
HtmlTags.clear
|
|
128
|
+
e orange(HtmlTags.add 'hello', 'world!')
|
|
129
|
+
e orange(HtmlTags.add 'hello')
|
|
130
|
+
e 'Now we will check whether the 3 following HTML Tags are valid within a <head> element:'
|
|
131
|
+
e orange('p: ')+is_this_an_allowed_tag_in_head_element?('p').to_s
|
|
132
|
+
e orange('<div>: ')+is_this_an_allowed_tag_in_head_element?('<div>').to_s
|
|
133
|
+
e orange('<base>: ')+is_this_an_allowed_tag_in_head_element?('<base>').to_s
|
|
134
|
+
e
|
|
135
|
+
e "Next we will test: HtmlTags.a('google.com','Go to Google') {{ description: 'yo there' }}"
|
|
136
|
+
e
|
|
137
|
+
e ' '+orange(HtmlTags.a('google.com','s1em') {{ description: 'yo there' }}).delete(N)
|
|
138
|
+
e
|
|
139
|
+
cliner
|
|
140
|
+
e 'Next we will test '+orange('label()')+':'
|
|
141
|
+
e
|
|
142
|
+
e HtmlTags.label 'John Doe'
|
|
143
|
+
e
|
|
144
|
+
cliner
|
|
145
|
+
e h2('Showing the axe-icon next', 'marl1em','','',
|
|
146
|
+
'on_click: show_image(:axe))') # Last one is javascript.
|
|
147
|
+
cliner
|
|
148
|
+
e 'Next testing:'
|
|
149
|
+
e "HtmlTags.a(BeautifulUrl[:my_gems], description: 'my gems')"
|
|
150
|
+
e HtmlTags.a(BeautifulUrl[:my_gems], description: 'my gems')
|
|
151
|
+
cliner
|
|
152
|
+
e 'HtmlTags.h2(text, css_class, the_id, css_style, javascript)'
|
|
153
|
+
e HtmlTags.h2('Hello world!','mars1em','','','onmouseover="this.style.textDecoration=\'underline\';"')
|
|
154
|
+
cliner
|
|
155
|
+
e 'Next testing the HtmlTags.img() tag:'
|
|
156
|
+
e "HtmlTags.img('foobar.png')"
|
|
157
|
+
e HtmlTags.img('foobar.png')
|
|
158
|
+
# ttags
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
require 'html_tags'
|
|
6
|
+
require 'colours/colours_e_autoinclude.rb'
|
|
7
|
+
|
|
8
|
+
@index = 0
|
|
9
|
+
# =========================================================================== #
|
|
10
|
+
# === esb
|
|
11
|
+
#
|
|
12
|
+
# This will also increment a counter automatically.
|
|
13
|
+
# =========================================================================== #
|
|
14
|
+
def esb(i)
|
|
15
|
+
@index += 1
|
|
16
|
+
e royalblue(@index.to_s+') ')+
|
|
17
|
+
steelblue(i)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# =========================================================================== #
|
|
21
|
+
# === pad_yellow
|
|
22
|
+
# =========================================================================== #
|
|
23
|
+
def pad_yellow(i)
|
|
24
|
+
e ' '+
|
|
25
|
+
yellowgreen(i.to_s)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
e
|
|
29
|
+
esb "Testing the HtmlTags.a() tag next - first via :content, "\
|
|
30
|
+
"then also with \n:css_class in the second run:"
|
|
31
|
+
e
|
|
32
|
+
pad_yellow HtmlTags.a(
|
|
33
|
+
'https://de.wikipedia.org/wiki/Lampensockel#Edisonsockel',
|
|
34
|
+
content: 'SELF'
|
|
35
|
+
)
|
|
36
|
+
e
|
|
37
|
+
pad_yellow HtmlTags.a(
|
|
38
|
+
[
|
|
39
|
+
'https://de.wikipedia.org/wiki/Lampensockel#Edisonsockel',
|
|
40
|
+
{content:'SELF', css_class:'mars2em'}
|
|
41
|
+
]
|
|
42
|
+
)
|
|
43
|
+
# =========================================================================== #
|
|
44
|
+
# === 2
|
|
45
|
+
# =========================================================================== #
|
|
46
|
+
e
|
|
47
|
+
esb 'Next testing the html tag <a> via the symbol :br meaning <br>:'
|
|
48
|
+
e
|
|
49
|
+
pad_yellow HtmlTags.a(
|
|
50
|
+
'https://de.wikipedia.org/wiki/Lampensockel#Edisonsockel',
|
|
51
|
+
'SELF',
|
|
52
|
+
:make_newline
|
|
53
|
+
)
|
|
54
|
+
# =========================================================================== #
|
|
55
|
+
# === 3
|
|
56
|
+
# =========================================================================== #
|
|
57
|
+
e
|
|
58
|
+
esb 'Next testing it with a String as first argument, and a Hash '\
|
|
59
|
+
'as the second argument:'
|
|
60
|
+
e
|
|
61
|
+
pad_yellow HtmlTags.a('https://geizhals.at/?cat=hhleuchtled&xf=1299_G9',
|
|
62
|
+
content: 'G9 Sockel auf geizhals.at'
|
|
63
|
+
)
|
|
64
|
+
e
|
|
65
|
+
|
|
66
|
+
# =========================================================================== #
|
|
67
|
+
# === 4
|
|
68
|
+
# =========================================================================== #
|
|
69
|
+
e
|
|
70
|
+
esb 'Next testing css_style: as the second argument:'
|
|
71
|
+
e
|
|
72
|
+
pad_yellow HtmlTags.a(
|
|
73
|
+
'https://rubygems.org/gems/ansi/',
|
|
74
|
+
css_style: 'margin-left:1em'
|
|
75
|
+
)
|
|
76
|
+
e
|
|
77
|
+
|
|
78
|
+
# =========================================================================== #
|
|
79
|
+
# === 5
|
|
80
|
+
# =========================================================================== #
|
|
81
|
+
e
|
|
82
|
+
esb 'Next testing a Hash:'
|
|
83
|
+
e
|
|
84
|
+
pad_yellow HtmlTags.a(
|
|
85
|
+
content: 'https://en.wikipedia.org/wiki/Bacteriochlorophyll',
|
|
86
|
+
description: 'SELF'
|
|
87
|
+
)
|
|
88
|
+
e
|
|
89
|
+
|
|
90
|
+
# =========================================================================== #
|
|
91
|
+
# === 6
|
|
92
|
+
# =========================================================================== #
|
|
93
|
+
e
|
|
94
|
+
esb 'Next testing another Hash with :link_description:'
|
|
95
|
+
e
|
|
96
|
+
pad_yellow HtmlTags.a(
|
|
97
|
+
'https://en.wikipedia.org/wiki/Bacteriochlorophyll',
|
|
98
|
+
link_description: 'yo there',
|
|
99
|
+
description: 'SELF'
|
|
100
|
+
)
|
|
101
|
+
e
|
|
102
|
+
|
|
103
|
+
# =========================================================================== #
|
|
104
|
+
# === 7
|
|
105
|
+
# =========================================================================== #
|
|
106
|
+
e
|
|
107
|
+
esb 'Next testing with →'
|
|
108
|
+
e
|
|
109
|
+
pad_yellow HtmlTags.a(
|
|
110
|
+
'→ https://en.wikipedia.org/wiki/Bacteriochlorophyll',
|
|
111
|
+
:self
|
|
112
|
+
)
|
|
113
|
+
e
|
metadata
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: html_tags
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.120
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Robert A. Heiler
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-10-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: "\n This library is called html_tags.\n\n Its basic core idea is
|
|
14
|
+
to collect all valid html tags into\n a single project, and then make this data
|
|
15
|
+
available to other\n projects.\n\n Other ideas are to autogenerate closing
|
|
16
|
+
tags (helper\n methods), and of course to generate string representations\n of
|
|
17
|
+
these html tags. This can then be used by other \n web-projects.\n\n A simple
|
|
18
|
+
usage example follows:\n\n require 'html_tags'\n HtmlTags.p 'hello world!'
|
|
19
|
+
# => \"<p>\nhello world!\n</p>\"\n\n Since Version 0.0.10 (April 2014) we can
|
|
20
|
+
also now query\n whether a string contains only valid HTML tags or whether\n
|
|
21
|
+
\ it does not.\n\n"
|
|
22
|
+
email: shevy@inbox.lt
|
|
23
|
+
executables: []
|
|
24
|
+
extensions: []
|
|
25
|
+
extra_rdoc_files: []
|
|
26
|
+
files:
|
|
27
|
+
- README.md
|
|
28
|
+
- USAGE.md
|
|
29
|
+
- doc/README.gen
|
|
30
|
+
- html_tags.gemspec
|
|
31
|
+
- lib/html_tags.rb
|
|
32
|
+
- lib/html_tags/array_registered_html_tags.rb
|
|
33
|
+
- lib/html_tags/autoinclude.rb
|
|
34
|
+
- lib/html_tags/autoinclude_base_module.rb
|
|
35
|
+
- lib/html_tags/base/README.md
|
|
36
|
+
- lib/html_tags/base/base.rb
|
|
37
|
+
- lib/html_tags/base/base_module.rb
|
|
38
|
+
- lib/html_tags/base/prototype.rb
|
|
39
|
+
- lib/html_tags/checks.rb
|
|
40
|
+
- lib/html_tags/closing_tag/closing_tag.rb
|
|
41
|
+
- lib/html_tags/constants.rb
|
|
42
|
+
- lib/html_tags/constants/array_strip_newlines.rb
|
|
43
|
+
- lib/html_tags/constants/misc.rb
|
|
44
|
+
- lib/html_tags/html_closing_tags.rb
|
|
45
|
+
- lib/html_tags/html_comment.rb
|
|
46
|
+
- lib/html_tags/html_tags.rb
|
|
47
|
+
- lib/html_tags/html_tags_constants.rb
|
|
48
|
+
- lib/html_tags/individual_tags/a.rb
|
|
49
|
+
- lib/html_tags/individual_tags/abbr.rb
|
|
50
|
+
- lib/html_tags/individual_tags/audio.rb
|
|
51
|
+
- lib/html_tags/individual_tags/b.rb
|
|
52
|
+
- lib/html_tags/individual_tags/blockquote.rb
|
|
53
|
+
- lib/html_tags/individual_tags/body.rb
|
|
54
|
+
- lib/html_tags/individual_tags/br.rb
|
|
55
|
+
- lib/html_tags/individual_tags/button.rb
|
|
56
|
+
- lib/html_tags/individual_tags/canvas.rb
|
|
57
|
+
- lib/html_tags/individual_tags/details.rb
|
|
58
|
+
- lib/html_tags/individual_tags/div.rb
|
|
59
|
+
- lib/html_tags/individual_tags/figure.rb
|
|
60
|
+
- lib/html_tags/individual_tags/footer.rb
|
|
61
|
+
- lib/html_tags/individual_tags/form.rb
|
|
62
|
+
- lib/html_tags/individual_tags/h1.rb
|
|
63
|
+
- lib/html_tags/individual_tags/h2.rb
|
|
64
|
+
- lib/html_tags/individual_tags/h3.rb
|
|
65
|
+
- lib/html_tags/individual_tags/h4.rb
|
|
66
|
+
- lib/html_tags/individual_tags/h5.rb
|
|
67
|
+
- lib/html_tags/individual_tags/h6.rb
|
|
68
|
+
- lib/html_tags/individual_tags/head.rb
|
|
69
|
+
- lib/html_tags/individual_tags/header.rb
|
|
70
|
+
- lib/html_tags/individual_tags/html.rb
|
|
71
|
+
- lib/html_tags/individual_tags/i.rb
|
|
72
|
+
- lib/html_tags/individual_tags/img.rb
|
|
73
|
+
- lib/html_tags/individual_tags/input.rb
|
|
74
|
+
- lib/html_tags/individual_tags/label.rb
|
|
75
|
+
- lib/html_tags/individual_tags/legend.rb
|
|
76
|
+
- lib/html_tags/individual_tags/li.rb
|
|
77
|
+
- lib/html_tags/individual_tags/main.rb
|
|
78
|
+
- lib/html_tags/individual_tags/nav.rb
|
|
79
|
+
- lib/html_tags/individual_tags/object.rb
|
|
80
|
+
- lib/html_tags/individual_tags/ol.rb
|
|
81
|
+
- lib/html_tags/individual_tags/p.rb
|
|
82
|
+
- lib/html_tags/individual_tags/pre.rb
|
|
83
|
+
- lib/html_tags/individual_tags/span.rb
|
|
84
|
+
- lib/html_tags/individual_tags/strong.rb
|
|
85
|
+
- lib/html_tags/individual_tags/style.rb
|
|
86
|
+
- lib/html_tags/individual_tags/table.rb
|
|
87
|
+
- lib/html_tags/individual_tags/tbody.rb
|
|
88
|
+
- lib/html_tags/individual_tags/td.rb
|
|
89
|
+
- lib/html_tags/individual_tags/textarea.rb
|
|
90
|
+
- lib/html_tags/individual_tags/th.rb
|
|
91
|
+
- lib/html_tags/individual_tags/thead.rb
|
|
92
|
+
- lib/html_tags/individual_tags/title.rb
|
|
93
|
+
- lib/html_tags/individual_tags/tr.rb
|
|
94
|
+
- lib/html_tags/individual_tags/ul.rb
|
|
95
|
+
- lib/html_tags/individual_tags/video.rb
|
|
96
|
+
- lib/html_tags/module.rb
|
|
97
|
+
- lib/html_tags/opening_tag/opening_tag.rb
|
|
98
|
+
- lib/html_tags/project/project_base_directory.rb
|
|
99
|
+
- lib/html_tags/requires/require_the_html_tags_project.rb
|
|
100
|
+
- lib/html_tags/requires/require_the_img_tag.rb
|
|
101
|
+
- lib/html_tags/shared.rb
|
|
102
|
+
- lib/html_tags/stag.rb
|
|
103
|
+
- lib/html_tags/toplevel_methods/add.rb
|
|
104
|
+
- lib/html_tags/toplevel_methods/full_output.rb
|
|
105
|
+
- lib/html_tags/toplevel_methods/newline_or_empty.rb
|
|
106
|
+
- lib/html_tags/toplevel_methods/strip_newlines.rb
|
|
107
|
+
- lib/html_tags/version/version.rb
|
|
108
|
+
- lib/html_tags/yaml/valid_tags_in_a_head_tag.yml
|
|
109
|
+
- test/testing_html_tags.rb
|
|
110
|
+
- test/testing_the_a_tag.rb
|
|
111
|
+
homepage: https://rubygems.org/gems/html_tags
|
|
112
|
+
licenses:
|
|
113
|
+
- MIT
|
|
114
|
+
metadata: {}
|
|
115
|
+
post_install_message:
|
|
116
|
+
rdoc_options: []
|
|
117
|
+
require_paths:
|
|
118
|
+
- lib
|
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: 2.7.6
|
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - ">="
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: 3.3.7
|
|
129
|
+
requirements: []
|
|
130
|
+
rubygems_version: 3.3.7
|
|
131
|
+
signing_key:
|
|
132
|
+
specification_version: 4
|
|
133
|
+
summary: 'This library is called html_tags. Its basic core idea is to collect all
|
|
134
|
+
valid html tags into a single project, and then make this data available to other
|
|
135
|
+
projects. Other ideas are to autogenerate closing tags (helper methods), and of
|
|
136
|
+
course to generate string representations of these html tags. This can then be used
|
|
137
|
+
by other web-projects. A simple usage example follows: require ''html_tags''
|
|
138
|
+
HtmlTags.p ''hello world!'' # => "<p> hello world! </p>" Since Version 0.0.10 (April
|
|
139
|
+
2014) we can also now query whether a string contains only valid HTML tags or whether
|
|
140
|
+
it does not.'
|
|
141
|
+
test_files: []
|