Skip to main content

html-reference

Logos and Images​

It is possible store image files in the ProgramData/AMS Controls/AMS.Eclipse.Server folder and reference from the Sriban template. However, it is recommended to instead include the images in the .html file as base64 encoded strings. This way, the images are included in the .html file and can be distributed as a single file.

The image can be converted using a web tool. Also, it is possible to first include the linked image in a template and then copy the resulting string into the .html file.

The following is an example of an image included in the .html file as a file reference:

{{image_base64 'logo.png'}}

This will result in the following output:

data:image/png;base64,{base64 encoded string}

That full string should be included in an <img> tag in the .html file.

<img src="data:image/png;base64,{base64 encoded string}">

Unit formatting​

In addition to the standard Scriban number formatting, the following custom options are available:

FormatLength​

The FormatLength method formats a length value in inches, desired output format, and the precision* to a string with the specified number of decimal places.

Format options:

  • 'i', 'in' = inches
  • 'f', 'ft' = feet (default)
  • 'fdi' = feet with decimal inches
  • 'ffi' = feet with fractional inches
  • 'fi' = fractional inches
  • 'm' = meters
  • 'cm' = centimeters
  • 'mm' = millimeters

Precision: For formats that are not fractional, the precision is the number of decimal places. For fractional formats, the precision is the largest denominator value possible.

{{ 120.1 | format_length }} <!-- 12 -->
{{ 120.456 | format_length "f" 1 }} <!-- 12.5 -->
{{ 120.456 | format_length "ffi" 4 }} <!-- 12 1/2 -->