@heroiclands/package-build 23.11.0 → 23.12.1

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -0
  3. package/assets/preview/check-sanitizer.go +68 -0
  4. package/assets/preview/gitea-theme.js +36 -0
  5. package/assets/preview/gitea.ini +127 -0
  6. package/assets/styles/content-base.css +119 -16
  7. package/bin/content-commands.mjs +2 -2
  8. package/bin/package-build-preview.mjs +75 -0
  9. package/content-config.mjs +11 -0
  10. package/docs/api.md +105 -46
  11. package/docs/authoring/links-and-markup.md +52 -14
  12. package/docs/commands.md +46 -2
  13. package/docs/configuration.md +21 -4
  14. package/docs/design.md +4 -3
  15. package/docs/guides/book.md +10 -6
  16. package/docs/reference/format-details.md +44 -40
  17. package/docs/reference/note-types.md +0 -1
  18. package/docs/reference/theme-pages.md +1 -1
  19. package/docs/source-preview.md +172 -0
  20. package/engine/base-compiler.mjs +7 -8
  21. package/engine/being-age.mjs +19 -105
  22. package/engine/calendar-notes.mjs +3 -25
  23. package/engine/compile-corpus.mjs +2 -1
  24. package/engine/content-format.yaml +0 -1
  25. package/engine/content-index.mjs +9 -9
  26. package/engine/content-spans.mjs +28 -6
  27. package/engine/current-date.mjs +37 -0
  28. package/engine/definition-list.mjs +58 -0
  29. package/engine/first-use.mjs +4 -2
  30. package/engine/frontmatter-lint.mjs +7 -2
  31. package/engine/helpers.mjs +2 -0
  32. package/engine/index.mjs +2 -0
  33. package/engine/infobox.mjs +1 -5
  34. package/engine/note-vocabulary.mjs +2 -2
  35. package/engine/npc-generate.mjs +7 -6
  36. package/engine/pdf-render.mjs +37 -4
  37. package/engine/preview-current-date.mjs +60 -0
  38. package/engine/site-build.mjs +5 -5
  39. package/engine/site-index.mjs +5 -2
  40. package/engine/site-preview.mjs +641 -325
  41. package/hugo-theme/layouts/_default/list.html +1 -1
  42. package/hugo-theme/layouts/blog/list.html +1 -1
  43. package/hugo-theme/layouts/blog-post/single.html +1 -1
  44. package/hugo-theme/layouts/partials/dictionary-lists.html +53 -0
  45. package/hugo-theme/layouts/partials/page-body.html +1 -1
  46. package/hugo-theme/static/css/style.css +22 -8
  47. package/package.json +8 -2
  48. package/types/content-config.d.mts +8 -0
  49. package/types/engine/base-compiler.d.mts +1 -1
  50. package/types/engine/being-age.d.mts +10 -44
  51. package/types/engine/calendar-notes.d.mts +2 -6
  52. package/types/engine/compile-corpus.d.mts +2 -1
  53. package/types/engine/content-index.d.mts +3 -1
  54. package/types/engine/content-spans.d.mts +4 -2
  55. package/types/engine/current-date.d.mts +9 -0
  56. package/types/engine/definition-list.d.mts +8 -0
  57. package/types/engine/frontmatter-lint.d.mts +6 -2
  58. package/types/engine/index.d.mts +2 -0
  59. package/types/engine/npc-generate.d.mts +2 -2
  60. package/types/engine/preview-current-date.d.mts +8 -0
  61. package/types/engine/site-index.d.mts +5 -1
  62. package/types/engine/site-preview.d.mts +40 -33
@@ -91,7 +91,8 @@ import { searchableFrontmatter } from "./note-package.mjs";
91
91
  import { indexRecordsFor } from "./content-index.mjs";
92
92
  // A being's computed `age` — see `engine/being-age.mjs`. `pdf-build.mjs`
93
93
  // reuses `collectContentPages`'s pages, so wiring it here reaches the book too.
