marqdo

15-toml-html-encodingok

features/15-toml-html-encoding.mq.md

Structure

importtoml:lib/toml.mq.mdhtml:lib/html.mq.mdenc:lib/encoding.mq.md
fn · h1Config and safe text without plugins
comment

Parse a TOML subset for tools, escape HTML before assembly, encode with base32.

fn · h1main
bind `cfg` = > toml.parse text=app = "demo" [server] port = 8080
call> print text=[app](`cfg`)
bind `srv` = [server](`cfg`)
call> print text=[port](`srv`)
bind `safe` = > html.escape text=<tag>
call> print text=`safe`
bind `b` = > enc.base32_encode text=ok
call> print text=`b`
Functions
Variables
  • b text
    N5VQ====
  • cfg map · 2
    appdemo
    serverMap(1)
  • safe text
    &lt;tag&gt;
  • srv map · 1
    port8080

Execution

demo 8080 &lt;tag&gt; N5VQ====

Source

---
title: Mid stdlib — toml, html, base32
description: Config TOML + HTML escape + base32 (Mid2 M8)
import toml:lib/toml.mq.md
import html:lib/html.mq.md
import enc:lib/encoding.mq.md
---

# Config and safe text without plugins

Parse a TOML subset for tools, escape HTML before assembly, encode with base32.

# main

**cfg = > toml.parse text="app = \"demo\"\n[server]\nport = 8080\n"**
> print text=[app](`cfg`)
**srv = [server](`cfg`)**
> print text=[port](`srv`)

**safe = > html.escape text="<tag>"**
> print text=`safe`

**b = > enc.base32_encode text="ok"**
> print text=`b`

Variable