Status & Roadmap
Authors & License
Funding U++
Search on this site

SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo



class HtmlObjectSaver

This is a helper abstract class used to save RichObject instances when exporting RichText to HTML.


Public Method List


virtual String GetHtml(const RichObject& object)

Exports object. Default implementation is empty.



virtual String GetHtml(const RichObject& object, const String& link)

Exports object which currently has anchor link. Default implementation calls single parameter GetHtml.



Export functions


String EncodeHtml(const RichText& text, Index<String>& css, const VectorMap<String, String>& links, const VectorMap<String, String>& labels, const String& path, const String& base = Null, Zoom z = Zoom(8, 40), const VectorMap<String, String>& escape = VectorMap<String, String>(), int imtolerance = 0)

String EncodeHtml(const RichText& text, Index<String>& css, const VectorMap<String, String>& links, const VectorMap<String, String>& labels, HtmlObjectSaver& object_saver, Zoom z = Zoom(8, 40), const VectorMap<String, String>& escape = VectorMap<String, String>())

Exports RichText text in html format.

css is set of CSS definitions. The CSS class name is index of definition formatted with FormatIntAlpha.

links is optional set of link translations. Whole link translation is attempted at first, then only part before '#' is attempted.

labels is optional set of label translations.

object_saver instance of HtmlObjectSaver used to store RichObject instances.

z Zoom factor.

escape optional map that translates RichText index entries to raw html code to be embedded into the body.

path overload with this parameter is using default HtmlObjectSaver to export RichObject instances as .png into path directory, in both zoomed size and original size as long as there is no link associated with the image.

base this is prefix added to .png name potentially used to make it unique if there is a chance of conflict in case the output dir is common for more .html pages.

imtolerance maximum tolerance of image size error before the image is rescaled in percents.



String AsCss(Index<String>& ss)

Converts set of CSS class definitions produced by EncodeHtml to css block of HTML. The purpose of having this process separated from EncodeHtml body production is to have ability to combine multiple bodies (multiple EncodeHtml calls) into single HTML page.




Do you want to contribute?