Skip to content
Metanorma
On this page

Collections configuration

General

Metanorma supports collections: groupings of individual Metanorma documents into a whole.

Collections are of particular use when the component documents are tightly linked with each other. For example:

  • multilingual documents: where each component document has the same content in a different language
  • documents that extensively cross-reference each other, for instance, definitions of an informational model spanning multiple documents.

A collection can rendered into the following output formats (other than in Metanorma XML):

HTML
treated as a single web site, with each Metanorma document a component web site.
PDF
treated as a single document, composed of the individual Metanorma documents.
PDF Portfolio
treated as a PDF portfolio of multiple PDF files, each generated from an individual Metanorma document. metanorma ≥ v2.3.1.
Word DOC
treated as a single document, composed of the individual Metanorma documents. metanorma ≥ v1.7.5

Compiling collections

Collections are compiled using the metanorma executable, as follows:

Usage:
  metanorma collection FILENAME [..options]
Options:
  -x, [--extensions=EXTENSIONS]     # Type of extension to generate
  -w, [--output-folder=FOLDER]      # Folder to generate collection in
  -c, [--coverpage=COVERPAGE]       # Cover page as Liquid template for collection (currently HTML only)

Where:

FILENAME
The collection manifest. This is a YAML file, outlining the structure of the collection, including the location and identifier for each of the component files.
FOLDER
The folder that the collection files are to be generated in.
COVERPAGE
A Liquid template file for the index page to the collection in HTML.

These are described further below.

Example command for generating a Metanorma collection

The command below compiles the collection described in the collection manifest si-brochure-bilingual.yml:

bundle exec metanorma collection si-brochure-bilingual.yml \
  -x xml,html,presentation,pdf \
  -w bilingual-brochure \
  -c collection_cover.html

Specifically, it:

  • generates the collection as XML, Presentation XML, HTML and PDF in the folder bilingual-brochure; and
  • uses the HTML index page template collection_cover.html.

The metanorma collection executable presupposes that the individual metanorma collections are already compiled into XML.

The compilation of the collection resolves any cross-references between files in the collection during preprocessing, so those inter-document links become simple hyperlinks.

Specifying collections

Collection manifest

The collection manifest contains the following keys. The format has been streamlined metanorma ≥ v2.0.0, but is backwards compatible with earlier instances of the manifest; the legacy equivalent keys are given in [brackets].

output-folder
The folder where output is generated to; same value as option --output-folder above. The output folder contains those preprocessed individual files, and files named collection in the target formats. If the output folder given is a relative path, the path is relative to the location of the YAML collection manifest metanorma ≥ v2.1.5.
directives
Directives on how the collection should be generated. Accepted values are listed below.
documents-inline
(default) Indicates that the files should be concatenated into a single XML file for processing. If neither documents-inline nor documents-external is supplied, documents-inline is presupposed.

Currently, if you are generating PDF or DOC output, you can only specify documents-inline.

documents-external
Indicates that the files are kept separate in processing, and the overall collection XML file does not contain the XML of the individual documents.
presentation-xml
Indicates that the XML supplied is in Metanorma Presentation XML format, and does not need to be converted to Presentation XML by Metanorma metanorma ≥ v1.3.5.

This is automatically included when sectionsplit is set in the Metanorma file, to break a single document up into multiple HTML files.

coverpage: {file-path}
Gives the location of the HTML coverpage, as an alternative to the -c argument of metanorma collection metanorma ≥ v1.5.7.

Any locally specified coverpage will be treated as a Liquid template, which can be populated with metadata extracted from the bibliographic metadata about the collection; refer to Metadata and boilerplate.

collection-word-coverpage: {file-path}
Gives the location of the Word DOC coverpage for the entire collection metanorma ≥ v1.7.5.

If left out, or given as null, no such coverpage is added.

collection-word-intropage: {file-path}
Gives the location of the Word DOC introductory section for the entire collection metanorma ≥ v1.7.5.

As with HTML and Word DOC output of standalone documents, this is intended for prefatory material appearing before user-specified prefatory content: typically boilerplate content, and a placeholder for the table of contents.

