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.!
198 199 200 |
# File '../../src/modules/HTML.rb', line 198 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]
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File '../../src/modules/HTML.rb', line 159 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.!
185 186 187 |
# File '../../src/modules/HTML.rb', line 185 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.
64 65 66 |
# File '../../src/modules/HTML.rb', line 64 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.!
78 79 80 |
# File '../../src/modules/HTML.rb', line 78 def Link(text, link_id) Builtins.sformat("<a href=\"%1\">%2</a>", link_id, text) end |
- (Object) List(items)
134 135 136 137 138 139 140 141 142 143 144 145 |
# File '../../src/modules/HTML.rb', line 134 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.
104 105 106 |
# File '../../src/modules/HTML.rb', line 104 def ListEnd "</ul>" end |
- (Object) ListItem(text)
118 119 120 |
# File '../../src/modules/HTML.rb', line 118 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.
91 92 93 |
# File '../../src/modules/HTML.rb', line 91 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
206 207 208 |
# File '../../src/modules/HTML.rb', line 206 def Newline "<br>" end |
- (Object) Newlines(count)
Make a number of forced HTML line breaks
215 216 217 218 219 220 221 222 223 |
# File '../../src/modules/HTML.rb', line 215 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 |