94
- import { applyComputedBeingAge, presentAmongRecords } from "./being-age.mjs";
94
+ import { applyComputedBeingAge } from "./being-age.mjs";
95
+ import { normalizeCurrentDate } from "./current-date.mjs";
95
96
  import { reckoningContext } from "./reckoning-markers.mjs";
96
97
  import { resolvedDateFields } from "./note-dates.mjs";
97
98
  import { isNoteRecord, noteFile } from "./index-records.mjs";
@@ -213,9 +214,7 @@ export function collectContentPages(contentBase, ctx) {
213
214
  const addressFindings = [];
214
215
  const fmLinkFindings = [];
215
216
 
216
- // The package's declared present, read once from the same corpus the site
217
- // and the PDF share — see `engine/being-age.mjs`. `pdf-build.mjs` reaches
218
- // this through the pages this function returns, so one call covers both.
217
+ // Site and PDF pages use the setting date alongside shared calendar context.
219
218
  const records =
220
219
  ctx.records ??
221
220
  indexRecordsFor({
@@ -223,7 +222,7 @@ export function collectContentPages(contentBase, ctx) {
223
222
  config: ctx.config,
224
223
  skipDirectories: ctx.skipDirectories,
225
224
  });
226
- const present = presentAmongRecords(records);
225
+ const present = normalizeCurrentDate(ctx.config?.currentDate);
227
226
  const dates = reckoningContext({ notes: records });
228
227
 
229
228
  for (const file of siteCorpusFiles(contentBase, ctx)) {
@@ -479,6 +478,7 @@ export function siteGates(pages, findings, { config, records, sqlTables }) {
479
478
  : pages;
480
479
  out.index = buildSiteIndex(expanded, {
481
480
  package: config.contentPackage,
481
+ currentDate: config.currentDate,
482
482
  foreignIndex: foreign.index,
483
483
  foreignReferences: foreign.references,
484
484
  records,
@@ -68,7 +68,7 @@ import {
68
68
  import { NOTE_SYSTEM } from "./systems.mjs";
69
69
  import { contentPackage } from "./content-package.mjs";
70
70
  import { reckoningContext } from "./reckoning-markers.mjs";
71
- import { presentAmongRecords } from "./being-age.mjs";
71
+ import { normalizeCurrentDate } from "./current-date.mjs";
72
72
  // The declared tag vocabulary, which is where `draft` is stated.
73
73
  import { isGmNote, isDraftNote } from "./note-vocabulary.mjs";
74
74
 
@@ -165,6 +165,8 @@ function mergeForeign(index, foreignIndex) {
165
165
  * @param {readonly SiteEntry[]} entries - Every page the site will publish,
166
166
  * each already knowing its own `url`.
167
167
  * @param {object} [options] - Cross-package inputs.
168
+ * @param {string} [options.package] - The builder's own content package.
169
+ * @param {string} [options.currentDate="720.1"] - Setting-wide neutral date for recurring events.
168
170
  * @param {Map<string, {package: string, type?: string}>} [options.foreignIndex]
169
171
  * The merged index from `loadForeignIndexes`. Omit when the build publishes
170
172
  * no cross-package links.
@@ -183,6 +185,7 @@ export function buildSiteIndex(
183
185
  foreignIndex = new Map(),
184
186
  noIndexPackages = new Set(),
185
187
  package: builderPackage,
188
+ currentDate,
186
189
  records = [],
187
190
  foreignReferences = new Map(),
188
191
  syntax,
@@ -303,7 +306,7 @@ export function buildSiteIndex(
303
306
  // event's `next` is computed against this present.
304
307
  dateContext: {
305
308
  ...reckoningContext({ notes: records }),
306
- present: presentAmongRecords(records),
309
+ present: normalizeCurrentDate(currentDate),
307
310
  },
308
311
  referenceTargets: buildReferenceTargets(records, new Map([...foreignReferences, ...index])),
309
312
  index,