If left out, or given as null, no such introductory material is added.

document-word-coverpage: {file-path}
Gives the location of the Word DOC coverpage for each individual document metanorma ≥ v1.7.5.

If left out, or given as null, the default cover page that would appear in a standalone document is used. If given as ”“, no such coverpage is added.

document-word-intropage: {file-path}
Gives the location of the DOC introductory section for each individual document metanorma ≥ v1.7.5.

If left out, or given as null, the default introductory section that would appear in a standalone document is used. If given as ”“, no such introductory section is added.

coverpage-style
Gives the style of the PDF and HTML coverpage, if multiple styles are offered metanorma ≥ v1.5.7.
bare-after-first
Compiles the first HTML document in the collection complete (with coverpage and boilerplate), and all subsequent files with the bare option (i.e. without coverpage and boilerplate) metanorma ≥ v1.3.5.

This is automatically included when sectionsplit is set in the Metanorma file, to break a single document up into multiple HTML files.

recompile-xml
If a file is specified as being *.adoc, Metanorma always recompiles it into XML, whether or not a corresponding XML file is already there.

This document attribute is only used to refresh XML files: by default, the last XML generated from Metanorma AsciiDoc is cached for time savings metanorma ≥ v2.0.6.

The attribute is set by default to true, and needs to be explicitly set to false in order to prevent recompilation metanorma ≥ v2.1.10.

Warning
The recompilation of XML does not take into account into any change detection of source files, so if the source file has changed and an XML present, the XML will still not be recompiled.
coverpage-pdf-portflio
The path to the file name of the fallback cover page in PDF format, for the generated PDF portfolio output. This PDF file is included in the PDF Portfolio as the cover page rendered if the PDF reader does not not support reading PDF Portfolio files natively metanorma ≥ v2.3.1.
flavor
The flavor of Metanorma to use in processing the collection metadata and (by default) the documents it contains metanorma ≥ v2.0.6. The corresponding value of flavor is described in the Metanorma document attribute :mn-document-class:.
format
Specifies the possible output formats for the collection as a list, as an alternative to the -f argument of metanorma collection. Allowed values are:
xml
Metanorma Semantic XML
presentation
Metanorma Presentation XML. This is added automatically if any of the following formats is specified.
html
HTML.
doc
Word DOC.
pdf
PDF.
pdf-portfolio
PDF Portfolio. metanorma ≥ v2.3.1
bibdata
Metadata about the collection. Entered in the Relaton format.
docid
type
(mandatory) docid/type is used by Metanorma to determine the flavour of the collection. Currently a collection can only contain documents of one flavour.
entry [manifest]
A manifest listing the documents contained in the collection, in nested hierarchy.

entry can appear recursively in a entry. This allows users to specify hierarchic levels of documents in the collection. That hierarchy will be reflected in the index page navigation for the collection.

type [level]
Names the current hierarchical level of the manifest.
title
Gives the title of the current level of the manifest.
file [fileref]
The file path of a document in the collection relative to the manifest file. file and entry are mutually exclusive: file indicates the leaf nodes of the manifest entries.
format
By default, the format values specified at the collection level (or html, by default) are also used at any level of the manifest; so if the formats for the collection are specified as pdf, html, then all documents in the collection are also compiled as PDF and HTML. This can be overridden at any level of the manifest, using the same form of values as with the format attribute metanorma ≥ v2.1.6. Any values specified at a given level in the manifest are inherited by all entries within that level; so specifying pdf, html at a subcollection will apply to all documents in the subcollection, unless those documents too have a format attribute.
  • The documents are expected to be Metanorma Semantic XML documents (++*++.xml), Metanorma Presentation XML documents (++*++.xml), attachments (see below), YAML files (++*++.yml, ++*++.yaml), or AsciiDoc source files (++*++.adoc).
  • If the file is in AsciiDoc format:

