Sfairadora

  • Reference Guide

encode_html

encode_html(rtxt, html_settings)
The parameter rtxt is either Rich_string or Rich_text. The function creates and returns a representation of the given text in the HTML format. The result is a String containing the HTML code. The function may return an error when writing of possible contained images fails.
The parameter html_settings of the type HTML_settings specifies parameters of encoding. It is a structure with following components:
Component Type
Component Name
Description
String
global_block_class
If set, it specifies the name of the CSS style class assigned to the topmost HTML element that contains all resulting text.
Default value is "rich_text_block".
String
image_folder
The name of folder where to store the images contained in the text.
String
img_src_prefix
The pathname joined to the name of an image file, as is encoded in HTML. (The value should reflect the position of the images folder relative to the final position of the resulting HTML file.)
String
img_class_name
If set, it specified the name of the CSS style class assigned to the image (<img>) HTML element.
Int optional
src_page_width
The page width of the source text relative to which the widths of images are calculated.
Int optional
dest_page_width
The page width of the target document.
If the both values src_page_width and dest_page_width are set, they are use together to calculate resulting image width encoded to HTML.
These values are left unset as default.
String
pw_unit
The unit for the dest_page_width value. It must be a valid unit of the CSS standard.
The default value is "px" (pixels).
Int
src_dpi
DPI of the source text used to recalculate image sizes when the values src_page_width and dest_page_width are not set.
The default value is 96.
Int optional
max_img_width
Minimum width of an image expressed in the target units that can be encoded in HTML. If the resulting image width were greater than this value, it is used instead of the computed one. In that case, the image can be displayed in a separate window by clicking it.
The value is left unset as default.
Byte
hidden_text
Handling of hidden text (the text marked with the attribute hidden):
0
do not code.
1
use a gray grid on the background (as displayed in Sfairadora).
Text optional
header
The header of the HTML file up to the <body> element (including the <body> element). If the value is not set, a standard header is generated.
The value is left unset as default (i.e. a standard header is used).
Text optional
footer
The footer of the HTML file complementary to the header. If the value is not set, a standard footer is generated.
The value is left unset as default.
String
title
If the header value is not specified, this string is used as a page title in the standard header. If the header value is set, this value is ignored.

See Also