Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFRA] Fix internal links implicitly #1096

Merged
merged 5 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion macros_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ consistency.
## What macros are available?

All the macros we use are in listed in this
[python file](https://github.com/bids-standard/bids-specification/blob/master/tools/mkdocs_macros_bids/macros.py).
[Python file](https://github.com/bids-standard/bids-specification/blob/master/tools/mkdocs_macros_bids/macros.py).

| Name | Purpose | Uses schema | Example |
| ----------------------- | -------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
19 changes: 19 additions & 0 deletions pdf_build_src/process_markdowns.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from datetime import datetime
import json
import os
import posixpath
import re
import subprocess
import sys
Expand Down Expand Up @@ -562,6 +563,13 @@ def edit_titlepage():
file.writelines(data)


class MockPage:
pass

class MockFile:
pass


def process_macros(duplicated_src_dir_path):
"""Search for mkdocs macros in the specification, run the embedded
functions, and replace the macros with their outputs.
Expand Down Expand Up @@ -594,6 +602,17 @@ def process_macros(duplicated_src_dir_path):
with open(filename, "r") as fo:
contents = fo.read()

# Create a mock MkDocs Page object that has a "file" attribute,
# which is a mock MkDocs File object with a str "src_path" attribute
# The src_path
mock_file = MockFile()
mock_file.src_path = posixpath.sep.join(filename.split(os.sep)[1:])

page = MockPage()
page.file = mock_file

_Context__self = {"page": page}

# Replace code snippets in the text with their outputs
matches = re.findall(re_code_snippets, contents)
for m in matches:
Expand Down
10 changes: 6 additions & 4 deletions src/schema/objects/columns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HED:
name: HED
description: |
Hierarchical Event Descriptor (HED) Tag.
See [Appendix III](/99-appendices/03-hed.html) for details.
See [Appendix III](SPEC_ROOT/99-appendices/03-hed.md) for details.
type: string
abbreviation:
name: abbreviation
Expand All @@ -16,14 +16,16 @@ acq_time__scans:
Acquisition time refers to when the first data point in each run was acquired.
Furthermore, if this header is provided, the acquisition times of all files
from the same recording MUST be identical.
Datetime format and their anonymization are described in [Units](/02-common-principles.html#units).
Datetime format and their anonymization are described in
[Units](SPEC_ROOT/02-common-principles.md#units).
type: string
format: datetime
acq_time__sessions:
name: acq_time
description: |
Acquisition time refers to when the first data point of the first run was acquired.
Datetime format and their anonymization are described in [Units](/02-common-principles.html#units).
Datetime format and their anonymization are described in
[Units](SPEC_ROOT/02-common-principles.md#units).
type: string
format: datetime
age:
Expand Down Expand Up @@ -512,7 +514,7 @@ units:
description: |
Physical unit of the value represented in this channel,
for example, `V` for Volt, or `fT/cm` for femto Tesla per centimeter
(see [Units](/02-common-principles.html#units)).
(see [Units](SPEC_ROOT/02-common-principles.md#units)).
type: string
format: unit
value:
Expand Down
62 changes: 31 additions & 31 deletions src/schema/objects/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ AnatomicalLandmarkCoordinateSystem:
name: AnatomicalLandmarkCoordinateSystem
description: |
Defines the coordinate system for the anatomical landmarks.
See [Appendix VIII](/99-appendices/08-coordinate-systems.html)
See [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"AnatomicalLandmarkCoordinateSystemDescription"`.
Expand Down Expand Up @@ -262,7 +262,7 @@ BodyPartDetails:
BodyPartDetailsOntology:
name: BodyPartDetailsOntology
description: |
[URI](/02-common-principles.html#uniform-resource-indicator) of ontology used for
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator) of ontology used for
BodyPartDetails (for example: `"https://www.ebi.ac.uk/ols/ontologies/uberon"`).
type: string
format: uri
Expand Down Expand Up @@ -378,7 +378,7 @@ ChunkTransformationMatrixAxis:
Code:
name: Code
description: |
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of the code used to present the stimuli.
Persistent identifiers such as DOIs are preferred.
If multiple versions of code may be hosted at the same location,
Expand All @@ -388,15 +388,15 @@ Code:
CogAtlasID:
name: CogAtlasID
description: |
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of the corresponding [Cognitive Atlas](https://www.cognitiveatlas.org/)
Task term.
type: string
format: uri
CogPOID:
name: CogPOID
description: |
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of the corresponding [CogPO](http://www.cogpo.org/) term.
type: string
format: uri
Expand Down Expand Up @@ -446,9 +446,9 @@ DatasetDOI:
description: |
The Digital Object Identifier of the dataset (not the corresponding paper).
DOIs SHOULD be expressed as a valid
[URI](/02-common-principles.html#uniform-resource-indicator);
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator);
bare DOIs such as `10.0.2.3/dfjj.10` are
[DEPRECATED](/02-common-principles.html#definitions).
[DEPRECATED](SPEC_ROOT/02-common-principles.md#definitions).
type: string
format: uri
DatasetType:
Expand Down Expand Up @@ -547,7 +547,7 @@ DigitizedHeadPointsCoordinateSystem:
description: |
Defines the coordinate system for the digitized head points.
See
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"DigitizedHeadPointsCoordinateSystemDescription"`.
Expand Down Expand Up @@ -637,7 +637,7 @@ EEGCoordinateSystem:
Defines the coordinate system for the EEG sensors.

See
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`EEGCoordinateSystemDescription`.
Expand Down Expand Up @@ -706,13 +706,13 @@ EchoTime:
(please note that the DICOM term is in milliseconds not seconds).
The data type number may apply to files from any MRI modality concerned with
a single value for this field, or to the files in a
[file collection](/99-appendices/10-file-collections.html)
[file collection](SPEC_ROOT/99-appendices/10-file-collections.md)
where the value of this field is iterated using the
[echo entity](/99-appendices/09-entities.html#echo).
[echo entity](SPEC_ROOT/99-appendices/09-entities.md#echo).
The data type array provides a value for each volume in a 4D dataset and
should only be used when the volume timing is critical for interpretation
of the data, such as in
[ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#\
[ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md#\
arterial-spin-labeling-perfusion-data)
or variable echo time fMRI sequences.
anyOf:
Expand Down Expand Up @@ -823,7 +823,7 @@ FiducialsCoordinateSystem:
Defines the coordinate system for the fiducials.
Preferably the same as the `"EEGCoordinateSystem"`.
See
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"FiducialsCoordinateSystemDescription"`.
Expand Down Expand Up @@ -881,13 +881,13 @@ FlipAngle:
Corresponds to: DICOM Tag 0018, 1314 `Flip Angle`.
The data type number may apply to files from any MRI modality concerned with
a single value for this field, or to the files in a
[file collection](/99-appendices/10-file-collections.html)
[file collection](SPEC_ROOT/99-appendices/10-file-collections.md)
where the value of this field is iterated using the
[flip entity](/99-appendices/09-entities.html#flip).
[flip entity](SPEC_ROOT/99-appendices/09-entities.md#flip).
The data type array provides a value for each volume in a 4D dataset and
should only be used when the volume timing is critical for interpretation of
the data, such as in
[ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#\
[ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md#\
arterial-spin-labeling-perfusion-data)
or variable flip angle fMRI sequences.
anyOf:
Expand Down Expand Up @@ -968,14 +968,14 @@ GeneticLevel:
Genetics.Database:
name: Genetics.Database
description: |
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of database where the dataset is hosted.
type: string
format: uri
Genetics.Dataset:
name: Genetics.Dataset
description: |
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
where data can be retrieved.
type: string
format: uri
Expand All @@ -984,7 +984,7 @@ Genetics.Descriptors:
description: |
List of relevant descriptors (for example, journal articles) for dataset
using a valid
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
when possible.
anyOf:
- type: string
Expand Down Expand Up @@ -1015,7 +1015,7 @@ HED:
name: HED
description: |
Hierarchical Event Descriptor (HED) information,
see: [Appendix III](/99-appendices/03-hed.html) for details.
see: [Appendix III](SPEC_ROOT/99-appendices/03-hed.md) for details.
anyOf:
- type: string
- type: object
Expand Down Expand Up @@ -1067,7 +1067,7 @@ HeadCoilCoordinateSystem:
description: |
Defines the coordinate system for the head coils.
See
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`HeadCoilCoordinateSystemDescription`.
Expand Down Expand Up @@ -1139,7 +1139,7 @@ ImageAcquisitionProtocol:
name: ImageAcquisitionProtocol
description: |
Description of the image acquisition protocol or
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
(for example from [protocols.io](https://www.protocols.io/)).
type: string
ImageDecayCorrected:
Expand Down Expand Up @@ -1440,7 +1440,7 @@ License:
description: |
The license for the dataset.
The use of license name abbreviations is RECOMMENDED for specifying a license
(see [Appendix II](/99-appendices/02-licenses.html)).
(see [Appendix II](SPEC_ROOT/99-appendices/02-licenses.md)).
The corresponding full license text MAY be specified in an additional
`LICENSE` file.
type: string
Expand Down Expand Up @@ -1487,7 +1487,7 @@ MEGCoordinateSystem:
name: MEGCoordinateSystem
description: |
Defines the coordinate system for the MEG sensors.
See [Appendix VIII](/99-appendices/08-coordinate-systems.html)
See [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"MEGCoordinateSystemDescription"`.
Expand Down Expand Up @@ -2119,7 +2119,7 @@ ReferencesAndLinks:
description: |
List of references to publications that contain information on the dataset.
A reference may be textual or a
[URI](/02-common-principles.html#uniform-resource-indicator).
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator).
items:
type: string
type: array
Expand Down Expand Up @@ -2175,7 +2175,7 @@ RepetitionTimePreparation:
The data type array provides a value for each volume in a 4D dataset and
should only be used when the volume timing is critical for interpretation of
the data, such as in
[ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html\
[ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md\
#arterial-spin-labeling-perfusion-data).
anyOf:
- type: number
Expand Down Expand Up @@ -2228,7 +2228,7 @@ SampleExtractionProtocol:
name: SampleExtractionProtocol
description: |
Description of the sample extraction protocol or
[URI](/02-common-principles.html#uniform-resource-indicator)
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
(for example from [protocols.io](https://www.protocols.io/)).
type: string
SampleFixation:
Expand Down Expand Up @@ -2313,7 +2313,7 @@ ScanDate:
description: |
Date of scan in the format `"YYYY-MM-DD[Z]"`.
This field is DEPRECATED, and this metadata SHOULD be recorded in the `acq_time` column of the
corresponding [Scans file](/03-modality-agnostic-files.html#scans-file).
corresponding [Scans file](SPEC_ROOT/03-modality-agnostic-files.md#scans-file).
type: string
format: date
ScanOptions:
Expand Down Expand Up @@ -2477,7 +2477,7 @@ SourceDatasets:
description: |
Used to specify the locations and relevant attributes of all source datasets.
Valid keys in each object include `"URL"`, `"DOI"` (see
[URI](/02-common-principles.html#uniform-resource-indicator)), and
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)), and
`"Version"` with
[string](https://www.w3schools.com/js/js_json_datatypes.asp)
values.
Expand Down Expand Up @@ -2775,7 +2775,7 @@ Units:
description: |
Measurement units for the associated file.
SI units in CMIXF formatting are RECOMMENDED
(see [Units](/02-common-principles.html#units)).
(see [Units](SPEC_ROOT/02-common-principles.md#units)).
type: string
format: unit
VascularCrushing:
Expand Down Expand Up @@ -2934,7 +2934,7 @@ iEEGCoordinateSystem:
description: |
Defines the coordinate system for the iEEG sensors.
See
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`iEEGCoordinateSystemDescription`.
Expand Down
6 changes: 3 additions & 3 deletions src/schema/objects/suffixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ blood:
name: Blood recording data
description: |
Blood measurements of radioactivity stored in
[tabular files](/02-common-principles.html#tabular-files)
[tabular files](SPEC_ROOT/02-common-principles.md#tabular-files)
and located in the `pet/` directory along with the corresponding PET data.
bold:
name: Blood-Oxygen-Level Dependent image
Expand Down Expand Up @@ -579,11 +579,11 @@ pet:
phase:
name: Phase image
description: |
[DEPRECATED](/02-common-principles.html#definitions).
[DEPRECATED](SPEC_ROOT/02-common-principles.md#definitions).
Phase information associated with magnitude information stored in BOLD
contrast.
This suffix should be replaced by the
[`part-phase`](/99-appendices/09-entities.html#part)
[`part-phase`](SPEC_ROOT/99-appendices/09-entities.md#part)
in conjunction with the `bold` suffix.
anyOf:
- unit: arbitrary
Expand Down
Loading