The file is compiled to a Metanorma Semantic XML document in preprocessing [added in https://github.com/metanorma/metanorma/releases/tag/v2.0.0]. By default, for caching reasons, the document is not recompiled to a Metanorma Semantic XML document if a corresponding XML document has already been generated in the same directory metanorma ≥ v2.0.6.

* If the document attribute of recompile-xml is set, The document is always* recompiled to a Metanorma Semantic XML document, even if a corresponding XML document has already been generated.

  • If a document is a YAML file, it is assumed to be a collection manifest itself, and its manifest is recursively read into the current manifest at that point of the entry metanorma ≥ v2.0.0.

** This allows manifests to include other manifests. If the YAML file is in a different directory, the file locations of any files it references are updated to be relative to the current manifest.

identifier
The document identifier, used to index the document in processing. It is also the identifier used to reference this document from other documents in the same collection, using bibliographic references (Cross-references). If the identifier is not supplied, and this is a Metanorma document, the identifier will be extracted from the document metanorma ≥ v2.0.0.
pdf-file
In PDF Portfolio output, specifies the file name to be used for the output PDF file. metanorma ≥ v2.3.1.
output-filename
The output name to be given to the document, without no file extension, e.g. document metanorma ≥ v2.3.1.
  • If this is a hierarchical level of the manifest with children, the output name is inherited by all child nodes of this node (and any documents they describe); if this is a hierarchical level of the manifest with parents, the output name overrides any child nodes specified in ancestors.
  • If an output filename is not specified, the document has the same base name as the input file name (given in file), but all such files appear at the root level of the output folder.
  • The output-filename path can specify subdirectories, imposing hierarchy on the output files of the collection (e.g. directory/filename).
  • If more than one output entry ends up with the same filename in the same location, disambiguating numbers are automatically inserted after the filename. For example, three entries with the same output-filename, dir1/filename, will end up output as {output-folder}/dir1/filename.html, {output-folder}/dir1/filename.1.html, {output-folder}/dir1/filename.2.html. Two file entries specified as dir1/filename.adoc and dir2/filename.adoc with no output-filename specified will end up in the same location, the output directory root: they will be generated as {output-folder}/filename.html and {output-folder}/filename.1.html.
  • The same output-filename variable can be used across multiple files that are child nodes of a manifest entry, with parameters used to differentiate them. The following parameters are used for output-filename:
{basename}
the base name of the current document, with no extensions; e.g. dir/filename.xml maps to filename
{basename_legacy}
the base name of the current document, with its specified extension; e.g. dir/filename.xml maps to filename.xml
{document-num}
the index number of the current document among all the Metanorma documents specified in the collection, numbered depth-first, and with numbering starting at 0.
attachment
When set to true, the file is not a Metanorma document but an attachment, and therefore will not be compiled but directly included by Metanorma metanorma ≥ v1.2.9.
url
Provides the external URL to link to for references to this document, replacing any links to the locally generated file metanorma ≥ v1.7.7. Is not currently intended to replace locally included files: fileref is still required for any such files to be processed.
sectionsplit
When set to true, the HTML output for the specified file is arranged as one HTML file per clause, with an index page created for the overall document.

The index page for the entire document links to the index page for the sectionsplit document.

sectionsplit-filename
The output name to be given to each document generated under the sectionsplit file metanorma ≥ v2.3.1.
  • If sectionsplit-filename is not specified, the files are named using the file entry base name, followed by a sequential number starting with 0, e.g. filename.adoc will generate filename.0.html, filename.1.html, filename.2.html, etc.
  • Like output-filename, sectionsplit-filename can include a directory path.
  • The template for the sectionsplit file names is the same for all files in the entry, and the same parameters can be used as for output-filename to differentiate them. The sequence number needs to be specified for differntiation, as {sectionsplit-num}. For example, given filename.adoc, {basename}.{sectionsplit-num} will generate the default filenames filename.0.html, filename.1.html, filename.2.html, etc.
index
Defaults to true. When set to false, the file is not to be included in any listing of manifest contents (i.e. in the collection cover page).
Note

Boolean attributes of files (attachment, sectionsplit, index) can be inherited from entry to all their file descendants metanorma ≥ v2.0.0.

Note

In the old manifest format, information about files as opposed to manifests needed to be stored under a separate docref container.

Before:

manifest:
  level: collection
  docrefs:
    - fileref: file1.xml
      identifier: ISO 123
    - fileref: file2.txt
      identifier: file2
      attachment: true
    - manifest
      level: annexes
      title: Annex set
      docrefs:
      - fileref: annex1.xml
        identifier: ISO 123 Annex 1
        sectionsplit: true
      - fileref: annex2.xml
        identifier: ISO 123 Annex 2
        sectionsplit: true

After:

entry:
  type: collection
  entry:
    - file: file1.adoc
    - file: file2.txt
      identifier: file2
      attachment: true
    - type: annexes
      title: Annex set
      sectionsplit: true
      entry:
      - file: annex1.adoc
      - file: annex2.adoc
prefatory-content
Content to put at the beginning of the collection container.
final-content
Content to put at the end of the collection container.

Both prefatory and final content are entered as Metanorma AsciiDoc, and are compiled as a document in the same flavor as the collection, with bibdata (bibliographic metadata) taken from the collection.

This bibdata is merged with any bibdata that is added in processing the Metanorma AsciiDoc; that for instance allows markup of document history to be passed into a collection as metadata metanorma ≥ v2.3.1.

Example collection manifest
directives:
  - documents-inline
  - coverpage: index.html
  - coverpage-style: JACK
bibdata:
  title:
    type: title-main
    language: en
    content: ISO Collection 1
  type: collection
  docid:
    type: iso
    id: ISO 12345
  edition: 1
  date:
    - type: created
      value: "2020"
    - type: issued
      value: "2020"
  copyright:
    owner:
      name: International Organization for Standardization
      abbreviation: ISO
    from: "2020"
format:
  - xml
  - presentation
  - pdf
entry:
  type: collection
  title: ISO Collection
  output-filename: "{basename}/document`
  entry:
    - file: rice-en.final.xml
      identifier: ISO 17301-1:2016
    - type: amendments
      title: Amendments
      entry:
        - file: rice-amd.final.xml
          identifier: ISO 17301-1:2016/Amd 1:2017
        - entry:
            - type: attachments
              title: Attachments
              attachment: true
              entry:
                - file: pics/action_schemaexpg1.svg
                  identifier: action_schemaexpg1.svg
                - file: ../../assets/rice_image1.png
                  identifier: rice_image1.png
    - file: dummy.xml
      identifier: ISO 17302
      url: /example/dummy
      sectionsplit: true
    - file: rice1-en.final.adoc
      sectionsplit: true
      sectionsplit-output: "{basename}-{sectionsplit-num}"
prefatory-content: |
  == Clause
  Welcome to our collection
final-content: |
  == Exordium
  Hic explicit

Manifest hooks

If the collection is being processed programmatically, in a Ruby script, it is possible to intervene in that processing, to change the content of the manifests it reads in.

This may be needed, for example, if a collection YAML points to certain files by default, but those file locations need to be different for distribution.

my_fileref_proc = Proc.new do |ref_folder, fileref|
  ...
end
my_identifier_proc = Proc.new do |identifier|
  ...
end
my_pre_parse_model = Proc.new do |collection_model|
  ...
end
Metanorma::Collection.tap do |mn|
  mn.set_identifier_resolver(&my_identifier_proc)
  mn.set_fileref_resolver(&my_fileref_proc)
  mn.set_pre_parse_model(&my_pre_parse_model)
end

The hooks provided metanorma ≥ v2.0.0 are:

setfilerefresolver
given ref_folder (the folder containing the manifest file) and fileref (the path to a file from within the manifest file), generate a new path to the file, redirecting the file reference. The generated path needs to be either absolute, or relative to ref_folder.
setidentifierresolver
given identifier, the identifier of a file in the collection, generate a new identifier.
preparsemodel
given a collection manifest (as parsed by YAML into a Ruby hash), return a new collection manifest.

Site manifest

The collection manifest is expected to reference Metanorma Semantic XML documents.

The starting point for generating a collection is Metanorma AsciiDoc documents. In order to specify a collection and generate it as straightforwardly as possible, the collection manifest should be accompanied by a site manifest, named metanorma.yml, specifying both the component AsciiDoc files, and the collection manifest, as dependency files.

Site compilation will compile both the component files, and the collection depending on them. This is done by running metanorma site generate in the same directory as metanorma.yml.

Since Metanorma site compilation compiles documents to a _site/documents directory, the collection manifest needs to reference the Semantic XML documents in that same _site/documents directory.

Example site manifest

The following two files are examples of a site manifest and a collection manifest compiled through metanorma site generate.

metanorma.yml:

---
metanorma:
  source:
    files:
      - document.1.adoc
      - document.2.adoc
      - collection.yml
  collection:
    organization: "British Standards Institute"
    name: "Retrofitting dwellings for improved energy efficiency -- Specification and guidance"

In the site manifest, the files to be compiled are listed under metanorma.source.files; any YAML file in the list is assumed to be a collection manifest.

The collection is specified in the site manifest with two attributes: a name for the collection document, and an organization treated as the corporate author of the collection. Both will feature in the index file of the documents generated in the site (_site/index.html), and correspond to bibdata.title.content and bibdata.copyright.owner.name in the collection manifest.

Example collection manifest

collection.yml:

---
directives:
  - documents-inline
bibdata:
  type: collection
  docid:
    type: bsi
    id: bsidocs
format:
  - xml
  - html
  - presentation
  - pdf
entry:
  - file: _site/documents/document.1.xml
    identifier: bsidocs-1
  - file: _site/documents/document.2.xml
    identifier: bsidocs-2
Note
document.1.adoc and document.2.adoc are compiled to _site as part of site compilation (although the new manifest format processing would take care of that anyway, if the collection manifest specified the files as adoc.) If the files to be processed in the collection are to be generated by the site manifest, then the file attributes in the collection manifest need to point to the Semantic XML where the site compilation deposits them -- i.e. under _site/documents. The collection generation also generates the collection in the same location, so there is no need to specify a collection destination directory, --output-folder under metanorma collection.

Index page template

The HTML index page template is currently realised as a Liquid template, which forms a sidebar for the display of the HTML content of each file.

The following fields are defined:

doctitle, docnumber, etc.
Information derived from the Relaton YAML description in the manifest of the entire collection.

The field names are as defined for Liquid templates in Metanorma: see Metadata and Boilerplate.

navigation
A nested list giving hyperlinks to the constituent documents, following the specification in the manifest field of the collection manifest.
nav_object
The same nested list, presented as a recursive object, in order to allow users to select only a subset of the navigation list for presentation metanorma ≥ v1.6.4.

It contains the following fields:

title
The list title.
type
The list type (from entry.type in the manifest) metanorma ≥ v2.0.0.
docrefs
A hyperlinked list of the documents at that level of the manifest.
children
An array of child manifests. This list can be recursive.
prefatory-content
Prefatory content from the collection manifest metanorma ≥ v1.5.6.
final-content
Final content from the collection manifest metanorma ≥ v1.5.6.
bibdata
A hash representation of the bibdata element representing the bibliographic metadata of the manifest metanorma ≥ v2.0.8.

Multilingual documents

Metanorma currently supports multilingual documents in its PDF output, as document collections.

  • By default, Metanorma treats multilingual documents as a concatenation of documents, each in its own language;
  • Metanorma also supports rendering multilingual documents as parallel columns of aligned text.

In order to control such alignment, Metanorma supports the following markup metanorma-standoc ≥ v1.10.8:

  • An attribute tag can be added to any block.

    This is used to indicate that blocks with the same tag value across documents in different languages are to be aligned in parallel columns, subject to the multilingual-rendering attribute.

  • An attribute multilingual-rendering can be added to any block.

    This indicates how that block is to be rendered in a multilingual columnar text.

    The options are:

    • common for blocks that are shared across all languages;
    • all-columns for blocks that span all columns of text, and are displayed consecutively;
    • parallel for a block that is to be aligned to the block occupying the same position in the document hierarchy in each language;
    • tag for all blocks sharing the same tag attribute as the current block.
  • The document attribute align-cross-elements indicates the Metanorma XML elements that are always to be aligned in multilingual text. It consists of a comma-delimited list of Metanorma XML tags; e.g. p,note,term.

Incremental collection builds (memory-bounded)

Why

A collection is normally compiled in a single process, with every component document resident in memory at once. For large collections this accumulates memory across documents until the build runs out of memory: the failure is cumulative, not per-document (each document's own peak may be modest), and no per-document optimization removes it. Collections in the hundreds of documents — for example large information-model libraries — hit this limit.

The incremental build stages the compilation so that peak memory is bounded by a single document rather than the whole collection. It is opt-in: the default collection build path is unchanged.

How it works

The incremental build has three stages.

  1. Compile each document in isolation, preserving its outgoing cross-document references as stubs on the semantic XML — rather than stripping them, as an isolated document with absent siblings otherwise would — and writing the result to a durable, content-addressed on-disk store.
  2. Run the isolated compiles one per process, sequentially. Process isolation is what bounds memory: each document is compiled in its own operating-system process, which exits and releases all its memory before the next document begins. Only one document is ever resident.
  3. Reinflate: a final pass reads the stored stubs and resolves them into real cross-document links, producing the same output an all-present build would — across HTML, PDF and Word.

Because cross-document reference resolution lives in the collection layer, operating on the semantic XML upstream of where output branches into the three formats, one implementation serves all of them: HTML, PDF (via collection.presentation.xml) and Word.

Important

The isolated compiles are run sequentially, not in parallel. Running them in parallel would re-introduce the cross-linking and section-split races that Metanorma deliberately avoids. The memory saving comes from process isolation and memory reclamation between documents, not from concurrency.

Render options

The incremental build is driven by three collection render options:

preserve_unresolved
When compiling a document in isolation, keep its unresolved cross-document repo:() references as stubs (retaining the bibitemid and repository document identifier) instead of stripping them to plain text. This is what allows a document built without its siblings present to be relinked later.
artifactstoredir
The directory of the content-addressed on-disk store that each document's stub-bearing semantic XML and anchor catalogue are written to. It is optional: when preserve_unresolved is set and artifactstoredir is omitted, the store defaults to a directory named .metanorma-collection-cache in the working directory. That name begins with a dot, so it is a hidden directory — it does not clutter ordinary directory listings. Pass artifactstoredir only to place the store somewhere else.
reinflate
Run the final reinflation pass: resolve the stored stubs into real cross-document links over the stored semantic XML. Only the cross-document resolution is run — the intra-document rendering passes were already applied during the isolated compile, so nothing is re-inflated.
Note

These are collection render options. Orchestration of the per-document processes — scheduling one bounded-memory process per document, then the reinflation pass — is provided separately (see metanorma/suma#94); command-line integration follows. Until then, the staged cycle is driven by a small per-process driver over the collection manifest.

The content-addressed store

Each document's stored artefacts are named:

<document-id-slug>.<content-hash>.<stage>.<format>

For example:

ISO-99000-1-2024.fd4e958e5f82dc20.semantic.xml
ISO-99000-1-2024.fd4e958e5f82dc20.anchors.json
document-id-slug
The document identifier, made filesystem-safe (ISO 99000-1:2024 becomes ISO-99000-1-2024). Human-readable but lossy; the hash carries identity.
content-hash
A 16-hexadecimal-digit SHA-256 over the compiled input and the Metanorma version. This is the resumption key.
stage
semantic (the stub-bearing semantic XML), anchors (the document's anchor catalogue, contributed to the collection-wide index), or presentation (after reinflation).
format
xml for semantic and presentation, json for anchors.

The store defaults to a directory named .metanorma-collection-cache — a hidden directory, since the name begins with a dot — in the working directory, and persists between builds, which gives two properties:

Resumable
An interrupted build recompiles only what is missing: a document whose artefacts for the current content hash are already present is skipped.
Idempotent
Re-running produces the same output with no side effects. By default, when a document's content changes, only its latest hashed version is retained; previous-hash versions of the same document are pruned. Pass keep_cache to retain every version.

What resumability does and does not provide

The store provides memory-bounding and cross-document correctness — not make-style compile-time incrementality. Every incremental build still reinflates every document; unchanged documents are not skipped at compile time.

Caution

The content hash is computed over a document's compiled input, not over the shared inputs it depends on. If you edit shared inputs — templates, or (for information-model documents) the referenced schemas — the hash will not see the change, because it is upstream of the document source, and stale cached artefacts could be reused. After editing shared inputs, clear the store so it is rebuilt. Tracking dependencies across shared inputs is the collection maintainer's responsibility.

Worked example

Take a three-part collection whose collection.yml lists the members ISO 99000-1:2024, ISO 99000-2:2024 and ISO 99000-3:2024, cross-referencing one another.

Stage each document, then generate the collection

A document is staged by rendering a manifest that contains only that document, with preserve_unresolved and artifactstoredir set — so it compiles in its own process, keeps its cross-document references as stubs, and writes them to the store:

# One member, in its own process (this is what the orchestration runs per document)
Metanorma::Collection.parse("iso-99000-1-only.yml").render(
  format: %i[xml],
  output_folder: "tmp",                      # discarded; the store is the output
  preserve_unresolved: true,
  # artifact_store_dir omitted, so the store defaults to the hidden
  # .metanorma-collection-cache directory; pass it only to place the store elsewhere.
)

Running that once per member (-1, -2, -3), sequentially, leaves the store holding one stub-bearing semantic XML and one anchor catalogue per document:

.metanorma-collection-cache/
  ISO-99000-1-2024.fd4e958e5f82dc20.semantic.xml
  ISO-99000-1-2024.fd4e958e5f82dc20.anchors.json
  ISO-99000-2-2024.ca9a7421d97ecdda.semantic.xml
  ISO-99000-2-2024.ca9a7421d97ecdda.anchors.json
  ISO-99000-3-2024.0eeb3368552ba91f.semantic.xml
  ISO-99000-3-2024.0eeb3368552ba91f.anchors.json

The collection is then generated by reinflating those stored stubs — a manifest whose members point at the stored semantic XML, rendered with reinflate:

# Reinflation reads the stored stubs and resolves cross-document links; it does
# not re-inflate the documents.
Metanorma::Collection.parse("reinflate.yml").render(
  format: %i[xml html],                      # add presentation/pdf/doc as needed
  output_folder: "_site",
  reinflate: true,
)

The result in _site/ is identical to an all-present single-process build: each repo:() reference is a live link (ISO 99000-2:2024's reference to ISO 99000-1:2024 becomes <a href="…">), across HTML, PDF and Word.

Update a single document

To update one document — say ISO 99000-2:2024 has changed — re-stage *only that document* and regenerate the collection:

  1. Re-stage the changed document by running the per-document build for ISO 99000-2:2024 again. Its content hash changes, so a new ISO-99000-2-2024.<new-hash>.semantic.xml is written and the previous-hash files for that document are pruned (unless keep_cache is set). Its inflation is paid once; the other two documents are untouched in the store.
  2. Regenerate the collection by reinflating as above. The two unchanged documents are served from their existing stored stubs; only the cross-document links are recomputed.
Note

You choose which document to re-stage — the build does not auto-detect which documents changed. Re-staging a document whose source is unchanged re-inflates it (the store saves the write, not the inflation), so re-stage only what you actually changed. Automatic change detection across a collection's dependency closure is deliberately deferred.

Going further: organization-scale publishing

Collections group documents within a single repository. For organizations that publish across many repositories, the metanorma-release gem provides channel-based routing, per-document GitHub Releases, and multi-repo aggregation into a unified portal. See Organization-Scale Publishing Setup.

Edit this page on GitHub →