.. Reminder for header structure: Parts (H1) : #################### with overline Chapters (H2) : ******************** with overline Sections (H3) : ==================== Subsections (H4) : -------------------- Subsubsections (H5) : ^^^^^^^^^^^^^^^^^^^^ Paragraphs (H6) : """"""""""""""""""""" ########################## Available Mustache helpers ########################## ******************** Comparison and logic ******************** These helpers allow you to conditionally display data, compare values, or apply logic inside templates. They are especially useful when rendering values based on states, flags, or patterns. Helper: ``IIf`` =============== **Purpose:** Inline conditional: if condition is true, return the second argument; otherwise, return the third. **Syntax:** ``{{ IIf condition, value_if_true, value_if_false }}`` **JSON input:** .. code-block:: json { "is_admin": true } **Template:** .. code-block:: html

Access: {{ IIf is_admin, "Administrator", "Standard user" }}

**Result:** .. code-block:: html

Access: Administrator

If `is_admin` was `false`, the result would be `Standard user`. You can also use constants or strings directly: .. code-block:: html {{ IIf true, "✓", "✗" }} → ✓ Helper: ``If_`` =============== **Purpose:** Advanced conditional expression. Takes three arguments: ``If_(condition, then_value, else_value)`` It’s similar to `IIf`, but supports more flexible comparisons when combined with `Equals_`, `Match`, etc. **JSON input:** .. code-block:: json { "os": "Windows" } **Template:** .. code-block:: html

{{ If_(Equals_ os "Windows"), "🪟 Windows detected", "Other OS" }}

**Result:** .. code-block:: html

🪟 Windows detected

