cave.html.html_builder module

class cave.html.html_builder.HTMLBuilder(output_dn: str, scenario_name: str, logo_fn: str, logo_custom: bool = False)[source]

Bases: object

The dictionary structure in the HTML-Builder follows the following syntax:

{"top1" : {
          "tooltip": str|None,
          "subtop1: {  # generates a further bottom if it is dictionary
                  "tooltip": str|None,
                  ...
                  }
          "table": str|None (html table)
          "figure" : str|None (file name)
          "bokeh" : (str, str)|None  # (script, div as returned by components())
          }
 "top2: { ... }
}
Parameters
  • output_dn (str) – output directory name

  • scenario_name (str) – name of scenario

  • logo_fn (str) – path to the logo of the configurator

  • logo_custom (bool) – if true, logo ist treated as external logo that needs to be copied

add_layer(layer_name, data_dict: collections.OrderedDict, is_tab: bool = False)[source]

add a further layer of top data_dict keys

Parameters
  • layer_name (str) – name of the layer

  • data_dict (OrderedDict) – see constructor

  • is_tab (bool) – if True, don’t use accordion but tab-structure to wrap content

Returns

(script, div) – script goes into header, div goes into body

Return type

(str, str)

generate_html(data_dict: collections.OrderedDict)[source]
Parameters

data_dict (OrderedDict) – see constructor

get_unique_id()[source]