diff --git a/.gitignore b/.gitignore index e7e34dc8..54c43d54 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ schemas/**/*.md schemas/**/*.html schemas/**/*.css schemas/**/*.js +examples/_build # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/examples/bf2raw/.config.json b/examples/_static/bf2raw/.config.json similarity index 100% rename from examples/bf2raw/.config.json rename to examples/_static/bf2raw/.config.json diff --git a/examples/bf2raw/image.json b/examples/_static/bf2raw/image.json similarity index 78% rename from examples/bf2raw/image.json rename to examples/_static/bf2raw/image.json index 28d1019b..9b6d6d19 100644 --- a/examples/bf2raw/image.json +++ b/examples/_static/bf2raw/image.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "bioformats2raw.layout": 3 } } diff --git a/examples/bf2raw/plate.json b/examples/_static/bf2raw/plate.json similarity index 94% rename from examples/bf2raw/plate.json rename to examples/_static/bf2raw/plate.json index 8c21052c..8044f226 100644 --- a/examples/bf2raw/plate.json +++ b/examples/_static/bf2raw/plate.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "bioformats2raw.layout": 3, "plate": { "columns": [ diff --git a/examples/label_strict/.config.json b/examples/_static/label_strict/.config.json similarity index 100% rename from examples/label_strict/.config.json rename to examples/_static/label_strict/.config.json diff --git a/examples/label_strict/colors_properties.json b/examples/_static/label_strict/colors_properties.json similarity index 97% rename from examples/label_strict/colors_properties.json rename to examples/_static/label_strict/colors_properties.json index aebd8689..c9d5b835 100644 --- a/examples/label_strict/colors_properties.json +++ b/examples/_static/label_strict/colors_properties.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "coordinateSystems": [ diff --git a/examples/multiscales_strict/.config.json b/examples/_static/multiscales_strict/.config.json similarity index 100% rename from examples/multiscales_strict/.config.json rename to examples/_static/multiscales_strict/.config.json diff --git a/examples/multiscales_strict/multiscales_example.json b/examples/_static/multiscales_strict/multiscales_example.json similarity index 98% rename from examples/multiscales_strict/multiscales_example.json rename to examples/_static/multiscales_strict/multiscales_example.json index ccc340ec..5a922e01 100644 --- a/examples/multiscales_strict/multiscales_example.json +++ b/examples/_static/multiscales_strict/multiscales_example.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "name": "example", diff --git a/examples/multiscales_strict/multiscales_example_relative.json b/examples/_static/multiscales_strict/multiscales_example_relative.json similarity index 98% rename from examples/multiscales_strict/multiscales_example_relative.json rename to examples/_static/multiscales_strict/multiscales_example_relative.json index 2c0c7f26..0ceddc15 100644 --- a/examples/multiscales_strict/multiscales_example_relative.json +++ b/examples/_static/multiscales_strict/multiscales_example_relative.json @@ -1,7 +1,7 @@ { "multiscales": [ { - "version": "0.6rc0", + "version": "{{ VERSION }}", "name": "example", "coordinateSystems" : [ { diff --git a/examples/multiscales_strict/multiscales_reference_to_label.json b/examples/_static/multiscales_strict/multiscales_reference_to_label.json similarity index 96% rename from examples/multiscales_strict/multiscales_reference_to_label.json rename to examples/_static/multiscales_strict/multiscales_reference_to_label.json index 0d756cc9..307207ec 100644 --- a/examples/multiscales_strict/multiscales_reference_to_label.json +++ b/examples/_static/multiscales_strict/multiscales_reference_to_label.json @@ -1,6 +1,6 @@ { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "name": "Image", diff --git a/examples/multiscales_strict/multiscales_transformations.json b/examples/_static/multiscales_strict/multiscales_transformations.json similarity index 98% rename from examples/multiscales_strict/multiscales_transformations.json rename to examples/_static/multiscales_strict/multiscales_transformations.json index cf601322..50172274 100644 --- a/examples/multiscales_strict/multiscales_transformations.json +++ b/examples/_static/multiscales_strict/multiscales_transformations.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "coordinateSystems": [ diff --git a/examples/ome/.config.json b/examples/_static/ome/.config.json similarity index 100% rename from examples/ome/.config.json rename to examples/_static/ome/.config.json diff --git a/examples/ome/series-2.json b/examples/_static/ome/series-2.json similarity index 77% rename from examples/ome/series-2.json rename to examples/_static/ome/series-2.json index 023d23a7..7d1d9c4d 100644 --- a/examples/ome/series-2.json +++ b/examples/_static/ome/series-2.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "series": ["0", "1"] } } diff --git a/examples/plate_strict/.config.json b/examples/_static/plate_strict/.config.json similarity index 100% rename from examples/plate_strict/.config.json rename to examples/_static/plate_strict/.config.json diff --git a/examples/plate_strict/plate_2wells.json b/examples/_static/plate_strict/plate_2wells.json similarity index 97% rename from examples/plate_strict/plate_2wells.json rename to examples/_static/plate_strict/plate_2wells.json index 09f4bec1..8d6fcc4a 100644 --- a/examples/plate_strict/plate_2wells.json +++ b/examples/_static/plate_strict/plate_2wells.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "plate": { "acquisitions": [ { diff --git a/examples/plate_strict/plate_6wells.json b/examples/_static/plate_strict/plate_6wells.json similarity index 97% rename from examples/plate_strict/plate_6wells.json rename to examples/_static/plate_strict/plate_6wells.json index 0f6b2d2c..181da381 100644 --- a/examples/plate_strict/plate_6wells.json +++ b/examples/_static/plate_strict/plate_6wells.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "plate": { "acquisitions": [ { diff --git a/examples/scene/.config.json b/examples/_static/scene/.config.json similarity index 100% rename from examples/scene/.config.json rename to examples/_static/scene/.config.json diff --git a/examples/scene/scene_registration.json b/examples/_static/scene/scene_registration.json similarity index 98% rename from examples/scene/scene_registration.json rename to examples/_static/scene/scene_registration.json index e70d3fa0..ff856765 100644 --- a/examples/scene/scene_registration.json +++ b/examples/_static/scene/scene_registration.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "scene": { "coordinateTransformations": [ { diff --git a/examples/scene/scene_stitching.json b/examples/_static/scene/scene_stitching.json similarity index 98% rename from examples/scene/scene_stitching.json rename to examples/_static/scene/scene_stitching.json index e4cf25da..0cce8802 100644 --- a/examples/scene/scene_stitching.json +++ b/examples/_static/scene/scene_stitching.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "scene": { "coordinateTransformations": [ { diff --git a/examples/subspace/.config.json b/examples/_static/subspace/.config.json similarity index 100% rename from examples/subspace/.config.json rename to examples/_static/subspace/.config.json diff --git a/examples/subspace/subspacePermute.json b/examples/_static/subspace/subspacePermute.json similarity index 98% rename from examples/subspace/subspacePermute.json rename to examples/_static/subspace/subspacePermute.json index e2c53ee0..3bdb2380 100644 --- a/examples/subspace/subspacePermute.json +++ b/examples/_static/subspace/subspacePermute.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "name": "multiscales", diff --git a/examples/transformations/.config.json b/examples/_static/transformations/.config.json similarity index 100% rename from examples/transformations/.config.json rename to examples/_static/transformations/.config.json diff --git a/examples/transformations/affine2d2d.json b/examples/_static/transformations/affine2d2d.json similarity index 100% rename from examples/transformations/affine2d2d.json rename to examples/_static/transformations/affine2d2d.json diff --git a/examples/transformations/affine2d2d_with_channel.json b/examples/_static/transformations/affine2d2d_with_channel.json similarity index 100% rename from examples/transformations/affine2d2d_with_channel.json rename to examples/_static/transformations/affine2d2d_with_channel.json diff --git a/examples/transformations/affine2d3d.json b/examples/_static/transformations/affine2d3d.json similarity index 100% rename from examples/transformations/affine2d3d.json rename to examples/_static/transformations/affine2d3d.json diff --git a/examples/transformations/bijection.json b/examples/_static/transformations/bijection.json similarity index 100% rename from examples/transformations/bijection.json rename to examples/_static/transformations/bijection.json diff --git a/examples/transformations/bijection_verbose.json b/examples/_static/transformations/bijection_verbose.json similarity index 100% rename from examples/transformations/bijection_verbose.json rename to examples/_static/transformations/bijection_verbose.json diff --git a/examples/transformations/byDimension1.json b/examples/_static/transformations/byDimension1.json similarity index 100% rename from examples/transformations/byDimension1.json rename to examples/_static/transformations/byDimension1.json diff --git a/examples/transformations/byDimension2.json b/examples/_static/transformations/byDimension2.json similarity index 100% rename from examples/transformations/byDimension2.json rename to examples/_static/transformations/byDimension2.json diff --git a/examples/transformations/byDimensionCoordinates.json b/examples/_static/transformations/byDimensionCoordinates.json similarity index 100% rename from examples/transformations/byDimensionCoordinates.json rename to examples/_static/transformations/byDimensionCoordinates.json diff --git a/examples/transformations/byDimensionInvalid1.json b/examples/_static/transformations/byDimensionInvalid1.json similarity index 100% rename from examples/transformations/byDimensionInvalid1.json rename to examples/_static/transformations/byDimensionInvalid1.json diff --git a/examples/transformations/byDimensionInvalid2.json b/examples/_static/transformations/byDimensionInvalid2.json similarity index 100% rename from examples/transformations/byDimensionInvalid2.json rename to examples/_static/transformations/byDimensionInvalid2.json diff --git a/examples/transformations/byDimensionXarray.json b/examples/_static/transformations/byDimensionXarray.json similarity index 100% rename from examples/transformations/byDimensionXarray.json rename to examples/_static/transformations/byDimensionXarray.json diff --git a/examples/transformations/displacements/.config.json b/examples/_static/transformations/displacements/.config.json similarity index 100% rename from examples/transformations/displacements/.config.json rename to examples/_static/transformations/displacements/.config.json diff --git a/examples/transformations/displacements/displacement_field.json b/examples/_static/transformations/displacements/displacement_field.json similarity index 100% rename from examples/transformations/displacements/displacement_field.json rename to examples/_static/transformations/displacements/displacement_field.json diff --git a/examples/transformations/displacements/multiscales.json b/examples/_static/transformations/displacements/multiscales.json similarity index 100% rename from examples/transformations/displacements/multiscales.json rename to examples/_static/transformations/displacements/multiscales.json diff --git a/examples/transformations/identity.json b/examples/_static/transformations/identity.json similarity index 100% rename from examples/transformations/identity.json rename to examples/_static/transformations/identity.json diff --git a/examples/transformations/mapAxis1.json b/examples/_static/transformations/mapAxis1.json similarity index 100% rename from examples/transformations/mapAxis1.json rename to examples/_static/transformations/mapAxis1.json diff --git a/examples/transformations/projectAxis.json b/examples/_static/transformations/projectAxis.json similarity index 100% rename from examples/transformations/projectAxis.json rename to examples/_static/transformations/projectAxis.json diff --git a/examples/transformations/projectAxis2.json b/examples/_static/transformations/projectAxis2.json similarity index 100% rename from examples/transformations/projectAxis2.json rename to examples/_static/transformations/projectAxis2.json diff --git a/examples/transformations/rotation.json b/examples/_static/transformations/rotation.json similarity index 100% rename from examples/transformations/rotation.json rename to examples/_static/transformations/rotation.json diff --git a/examples/transformations/scale.json b/examples/_static/transformations/scale.json similarity index 100% rename from examples/transformations/scale.json rename to examples/_static/transformations/scale.json diff --git a/examples/transformations/scale_with_discrete.json b/examples/_static/transformations/scale_with_discrete.json similarity index 100% rename from examples/transformations/scale_with_discrete.json rename to examples/_static/transformations/scale_with_discrete.json diff --git a/examples/transformations/sequence.json b/examples/_static/transformations/sequence.json similarity index 100% rename from examples/transformations/sequence.json rename to examples/_static/transformations/sequence.json diff --git a/examples/transformations/translation.json b/examples/_static/transformations/translation.json similarity index 100% rename from examples/transformations/translation.json rename to examples/_static/transformations/translation.json diff --git a/examples/transformations/xarrayLike.json b/examples/_static/transformations/xarrayLike.json similarity index 100% rename from examples/transformations/xarrayLike.json rename to examples/_static/transformations/xarrayLike.json diff --git a/examples/well_strict/.config.json b/examples/_static/well_strict/.config.json similarity index 100% rename from examples/well_strict/.config.json rename to examples/_static/well_strict/.config.json diff --git a/examples/well_strict/well_2fields.json b/examples/_static/well_strict/well_2fields.json similarity index 89% rename from examples/well_strict/well_2fields.json rename to examples/_static/well_strict/well_2fields.json index 636edf2e..763f5b50 100644 --- a/examples/well_strict/well_2fields.json +++ b/examples/_static/well_strict/well_2fields.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "well": { "images": [ { diff --git a/examples/well_strict/well_4fields.json b/examples/_static/well_strict/well_4fields.json similarity index 93% rename from examples/well_strict/well_4fields.json rename to examples/_static/well_strict/well_4fields.json index 9baae566..7a80782a 100644 --- a/examples/well_strict/well_4fields.json +++ b/examples/_static/well_strict/well_4fields.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "well": { "images": [ { diff --git a/index.md b/index.md index 382bb634..ce129854 100644 --- a/index.md +++ b/index.md @@ -346,7 +346,7 @@ series.ome.zarr # One converted fileset from bioformats2raw The OME-Zarr Metadata in the top-level `zarr.json` file must contain the `bioformats2raw.layout` key: -```{literalinclude} examples/bf2raw/image.json +```{literalinclude} examples/_build/bf2raw/image.json :language: json ``` @@ -354,13 +354,13 @@ If the top-level group represents a plate, the `bioformats2raw.layout` metadata but the `plate` key MUST also be present, takes precedence and parsing of such datasets should follow (see [plate metadata](#plate-md)). It is not possible to mix collections of images with plates at present. -```{literalinclude} examples/bf2raw/plate.json +```{literalinclude} examples/_build/bf2raw/plate.json :language: json ``` The OME-Zarr Metadata in the `zarr.json` file within the OME group may contain the `series` key: -```{literalinclude} examples/ome/series-2.json +```{literalinclude} examples/_build/ome/series-2.json :language: json ``` @@ -698,7 +698,7 @@ is set to the position of the ith axis of the input coordinate system. :::{dropdown} Example -```{literalinclude} examples/transformations/identity.json +```{literalinclude} examples/_build/transformations/identity.json :language: json ``` @@ -730,7 +730,7 @@ The value at position `i` in the array indicates which input axis becomes the `i :::{dropdown} Example 1 -```{literalinclude} examples/transformations/mapAxis1.json +```{literalinclude} examples/_build/transformations/mapAxis1.json :language: json ``` @@ -771,7 +771,7 @@ In this example, the output coordinate system `out` contains two more axes (`c` than the input coordinate system `in`. This is reflected by the following `projectAxis` transformation: -```{literalinclude} examples/transformations/projectAxis.json +```{literalinclude} examples/_build/transformations/projectAxis.json :language: json ``` @@ -789,7 +789,7 @@ In this example, the output coordinate system `out` contains one axes more (`z`) than the input coordinate system `in`. This is reflected by the following `projectAxis` transformation: -```{literalinclude} examples/transformations/projectAxis2.json +```{literalinclude} examples/_build/transformations/projectAxis2.json :language: json ``` which defines the function @@ -824,7 +824,7 @@ The array MUST have length `N`. :::{dropdown} Example -```{literalinclude} examples/transformations/translation.json +```{literalinclude} examples/_build/transformations/translation.json :language: json ``` @@ -852,7 +852,7 @@ The array MUST have length `N`. :::{dropdown} Example 1 (spec:example:coordinate_transformation_scale)= -```{literalinclude} examples/transformations/scale.json +```{literalinclude} examples/_build/transformations/scale.json :language: json ``` @@ -871,7 +871,7 @@ i.e., the mapping from the first input axis to the first output axis is determin If the data contains discrete axes (e.g., channels), these axes are typically not transformed, but must be represented in the scale parameters. -```{literalinclude} examples/transformations/scale_with_discrete.json +```{literalinclude} examples/_build/transformations/scale_with_discrete.json :language: json ``` ::: @@ -898,7 +898,7 @@ where the outer array MUST be length `M` and the inner arrays MUST be length `N+ :::{dropdown} Example 1 A 2D-2D example: -```{literalinclude} examples/transformations/affine2d2d.json +```{literalinclude} examples/_build/transformations/affine2d2d.json :language: json ``` @@ -929,7 +929,7 @@ Note that the order of the axes can in general be determined by the application These axes relate to the memory or on-disk order insofar as the last dimension is contiguous when the zarr array is c-order (the default for zarr version 2, and the only option for zarr version 3). -```{literalinclude} examples/transformations/affine2d3d.json +```{literalinclude} examples/_build/transformations/affine2d3d.json :language: json ``` @@ -959,7 +959,7 @@ where the last row `[0 0 1]` is omitted in the JSON representation. If the image data contains discrete axes (e.g., channels), these axes are typically not transformed, but must be represented in the transformation matrix. -```{literalinclude} examples/transformations/affine2d2d_with_channel.json +```{literalinclude} examples/_build/transformations/affine2d2d_with_channel.json :language: json ``` ::: @@ -987,7 +987,7 @@ and the inner arrays MUST be length `N`. :::{dropdown} Example A 2D example -```{literalinclude} examples/transformations/rotation.json +```{literalinclude} examples/_build/transformations/rotation.json :language: json ``` @@ -1032,7 +1032,7 @@ f2(f1(f0(x))) This sequence: -```{literalinclude} examples/transformations/sequence.json +```{literalinclude} examples/_build/transformations/sequence.json :language: json ``` @@ -1135,7 +1135,7 @@ Applying the transformation to a point `x` in physical coordinates in the input In this example, a `displacements` transformation is defined between two 2D coordinate systems, `physical` and `output`. The transformation references a displacement vector field located at `coordinateTransformations/displacementField`. -```{literalinclude} examples/transformations/displacements/multiscales.json +```{literalinclude} examples/_build/transformations/displacements/multiscales.json :language: json ``` @@ -1143,7 +1143,7 @@ This multiscales (containing the vector field) MUST have three dimensions, i.e., `x` and `y` as mandated by the input coordinate system and an additional dimension `c` to hold the x- and y-displacements. The metadata for the multiscale group at location `coordinateTransformations/displacementField` would look as follows: -```{literalinclude} examples/transformations/displacements/displacement_field.json +```{literalinclude} examples/_build/transformations/displacements/displacement_field.json :language: json ``` @@ -1195,7 +1195,7 @@ using lower dimensional transformations on subsets of dimensions. A valid `byDimension` transformation: -```{literalinclude} examples/transformations/byDimension1.json +```{literalinclude} examples/_build/transformations/byDimension1.json :language: json ``` ::: @@ -1204,7 +1204,7 @@ A valid `byDimension` transformation: Another valid `byDimension` transformation: -```{literalinclude} examples/transformations/byDimension2.json +```{literalinclude} examples/_build/transformations/byDimension2.json :language: json ``` ::: @@ -1213,7 +1213,7 @@ Another valid `byDimension` transformation: This is an **invalid** `byDimension` transform: -```{literalinclude} examples/transformations/byDimensionInvalid1.json +```{literalinclude} examples/_build/transformations/byDimensionInvalid1.json :language: json ``` @@ -1226,7 +1226,7 @@ The coordinate system has two axes (indices `0` and `1`), but the transformation Another **invalid** `byDimension` transform: -```{literalinclude} examples/transformations/byDimensionInvalid2.json +```{literalinclude} examples/_build/transformations/byDimensionInvalid2.json :language: json ``` @@ -1260,13 +1260,13 @@ It may not be correct for any point of appropriate dimensionality. :::{dropdown} Example -```{literalinclude} examples/transformations/bijection.json +```{literalinclude} examples/_build/transformations/bijection.json :language: json ``` the input and output of the `forward` and `inverse` transformations are understood to be: -```{literalinclude} examples/transformations/bijection_verbose.json +```{literalinclude} examples/_build/transformations/bijection_verbose.json :language: json ``` ::: @@ -1407,7 +1407,7 @@ In this example, a multiscales group containing labels is located at `labels/lab :::{dropdown} Example: Complete multiscales metadata A complete example of json-file for a 5D (TCZYX) multiscales with 3 resolution levels could look like this: -```{literalinclude} examples/multiscales_strict/multiscales_example.json +```{literalinclude} examples/_build/multiscales_strict/multiscales_example.json :language: json ``` ::: @@ -1562,7 +1562,7 @@ In the `zarr.json` under the image.zarr group, an explicit `identity` transform the coordinate system named `"physical"` in the multiscales metadata of the original image is the same as the coordinate system named `"physical"` in the multiscales metadata of the label image: -```{literalinclude} examples/multiscales_strict/multiscale_reference_to_label.json +```{literalinclude} examples/_build/multiscales_strict/multiscale_reference_to_label.json :language: json ``` @@ -1586,7 +1586,7 @@ a coordinate system named `"physical"` serves as the "[intrinsic](#spec:hint:mul The `image-label` field contains information about the source image and display colors for the label image, i.e., a label image in which 0s and 1s represent intercellular and cellular space, respectively: -```{literalinclude} examples/label_strict/colors_properties.json +```{literalinclude} examples/_build/label_strict/colors_properties.json :language: json ``` @@ -1665,14 +1665,14 @@ The `rowIndex`, `columnIndex`, and `path` MUST all refer to the same row/column For example the following JSON object defines a plate with two acquisitions and 6 wells (2 rows and 3 columns), containing up to 2 fields of view per acquisition. -```{literalinclude} examples/plate_strict/plate_6wells.json +```{literalinclude} examples/_build/plate_strict/plate_6wells.json :language: json ``` The following JSON object defines a sparse plate with one acquisition and 2 wells in a 96 well plate, containing one field of view per acquisition. -```{literalinclude} examples/plate_strict/plate_2wells.json +```{literalinclude} examples/_build/plate_strict/plate_2wells.json :language: json ``` ::: @@ -1701,14 +1701,14 @@ For example the following JSON object defines a well with four fields of view. The first two fields of view were part of the first acquisition while the last two fields of view were part of the second acquisition. -```{literalinclude} examples/well_strict/well_4fields.json +```{literalinclude} examples/_build/well_strict/well_4fields.json :language: json ``` The following JSON object defines a well with two fields of view in a plate with four acquisitions. The first field is part of the first acquisition, and the second field is part of the last acquisition. -```{literalinclude} examples/well_strict/well_2fields.json +```{literalinclude} examples/_build/well_strict/well_2fields.json :language: json ``` ::: @@ -1905,6 +1905,6 @@ Copyright © 2025 W3C® (MIT, ERCIM, Keio, Beihang). ```{toctree} :maxdepth: 1 -examples/index +examples/_build/index schemas/index ``` diff --git a/pre_build.py b/pre_build.py index 86a4d0d9..5da7745c 100644 --- a/pre_build.py +++ b/pre_build.py @@ -4,6 +4,7 @@ from pathlib import Path import jsonc as json import logging +from _version import __version__ # Suppress warnings from json-schema-for-humans about unresolvable URLs logging.getLogger().setLevel(logging.ERROR) @@ -12,11 +13,31 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) +def update_version_in_json(): + """Update the version in the JSON examples.""" + + examples_dir='examples' + json_files = glob.glob(os.path.join(examples_dir, '**', '*.json'), recursive=True) + for json_file in json_files: + with open(json_file, 'r') as f: + content = f.read() + # version is marked as "{{ VERSION }}" in the examples, + # so we can replace it with the actual version + content = content.replace('{{ VERSION }}', __version__) + + # store updated content to a different directory + # to avoid overwriting the original examples + + new_file_path = json_file.replace("_static", "_build") + os.makedirs(os.path.dirname(new_file_path), exist_ok=True) + with open(new_file_path, 'w') as f: + f.write(content) + def build_json_examples(): """Build markdown files from json examples.""" # glob recursively to find all json files - input_directory = 'examples' - output_directory = 'examples' + input_directory = 'examples/_build' + output_directory = 'examples/_build' os.makedirs(output_directory, exist_ok=True) # iterate over all folders in the examples directory @@ -198,6 +219,7 @@ def render_authors_md(): f.write(markdown_authors) +update_version_in_json() build_json_examples() build_json_schemas() build_footer()