Menu

Methods and Functions

James B. Helix-Roveda

Methods and Functions

Add Break

add_br()

Add a break to the html document.

add_goto_top(<text>)

Add a link that points to the top of the html document. The text is displayed as link. Typically used for 'Up' or 'go to top'.

Add Heading

add_heading(<LEVEL>, <text> [, <anchor>])

Add a heading to the html document. Optionally, you can give it a named anchor. If anchor is given, it will insert an attribute <hLEVEL id="anchor">text</hLEVEL>. If you use _default_ as anchor, the anchor will be automatically derived from the text, all lowercase, blanks replaced by underscores.

Add Horizontal Ruler

add_hr()

Add a horizontal ruler.

Add HTML

add_html(<html>)

Add arbitrary html code (as one string) to the html document.

add_link(<link>, <text>)

Add a link to the html document.

Add Ordered List

add_ol(<ref_to_array> [, <list_type> [, <start_value>])

Add an ordered list. The array elements are inserted as the list elements. Optionally specify the list type (1 Aa Ii) and/or the start value.

Add Local Anchor

add_local_anchor(<anchor>, <text>)

An anchor is set at the current position, the text is filed in an array for later use. It will be replaced during output of the html at the position, where the local anchor list is to be placed. See set_local_anchor_list().

Add Paragraph

add_paragraph(<type>, <text>)

Add a paragraph of any type. Use e.g. 'p' or 'pre' as type.

Add Remark

add_remark(<remark>)

Add a remark to the html document.

Add Table

add_table(<ref_to_array>, <element_delimiter>, <col_align>, <title_rows> [, <caption>])

Add a table to the html document. You must provide a reference to an array. The array should contain lines of text like: ('!' as element_delimiter expected):

value1          !   value in col 2  !  value in col 3 ! etc
value2 in col 1 !                   !  xyz            ! even more
3               !   4               !          5      ! what the heck...

The col_align is a string containing one character ('L', 'C' or 'R') for each table column which defines its respective alignment.

The number of title_rows define the number of rows, that are enclosed in 'th' tags instead of 'td' tags.

The table caption is optional.

Add Unordered List

add_ul(<ref_to_array>)

Add an unordered list. The array elements are inserted as the list elements.

Get HTML

get_html()

Returns the (so far) created html document as a string.

Get CSS Style

get_style()

Returns the currently defined css style definitions.

Get Title

get_title()

Returns the title of the htm document, if defined.

Save To File

save2file(<complete_path> [, <compress_command> [, <force>]])

That saves the so far created html document to the file complete_path. Compress the resulting file if a compress_command is given. Supported are xz, bzip2 and gzip. Use any value for force to use the --force argument to the supported compression command.

The method returns the resulting filename (the complete path including the extension which may probably be changed by the compress_command or undef if anything did not work correctly. Error messages will go to STDERR.

Set Character Set

set_charset(<mycharset>)

Add a meta tag that defines the character set for this html document. Default is utf-8.

Set Local Anchor List

set_local_anchor_list()

That inserts a special remark which will be replaced by the links to all filed local anchors when the html document is requested (get_html, save2file). You may use that e.g. for a table of contents. It can be used more than once.

Set CSS Style

set_style(<style_definitions>)

Set the css style definitions for the html document.

These are the default settings (for a simple and neutral design):

table {
    border-collapse: collapse;
    border: 1px solid black;
    margin-top: 5px;
}

th, td {
    border: 1px solid black;
    padding: 5px;
}

Set Title

set_title(<mytitle>)

Set the title of the html document.


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.