V:4.1.4/Karajan:HTML Library
From Java CoG Kit
Files: html.k, html.xml
The HTML library can be used to produce HTML output from Karajan scripts. It is incomplete, but able to generate simple HTML pages. It is listed here in the hope that it will be useful. However, not many guarantees are made about it. The library elements utilize the html channel.
test jump to html:write write
HTML Elements
html:write
html:write(file, html)
Writes all arguments received on the html channel to the specified file. It is roughly equivalent to the following:
file:write(name=filefrom(html ... ) )
The following code produces a simple HTML file:
import("html.k") write(file="out.html"html(head(title("Title") )body(h1("Heading 1")text("Some text") ) ) )
The XML syntax may appear more convenient for using the HTML library:
<importname="html.xml"/> <write file="out.html"> <html> <head> <title>Title</title> </head> <body> <h1>Heading 1</h1> <text>Some text</text> </body> </html> </write>
html:quickstart
html:quickstart(title, html)
Produces an HTML skeleton output with the given title, and the arguments on the html channel substituted inside the <body> tag.
html:html
html:html(html)
Generates the <html></html> tag pairs with the html arguments substituted inside.
html:head
html:head(html)
html:title
html:title(title)
html:body
html:body(*bgcolor, html)
html:table
html:table(*width, *height, *border, *cellpadding, *rules, *bgcolor, *class, *style, html)
html:tr
html:tr(*width, *height, html)
html:td
html:td(text, *width, *height, *colspan, *bgcolor, *align, *valign, html)
A note that needs to be made about td is that the text argument is mandatory, which means that it needs to always be present, even if a HTML nested element is used. The following example shows the correct usage for a table cell containing just an image:
...table( ...tr( td("", {[el|html|img}}(src="image.jpg")) ) ... ) ...
or
... <table> ... <tr> <td text=""> <imgsrc="image.jpg"/> </td> </tr> ... </table> ...
html:th
html:th(text, *width, *height, *colspan, html)
See also: td
html:h1
html:h1(text, html)
html:h2
html:h2(text, html)
html:h3
html:h3(text, html)
html:h4
html:h4(text, html)
html:h5
html:h5(text, html)
html:h6
html:h6(text, html)
html:ul
html:ul(html)
html:pre
html:pre(text , html)
html:br
html:br()
html:li
html:li()
html:a
html:a(text, *href, *style, html)
html:anchor
html:anchor(name)
Anchor is used to define a HTML anchor since the a element does not support this functionality. It effectively returns <a name="{<code>name}"/></code> on the html channel.
html:img
html:img(src, *border)
html:text
html:text(text)
Returns the value of the text argument on the html channel.
