Class: Yast::HTMLClass
- Inherits:
-
Module
- Object
- Module
- Yast::HTMLClass
- Defined in:
- ../../src/modules/HTML.rb
Instance Method Summary (collapse)
-
- (Object) Bold(text)
Make a piece of HTML code bold.
-
- (Object) ColoredList(items, color)
Make a HTML (unsorted) colored list from a list of strings.
-
- (Object) Colorize(text, color)
Colorize a piece of HTML code.
-
- (Object) Heading(text)
Make a HTML heading from a text.
-
- (Object) Link(text, link_id)
Make a HTML link.
-
- (Object) List(items)
Make a HTML (unsorted) list from a list of strings.
-
- (Object) ListEnd
End a HTML (unsorted) list.
-
- (Object) ListItem(text)
Make a HTML list item.
-
- (Object) ListStart
Start a HTML (unsorted) list.
- - (Object) main
-
- (Object) Newline
Make a forced HTML line break.
-
- (Object) Newlines(count)
Make a number of forced HTML line breaks.
-
- (Object) Para(text)
Make a HTML paragraph from a text.
Instance Method Details
- (Object) Bold(text)
Make a piece of HTML code bold
i.e. embed it into [b]…
You still need to embed that into a paragraph or heading etc.!
207 208 209 |
# File '../../src/modules/HTML.rb', line 207 def Bold(text) Ops.add(Ops.add("<b>", text), "</b>") end |
- (Object) ColoredList(items, color)
Make a HTML (unsorted) colored list from a list of strings
[ul] [li][font color=“…”]…[/li] [li][font color=“…”]…[/li] … [/ul]
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File '../../src/modules/HTML.rb', line 166 def ColoredList(items, color) items = deep_copy(items) html = "<ul>" Builtins.foreach(items) do |item| html = Ops.add( html, Builtins.sformat("<li><font color=\"%1\">%2</font></li>", color, item) ) end html = Ops.add(html, "</ul>") html end |
- (Object) Colorize(text, color)
Colorize a piece of HTML code
i.e. embed it into [font color=“…”]…
You still need to embed that into a paragraph or heading etc.!
193 194 195 |
# File '../../src/modules/HTML.rb', line 193 def Colorize(text, color) Builtins.sformat("<font color=\"%1\">%2</font>", color, text) end |
- (Object) Heading(text)
Make a HTML heading from a text
i.e. embed a text into [h3]…
Note: There is only one heading level here since we don't have any more fonts anyway.
65 66 67 |
# File '../../src/modules/HTML.rb', line 65 def Heading(text) Ops.add(Ops.add("<h3>", text), "</h3>") end |
- (Object) Link(text, link_id)
Make a HTML link
For example [a href=“…”]…
You still need to embed that into a paragraph or heading etc.!
80 81 82 |
# File '../../src/modules/HTML.rb', line 80 def Link(text, link_id) Builtins.sformat("<a href=\"%1\">%2</a>", link_id, text) end |
- (Object) List(items)
140 141 142 143 144 145 146 147 148 149 150 151 |
# File '../../src/modules/HTML.rb', line 140 def List(items) items = deep_copy(items) html = "<ul>" Builtins.foreach(items) do |item| html = Ops.add(Ops.add(Ops.add(html, "<li>"), item), "</li>") end html = Ops.add(html, "</ul>") html end |
- (Object) ListEnd
End a HTML (unsorted) list
For example [/ul]
You might consider using HTML::list() instead which takes a list of items and does all the rest by itself.
108 109 110 |
# File '../../src/modules/HTML.rb', line 108 def ListEnd "</ul>" end |
- (Object) ListItem(text)
123 124 125 |
# File '../../src/modules/HTML.rb', line 123 def ListItem(text) Ops.add(Ops.add("<li><p>", text), "</p></li>") end |
- (Object) ListStart
Start a HTML (unsorted) list
For example [ul]
You might consider using HTML::list() instead which takes a list of items and does all the rest by itself.
94 95 96 |
# File '../../src/modules/HTML.rb', line 94 def ListStart "<ul>" end |
- (Object) main
39 40 41 |
# File '../../src/modules/HTML.rb', line 39 def main textdomain "base" end |
- (Object) Newline
Make a forced HTML line break
216 217 218 |
# File '../../src/modules/HTML.rb', line 216 def Newline "<br>" end |
- (Object) Newlines(count)
Make a number of forced HTML line breaks
226 227 228 229 230 231 232 233 234 |
# File '../../src/modules/HTML.rb', line 226 def Newlines(count) html = "" while Ops.greater_than(count, 0) html = Ops.add(html, "<br>") count = Ops.subtract(count, 1) end html end |
- (Object) Para(text)
Make a HTML paragraph from a text
i.e. embed a text into * [p]…
50 51 52 |
# File '../../src/modules/HTML.rb', line 50 def Para(text) Ops.add(Ops.add("<p>", text), "</p>") end |