site
Offline API reference site from the index: hub + search, a page per unit / class: DocInsight, members, callers, impact, DFM wiring, tables; incremental.
Read this when you want browsable API documentation of a Delphi project without a server. site writes plain HTML from the index: a hub with every unit, its classes and a search box, and a page per unit and class / interface with its DocInsight text, members and charts. Each routine lists its callers (as find-callers --resolved), impact (as impact), .dfm event and tables; a form lists its .dfm wiring, a class has a has-a chart. A re-run writes only changed files; the same index gives the same bytes.
How to run it
Full flag list: site in the CLI reference.
Flags
| Flag | Argument | Meaning | Default |
|---|---|---|---|
--db | <project.sqlite> | ||
--project | <x.dproj> | ||
--output | <dir> | ||
--max-pages | N | ||
--full |
Where to click
No IDE surface: this feature runs from the CLI (see How to run it).
Details
Writes a static API reference site for one Delphi project from its index: a hub page with
the unit / class tree and a search box, one page per unit and one per class or interface with
its DocInsight text, its members, who calls each routine, its impact, its .dfm wiring, the tables it touches and its charts. The site is plain files -- open index.html
from disk, publish the folder anywhere; no server, no internet, nothing to install.
The MVP came in 1.60 (G-77 S3); 1.61 (S4) added the depth facts, the collaboration chart and incremental regeneration.
Running it from the CLI
drag-lint site (--db <project.sqlite> | --project <x.dproj>) --output <dir> [--max-pages N] [--full]
--db-- the project index to document.--project-- instead of--db: the project's.dproj; its index is the manifest section that owns it, else<project folder>\_D-RAG\<project name>.sqlite. No index = exit 2 naming theindexcommand to run.--output(alias--out) -- the site folder. It must be new, empty, or a site an earlier run wrote (it holds a.drag-lint-sitemarker): then the run is incremental (below) and anything else you put there is left alone. A folder with other files and no marker is refused (exit 2) and not touched.--max-pages N-- write at most N pages, in page order (each unit, then its classes). A name whose page was cut is shown as code, never as a dead link; the hub says how many were cut.--full-- lay out every chart again withdot.exeinstead of reusing the picture the old page holds (use it after a Graphviz upgrade). The files written are the same either way.
The charts are laid out by Graphviz: dot.exe is found the way ask finds it (DRAGLINT_DOT,
the dot setting, beside the engine, the installed copy, PATH).
Index the project first (drag-lint index --project <x.dproj>): the site is exactly as current
as the index.
What is in the folder
| File | Content |
|---|---|
index.html | the hub: every unit, its classes and interfaces under it, with their one-line summary; a search box over every page and member |
units\<Unit>.html | one unit: its DocInsight text, the uses chart, uses (interface / implementation), used by, its classes, and every interface-section declaration with its doc and depth facts |
types\<Unit.TClass>.html | one class or interface: its DocInsight text, the inheritance chart, ancestors, descendants, every non-private member with its declaration, doc and depth facts, its .dfm event wiring (a form), the tables its members touch, and the collaboration chart |
site.css, viewer.js | the shared chart viewer v1 (the same script as ask bundles and the IDE chart panel) and the site styles |
search-index.js, search-index.json | the search index: one row per page and per listed member (name, qualified name, kind, link, summary) |
.drag-lint-site | the marker that lets a later run replace the generated files |
The DocInsight text
Every doc comment the index stored is shown: summary, parameters, returns, exceptions
(<exception cref>), remarks, example, since, deprecated and see also. Inside the text,
<para> becomes a paragraph, <c> and <paramref> code, <code> a code block, <list> a
list, and <see cref> / <seealso cref> a link to the page (or the member on its page) that
documents the name -- a qualified name, a name of the same unit, or a short name exactly one
page carries. A name with no page stays code. The drag-lint:auto markers are dropped; the
generated lines between them (called from, calls, used by) are shown as written.
Private and strict-private members are not listed; a type page says how many it left out.
Depth facts on every member (1.61)
Under the doc of each listed routine and property:
- called from -- every resolved call site: the calling routine (a link to its block) and the
file.pas:lineof the call (opens in the IDE). These are exactly the rows ofdrag-lint query find-callers --resolved --name <Name>whosetarget_qnameis this member, a property'sread/writemode and an interfaceviaincluded. A by-name callback reach ([callback]in find-callers) names no single member and is not listed. "no caller in the index" means the lookup ran and found none. - impact (routines with a caller) --
depth d: c caller(s) in u unit(s)for depth 1 to 3, the levelsdrag-lint impact --qname <Unit.TClass.Method>prints (its default--depth 3). - wired in the .dfm -- the event a handler is bound to (
Button1.OnClick), from the index's symbol facts. - tables -- the tables the routine reads and writes, from its SQL text (the facts
touches-tablesuses).
A class that roots a .dfm (a form or data module) also gets a DFM event wiring list --
handler, .dfm file and line, the list drag-lint wiring --qname <Unit.TForm> prints -- and
every class a Tables touched line summing its members, private ones included.
The charts
A unit page has one chart, a class / interface page two, drawn with the shared viewer (pan, zoom, fit, back / forward on the first):
- a unit page: the units that use it on the left, the units it uses on the right (dashed = implementation uses, grey = outside the project);
- a class / interface page: its parent class and implemented interfaces on the left, the project types that inherit it on the right (grey = outside the project: the tooltip names its kind or qualified name when the index knows one);
- the collaboration chart of a class / interface page (has-a): the project types that hold it
in a field or property on the left, the project types it holds on the right (private fields
count; a generic
TObjectList<TFoo>holds aTFoo). The lines under it name the field.
Every node but the centre links to its own page -- the site's recentre is a link, and the
browser's back button returns. The centre node, and every file.pas:line link on a page,
opens the declaration in the IDE through draglint:// (register it once with
drag-lint protocol register). At most 30 nodes are drawn per side; the rest are listed on the
page.
Incremental regeneration (1.61)
Run site again into the same folder after a reindex and it writes only what changed: every
page is rendered from the index, but a file whose bytes are already right is not touched (its
write time stays), a chart whose DOT text is unchanged reuses the picture the old page holds
(no dot.exe run), and a page of a symbol that is gone is removed. Edit one unit and the files
that change are that unit's pages and the pages that show a fact of it -- the callers and call-site
lines of the routines it calls, its place in a held-by list. The second summary line counts it:
site: 3 page(s) written, 6 unchanged, 1 removed; 0 chart(s) laid out, 13 reused
Impact counts reach three calls deep, so a change in WHO calls what (not a doc or a line) can also
rewrite a page two or three calls away. The result is byte-identical to a fresh run into an empty
folder (run_v161_SITE2_depth.ps1 checks exactly that).
Deterministic output
The same index gives the same bytes: pages are read in name order, the charts are laid out
from DOT text built in that order, and no page holds a time, a run path or a random id. Run it
twice and compare the folders -- they are identical (the test run_v160_SITE_site.ps1 does
exactly that). A re-published folder therefore only differs where the index differs.
Exit codes
| Code | Meaning |
|---|---|
| 0 | site written; stdout names the page and chart counts, then the written / unchanged / removed pages and the charts laid out / reused |
| 1 | the index cannot be read, dot.exe is missing, or a chart could not be laid out |
| 2 | usage: no --db / --project, no --output, a bad --max-pages, no index, or --output holds files and no site marker |
| 3 | unknown flag |
Limits of the MVP
- Pages exist for units, classes and interfaces. Records, enums, routines and constants are listed (with their docs and anchors) on their unit or type page.
- Charts show direct ancestors and descendants only, not the whole chain.
- Callers, impact and wiring are as complete as the index's call resolution: a call the resolver
could not bind is not listed (
find-callerswithout--resolvedlists name matches). - Each overload lists its own callers;
find-callers --namegroups them under one qualified name with a header per overload. - Pan and zoom work on the first chart of a page; the collaboration chart is a plain picture whose nodes still link.