Helper: ``Equals_`` =================== **Purpose:** Compares two values for equality. Often used inside `If_` or `IIf`. **JSON input:** .. code-block:: json { "status": "running" } **Template:** .. code-block:: html {{#Equals_ status "running"}}

Service is active

{{/Equals_}} **Result:** .. code-block:: html

Service is active

Helper: ``Match`` ================= **Purpose:** Tests if a string matches a regular expression (case sensitive). **JSON input:** .. code-block:: json { "version": "v1.2.3" } **Template:** .. code-block:: html {{#Match version "=v1\\."}}

Version 1.x detected

{{/Match}} **Result:** .. code-block:: html

Version 1.x detected

If the pattern doesn’t match (e.g., version is `"v2.0"`), nothing is shown. Helper: ``MatchI`` ================== **Purpose:** Same as `Match`, but case*insensitive. **JSON input:** .. code-block:: json { "env": "Production" } **Template:** .. code-block:: html {{#MatchI env "production"}}

Production environment

{{/MatchI}} **Result:** .. code-block:: html

Production environment

************************** List and object operations ************************** These helpers are useful when working with lists or dictionaries (objects). They allow iteration, extraction, and transformation of structured data in Mustache templates. Helper: ``Items`` ================= **Purpose:** Converts a dictionary into a list of key*value pairs so it can be iterated in Mustache. **JSON input:** .. code-block:: json { "services": { "WAPT": "running", "Antivirus": "stopped" } } **Template:** .. code-block:: html **Result:** .. code-block:: html Helper: ``Get`` =============== **Purpose:** Retrieves a value from a dictionary by key, with an optional default value if the key is missing. **JSON input:** .. code-block:: json { "settings": { "theme": "dark" } } **Template:** .. code-block:: html

Theme: {{ Get settings, "theme", "light" }}

Language: {{ Get settings, "lang", "en" }}

**Result:** .. code-block:: html

Theme: dark

Language: en

Helper: ``Count`` ================= **Purpose:** Counts the number of elements in a list or the number of keys in a dictionary. **JSON input:** .. code-block:: json { "disks": ["C:", "D:", "E:"] } **Template:** .. code-block:: html

Number of disks: {{ Count disks }}

**Result:** .. code-block:: html

Number of disks: 3

Helper: ``Values`` ================== **Purpose:** Extracts the values of a dictionary as a list. **JSON input:** .. code-block:: json { "apps": { "firefox": "browser", "vlc": "media" } } **Template:** .. code-block:: html **Result:** .. code-block:: html Helper: ``Keys`` ================ **Purpose:** Extracts the keys of a dictionary as a list. **JSON input:** .. code-block:: json { "apps": { "firefox": "browser", "vlc": "media" } } **Template:** .. code-block:: html **Result:** .. code-block:: html Helper: ``First`` ================= **Purpose:** Extracts the first `n` items from a list. **JSON input:** .. code-block:: json { "users": ["alice", "bob", "carol"] } **Template:** .. code-block:: html **Result:** .. code-block:: html Helper: ``Last`` ================ **Purpose:** Extracts the last `n` items from a list. **JSON input:** .. code-block:: json { "logs": ["log1", "log2", "log3", "log4"] } **Template:** .. code-block:: html **Result:** .. code-block:: html Helper: ``Slice`` ================= **Purpose:** Extracts a sublist from a list using `start` and `end` indices. **JSON input:** .. code-block:: json { "items": ["A", "B", "C", "D", "E"] } **Template:** .. code-block:: html **Result:** .. code-block:: html *************** Data formatting *************** These helpers are used to convert raw numerical or structured values into more readable formats, such as human*readable file sizes or CSV tables. Helper: ``HumanBytes`` ====================== **Purpose:** Converts a byte size (integer) into a human*readable format with units (e.g. KB, MB, GB, etc.). This helper is extremely useful for displaying disk sizes, memory usage, file sizes, etc. **JSON input:** .. code-block:: json { "disk_size": 1073741824 } **Template:** .. code-block:: html

Total size: {{ HumanBytes disk_size }}

**Result:** .. code-block:: html

Total size: 1.00 GiB

You can also use it directly in loops: .. code-block:: html {{#disks}}
  • {{mountpoint}} * {{ HumanBytes size }}
  • {{/disks}} Helper: ``CSV`` =============== **Purpose:** Converts a list of dictionaries into a comma* or semicolon*separated text (CSV format). This is useful for exporting rows of audit data like software lists, users, etc. **Syntax:** ``CSV list, separator, column1, column2, ...`` **JSON input:** .. code-block:: json { "users": [ {"name": "Alice", "email": "alice@example.com"}, {"name": "Bob", "email": "bob@example.com"} ] } **Template:** .. code-block:: html
    {{ CSV users, ";", "name", "email" }}
    **Result:** .. code-block:: html
          name;email
          Alice;alice@example.com
          Bob;bob@example.com
        
    You can also use a comma or tab as the separator: .. code-block:: html {{ CSV users, ",", "name", "email" }} **************************** String and text manipulation **************************** These helpers allow you to transform or reformat text values before display. They are useful for cleaning raw values, formatting labels, or adjusting alignment. Helper: ``Lower`` ================= **Purpose:** Converts a string to lowercase. **JSON input:** .. code-block:: json { "username": "AdminUser" } **Template:** .. code-block:: html

    Login (lowercase): {{ Lower username }}

    **Result:** .. code-block:: html

    Login (lowercase): adminuser

    Helper: ``Upper`` ================= **Purpose:** Converts a string to uppercase. **JSON input:** .. code-block:: json { "department": "it support" } **Template:** .. code-block:: html

    DEPARTMENT: {{ Upper department }}

    **Result:** .. code-block:: html

    DEPARTMENT: IT SUPPORT

    Helper: ``Pad`` =============== **Purpose:** Pads a string on the right to reach a given width. Optional third argument sets the fill character. **JSON input:** .. code-block:: json { "value": "WAPT" } **Template:** .. code-block:: html
    {{ Pad value, 10, "." }}
    **Result:** .. code-block:: html
    WAPT......
    Helper: ``PadLeft`` =================== **Purpose:** Pads a string on the left to reach a given width. Useful for aligning numbers. **JSON input:** .. code-block:: json { "id": "42" } **Template:** .. code-block:: html
    {{ PadLeft id, 5, "0" }}
    **Result:** .. code-block:: html
    00042
    Helper: ``Sub`` =============== **Purpose:** Extracts a substring from a string. Arguments: `string`, `start`, and optionally `length`. **JSON input:** .. code-block:: json { "serial": "ABC123456789" } **Template:** .. code-block:: html

    Short serial: {{ Sub serial, 3, 6 }}

    **Result:** .. code-block:: html

    Short serial: 123456

    Helper: ``CamelCase`` ===================== **Purpose:** Converts a string to camelCase. Useful for variable naming or display standardization. **JSON input:** .. code-block:: json { "title": "system audit summary" } **Template:** .. code-block:: html

    Var: {{ CamelCase title }}

    **Result:** .. code-block:: html

    Var: systemAuditSummary

    Helper: ``SnakeCase`` ===================== **Purpose:** Converts a string to snake_case (lowercase + underscores). **JSON input:** .. code-block:: json { "title": "System Audit Summary" } **Template:** .. code-block:: html

    Key: {{ SnakeCase title }}

    **Result:** .. code-block:: html

    Key: system_audit_summary

    Helper: ``EnumTrim`` ==================== **Purpose:** Cleans up enumerated strings like `[0] Active`, removing the bracketed prefix. **JSON input:** .. code-block:: json { "status": "[1] Enabled" } **Template:** .. code-block:: html

    Status: {{ EnumTrim status }}

    **Result:** .. code-block:: html

    Status: Enabled

    Helper: ``EnumTrimRight`` ========================= **Purpose:** Like `EnumTrim`, but trims bracketed values **only from the right side** of the string. **JSON input:** .. code-block:: json { "label": "Mode [2]" } **Template:** .. code-block:: html

    Mode: {{ EnumTrimRight label }}

    **Result:** .. code-block:: html

    Mode: Mode

    ************************ Date and time formatting ************************ These helpers are used to format dates, times, or durations. They're especially useful for rendering audit fields like installation dates, boot times, or update durations. Helper: ``LocalTime`` ===================== **Purpose:** Converts a UTC time or datetime into a **localized time only**, without the date part. This is useful when you want to show the time of an event (e.g., boot time, user login time), independently of the date. **JSON input:** .. code-block:: json { "last_logon": "2024*04*15T06:45:00Z" } **Template:** .. code-block:: html

    Last logon time: {{ LocalTime last_logon }}

    **Result:** .. code-block:: html

    Last logon time: 08:45:00

    *(Assuming local time is UTC+2)* If the input is a date string without a time component, the result will default to `00:00:00` (midnight). Helper: ``LocalDate`` ===================== **Purpose:** Converts a UTC date or datetime into a local **date only**, in `YYYY*MM*DD` format. **JSON input:** .. code-block:: json { "install_date": "2023*12*15T14:50:00Z" } **Template:** .. code-block:: html

    Installed on: {{ LocalDate install_date }}

    **Result:** .. code-block:: html

    Installed on: 2023*12*15

    Helper: ``DateFmt`` =================== **Purpose:** Formats a date using a **custom pattern**, similar to `strftime`. Input can be a UTC string or timestamp, and you pass the format string as second argument. **JSON input:** .. code-block:: json { "build_time": "2024*04*12T11:00:00Z" } **Template:** .. code-block:: html

    Build date: {{ DateFmt build_time, "%d/%m/%Y" }}

    **Result:** .. code-block:: html

    Build date: 12/04/2024

    Helper: ``DateTimeToText`` ========================== **Purpose:** Converts a full datetime into a **human*readable** string (e.g., "Friday 5 April 2024, 08:35"). **JSON input:** .. code-block:: json { "last_check": "2024*04*05T08:35:00Z" } **Template:** .. code-block:: html

    Last check: {{ DateTimeToText last_check }}

    **Result:** .. code-block:: html

    Last check: Friday 5 April 2024, 08:35

    *(Formatting depends on the locale used)* Helper: ``DateToText`` ====================== **Purpose:** Converts a date string into readable text format (simpler variant of `DateTimeToText`, legacy style). **JSON input:** .. code-block:: json { "release_date": "2024*02*01" } **Template:** .. code-block:: html

    Release: {{ DateToText release_date }}

    **Result:** .. code-block:: html

    Release: Thursday 1 February 2024

    Helper: ``TimeLogToText`` ========================= **Purpose:** Parses a **log time delta string** (e.g. `"00:04:32"`) and converts it to a human*readable format. **JSON input:** .. code-block:: json { "uptime": "00:04:32" } **Template:** .. code-block:: html

    System uptime: {{ TimeLogToText uptime }}

    **Result:** .. code-block:: html

    System uptime: 4 minutes, 32 seconds

    ****************** HTML and rendering ****************** These helpers let you safely display structured data, escape it, or convert markup formats (Markdown, Wiki, etc.) into HTML for display in templates. Helper: ``{{> file.ext }}`` =========================== **Purpose:** Includes a partial file (such as HTML, CSS, TXT, PNG, JPG) into the template output. This allows reusable fragments to be shared across multiple templates, like common styles or headers. Partials must be placed in the ``templates/partials/`` directory and can be overridden in the user's AppData template folder. **Example partial (``style.css``):** .. code-block:: css body { background: #f0f0f0; } **Template:** .. code-block:: html {{> style.css }} **Result:** .. code-block:: html Helper: ``ToJson2`` =================== **Purpose:** Converts a value (usually a dictionary or list) into pretty printed JSON for display. It adds indentation and spacing for readability — very useful for debugging or showing structured data. **JSON input:** .. code-block:: json { "network": { "ip": "192.168.1.10", "mask": "255.255.255.0" } } **Template:** .. code-block:: html
    {{ ToJson2 network }}
    **Result:** .. code-block:: html
    {
      "ip": "192.168.1.10",
      "mask": "255.255.255.0"
        }
      
    Helper: ``ToJson`` ================== **Purpose:** Converts a value to compact JSON (without formatting). Use it when embedding JSON in JavaScript or HTML attributes. **JSON input:** .. code-block:: json { "cpu": { "cores": 4, "model": "Intel" } } **Template:** .. code-block:: html {{ ToJson cpu }} **Result:** .. code-block:: html {"cores":4,"model":"Intel"} Helper: ``JsonQuote`` ===================== **Purpose:** Escapes JSON content to safely include it inside an HTML or JavaScript string. Escapes quotes, backslashes, etc. **JSON input:** .. code-block:: json { "path": "C:\\Program Files\\WAPT" } **Template:** .. code-block:: html **Result:** .. code-block:: html Helper: ``JsonQuoteUri`` ======================== **Purpose:** Escapes JSON content for use inside a URL. It percent encodes special characters. **JSON input:** .. code-block:: json { "search": "disk space (C:)" } **Template:** .. code-block:: html Search **Result:** .. code-block:: html Search Helper: ``SimpleToHtml`` ======================== **Purpose:** Converts plain text with line breaks into basic HTML (`
    ` tags, no Markdown support). Useful for displaying audit logs or raw output from commands. **JSON input:** .. code-block:: json { "log": "Update started\nSuccess\nReboot required" } **Template:** .. code-block:: html
    {{ SimpleToHtml log }}
    **Result:** .. code-block:: html
    Update started
    Success
    Reboot required
    Helper: ``MarkdownToHtml`` ========================== **Purpose:** Parses a Markdown string and renders it as HTML. Supports headers, lists, bold, etc. **JSON input:** .. code-block:: json { "note": "# Status\n* OK\n* Warning\n* Error" } **Template:** .. code-block:: html
    {{ MarkdownToHtml note }}
    **Result:** .. code-block:: html

    Status

    Helper: ``WikiToHtml`` ====================== **Purpose:** Parses a Wiki*style string (similar to DokuWiki or MediaWiki syntax) and renders it as HTML. **JSON input:** .. code-block:: json { "doc": "== Info ==\nThis **device** is _critical_!" } **Template:** .. code-block:: html
    {{ WikiToHtml doc }}
    **Result:** .. code-block:: html

    Info

    This device is critical!

    *************** Other utilities *************** These helpers provide general*purpose functions useful for formatting or generating dynamic values. Helper: ``JoinValues`` ====================== **Purpose:** Joins the values of a list (or dictionary) into a single string using a custom separator. **JSON input:** .. code-block:: json { "packages": ["firefox", "vlc", "notepad++"] } **Template:** .. code-block:: html

    Installed: {{ JoinValues packages, ", " }}

    **Result:** .. code-block:: html

    Installed: firefox, vlc, notepad++

    Works with values in a dictionary as well: .. code-block:: json { "apps": { "1": "WAPT", "2": "Chrome" } } **Template:** .. code-block:: html

    Apps: {{ JoinValues apps, " | " }}

    **Result:** .. code-block:: html

    Apps: WAPT | Chrome

    Helper: ``Join`` ================ **Purpose:** Joins the **items** of a list or the **keys** of a dictionary using a separator. **JSON input:** .. code-block:: json { "groups": ["admins", "users", "guests"] } **Template:** .. code-block:: html

    Groups: {{ Join groups, " * " }}

    **Result:** .. code-block:: html

    Groups: admins * users * guests

    With a dictionary: .. code-block:: json { "users": { "u1": "Alice", "u2": "Bob" } } **Template:** .. code-block:: html

    User IDs: {{ Join users, ", " }}

    **Result:** .. code-block:: html

    User IDs: u1, u2

    Helper: ``NewGuid`` =================== **Purpose:** Generates a random UUID (Universally Unique Identifier). Useful for tagging data or testing. **Template:** .. code-block:: html

    Generated ID: {{ NewGuid }}

    **Result:** .. code-block:: html

    Generated ID: a8f9e870*3d3c*4a71*91e9*52a4572282e9

    Helper: ``ExtractFileName`` =========================== **Purpose:** Extracts the file name from a full path. **JSON input:** .. code-block:: json { "filepath": "C:/Program Files/WAPT/wapt.exe" } **Template:** .. code-block:: html

    File: {{ ExtractFileName filepath }}

    **Result:** .. code-block:: html

    File: wapt.exe

    ******************** Encoding and hashing ******************** These helpers allow you to encode/decode strings, binary content, or generate hashes. They are especially useful for working with logs, identifiers, images, or URLs in audit reports. Helper: ``b64encode`` ===================== **Purpose:** Encodes a plain string into base64 format. **JSON input:** .. code-block:: json { "password": "secret123" } **Template:** .. code-block:: html

    Encoded password: {{ b64encode password }}

    **Result:** .. code-block:: html

    Encoded password: c2VjcmV0MTIz

    Helper: ``sha256`` ================== **Purpose:** Calculates the SHA*256 hash of a string. Commonly used for integrity checks or anonymization. **JSON input:** .. code-block:: json { "serial": "ABC123456" } **Template:** .. code-block:: html

    SHA256: {{ sha256 serial }}

    **Result:** .. code-block:: html

    SHA256: b7f51c2... (64 characters)

    Helper: ``sha1`` ================ **Purpose:** Computes the SHA*1 hash of a string (legacy use). **JSON input:** .. code-block:: json { "username": "admin" } **Template:** .. code-block:: html

    SHA1: {{ sha1 username }}

    **Result:** .. code-block:: html

    SHA1: d033e22ae348aeb5660fc2140aec35850c4da997

    Helper: ``md5`` =============== **Purpose:** Generates the MD5 hash of a string. **JSON input:** .. code-block:: json { "filename": "report.pdf" } **Template:** .. code-block:: html

    MD5: {{ md5 filename }}

    **Result:** .. code-block:: html

    MD5: 76c7f3b9d5f43a86ad6f9e1a4567ebc3

    Helper: ``BlobToBase64`` ======================== **Purpose:** Encodes binary content (e.g., logs, images, attachments) to base64. Used internally when embedding binary data inside HTML or JavaScript. **JSON input:** .. code-block:: json { "log_data": "binary_content" } **Template:** .. code-block:: html
    {{ BlobToBase64 log_data }}
    **Result:** .. code-block:: html
    YmFzZTY0IGVuY29kZWQgbG9n...
    Helper: ``b64decode`` ===================== **Purpose:** Decodes a base64*encoded string. **JSON input:** .. code-block:: json { "encoded": "SGVsbG8gd29ybGQh" } **Template:** .. code-block:: html

    Decoded: {{ b64decode encoded }}

    **Result:** .. code-block:: html

    Decoded: Hello world!

    Helper: ``_chr`` ================ **Purpose:** Converts an integer or a list of integers into the corresponding ASCII characters. This can be used to create control sequences like carriage return (13), newline (10), or even emojis (Unicode values). **JSON input:** .. code-block:: json { "newline": [13, 10] } **Template:** .. code-block:: html
    {{ _chr newline }}
    **Result:** .. code-block:: html
    ↵ (carriage return + line feed)
    Another example: .. code-block:: html

    {{ _chr 65 }}

    **Result:** .. code-block:: html

    A

    ******************* Networking and HTTP ******************* These helpers perform HTTP requests directly from the template. They allow dynamic data fetching from URLs or APIs (internal or external). ⚠️ **Warning:** These helpers can impact performance and should be used with caution in production templates. Prefer `Safe` variants when exposing data to users. Helper: ``HttpGet`` =================== **Purpose:** Sends a basic HTTP GET request to the given URL. **JSON input:** .. code-block:: json { "url": "https://api.example.com/status" } **Template:** .. code-block:: html

    Status: {{ HttpGet url }}

    **Result:** .. code-block:: html

    Status: {"status":"ok"}

    If the response is JSON, it will be returned as a string (not parsed). Use `ToJson2` if needed. Helper: ``HttpGetSafe`` ======================= **Purpose:** Like `HttpGet`, but with internal validation. Ensures the URL is safe and access is allowed. Preferred in public facing templates. **JSON input:** .. code-block:: json { "url": "https://example.com/uptime.txt" } **Template:** .. code-block:: html

    Uptime: {{ HttpGetSafe url }}

    **Result:** .. code-block:: html

    Uptime: 3 days, 6 hours

    Helper: ``DoHttpGet`` ===================== **Purpose:** Lower level version of `HttpGet`, with optional certificate validation. This version is not recommended in templates — it is used internally. **JSON input:** .. code-block:: json { "url": "https://internal.local/api", "verify": "0" } **Template:** .. code-block:: html

    {{ DoHttpGet url, verify }}

    **Result:** .. code-block:: html

    {"message": "OK"}

    Helper: ``HttpPost`` ==================== **Purpose:** Sends an HTTP POST request with a payload. The data should be an array: `[url, payload]`. **JSON input:** .. code-block:: json { "post_data": ["https://api.example.com/send", "msg=hello"] } **Template:** .. code-block:: html

    Response: {{ HttpPost post_data }}

    **Result:** .. code-block:: html

    Response: {"status":"received"}

    Helper: ``HttpPostSafe`` ======================== **Purpose:** Safe variant of `HttpPost`, applying domain or content restrictions. **JSON input:** .. code-block:: json { "post_data": ["https://trusted.example.com/api", "data=123"] } **Template:** .. code-block:: html

    {{ HttpPostSafe post_data }}

    **Result:** .. code-block:: html

    {"status":"ok"}

    Helper: ``DoHttpPost`` ====================== **Purpose:** Low level variant of `HttpPost` with optional certificate check. **JSON input:** .. code-block:: json { "args": ["https://local/api", "ping=1"], "verify": "0" } **Template:** .. code-block:: html

    {{ DoHttpPost args, verify }}

    **Result:** .. code-block:: html

    {"ping":"ok"}