This page covers code and data. They share a page because they are mirror images: code holds text the processor never interprets, data holds a value that must parse; the two share one src= route syntax, yet weigh "cannot resolve" in opposite ways. Each rule names its source; the right-hand side is measured output from geml check, geml get and --to html.
Specified written into the specification. GEP draft defined by a proposal, implemented on this branch, not yet in the spec. Impl. gap none found on this page.
| Rule | Source | Status | |
|---|---|---|---|
| Shared by both | |||
| 1 | One route syntax: src=<path>[#L<start>[-<end>]], 1-based and inclusive; resolved relative to the document, or to --root when given; http(s) is fetched by the renderer, every other scheme is refused. | §3.3 · §9.4 | Specified |
| 2 | One attribute, two weights: an unresolvable code route is a warning (the block describes a region of code somewhere; the document stands without the sources), an unresolvable data route is an error (the value is what the document promised). A stale range is an error for both. | §3.3 · §3.2 | Specified |
| 3 | Neither may carry src= and a body together (code-src-and-body, data-src-and-body errors). A code route has no extension gate; a data route must be .json/.jsonl. | §3.3 · §3.2 · A.5 | Specified |
| code | |||
| 4 | Raw body; lang= is only a label; the body is never run. Renders as <pre><code class="language-xx">. | §3 · §9.1 | Specified |
| 5 | src=<path>[#L<s>[-<e>]] names the code shown. Src with a body: error; a drifted range: error; unresolvable: warning (the graph stays valid); a disallowed scheme: error. | §3.3 · A.5 | Specified |
| data | |||
| 6 | The value tree (JSON's value domain). json by default, jsonl one value per line with blank lines ignored. A body that does not parse is a data-parse error naming the line. | §3.2 · A.5 | Specified |
| 7 | yaml/toml are reserved names: with no engine the body is kept, a warning is emitted, and the processor never guesses. An unknown format degrades the same way. csv is not a data format. | §3.2 | Specified |
| 8 | src= and a body are mutually exclusive (error); the file must be .json/.jsonl; schema= is reserved, a malformed shape is an error, and nothing validates against it. | §3.2 · A.5 | Specified |
| 9 | #cfg["tags"][1], #log[1]["t"] read one node of the value tree by coordinate. | GEP-0011 | GEP draft |
code: the text itself, or a route to a region of sourceThe body is text and is never run (§9.1). Instead of copying code, src= can point at a file and a line range, and drift is caught.
src= Specifiedhelper.js has three lines.=== code {#inline lang=ts caption="Inline body"} export const x = 1; === === code {#routed lang=js src=helper.js#L1-2} === === code {#both lang=js src=helper.js} body and src together === === code {#drift lang=js src=helper.js#L40-50} === === code {#missing lang=js src=nowhere.js} === === code {#scheme lang=js src=ftp://x/y.js} ===
error: code: carries both `src=` and an inline body; exactly one is permitted (line 11) error: code source `helper.js#L40-50`: the file has 3 line(s), so lines 40-50 no longer exist — the range is stale (line 14) warning: cannot resolve code source `nowhere.js` — not checked (line 16) error: code source `ftp://x/y.js` names a disallowed URL scheme (line 18) 3 error(s), 1 warning(s)
<path>[#L<start>[-<end>]], 1-based, inclusive. Resolved relative to the document, and also relative to --root when one is named, never outside §9.4's confinement.data's src= is an error when unresolvable (§3.2): its value is exactly what the document promised, and failing to load it breaks the promise. The two types weigh the same attribute oppositely, each for a reason.data: a verified value treeAdded by GEP-0005. code carries text that must not be interpreted; data carries a value that must parse.
=== data {#cfg} %% format defaults to json {"name": "geml", "tags": ["a", "b"], "n": 3} === === data {#log format=jsonl} {"t": 1, "ok": true} {"t": 2, "ok": false} %% blank lines ignored; a block appended at EOF is a new record === === data {#ext src=rows.json} %% the content lives in a file; the block is its addressable view ===
$ geml get p5-data.geml '#cfg["tags"][1]' b $ geml get p5-data.geml '#log[1]["t"]' 2
value, exposed in the document model. json is the default because it is the value tree's own serialization, the one a zero-dependency processor can always verify.[ cannot occur in a legal id, so nothing is confused. geml list does not enumerate coordinates; the author constructs them. Implemented on this branch, not yet in the spec.=== data {#bad} {"name": "geml", ← not one complete JSON value === === data {#y format=yaml} %% reserved name name: geml === === data {#both src=rows.json} {"x": 1} ← src and body together === === data {#sch schema=not-a-ref} {"x": 1} === === data {#csvish format=csv} a,b ===
error: data: body is not valid JSON (Expected double-quoted property name in JSON at position 16 (line 1 column 17)) (line 14) warning: data: no `yaml` engine in this processor; body kept raw, not verified (line 16) warning: data: no `toml` engine in this processor; body kept raw, not verified (line 20) error: data: carries both `src=` and an inline body; exactly one is permitted (the body wins here) (line 25) error: data: `schema=not-a-ref` must name a block (`#id`) or a GEML document (`doc.geml[#id]`) (line 28) warning: unknown data format `weird`; body kept raw (line 31) warning: unknown data format `csv`; body kept raw (line 34) 3 error(s), 4 warning(s)
data-parse names the line.yaml/toml are reserved names: without an engine the body is kept, not verified, never guessed — the same degradation as an unknown diagram format (§7). An unknown format likewise. csv is not a data format: it is not self-describing (delimiter, header and quoting are parameters) and only means something against a column model, so it is a table format (§6).All run with the repository's current build, node geml-parser/dist/geml.js. The probe files live in the session scratch directory; their full text appears on the left of each figure above.
| Probe | Covers | check result | Where on this page |
|---|---|---|---|
| p3-code.geml · helper.js | inline body, route, src with body, drifted range, unresolvable, disallowed scheme | 3 error 1 warning | code |
| p5-data.geml · rows.json | json, jsonl, src, bad JSON, yaml, toml, src with body, schema, unknown format, csv, coordinates | 3 error 4 warning | data |