1Introduction
The site publishes the Kit's documents declared to the pipeline, converted into pages. The others are consulted in the downloadable archive, even after a recent update — §2.2.
The conversion starts from the Word files (.docx) produced by the stylesheet for prose documents, extracts their structure, and renders it as HTML pages with their navigation, their glossary and their home page. Each publication produces an archive ready for transfer.
The table below shows what applies in full to every project and what depends on the project, to be filled in at set-up.
| Scope | Section | Project value |
|---|---|---|
| INVARIANT | §2.1 Selection criteria for published documents | — |
| INVARIANT | §2.3 Delivery rules — tools, delta logic | — |
| INVARIANT | §3 Registry.js — structure, usage, update rule | — |
| INVARIANT | §4 Delta deployment — logic, whole-site ZIP, naming, lastDeploy | — |
| INVARIANT | §5 HTML site structure | — |
| INVARIANT | §6 PDF generation | — |
| INVARIANT | §7 Robustness rules | — |
| PROJECT | §2.2 Sections and published documents | List of the project's documents, HTML slugs, PDF activation. Define in Registry.js, section documents. |
| PROJECT | §4.3 ZIP naming | Replace the Kit's domain with that of the project's subsite. |
2Publication scope
The site publishes a deliberate selection: the Kit's working documents, the Kit's prompt included. The stylesheets, their References and the Cover Sheet, which carries the PCL constants, are not published: they travel in the archive — §2.2.
2.1Selection criteria
–The document is worth reading on its own for a Kit user.
–The document serves the use of the Kit rather than its configuration — stylesheet, Reference, rendering constants.
–The document is stable.
2.2Sections and published documents
The site is organised into numbered sections. For the Kit, the paper binder takes up the same sections, with the same titles and the same documents — see §2.5. The stylesheets do not appear there: their documents are found in the downloadable archive.
| # | Title | Documents | HTML file | |
|---|---|---|---|---|
| 01 | Before you begin | Kit — Documentation — How to document your projects | comment-documenter-[document language].html | yes |
| Kit — Documentation — Reading Guide | reading-guide-[document language].html | yes | ||
| 02 | Working with Claude AI | Claude AI — Documentation — Manual | claude-manuel-[document language].html | yes |
| Claude AI — Documentation — Practical Guide | claude-guide-pratique-[document language].html | yes | ||
| Claude AI — Documentation — Environment | claude-environnement-[document language].html | yes | ||
| 03 | Starting and maintaining a project | Kit — Project — Initialisation Guide | guide-initialisation-[document language].html | yes |
| Kit — Project — Update Guide | guide-mise-a-jour-[document language].html | yes | ||
| Kit — Project — Naming Convention | convention-nommage-[document language].html | yes | ||
| 04 | Steering the AI and adapting the Kit to your needs | Kit — Documentation — Dialogue Commands | prompts-de-dialogue-[document language].html | yes |
| Kit — Documentation — Extending the Kit | etendre-le-kit-[document language].html | yes | ||
| 05 | Files and structure | Kit — Project — Prompt | kit-prompt-[document language].html | yes |
| Kit — Project — Common Structure | structure-commune-[document language].html | yes | ||
| Kit — Documentation — Execution environment | environnement-execution-[document language].html | yes | ||
| Kit — Documentation — HTML Pipeline | pipeline-html-[document language].html | yes | ||
| Kit — Documentation — Quality Control | quality-control-[document language].html | yes | ||
| Kit — Glossary — Terms | glossaire-[document language].html | no | ||
| 06 | Publishing and sharing a project | Kit — Documentation — Publishing and reuse | publication-reprise-[document language].html | yes |
2.3Delivery rules
Each generation produces either a full pass — first deployment or lastDeploy null — or a delta pass for every later deployment. The logic is driven by the Registry. See §4 for details.
| File produced | Tool | Full pass | Delta |
|---|---|---|---|
| html/*.html — document pages | Node.js, pandoc AST, HTML stylesheet | All | The .docx changed since lastDeploy; all if the HTML stylesheet has changed — §4.2 |
| html/glossaire.html, or glossaire-{language}.html per published language | Kit helper kit_gen_glossaire_html.js from the terms module, never via the AST | Always | Always |
| index.html and index-{language}.html — loaders | Node.js, pageChargeur() | Always | Always |
| html/a-propos.html, about.html, ueber.html, iwwer.html — About this site page, one per site language | Node.js, renderAboutPage() on the data of etatDuSite() | Always | Always |
| assets/kit-style.css | Node.js, getCSS() | Always | If the HTML stylesheet has changed since lastDeploy |
| assets/pdf/*.pdf | LibreOffice CLI from the source file .docx | If PDF is enabled | With the matching .html |
| assets/pieces/* — appendix pieces | Direct copy from the project root, declared by the piece key | If declared | The sheet produces its own PDF, like any document |
| assets/png/{slug}/*.jpg, *.png — linked photos | Copied from the project’s assets/png/, checked — HTML Reference §14.7 | Always | Always |
| .htaccess | Not produced — origin declared under deploy.siteInfrastructure, Kit - Projet - Prompt §16 | Out of scope | Out of scope |
| robots.txt | Not produced — origin declared under deploy.siteInfrastructure, Kit - Projet - Prompt §16 | Out of scope | Out of scope |
A document published in several languages produces one page per variant, each with its suffixed slug and its own entry in Registry.documents. The delta compares slug by slug, so each language is republished independently of the others. Where the language selector appears follows the mode declared in the Registry under rendering.languageSelector — Common Structure §15.
2.4Home page — introductory block
The landing page shows a quotation block above the list of sections. This text is the official source of truth — the index generator copies it verbatim into its dedicated constant.
A framework for documentation projects carried out with Claude. Together, you write your documents, and the Kit turns them into complete documentation: a website, a paper binder, or both, as you need. This site brings together the guides, the glossary and the dialogue commands, in French, German and English.
The text is passed to the landing generator through the configuration field provided for it. If the field is empty or absent, the block is hidden automatically — no orphaned orange bar.
The same rule applies to consumer projects: each project's HTML Pipeline defines its own text in §2.4, copied verbatim by its site generator.
The landing page illustration, when rendering.indexIcon declares it, leads to the document the project designates under rendering.indexTarget — a family or a published slug, todos by default. On a multilingual site, the link follows the language of the index; a document with no variant in that language opens in the project language, and its language icons lead to the others. The document page carries its PDF button. A target that cannot be found stops the pass. The Kit publishes its Todos in each of its languages without listing it in the index: the illustration is its entry point.
A discreet i, to the right of the introduction title, leads to the About this site page, in the language of the index: the version of the Kit that built the site, the last pass, the stylesheet versions with the document floor, the Kit archive, then the state of each document — up to date or compliant —, and the Kit’s address. The generator produces it at every pass, for every site — HTML Reference §24.
2.5Paper Cover Sheet and HTML landing page — independent indexes
The binder's index, in §2 of the Cover Sheet document, and the site's, in the section constant of the site generator, are declared separately. No script reads one to drive the other.
Whether they match is the project's choice. The Kit keeps them identical: the same sections and the same documents in the same reading order, the binder carrying only the base language. A project may also put together a lighter binder that takes up only part of what the site publishes.
The HTML landing page remains the web index: it enriches each entry with publication metadata, and what is not read online is left out — stylesheets, Registry, Cover Sheet, data modules.
The shared look — numbered sections, spirit, reading key — is kept in every case; the divider colours stay with the paper — Common Structure §11.
A project's site generator is the gen-*-site.js that requires kit_publication.js, one per project; gen-[prefix]-site.js is its recommended name. The Kit has its own, separate from those of consumer projects. A project's generator is a durable project file, written once and maintained thereafter — Naming Convention §3.5. The Kit's, gen-kit-site.js, is a stable Kit artifact; it stays tied to the Kit's structure, and no project takes it over: started outside the Kit folder, it stops and points to the project's generator.
3Registry — central source of truth
The Registry is the pipeline's single point of configuration. It holds the stylesheet versions, the generation timestamps of each document, the rendering flags, the compilation notice and the last deployment. Any information that could be derived for consistency is read here.
3.1Structure
The Registry exports an object whose sections are described in the table below. The file has no timestamp in its name — it is the source of timestamps. The Registry of a consumer project is documented in Common Structure §5: its optional stylesheets section lists only the stylesheets the project writes; the Kit's remain declared in the Kit's Registry.
| Section | Keys | Content |
|---|---|---|
| project | docLanguage, siteLanguages, documentAuthor, webAuthor, documentSiteBase, allowNonKitTemplates, projectShareable, autoAddGlossary, autoAddTextHighlights, autoAddBrands | Identity and language of the Kit. Drives the stylesheets' L10N selection and the Cover Sheet renderer's localised constants. Also holds the author of documents and pages, and the root for cross-document references. Also declares the site languages, the offer for take-over, the templates outside the Kit and the automatic additions — Common Structure §5.1. |
| requires | coverSheet, readingGuide, glossary, textHighlights, documentTitles, brands, variableNames, hassEntities, colors | Presence flags for data modules and optional files. Read by generators to make require() and setters conditional. |
| stylesheets | general, glossary, yaml, html | Semantic version, timestamp of the .js and .docx file set, and the minDocumentVersion floor below which a published document is obsolete — for General, and for Glossary and YAML, whose version is in the fingerprint of the documents that use their renderings. |
| familyDomains | array of hostnames | Domains whose links stay captured in the Android app's WebView. Read by setFamilyDomains(). |
| documents | one slug per document | Timestamp of the last generation. One entry per language variant for translated documents. |
| rendering | homeHref, languageSelector, indexIcon, indexTarget, toc, images, translationNote, coverDate | Flags driving deliverable generation: home icon of the landing page, the other pages returning to the index of their language, language selector position, generation and hiding of the HTML TOC. Landing page illustration and the document it leads to — §2.4. images, optional: caps for linked photos — §7.10. translationNote, optional: translation note of the variants, false by default — Kit Prompt §17. coverDate, optional: format of the date in the cover page footer — Common Structure §5.1. |
| compiledWith | object per language or null | Compilation notice in the HTML footer. null or absent: no notice. Never concerns the .docx. |
| projectZip | version, filename, updated, downloadUrl, include | Release downloadable from the landing page. Version number as per Naming Convention §6. downloadUrl: address of the archive, followed by the projects that take the Kit. include, optional: the part of the project outside the Kit, which enters the archive — Common Structure §11. |
| deploy | siteName, siteInfrastructure, lastDeploy, lastArchive, historicalPath | Name of the published site, which names the archive; origin of robots.txt and .htaccess; ISO timestamp of the last deployment, written only by the site generator. lastArchive: the project archive produced by the last pass; missing at the start of a pass, it is requested — Common Structure §11. historicalPath, optional: path of the pages present only on the server — §4. |
module.exports = {
project: { docLanguage: 'FR' },
requires: { coverSheet: true, readingGuide: true, glossary: true,
textHighlights: true, documentTitles: true, brands: true,
variableNames: false, hassEntities: false, colors: false },
stylesheets: {
general: { version: '…', ts: 'AAAA-MM-JJ - HHhMM',
minDocumentVersion: '…' },
glossary: { version: '…', ts: 'AAAA-MM-JJ - HHhMM',
minDocumentVersion: '…' },
yaml: { version: '…', ts: 'AAAA-MM-JJ - HHhMM',
minDocumentVersion: '…' },
html: { version: '…', ts: 'AAAA-MM-JJ - HHhMM' },
},
familyDomains: ['sliver.lu'],
documents: {
'reading-guide-fr': { ts: 'AAAA-MM-JJ - HHhMM' },
// un slug par document Kit ; un slug par variante de langue
},
rendering: {
homeHref: 'https://sliver.lu',
languageSelector: 'site',
indexIcon: true,
indexTarget: 'todos',
toc: { generate: false, hidden: true },
},
compiledWith: null, // objet par langue, ou null
projectZip: { version: '…', filename: '…', updated: 'AAAA-MM-JJ',
downloadUrl: '…' },
deploy: {
siteName: '…',
siteInfrastructure: 'parent', // 'parent' | 'project' | 'none'
lastDeploy: null, // ISO 8601 UTC
lastArchive: null, // archive de la dernière passe réussie
},
};3.2Use in generators
Every generator that uses cross-references loads the Registry at start-up and reads the values dynamically.
const registry = require('./Kit - Registry.js');
const v = registry.stylesheets.general.version; // version active
const ts = registry.documents['reading-guide-fr'].ts; // horodatage document
const toc = registry.rendering.toc.generate;
const last = registry.deploy.lastDeploy; // null ou ISO3.3Update rule
The Registry is never edited by hand — Common Structure §5.3: the AI updates it on request, except for the fields the site generator writes itself.
–Stylesheet version changed: update the file set's version and timestamp in the stylesheets section.
–Document regenerated: update the timestamp of the slug concerned. A translated document has one entry per variant.
–Rendering flag adjusted: update the rendering section. Renderers read this flag at generation time — a simple switch needs no document to be regenerated.
–Compilation notice: update compiledWith. An editorial decision, with no effect on the documents produced.
–lastDeploy: updated automatically by the site generator after each ZIP is generated. Never edit by hand.
–Content dates: contentTs and contentHash, in the documents section, are written by the site generator. At every pass it takes, through empreinteDeContenu() of kit_publication.js, the fingerprint of the plain text of the body, what follows the first heading — headings, paragraphs, list items, cells, notes, tips, code and prompt blocks, image captions —, without the title page the stylesheet composes, without indentation, colour, italics, version fingerprint or timestamp, and with the non-breaking space, the zero-width space and the non-breaking hyphen neutralised. Same fingerprint: nothing moves. Different or absent: contentTs takes the document's timestamp. A fingerprint equal to that of the former formula, title page included, is replaced without redating the document — Quality Control §3.19. The history page is dated on contentTs, so a stylesheet bump, which regenerates the corpus without changing its text, adds no line to it. Never edit by hand. The write preserves the entry's other keys — the pdf key, for one — and an entry whose value carries a brace or a bracket is reported by name, as a warning, instead of being rewritten.
–Icons of the subsite: the subsite's icons — favicon.svg, favicon.ico, apple-touch-icon.png and index-icon.svg — live at the root of the project, and the pass copies them into the site's resources. They belong to the project — Kit Prompt §16: a subsite taken over from its archive alone keeps its identity. The pass stops, naming the file that is missing; index-icon.svg is expected only if rendering.indexIcon declares it. deploy.siteInfrastructure covers robots.txt and .htaccess only. The drawing in index-icon.svg centres itself in its display area, vertically and horizontally, and fills it: the stylesheet centres the box — HTML Reference §17.2 —, never the content of the file, and an off-centre drawing shows exactly as it is on the page.
–Project archive: the pass produces the project archive through kit_publication.js — Quality Control §3.19 —, under the name declared in projectZip.filename, for every project — Common Structure §11. When projectShareable is true, it places it under assets/downloads/; otherwise it delivers it at the project root, beside the site ZIP. When shared, the publication ZIP carries it, so that the landing page's link and projectZip.downloadUrl resolve the announced version, with no separate deposit. It is composed from a list: neither the site folder, nor the archives, nor any hidden file go into it.
4Delta deployment
The generator produces a single ZIP, which carries the whole site. The state of lastDeploy governs what is regenerated — every page, or only those whose document has moved — never what the archive contains. A partial archive unpacked onto a complete folder takes away everything that was not in it, and the loss shows only when the lost page is visited. The pass therefore stops if the site folder does not carry one page per published document: run the full pass instead. A full pass sets the existing site aside after the fingerprint gate and restores it if it stops: a rejected document leaves the published state intact. The output folder, KIT_OUT_DIR, must be a subfolder of the project, distinct from docx/ and from the temporary folder; the pass refuses any other path.
4.1Delta logic
The comparison uses the document's local timestamp, read from the Registry, converted to ISO 8601 UTC and then compared with lastDeploy. A document with a later timestamp triggers the regeneration of its page and its PDF; linked photos are copied at every pass — HTML Reference §14.7. The others keep their page: the ZIP always carries the whole site — §4. A change of the HTML stylesheet regenerates every page — §4.2.
// lastDeploy null = passe complète
const lastDeployIso = (mode === 'full')
? null
: (registry.deploy && registry.deploy.lastDeploy);
function kitTsToIsoDateTime(ts) {
// 'AAAA-MM-JJ - HHhMM' en heure locale Luxembourg vers ISO 8601 UTC.
// L'offset local (CET +1h, CEST +2h) est recupere via Intl.DateTimeFormat
// et soustrait pour obtenir l'UTC reel. Sans cette conversion, toutes
// les comparaisons seraient decalees de une ou deux heures.
const m = /^(\d{4})-(\d{2})-(\d{2})\s*-\s*(\d{2})h(\d{2})$/.exec(ts || '');
if (!m) return null;
const [, y, mo, d, h, mi] = m;
const naive = new Date(Date.UTC(+y, +mo - 1, +d, +h, +mi, 0));
const dtf = new Intl.DateTimeFormat('en-US', {
timeZone: 'Europe/Luxembourg',
timeZoneName: 'longOffset',
});
const tz = dtf.formatToParts(naive).find(p => p.type === 'timeZoneName');
const m2 = /GMT([+-])(\d{2}):(\d{2})/.exec(tz ? tz.value : '');
if (!m2) return naive.toISOString();
const offsetMin = (m2[1] === '+' ? 1 : -1) * (+m2[2] * 60 + +m2[3]);
return new Date(naive.getTime() - offsetMin * 60 * 1000).toISOString();
}
function isNewerThanLastDeploy(ts, lastDeployIso) {
if (!lastDeployIso) return true; // passe complete
const iso = kitTsToIsoDateTime(ts);
if (!iso) return true; // prudence : inclure si TS incompatible
return iso > lastDeployIso;
}
// Dans la boucle des documents :
const meta = registry.documents && registry.documents[slug];
if (!meta || !meta.ts) continue;
if (mode !== 'full' && !isNewerThanLastDeploy(meta.ts, lastDeployIso)) {
console.log('- ' + slug + ' (inchange, exclu du delta)');
continue;
}4.2Special case — the stylesheet
If the HTML stylesheet has changed since the last deployment — its timestamp in the Registry is later than lastDeploy —, the pass regenerates the CSS file and every page: a new version of the stylesheet changes what each page carries. Since a consumer project's Registry does not declare the Kit's HTML stylesheet — Common Structure §5.1 —, the CSS and the pages are regenerated in full there only on a full pass.
4.3ZIP naming convention
Pattern: {domain} (YYYY-MM-DD - HHhMM).zip. The ZIP of the Kit's subsite therefore carries the Kit's domain. Consumer projects replace the domain with that of their subsite.
4.4Automatic update of lastDeploy
After a ZIP is generated successfully, the generator writes the ISO timestamp of the current moment into lastDeploy. This operation rewrites the Registry on disk.
5Site structure
All HTML pages — documents, glossaries, per-language index pages — sit in the html/ subfolder. At the root of the subsite the Kit writes only the loaders index.html and index-{language}.html, which carry no content. This separation keeps the hierarchy readable and the relative paths uniform from every page.
5.1File hierarchy
| Path | Content |
|---|---|
| [subsite]/ | Root of the subsite |
| index.html, index-{language}.html | Loaders for the index pages. The only files the Kit writes at the root; they carry no content. |
| html/ | Folder for every document page and the per-language index pages |
| html/[slug].html | Document page — one file per published document |
| html/[slug]-[lang].html | Language variant of a translated document — Naming Convention §2.4 |
| html/a-propos.html, about.html, ueber.html, iwwer.html | About this site page, one per site language: the Kit that built it and the state of each document — HTML Reference §24 |
| html/glossaire.html, html/glossaire-{language}.html | HTML glossary, one per published language when it is translated — generated by the Kit helper from the terms module, never via the AST |
| assets/ | Shared resources |
| assets/kit-style.css | HTML style sheet, generated from the stylesheet |
| assets/favicon.svg | Main icon. Carried by the project — Kit - Projet - Prompt §16 |
| assets/favicon.ico | Multi-size fallback. Carried by the project — Kit - Projet - Prompt §16 |
| assets/apple-touch-icon.png | iOS home-screen icon. Carried by the project — Kit - Projet - Prompt §16 |
| assets/index-icon.svg | Illustration of the landing page. Carried by the project — Kit - Projet - Prompt §16 |
| assets/downloads/ | Project archive offered for download from the landing page. Folder present when projectShareable is true in the Registry: the pass produces the archive there, under the name declared in projectZip.filename, and the publication ZIP carries it. |
| assets/pieces/ | Appendix pieces deposited by the project, under their original name — never the slug, never a produced file. HTML Pipeline §6.3 |
| assets/pdf/ | PDFs generated from the .docx — one per enabled document |
| assets/png/{slug}/ | Photos linked by the documents, copied from the project’s assets/png/ — one folder per document that introduces them, HTML Reference §14.7 |
| robots.txt | Crawling directives. Deposited by the origin declared under deploy.siteInfrastructure — Kit - Projet - Prompt §16 |
| .htaccess | Apache configuration of the subsite. Generated by the parent site's project, never by a subproject — Kit - Projet - Prompt §16 |
5.2Relative paths
Pages in the html/ subfolder reach the style sheet, the images and the PDFs by going up one level, to assets/. The other pages — the index page of their language, the glossary, the documents — sit beside them, in html/.
5.3Structure of the deployment ZIP
The ZIP mirrors the hierarchy above exactly. Extracting it on the server rebuilds the expected structure with no manual handling.
kit.sliver.lu (AAAA-MM-JJ - HHhMM).zip ├── index.html ├── index-fr.html ├── index-de.html ├── index-en.html ├── index-lu.html ├── html/ │ ├── kit-index-fr.html │ ├── kit-index-de.html │ ├── kit-index-en.html │ ├── reading-guide-fr.html │ ├── claude-manuel-fr.html │ ├── glossaire-fr.html │ └── ... └── assets/ ├── kit-style.css ├── pdf/ │ └── reading-guide-fr.pdf └── downloads/ └── kit-x.yy.zip
A site publishes one index page per language, in html/, named {prefix}-index-{language}.html — the prefix comes from deploy.siteName. The base language carries its suffix like the others: none has two possible addresses.
–Localised content. Section titles, document labels, subtitle, welcome text and index page title follow the language of the page. The labels come from the titles table — Common Structure §6.8; the section titles come from sectionTitles in the same table, with the site generator's constant as fallback.
–Links to the right variant. The German index page points to the German pages. An untranslated document appears there under its German label and points to the existing variant.
–Language selector. Each index page links to the others through the language selector, placed according to rendering.languageSelector — Common Structure §15. The history page has one name per language: historique, verlauf, history.
6PDF generation
A PDF can be generated from a Word document directly in the session with LibreOffice on the command line, when the environment provides it — Execution environment §2. If the source file is in the working tree, the PDF can be produced without any action on the user's side.
6.1Reference command
soffice --headless --convert-to pdf document.docx --outdir ./ # Exemple avec chemin complet : soffice --headless \ --convert-to pdf \ 'Kit - Documentation - Pipeline HTML - FR (AAAA-MM-JJ - HHhMM).docx' \ --outdir /mnt/user-data/outputs/
6.2Integration into the site generator
If a document's entry in the Registry carries pdf at true, the generator produces the PDF with LibreOffice and includes it in the ZIP under the PDF folder. The Kit site carries the same key in SECTIONS of gen-kit-site.js.
6.3Annexes and manuals — external PDF
Documents in the Annexe and Manuel categories of a consumer project accompany an original piece: a PDF that is never produced by LibreOffice. The piece is declared in the Registry, through the piece key of the document’s entry, and lives at the root of the project. The generator copies it as is — no conversion is called for it.
No matching by base name: the Registry names the file, and it alone. The piece follows the pattern of Naming Convention §8, [Prefix] - {Annexe|Manuel} - [Name].pdf: that is how the project archive's allow-list recognises it — Common Structure §11.
–Sheet and piece: the sheet carries a timestamp, the piece never does — it is a frozen source file, deposited as is.
–HTML slug: prefixed with the category to avoid any collision if two documents with the same name exist in two different categories.
–Pipeline behaviour: direct copy of the piece under assets/pieces/; the document follows the normal chain of HTML generation and validation.
–Loud failure when missing: if the declared piece is missing from the project root at generation time, the generator stops and names the missing file. No silent fallback to a generated PDF, no page without an icon.
–Landing page sections: the permanent Annexes and Manuals sections appear at the end of the subsite's landing page, after the numbered sections. Each is hidden if it holds no document. Alphabetical order within each.
–Genre of the sheet: the document accompanying the piece is a document of record — Kit Prompt §12. It reports on the piece without copying it, names what is wrong, and closes on the section of points found. §6.3 settles the mechanics; the genre of the text is read in the Prompt.
–The sheet is published, the button serves the piece: the appendix sheet is published like any other page, and its download button returns the original piece, never the PDF drawn from it. The piece is declared in the Registry, through the piece key of the document's entry, and lives at the root of the project; the pass copies it under assets/pieces/, under its original name and never under the slug, and stops, naming it, if it is missing. The folder separates what is deposited from what is produced: a piece and a sheet's PDF cannot collide.
–The PDF of the sheet is still produced: it enters the site ZIP, for the binder, and no page links to it: the reader is thus never made to choose between two PDFs of which only one holds. The button changes neither icon nor label from page to page — the note at the head of the sheet says what it returns.
Reference pattern for the site generator: the piece is copied by copierPieces() of kit_publication.js, which kit_check_setters.py --html requires — §7.9 —, and the sheet's button serves it.
// gen-[préfixe]-site.js — extrait pour une fiche d'annexe
const pub = require('../kit/kit_publication.js');
// La piece se declare au Registry, par la cle piece de l'entree du
// document ; elle vit a la racine du projet. copierPieces() la copie
// sous assets/pieces/, sous son nom d'origine, et s'arrete en la
// nommant si elle manque — un appel par passe, apres demarrer().
pub.copierPieces({ racine: PROJECT_DIR, siteDir: OUTPUT_DIR, registry });
// Dans la boucle de generation de chaque document : le bouton de la
// fiche sert la piece, jamais le PDF de la fiche.
const meta = (registry.documents || {})[slug] || {};
const pdfHref = meta.piece ? `../assets/pieces/${meta.piece}` : undefined;
// Le .docx suit la chaine ordinaire : page HTML, et PDF si le drapeau
// du document l'autorise. Ce PDF reste dans assets/pdf, sans lien.7Robustness rules
This section documents the pipeline's most dangerous traps and the mandatory rules that follow from them. Each rule comes from a real error that caused lost content or corrupted rendering.
7.1The doc.paragraphs trap — silent loss of tables
If an update script reads an existing document with a Python library and iterates over its paragraphs to rebuild it, every table disappears silently. The document produced is syntactically valid but stripped of its tabular content.
Measured on a real document: 300 paragraphs in the XML, of which only 84 were visible to the iteration — 28 per cent. The other 216 lived in the tables, and all 18 tables were lost without the slightest warning.
7.2Escaping on paths
The HTML stylesheet’s escaping function protects the special characters of everything written into the page — running text and attribute values alike. An image source, a link target or a path is therefore escaped too, once, when the attribute is written.
–Forbidden: escaping twice — a value already escaped, passed through the function again, yields & and corrupts the path — or escaping a path before reading the file on disk.
–Required: escaping every value written into an attribute, paths included, as well as all cell or paragraph text.
7.3Prior reading specific to the HTML pipeline
Reading the References before generation follows Prompt §5.1. The following readings are specifically required before writing the first line of an AST converter or a site generator.
–HTML Reference: in full, in particular the function contracts and the AST conversion pipeline.
–General Reference: §1.2 for the basic structure of a document and §13 for the return contracts — the converter produces HTML but reasons on structures taken from the Word model (.docx).
Strict stop rule: if any of these documents has not been read in the current session, full stop. Do not ask a question, do not assume, do not continue.
7.4Validating the source document before conversion
A document enters the HTML pipeline only after passing the validation chain. The validator's detailed contract — list of checks, usage, return codes — is in Quality Control §3.1. The conditions below are specific to the pipeline and checked on entry. The fingerprint and the version do not ask the same question: the fingerprint tells whether the document was produced by the Kit, the floor whether it still renders faithfully.
| Condition | Expected | Consequence if absent |
|---|---|---|
| Fingerprint present | StylesheetVersion and GeneratedAt in the document properties | Absent: the document is rejected at conversion |
| Version up to date | StylesheetVersion greater than or equal to minDocumentVersion, the floor declared in the Registry; GlossaryVersion and YamlVersion, when the document carries them, greater than or equal to the floor of their stylesheet | Lower: the document is obsolete and blocked |
| Validator passed | kit_validate_docx.js exit 0 on the source .docx | A document that has not been validated must never enter the pipeline |
7.5The level of a heading comes from the document
The conversion returns a heading block carrying its level, and the generator reads it as it stands. This rests on the style inheritance chain, which General sets up by declaring the Normal style: without it, a converter that resolves inheritance recognised no heading, and everything that followed stayed at the level of the previous one.
The text of a heading decides nothing. A paragraph starting with a number stays a paragraph; a heading whose text starts with a digit stays a heading, which Kit Prompt §12 forbids in any case for readability.
7.6Paragraph with a bold lead — the separator stays
When the AST converter meets a paragraph starting with bold text, it detects a bold lead and calls the matching helper with the bold text and the rest of the sentence.
The rest goes through as it stands. The separator that follows the lead — colon, em dash, plain hyphen — belongs to the document: it reads on paper and must read on the page. The HTML stylesheet sets none of its own, so nothing is doubled.
Rule: nothing is stripped from the start of the rest, neither separator nor space. A strip costs a character that the text-conservation guard then requires, and publication stops on a loss coming from the generator and not from the document. This rule applies to any AST converter written from scratch.
7.7Family and external hyperlinks
The HTML generator must distinguish links to the family's domains and their subdomains, which stay captured in the mobile app's WebView, from external links, which must open in the system browser. This distinction is handled by an internal helper of the HTML stylesheet, which adds the external-opening attributes to the latter only.
Configuration: the list of family domains is declared in the Registry, and every site generator calls the matching setter at the top. If the setter is never called, every absolute link is treated as external.
Matching mechanics. Relative URLs and anchors are family by definition. Non-http schemes — email, telephone — are family by definition, since the system handles them. For absolute URLs the host name is extracted and compared with the list: exact match or subdomain. Cross-links between family sites therefore stay in the WebView.
A CSS class is set on external links as a hook, deliberately declared empty. It lets a project style external links differently without touching the stylesheet. The helper is called when URLs are detected in running text and for table cells carrying a link.
7.8Single-column blocks at conversion
A code or dialogue block may come out of the conversion with its first row in the header of its table. The generator therefore reads every row for these blocks, and takes the first of that set for the note and the tip.
The header and body split holds for the ordinary table alone: read from the body alone, the first row of a block would be lost, and the conservation guard would stop the pass, naming a fragment it could not find.
7.9Mandatory setters at the top of the site generator
Every HTML site generator must call a series of setters at the top, before building the first element. A missing required setter silently disables the matching pipeline: the generator runs without error but produces a semantically truncated site.
| # | Setter | Source | Effect if absent |
|---|---|---|---|
| 1 | setLanguage | Registry.project.docLanguage | Default EN — every localised string in English |
| 2 | setFamilyDomains | Registry.familyDomains | Every absolute link treated as external |
| 3 | setGlossaryTerms | terms module, surfaces of the page language | No glossary link on any page — semantically truncated site |
| 4 | setBrands | project's brands module | No brand rendered in small caps |
| 5 | setVariableNames | project's variables module | No variable name rendered in green italics |
| 6 | setHassEntities | project's entities module | No entity rendered in purple italics |
| 7 | setGlossaryHref | glossary slug of the rendered language | Every term link targets the same page — a non-French-speaking reader gets the definitions in the project's language |
| 8 | setDocumentTitles | [Prefix] - Document Titles (TS).js — titleEntries and categoryLabels, with the project language | Labels frozen in the project language, no document reference turned into a hyperlink, title page subtitles not composed |
| 9 | setLanguageSelector | Registry.rendering.languageSelector | Default “document”: icons at document level instead of the bar menu |
| 10 | setTextHighlights | project's Text Highlights module | No declared fragment highlighted |
| 11 | setWebAuthor | Registry.project.webAuthor | Footer signed “Author not declared” in the page language |
| 12 | setColors | project colours module, html table | Kit colours across the whole site |
| 13 | setSiteInfrastructure | Registry.deploy.siteInfrastructure | Default “parent”: robots.txt and .htaccess expected from the parent site |
| 14 | setKitDocumentTitles | ../kit/Kit - Document Titles (TS).js — titleEntries, with the Kit site root and language, read from the Kit's Registry; projects only | A Kit document cited by the project leads to the namesake page of the project, or nowhere |
Data setters depend on the Registry flags — a project with no glossary does not call the matching setter, since the module does not exist. Those every site generator calls unconditionally are the ones kit_check_setters.py --html requires — Quality Control §3.4. setGlossaryHref concerns only projects publishing their glossary in several languages: its default value suits a monolingual project, and it is called once per rendered document, since the target changes with the document's language. setGlossaryTerms is likewise called again with buildSearchTerms of the page language: a translated page recognises the terms of its own language — Common Structure §6.1.
The generator also passes the stylesheet the compilation notice read from the Registry and, for each translated document, the list of its published languages. This list is declared in the generator, never in the Registry: the translation scope is decided document by document.
The glossary window and the Back arrow of its pages belong to the rendering, with no setter: the HTML stylesheet sets them — HTML Reference §28 —, and a generator does not compose them again.
// Patron canonique en tete de gen-[préfixe]-site.js — ordre recommande
// Le Kit vit dans ../kit/, jamais copie — Structure commune §3
const path = require('path');
const registryPath = path.resolve('[Préfixe] - Registry.js');
const registry = require(registryPath);
const style = require('../kit/Kit - Stylesheet - HTML - Code (TS).js');
const pub = require('../kit/kit_publication.js');
const LANG = registry.project.docLanguage;
// 1. Setters que kit_check_setters.py --html exige toujours
style.setLanguage(LANG);
style.setFamilyDomains(registry.familyDomains || []);
style.setWebAuthor(registry.project.webAuthor);
style.setLanguageSelector((registry.rendering || {}).languageSelector || 'document');
style.setSiteInfrastructure(registry.deploy.siteInfrastructure || 'parent');
// 2. Setters de donnees selon Registry.requires — Structure commune §6.6
const req = registry.requires;
let termes = null; // surfaces par langue, plus bas
if (req.glossary) {
termes = require('./[Préfixe] - Glossary - Terms (TS).js');
style.setGlossaryTerms(termes.buildSearchTerms(LANG));
}
if (req.brands) {
const { brandEntries } = require('./[Préfixe] - Brands (TS).js');
style.setBrands(brandEntries);
}
if (req.variableNames) {
const { variableNameEntries } = require('./[Préfixe] - Variable Friendly Names (TS).js');
style.setVariableNames(variableNameEntries);
}
if (req.hassEntities) {
const { hassEntityEntries } = require('./[Préfixe] - HASS Entities (TS).js');
style.setHassEntities(hassEntityEntries);
}
if (req.textHighlights) {
const { highlightEntries } = require('./[Préfixe] - Text Highlights (TS).js');
style.setTextHighlights(highlightEntries);
}
if (req.colors) {
const { colorEntries } = require('./[Préfixe] - Colors (TS).js');
style.setColors(colorEntries.html);
}
if (req.documentTitles) {
const t = require('./[Préfixe] - Document Titles (TS).js');
style.setDocumentTitles(t.titleEntries, t.categoryLabels, LANG);
// Documents du Kit cites par le projet — General Reference §16
const kitReg = require('../kit/Kit - Registry.js');
const kt = require('../kit/Kit - Document Titles (TS).js');
style.setKitDocumentTitles(kt.titleEntries, kitReg.project.documentSiteBase,
kitReg.project.docLanguage);
}
// 3. Publication — Quality Control §3.19
// Propres au generateur : mode ('full' ou 'delta'), publies et entrees
// (documents du projet), releves (vide, rempli ci-dessous a chaque
// page ecrite), zipPath (ZIP du site, a la racine du projet), langues (du
// site), passe (horodatage), aPropos ({ famille, nom, langue, chemin }
// par page publiee), conversion (dossier de travail, hors du projet).
const racine = process.cwd();
const siteDir = path.join(racine, 'site'); // sous-dossier du projet, hors docx/
const manque = pub.verifierDepart(registry); // joint au controle des capacites
if (manque.length) throw new Error(manque.join('\n'));
pub.controlerDocuments(publies); // chaque document publie, delta compris
pub.demarrer({ racine, siteDir, registry, mode });
style.resetCiblesDeLiens(); // releve des cibles de liens, vide a l'entree
const produits = [...pub.copierIcones({ racine, siteDir, registry }),
...pub.copierPieces({ racine, siteDir, registry })];
for (const doc of entrees) { // documents a convertir
style.setLanguage(doc.langue); // langue de la page
if (termes) style.setGlossaryTerms(termes.buildSearchTerms(doc.langue));
style.setGlossaryHref(`glossaire-${doc.langue.toLowerCase()}.html`);
const conv = pub.preparerConversion(doc.chemin, conversion, registry);
const blocs = pandoc(conv.docx); // AST du document — §7.10
const corps = convertir(blocs, t => pub.imageDeMarqueur(t, conv.images));
pub.controlerAncres(doc.slug, corps); // avant renderDocument
releves.push({ cle: doc.cle, ts: doc.ts, // date de contenu — §3.3
empreinte: pub.empreinteDeContenu(blocs),
anterieure: pub.empreinteDeContenuAnterieure(blocs) });
// renderDocument, ecriture de la page, chemin ajoute a produits
}
produits.push(...pub.copierImagesLiees(
publies.map(p => p.chemin), siteDir, registry));
// Sommaire de chaque langue : renderLandingPage({ ..., aboutHref:
// style.getStrings().aboutHref }) — HTML Reference §24
for (const langue of langues) { // page A propos par langue
style.setLanguage(langue);
const page = style.renderAboutPage(
{ ...pub.etatDuSite({ entrees: aPropos, langue, passe }) });
// ecrite sous html/, nom style.getStrings().aboutHref
}
pub.controlerCiblesDeLiens(style.ciblesDeLiens(), produits, siteDir);
pub.controlerLiensDuSite(siteDir, registry); // pages et PDF, ancres comprises
pub.terminer({ racine, siteDir, registry, registryPath, releves, zipPath });
// Dossier provisoire de la fin de passe : cree et retire par
// kit_publication.js, hors du projet — jamais designe par l'appelant.7.10Linked photos — the conversion sees them
pandoc ignores a linked image: without a precaution, the photo’s paragraph would come out empty and the page would lose it silently. A project’s site generator therefore calls three functions of kit_publication.js — Quality Control §3.19: preparerConversion() before pandoc, whose copy it converts; imageDeMarqueur() during the walk, which designates the photo for picture() to place with its caption and proportion; copierImagesLiees() after the last page, over every published document. Conversion rules and checks: HTML Reference §14.7.