Oninit® QueryLens — HTML output
HTML is the default output mode — no flag required, or --html to be explicit. The schema is rendered as a syntax-highlighted, hyperlinked view of the source, with an optional summary section listing every registered object by category.
sql2html < schema.sql > schema.frag.html sql2html -h "Production schema" -s -2 < schema.sql > schema.html
Document structure
With -h <title>, the output is a self-contained HTML document:
<HTML>
<HEAD><TITLE>{title}</TITLE></HEAD>
<BODY>
<H1>{title}</H1>
{summary if -s}
<H3>Source</H3>
<pre>{syntax-highlighted body}</pre>
</BODY>
</HTML>
Without -h, the surrounding tags are omitted and only the inner fragment is emitted. This is intentional — it lets the output be embedded in a larger page (the project's own distribution pages do exactly this).
Summary section
When -s is set, one <H4> heading is emitted per non-empty category, in this fixed order:
| Order | Category | Type tag |
|---|---|---|
| 1 | User Defined Types | udt |
| 2 | Tables | table |
| 3 | Synonyms | syn |
| 4 | Views | view |
| 5 | Routines | udr |
| 6 | Aggregates | uda |
Under each heading every registered object of that type is emitted as <A HREF="#...">name</A>, one per line. Indexes, triggers, and constraints are not in the summary but are still anchored in the source body and reachable by direct URL fragment.
Anchors and cross-references
For each CREATE statement the creating keyword (the word TABLE in CREATE TABLE foo, the word VIEW in CREATE VIEW, and so on) is wrapped in a named anchor:
| Object class | Anchor |
|---|---|
| Permanent object | <A NAME="{type}_{name}">CREATE</A> |
| Temporary table | <A NAME="{type}_{name}_{line}">...</A> — line number disambiguates re-used names |
Each resolved reference replaces its referencing token with a hyperlink back to the corresponding anchor — <A HREF="#table_systables">systables</A> or, for temp tables, <A HREF="#temp_x_42">x</A> (matched to the most recent prior declaration). The same anchor scheme is used by the JSON and PDF outputs, so links generated from one format reach the others unchanged.
Syntax highlighting
The source body is wrapped in <pre> with per-token-class colour applied via <font color="...">. Whitespace and column position are preserved using the lexer's whitespace fields so the rendered source visually matches the input.
| Token class | Colour |
|---|---|
| TOK_SQL_WORD, TOK_SPL_WORD, TOK_SQL_OP | navy |
| TOK_SQL_DATATYPE | teal |
| TOK_LIT_NUMBER | magenta |
| TOK_LIT_STRING | red |
| TOK_COMMENT | green |
| TOK_COLLECTION | blue |
| TOK_OPT_DIRECTIVE | gray |
| TOK_OPT_COMMENT | silver |
| (default — identifiers) | black |
Example
A rendered run against the bundled sysmaster.gz fixture is available as sysmaster.html (produced by an earlier variant; current source emits the structure described above).