@heroiclands/package-build 22.4.5 → 22.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/CONTENT.md +109 -0
- package/bin/content-build.mjs +36 -8
- package/content-config.mjs +8 -3
- package/docs/api.md +86 -46
- package/docs/commands.md +64 -24
- package/docs/configuration.md +20 -1
- package/docs/content-format.md +71 -0
- package/engine/frontmatter-lint.mjs +2 -0
- package/engine/holdings.mjs +391 -0
- package/engine/index.mjs +9 -0
- package/engine/map-build.mjs +41 -11
- package/engine/map-dot.mjs +84 -24
- package/engine/map-graphviz.mjs +12 -3
- package/engine/map-layout.mjs +283 -101
- package/engine/map-places.mjs +33 -3
- package/engine/market-class.mjs +178 -0
- package/engine/metadata-index.mjs +7 -4
- package/engine/note-vocabulary.mjs +19 -0
- package/engine/site-build.mjs +88 -10
- package/engine/site-maps.mjs +165 -0
- package/package.json +1 -1
- package/types/engine/holdings.d.mts +146 -0
- package/types/engine/index.d.mts +3 -0
- package/types/engine/map-build.d.mts +13 -7
- package/types/engine/map-dot.d.mts +22 -9
- package/types/engine/map-graphviz.d.mts +8 -1
- package/types/engine/map-layout.d.mts +117 -49
- package/types/engine/map-places.d.mts +26 -0
- package/types/engine/market-class.d.mts +62 -0
- package/types/engine/note-vocabulary.d.mts +10 -0
- package/types/engine/site-build.d.mts +37 -6
- package/types/engine/site-maps.d.mts +81 -0
package/docs/commands.md
CHANGED
|
@@ -1864,7 +1864,8 @@ demo-book: error: the document tree named by `pdf.document` cannot be read
|
|
|
1864
1864
|
|
|
1865
1865
|
**NAME**
|
|
1866
1866
|
|
|
1867
|
-
Draw the containment tree, the map from a place, or the whole
|
|
1867
|
+
Draw the containment tree, the map or the chart from a place, or the whole
|
|
1868
|
+
route graph.
|
|
1868
1869
|
|
|
1869
1870
|
**SYNOPSIS**
|
|
1870
1871
|
|
|
@@ -1872,6 +1873,7 @@ Draw the containment tree, the map from a place, or the whole route graph.
|
|
|
1872
1873
|
content-build map --tree [--root <shortcode>] [--engine dot|twopi|neato] [--rankdir TB|LR|BT|RL]
|
|
1873
1874
|
[--nodesep <inches>] [--ranksep <inches>] [--no-polities]
|
|
1874
1875
|
content-build map --from <shortcode>.. | --from all
|
|
1876
|
+
content-build map --chart <shortcode>.. | --chart all [--horizon <days>]
|
|
1875
1877
|
content-build map --travel
|
|
1876
1878
|
content-build map [...] [--scale <factor>] [--base <url>] [--out <dir>]
|
|
1877
1879
|
```
|
|
@@ -1884,14 +1886,13 @@ index — so a consumer's map draws its dependencies' places beside its own
|
|
|
1884
1886
|
and no note is opened except to locate a finding. Everything lands under
|
|
1885
1887
|
`build/map/`, always the `.dot` beside the `.svg`, so a drawing can be
|
|
1886
1888
|
re-rendered, diffed or read without the index. GraphViz draws: `dot` (or
|
|
1887
|
-
`twopi`, `neato`) for the tree, `neato` for the
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
failing.
|
|
1889
|
+
`twopi`, `neato`) for the tree, `neato` for the others. It is a build-time
|
|
1890
|
+
tool of this command alone; when the engine a run needs is not installed
|
|
1891
|
+
the command says so, names what to install, and stops. A build that asks
|
|
1892
|
+
for maps as one step of a larger job — a site build — writes the `.dot`
|
|
1893
|
+
files, emits one warning and skips the renderings rather than failing.
|
|
1893
1894
|
|
|
1894
|
-
The
|
|
1895
|
+
The four drawings, any of which may be asked for in one run:
|
|
1895
1896
|
|
|
1896
1897
|
**`--tree`** — the author's check. The containment tree from `data.parents`,
|
|
1897
1898
|
edges running child → parent, clustered by continent — a `region` parented
|
|
@@ -1950,6 +1951,39 @@ sailor's chart, a tax survey, partial and from somewhere, whose prose says
|
|
|
1950
1951
|
whose it is — and never the survey. The two are two sources of the same
|
|
1951
1952
|
thing on a place's page.
|
|
1952
1953
|
|
|
1954
|
+
**`--chart <shortcode>`** — the chart from a place, `chart-<shortcode>.svg`:
|
|
1955
|
+
the world-scale drawing chosen by viewpoint rather than projection — the
|
|
1956
|
+
sea from a port, the eastern roads from a caravan city. It is the same
|
|
1957
|
+
graph from the same place with a larger horizon: the centre pinned, north
|
|
1958
|
+
up and east right, the neighbours exactly as `--from` draws them, and
|
|
1959
|
+
beyond them the hops chaining on. Hops compose as a running vector sum
|
|
1960
|
+
weighted by their days, and a hop is accepted when its bearing lies within
|
|
1961
|
+
one octant — 45° either way — of the **running composed direction** at
|
|
1962
|
+
that point, not of the previous hop; so a path may bend a little at every
|
|
1963
|
+
hop, but never turn back, and a place reached only through a hop that
|
|
1964
|
+
turns back is omitted. Where several chains reach one place, the one with
|
|
1965
|
+
the fewest total days is drawn. The total is the sum of the hops' days,
|
|
1966
|
+
placed on the ring of the smallest marker not less than it. A border
|
|
1967
|
+
carries no days: on the first hop it sits on the innermost ring, as on the
|
|
1968
|
+
map from a place; beyond the first hop it makes the total unknown, the
|
|
1969
|
+
place goes to the rim marked unknown, and the chart states nothing beyond
|
|
1970
|
+
it. `all` draws the chart from every place that states or is named in a
|
|
1971
|
+
border or a route.
|
|
1972
|
+
|
|
1973
|
+
_The horizon._ `--horizon <days>`, a marker of the scale, `360` by default:
|
|
1974
|
+
one ring per marker up to and including it, on the same log spacing as the
|
|
1975
|
+
map from a place, so a chart to a year's travel is simply a larger page
|
|
1976
|
+
with more rings. A place whose total exceeds the horizon is omitted — the
|
|
1977
|
+
chart is already the larger view, and there is no "beyond" rim, only the
|
|
1978
|
+
unknown one, a log step past the horizon. `--horizon` applies to charts
|
|
1979
|
+
alone; the map from a place keeps its horizon of 90 days and its rim.
|
|
1980
|
+
|
|
1981
|
+
_The dimming._ The neighbours are drawn full, the second hop as the map
|
|
1982
|
+
from a place draws it — grey border and label, pale fill, faint edge —
|
|
1983
|
+
and each hop beyond a step fainter, never below half opacity, so the
|
|
1984
|
+
farthest place still reads. An edge is dimmed with its far end, and
|
|
1985
|
+
labelled with its bearing and days like any other.
|
|
1986
|
+
|
|
1953
1987
|
**`--travel`** — the whole route graph, `travel.svg`, for the author: one
|
|
1954
1988
|
undirected edge per pair of places, a border dashed, each route asking
|
|
1955
1989
|
`neato` for a length on the same log scale as the rings so the god's-eye
|
|
@@ -1964,25 +1998,28 @@ page can inline the SVG. Without it the names are plain text.
|
|
|
1964
1998
|
|
|
1965
1999
|
**OPTIONS**
|
|
1966
2000
|
|
|
1967
|
-
| Option | Type | Default | Description
|
|
1968
|
-
| ------------ | ------- | ------------ |
|
|
1969
|
-
| `--tree` | boolean | `false` | Draw the containment tree: `tree.svg`, one `tree-<shortcode>.svg` per continent, and the findings.
|
|
1970
|
-
| `--root` | string | — | With `--tree`, draw the subtree beneath this place as `tree-<shortcode>.svg` and report nothing.
|
|
1971
|
-
| `--from` | string | — | Draw the map from this place as `from-<shortcode>.svg`; repeatable, or `all` for every place with a border or a route.
|
|
1972
|
-
| `--
|
|
1973
|
-
| `--
|
|
1974
|
-
| `--
|
|
1975
|
-
| `--
|
|
1976
|
-
| `--
|
|
1977
|
-
| `--
|
|
1978
|
-
| `--
|
|
1979
|
-
| `--
|
|
1980
|
-
| `--
|
|
2001
|
+
| Option | Type | Default | Description |
|
|
2002
|
+
| ------------ | ------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2003
|
+
| `--tree` | boolean | `false` | Draw the containment tree: `tree.svg`, one `tree-<shortcode>.svg` per continent, and the findings. |
|
|
2004
|
+
| `--root` | string | — | With `--tree`, draw the subtree beneath this place as `tree-<shortcode>.svg` and report nothing. |
|
|
2005
|
+
| `--from` | string | — | Draw the map from this place as `from-<shortcode>.svg`; repeatable, or `all` for every place with a border or a route. |
|
|
2006
|
+
| `--chart` | string | — | Draw the chart from this place as `chart-<shortcode>.svg` — the map from it at a larger horizon; repeatable, or `all`. |
|
|
2007
|
+
| `--horizon` | number | `360` | The charts' horizon in days, a marker of the scale: rings are drawn to it, and a place farther than it is left out. |
|
|
2008
|
+
| `--travel` | boolean | `false` | Draw the whole route graph as `travel.svg`. |
|
|
2009
|
+
| `--engine` | choice | `dot` | The tree's layout engine — `dot`, `twopi` (radial, rooted on the world or the `--root`) or `neato`. The other drawings are always `neato`. |
|
|
2010
|
+
| `--rankdir` | choice | `TB` | The tree's rank direction — `TB`, `LR`, `BT` or `RL`; `dot` engine only. |
|
|
2011
|
+
| `--nodesep` | number | by `--scale` | The tree's GraphViz `nodesep`, in inches. |
|
|
2012
|
+
| `--ranksep` | number | by engine | The tree's GraphViz `ranksep`, in inches. |
|
|
2013
|
+
| `--scale` | number | `1` | Multiply every node's width, height, font size and border weight, the legend's included. |
|
|
2014
|
+
| `--polities` | boolean | `true` | Draw polities beside their regions in the tree. `--no-polities` drops them. |
|
|
2015
|
+
| `--base` | string | — | The site base this package's pages are served under, ending in a slash; given, every name is a link to its page. |
|
|
2016
|
+
| `--out` | string | `build/map` | Directory to write into, relative to the working directory. |
|
|
1981
2017
|
|
|
1982
2018
|
**EXIT STATUS**
|
|
1983
2019
|
|
|
1984
|
-
1 when no drawing is asked for, when a `--from` or `--root`
|
|
1985
|
-
place, when
|
|
2020
|
+
1 when no drawing is asked for, when a `--from`, `--chart` or `--root`
|
|
2021
|
+
names no place, when `--horizon` is not a marker of the days scale, when
|
|
2022
|
+
the GraphViz engine a drawing needs is not installed, when a
|
|
1986
2023
|
dependency's index cannot be read, when a note the index cannot record is
|
|
1987
2024
|
met, on any error finding from `--tree` (a place with no parent, a parent
|
|
1988
2025
|
that does not resolve, a cycle), or on any other thrown error. Otherwise 0
|
|
@@ -1999,6 +2036,9 @@ assets/content/Regions/Marches/Lost_Fort.md:9:14: error: place "lostfort" names
|
|
|
1999
2036
|
$ content-build map --from dunharargn --base /thalorna/
|
|
2000
2037
|
[…] 394 place(s) → 1 drawing(s) under build/map
|
|
2001
2038
|
|
|
2039
|
+
$ content-build map --chart takheperurgn --horizon 90
|
|
2040
|
+
[…] 394 place(s) → 1 drawing(s) under build/map
|
|
2041
|
+
|
|
2002
2042
|
$ content-build map --travel
|
|
2003
2043
|
[…] GraphViz's `neato` is not installed, and `content-build map` draws with it; install GraphViz (`brew install graphviz` on macOS, `apt-get install graphviz` on Debian or Ubuntu) and run the command again
|
|
2004
2044
|
```
|
package/docs/configuration.md
CHANGED
|
@@ -770,6 +770,7 @@ Any other key under `docs.itemFields` is refused:
|
|
|
770
770
|
| `site.notfound` | object | `null` |
|
|
771
771
|
| `site.hugo` | object | `{}` |
|
|
772
772
|
| `site.search` | boolean | `true` |
|
|
773
|
+
| `site.maps` | boolean | `true` |
|
|
773
774
|
|
|
774
775
|
How much of a package reaches the web at all is **not** here — it is
|
|
775
776
|
[`publish.site`](#publish). `site` is framing: which named pass bundle
|
|
@@ -819,7 +820,7 @@ published. A `site.out` is refused by name:
|
|
|
819
820
|
|
|
820
821
|
> ``package-build config: `site` must be a mapping.``
|
|
821
822
|
|
|
822
|
-
> ``package-build config: `site.<key>` is not a recognized option (expected one of: base, assets, description, packages, pass, passOptions, notfound, hugo, search).``
|
|
823
|
+
> ``package-build config: `site.<key>` is not a recognized option (expected one of: base, assets, description, packages, pass, passOptions, notfound, hugo, search, maps).``
|
|
823
824
|
|
|
824
825
|
`site.assets` is the host every package's imagery is served from, and it is
|
|
825
826
|
the one address in this file that is not this repository's own. A note names
|
|
@@ -950,6 +951,24 @@ site:
|
|
|
950
951
|
|
|
951
952
|
> ``package-build config: `site.search` must be a boolean.``
|
|
952
953
|
|
|
954
|
+
`site.maps` is whether every place page carries the map from that place. On
|
|
955
|
+
by default: `content-build site` draws the map `content-build map --from`
|
|
956
|
+
draws — the place's borders and routes, each neighbour at its bearing — for
|
|
957
|
+
every place that states a border or a route or is named in one, lays it beside
|
|
958
|
+
the page as `from-<shortcode>.svg`, and names the file in the page's front
|
|
959
|
+
matter as `map`, which the theme inlines so every place name on it is a link
|
|
960
|
+
to that place's page. A place with no relation carries no map and no key.
|
|
961
|
+
GraphViz draws; when it is not installed the build says so once, as a
|
|
962
|
+
warning, and writes every page as it would without maps — a site never fails
|
|
963
|
+
for want of one. `false` draws nothing and asks nothing of GraphViz.
|
|
964
|
+
|
|
965
|
+
```yaml
|
|
966
|
+
site:
|
|
967
|
+
maps: false
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
> ``package-build config: `site.maps` must be a boolean.``
|
|
971
|
+
|
|
953
972
|
### The generated Hugo configuration
|
|
954
973
|
|
|
955
974
|
`content-build site` writes `build/hugo/hugo.toml` on every run. Every value
|
package/docs/content-format.md
CHANGED
|
@@ -2440,6 +2440,23 @@ subType `deity` covers a god's nature, domains, epithets and aspects in prose.
|
|
|
2440
2440
|
That frees the name for the territorial sense, which earns it: every affiliation
|
|
2441
2441
|
subType holds sway somewhere, while the divine sense applies to one.
|
|
2442
2442
|
|
|
2443
|
+
**`domains` names what the affiliation holds directly**, and nothing beneath
|
|
2444
|
+
it. A polity whose `domains` names a region holds the region; the settlements
|
|
2445
|
+
within it are the region's, reached through its `contains`, and are not
|
|
2446
|
+
repeated here. A house holds its manors and names each; the crown holds the
|
|
2447
|
+
realm and names the realm. What lies below a holder is answered by the two
|
|
2448
|
+
hierarchies together — `place.parents` for where a place sits, and
|
|
2449
|
+
`affiliation.parents` for whom a holder answers to — so a subinfeudated manor
|
|
2450
|
+
sits in one region by the first and under a lord of another polity by the
|
|
2451
|
+
second, and both pages say so.
|
|
2452
|
+
|
|
2453
|
+
The website reads `domains` across the package and every fetched index and
|
|
2454
|
+
writes the affiliation's page a `holdings` list — every place its `domains`
|
|
2455
|
+
names, each entry `{ title, url, type, subType }`, sorted by `subType` then
|
|
2456
|
+
`title`, and absent when `domains` names nothing. Every place it names carries
|
|
2457
|
+
the affiliation back in `held_by`. Both are derived; a note that writes one has
|
|
2458
|
+
it replaced.
|
|
2459
|
+
|
|
2443
2460
|
If `sohl` is present, this becomes an `affiliation` item.
|
|
2444
2461
|
|
|
2445
2462
|
| shared source | → sohl | → hm3 |
|
|
@@ -3087,9 +3104,38 @@ three maps, and none of those maps needs to know it is a keep.
|
|
|
3087
3104
|
| `lore` | `WikiLink[]` | Lore concerning this place — its peoples, its law, its calendar, its history |
|
|
3088
3105
|
| `parents` | `WikiLink[]` | Enclosing places within which this place is located |
|
|
3089
3106
|
| `population` | `number` | Approximate population (precision 2 significant digits) |
|
|
3107
|
+
| `market` | `number` | Market class, 1 to 6 — what trade a settlement supports |
|
|
3090
3108
|
| `borders` | `{ to, bearing }[]` | Places sharing a frontier with this one, and where each lies from here |
|
|
3091
3109
|
| `routes` | `{ to, bearing, mode, days, terrain?, leagues? }[]` | Journeys from this place's centre to another place |
|
|
3092
3110
|
|
|
3111
|
+
#### What a settlement's market supports
|
|
3112
|
+
|
|
3113
|
+
`population` states how many people a settlement holds; `market` states what a
|
|
3114
|
+
traveller can buy there. Those are different questions — two settlements of
|
|
3115
|
+
eight hundred are a different proposition when one holds a weekly market and
|
|
3116
|
+
the other a chartered fair with a moneylender — so a note states both, either,
|
|
3117
|
+
or neither.
|
|
3118
|
+
|
|
3119
|
+
The value is a **class**, not a measurement. The numbers order six steps and do
|
|
3120
|
+
nothing else: a `5` is not a market two fifths larger than a `3`, it is a city
|
|
3121
|
+
rather than a town. `content-build lint` refuses a value off the scale instead
|
|
3122
|
+
of rounding it onto one, so a reader can trust that a number means the same
|
|
3123
|
+
thing on every page.
|
|
3124
|
+
|
|
3125
|
+
| `market` value | the settlement is | what can be had there |
|
|
3126
|
+
| -------------- | ----------------- | ------------------------------------------------------------------------------------------------- |
|
|
3127
|
+
| `1` | a hamlet | no market — what neighbours trade among themselves |
|
|
3128
|
+
| `2` | a village | a weekly market: staples, a smith, what a household cannot make |
|
|
3129
|
+
| `3` | a town | a regular market, most common goods, several trades working full time |
|
|
3130
|
+
| `4` | a market town | a chartered fair, goods carried from a week away, a moneylender |
|
|
3131
|
+
| `5` | a city | anything ordinary, in quantity; foreign goods; a guild structure |
|
|
3132
|
+
| `6` | a great city | the rare and the imported as a matter of course; banking; the market from which other markets buy |
|
|
3133
|
+
|
|
3134
|
+
The key is meaningful on a settlement, and the lint checks no `subType`
|
|
3135
|
+
condition — as it checks none for `population`. Which places a fact says
|
|
3136
|
+
something about is the author's judgement, and the `data:` container is closed
|
|
3137
|
+
per type rather than per subType.
|
|
3138
|
+
|
|
3093
3139
|
#### Where a place is, in relation to other places
|
|
3094
3140
|
|
|
3095
3141
|
`parents` states what a place is **within**. Two more properties state what
|
|
@@ -3187,6 +3233,31 @@ closed set, and each finding is located at the entry that states it.
|
|
|
3187
3233
|
| `river` | boat |
|
|
3188
3234
|
| `lake` | boat |
|
|
3189
3235
|
|
|
3236
|
+
#### What lies within a place, and who holds it
|
|
3237
|
+
|
|
3238
|
+
`parents` states what a place is within; an affiliation's `domains` states
|
|
3239
|
+
what it holds. The website reads both across the package and every fetched
|
|
3240
|
+
index and writes each place's page two lists, each entry
|
|
3241
|
+
`{ title, url, type, subType }` and each absent when empty:
|
|
3242
|
+
|
|
3243
|
+
- `contains` — every place whose `parents` names this one, sorted by
|
|
3244
|
+
`subType` then `title`. A region lists its settlements, sites, structures
|
|
3245
|
+
and features; a settlement lists the structures within it.
|
|
3246
|
+
- `held_by` — every affiliation whose `domains` names this one, sorted by
|
|
3247
|
+
`title`.
|
|
3248
|
+
|
|
3249
|
+
Both are derived; a note that writes one has it replaced. **`domains` is
|
|
3250
|
+
never expanded**: a region held by a polity lists the polity in `held_by`, and
|
|
3251
|
+
a settlement within that region lists only the house or order whose `domains`
|
|
3252
|
+
names it — its lord's lord is reached through `affiliation.parents`.
|
|
3253
|
+
|
|
3254
|
+
**A settlement, a site or a structure is held by someone.** One of those that
|
|
3255
|
+
no affiliation's `domains` names — in this package or in a fetched index — is
|
|
3256
|
+
a warning from `content-build lint`, `unheld land`, located at the note's
|
|
3257
|
+
`type:` line, so a gap in tenure shows while a note is written. A `world`, a
|
|
3258
|
+
`region` and a `feature` are exempt: a region is held through its polity's
|
|
3259
|
+
`domains`, and a river by nobody.
|
|
3260
|
+
|
|
3190
3261
|
**A place declares only what is true of ground.** Four properties were removed
|
|
3191
3262
|
because they were true of something else, and each removal has a home to go to.
|
|
3192
3263
|
|
|
@@ -1424,6 +1424,8 @@ export function lintNote(
|
|
|
1424
1424
|
if (typeof field.check !== "function") continue;
|
|
1425
1425
|
findings.push(...field.check(note, { index }));
|
|
1426
1426
|
}
|
|
1427
|
+
// A check the type declares of the whole note, with the same index.
|
|
1428
|
+
if (typeof entry.check === "function") findings.push(...entry.check(note, { index }));
|
|
1427
1429
|
}
|
|
1428
1430
|
|
|
1429
1431
|
const fields = authoredFields(schema);
|