Class: Yast::HTMLClass
- Inherits:
-
Module
- Object
- Module
- Yast::HTMLClass
- Defined in:
- library/wizard/src/modules/HTML.rb
Instance Method Summary collapse
-
#Bold(text) ⇒ Object
Make a piece of HTML code bold.
-
#ColoredList(items, color) ⇒ Object
Make a HTML (unsorted) colored list from a list of strings.
-
#Colorize(text, color) ⇒ Object
Colorize a piece of HTML code.
-
#Heading(text) ⇒ Object
Make a HTML heading from a text.
-
#Link(text, link_id) ⇒ Object
Make a HTML link.
-
#List(items) ⇒ Object
Make a HTML (unsorted) list from a list of strings.
-
#ListEnd ⇒ Object
End a HTML (unsorted) list.
-
#ListItem(text) ⇒ Object
Make a HTML list item.
-
#ListStart ⇒ Object
Start a HTML (unsorted) list.
- #main ⇒ Object
-
#Newline ⇒ Object
Make a forced HTML line break.
-
#Newlines(count) ⇒ Object
Make a number of forced HTML line breaks.
-
#Para(text) ⇒ Object
Make a HTML paragraph from a text.
Instance Method Details
#Bold(text) ⇒ Object
Make a piece of HTML code bold
i.e. embed it into [b]...[/b]
You still need to embed that into a paragraph or heading etc.!
192 193 194 |
# File 'library/wizard/src/modules/HTML.rb', line 192 def Bold(text) Ops.add(Ops.add("<b>", text), "</b>") end |
#ColoredList(items, color) ⇒ Object
Make a HTML (unsorted) colored list from a list of strings
[ul] [li][font color="..."]...[/font][/li] [li][font color="..."]...[/font][/li] ... [/ul]
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'library/wizard/src/modules/HTML.rb', line 155 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 Ops.add(html, "</ul>") end |
#Colorize(text, color) ⇒ Object
Colorize a piece of HTML code
i.e. embed it into [font color="..."]...[/font]
You still need to embed that into a paragraph or heading etc.!
179 180 181 |
# File 'library/wizard/src/modules/HTML.rb', line 179 def Colorize(text, color) Builtins.sformat("<font color=\"%1\">%2</font>", color, text) end |
#Heading(text) ⇒ Object
Make a HTML heading from a text
i.e. embed a text into [h3]...[/h3]
Note: There is only one heading level here since we don't have any more fonts anyway.
62 63 64 |
# File 'library/wizard/src/modules/HTML.rb', line 62 def Heading(text) Ops.add(Ops.add("<h3>", text), "</h3>") end |
#Link(text, link_id) ⇒ Object
Make a HTML link
For example [a href="..."]...[/a]
You still need to embed that into a paragraph or heading etc.!
76 77 78 |
# File 'library/wizard/src/modules/HTML.rb', line 76 def Link(text, link_id) Builtins.sformat("<a href=\"%1\">%2</a>", link_id, text) end |
#List(items) ⇒ Object
Make a HTML (unsorted) list from a list of strings
[ul] [li]...[/li] [li]...[/li] ... [/ul]
132 133 134 135 136 137 138 139 140 141 |
# File 'library/wizard/src/modules/HTML.rb', line 132 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 Ops.add(html, "</ul>") end |
#ListEnd ⇒ Object
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.
102 103 104 |
# File 'library/wizard/src/modules/HTML.rb', line 102 def ListEnd "</ul>" end |
#ListItem(text) ⇒ Object
Make a HTML list item
For example embed a text into [li][p]...[/p][/li]
You might consider using HTML::list() instead which takes a list of items and does all the rest by itself.
116 117 118 |
# File 'library/wizard/src/modules/HTML.rb', line 116 def ListItem(text) Ops.add(Ops.add("<li><p>", text), "</p></li>") end |
#ListStart ⇒ Object
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.
89 90 91 |
# File 'library/wizard/src/modules/HTML.rb', line 89 def ListStart "<ul>" end |
#main ⇒ Object
37 38 39 |
# File 'library/wizard/src/modules/HTML.rb', line 37 def main textdomain "base" end |
#Newline ⇒ Object
Make a forced HTML line break
200 201 202 |
# File 'library/wizard/src/modules/HTML.rb', line 200 def Newline "<br>" end |
#Newlines(count) ⇒ Object
Make a number of forced HTML line breaks
209 210 211 212 213 214 215 216 217 |
# File 'library/wizard/src/modules/HTML.rb', line 209 def Newlines(count) html = "" while Ops.greater_than(count, 0) html = Ops.add(html, "<br>") count = Ops.subtract(count, 1) end html end |
#Para(text) ⇒ Object
Make a HTML paragraph from a text
i.e. embed a text into * [p]...[/p]
48 49 50 |
# File 'library/wizard/src/modules/HTML.rb', line 48 def Para(text) Ops.add(Ops.add("<p>", text), "</p>") end |