Skip to content

Commit a4a03dd

Browse files
authored
Merge pull request #1096 from effigies/deep_magic
[INFRA] Fix internal links implicitly
2 parents 9678b82 + 5e07fe3 commit a4a03dd

7 files changed

Lines changed: 186 additions & 51 deletions

File tree

macros_doc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ consistency.
7878
## What macros are available?
7979

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

8383
| Name | Purpose | Uses schema | Example |
8484
| ----------------------- | -------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

pdf_build_src/process_markdowns.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from datetime import datetime
1111
import json
1212
import os
13+
import posixpath
1314
import re
1415
import subprocess
1516
import sys
@@ -562,6 +563,13 @@ def edit_titlepage():
562563
file.writelines(data)
563564

564565

566+
class MockPage:
567+
pass
568+
569+
class MockFile:
570+
pass
571+
572+
565573
def process_macros(duplicated_src_dir_path):
566574
"""Search for mkdocs macros in the specification, run the embedded
567575
functions, and replace the macros with their outputs.
@@ -594,6 +602,17 @@ def process_macros(duplicated_src_dir_path):
594602
with open(filename, "r") as fo:
595603
contents = fo.read()
596604

605+
# Create a mock MkDocs Page object that has a "file" attribute,
606+
# which is a mock MkDocs File object with a str "src_path" attribute
607+
# The src_path
608+
mock_file = MockFile()
609+
mock_file.src_path = posixpath.sep.join(filename.split(os.sep)[1:])
610+
611+
page = MockPage()
612+
page.file = mock_file
613+
614+
_Context__self = {"page": page}
615+
597616
# Replace code snippets in the text with their outputs
598617
matches = re.findall(re_code_snippets, contents)
599618
for m in matches:

src/schema/objects/columns.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ HED:
33
name: HED
44
description: |
55
Hierarchical Event Descriptor (HED) Tag.
6-
See [Appendix III](/99-appendices/03-hed.html) for details.
6+
See [Appendix III](SPEC_ROOT/99-appendices/03-hed.md) for details.
77
type: string
88
abbreviation:
99
name: abbreviation
@@ -16,14 +16,16 @@ acq_time__scans:
1616
Acquisition time refers to when the first data point in each run was acquired.
1717
Furthermore, if this header is provided, the acquisition times of all files
1818
from the same recording MUST be identical.
19-
Datetime format and their anonymization are described in [Units](/02-common-principles.html#units).
19+
Datetime format and their anonymization are described in
20+
[Units](SPEC_ROOT/02-common-principles.md#units).
2021
type: string
2122
format: datetime
2223
acq_time__sessions:
2324
name: acq_time
2425
description: |
2526
Acquisition time refers to when the first data point of the first run was acquired.
26-
Datetime format and their anonymization are described in [Units](/02-common-principles.html#units).
27+
Datetime format and their anonymization are described in
28+
[Units](SPEC_ROOT/02-common-principles.md#units).
2729
type: string
2830
format: datetime
2931
age:
@@ -563,7 +565,7 @@ units:
563565
description: |
564566
Physical unit of the value represented in this channel,
565567
for example, `V` for Volt, or `fT/cm` for femto Tesla per centimeter
566-
(see [Units](/02-common-principles.html#units)).
568+
(see [Units](SPEC_ROOT/02-common-principles.md#units)).
567569
type: string
568570
format: unit
569571
value:

src/schema/objects/metadata.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ AnatomicalLandmarkCoordinateSystem:
6161
name: AnatomicalLandmarkCoordinateSystem
6262
description: |
6363
Defines the coordinate system for the anatomical landmarks.
64-
See [Appendix VIII](/99-appendices/08-coordinate-systems.html)
64+
See [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
6565
for a list of restricted keywords for coordinate systems.
6666
If `"Other"`, provide definition of the coordinate system in
6767
`"AnatomicalLandmarkCoordinateSystemDescription"`.
@@ -262,7 +262,7 @@ BodyPartDetails:
262262
BodyPartDetailsOntology:
263263
name: BodyPartDetailsOntology
264264
description: |
265-
[URI](/02-common-principles.html#uniform-resource-indicator) of ontology used for
265+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator) of ontology used for
266266
BodyPartDetails (for example: `"https://www.ebi.ac.uk/ols/ontologies/uberon"`).
267267
type: string
268268
format: uri
@@ -378,7 +378,7 @@ ChunkTransformationMatrixAxis:
378378
Code:
379379
name: Code
380380
description: |
381-
[URI](/02-common-principles.html#uniform-resource-indicator)
381+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
382382
of the code used to present the stimuli.
383383
Persistent identifiers such as DOIs are preferred.
384384
If multiple versions of code may be hosted at the same location,
@@ -388,15 +388,15 @@ Code:
388388
CogAtlasID:
389389
name: CogAtlasID
390390
description: |
391-
[URI](/02-common-principles.html#uniform-resource-indicator)
391+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
392392
of the corresponding [Cognitive Atlas](https://www.cognitiveatlas.org/)
393393
Task term.
394394
type: string
395395
format: uri
396396
CogPOID:
397397
name: CogPOID
398398
description: |
399-
[URI](/02-common-principles.html#uniform-resource-indicator)
399+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
400400
of the corresponding [CogPO](http://www.cogpo.org/) term.
401401
type: string
402402
format: uri
@@ -446,9 +446,9 @@ DatasetDOI:
446446
description: |
447447
The Digital Object Identifier of the dataset (not the corresponding paper).
448448
DOIs SHOULD be expressed as a valid
449-
[URI](/02-common-principles.html#uniform-resource-indicator);
449+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator);
450450
bare DOIs such as `10.0.2.3/dfjj.10` are
451-
[DEPRECATED](/02-common-principles.html#definitions).
451+
[DEPRECATED](SPEC_ROOT/02-common-principles.md#definitions).
452452
type: string
453453
format: uri
454454
DatasetType:
@@ -547,7 +547,7 @@ DigitizedHeadPointsCoordinateSystem:
547547
description: |
548548
Defines the coordinate system for the digitized head points.
549549
See
550-
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
550+
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
551551
for a list of restricted keywords for coordinate systems.
552552
If `"Other"`, provide definition of the coordinate system in
553553
`"DigitizedHeadPointsCoordinateSystemDescription"`.
@@ -637,7 +637,7 @@ EEGCoordinateSystem:
637637
Defines the coordinate system for the EEG sensors.
638638
639639
See
640-
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
640+
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
641641
for a list of restricted keywords for coordinate systems.
642642
If `"Other"`, provide definition of the coordinate system in
643643
`EEGCoordinateSystemDescription`.
@@ -706,13 +706,13 @@ EchoTime:
706706
(please note that the DICOM term is in milliseconds not seconds).
707707
The data type number may apply to files from any MRI modality concerned with
708708
a single value for this field, or to the files in a
709-
[file collection](/99-appendices/10-file-collections.html)
709+
[file collection](SPEC_ROOT/99-appendices/10-file-collections.md)
710710
where the value of this field is iterated using the
711-
[echo entity](/99-appendices/09-entities.html#echo).
711+
[echo entity](SPEC_ROOT/99-appendices/09-entities.md#echo).
712712
The data type array provides a value for each volume in a 4D dataset and
713713
should only be used when the volume timing is critical for interpretation
714714
of the data, such as in
715-
[ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#\
715+
[ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md#\
716716
arterial-spin-labeling-perfusion-data)
717717
or variable echo time fMRI sequences.
718718
anyOf:
@@ -823,7 +823,7 @@ FiducialsCoordinateSystem:
823823
Defines the coordinate system for the fiducials.
824824
Preferably the same as the `"EEGCoordinateSystem"`.
825825
See
826-
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
826+
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
827827
for a list of restricted keywords for coordinate systems.
828828
If `"Other"`, provide definition of the coordinate system in
829829
`"FiducialsCoordinateSystemDescription"`.
@@ -881,13 +881,13 @@ FlipAngle:
881881
Corresponds to: DICOM Tag 0018, 1314 `Flip Angle`.
882882
The data type number may apply to files from any MRI modality concerned with
883883
a single value for this field, or to the files in a
884-
[file collection](/99-appendices/10-file-collections.html)
884+
[file collection](SPEC_ROOT/99-appendices/10-file-collections.md)
885885
where the value of this field is iterated using the
886-
[flip entity](/99-appendices/09-entities.html#flip).
886+
[flip entity](SPEC_ROOT/99-appendices/09-entities.md#flip).
887887
The data type array provides a value for each volume in a 4D dataset and
888888
should only be used when the volume timing is critical for interpretation of
889889
the data, such as in
890-
[ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#\
890+
[ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md#\
891891
arterial-spin-labeling-perfusion-data)
892892
or variable flip angle fMRI sequences.
893893
anyOf:
@@ -968,14 +968,14 @@ GeneticLevel:
968968
Genetics.Database:
969969
name: Genetics.Database
970970
description: |
971-
[URI](/02-common-principles.html#uniform-resource-indicator)
971+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
972972
of database where the dataset is hosted.
973973
type: string
974974
format: uri
975975
Genetics.Dataset:
976976
name: Genetics.Dataset
977977
description: |
978-
[URI](/02-common-principles.html#uniform-resource-indicator)
978+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
979979
where data can be retrieved.
980980
type: string
981981
format: uri
@@ -984,7 +984,7 @@ Genetics.Descriptors:
984984
description: |
985985
List of relevant descriptors (for example, journal articles) for dataset
986986
using a valid
987-
[URI](/02-common-principles.html#uniform-resource-indicator)
987+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
988988
when possible.
989989
anyOf:
990990
- type: string
@@ -1015,7 +1015,7 @@ HED:
10151015
name: HED
10161016
description: |
10171017
Hierarchical Event Descriptor (HED) information,
1018-
see: [Appendix III](/99-appendices/03-hed.html) for details.
1018+
see: [Appendix III](SPEC_ROOT/99-appendices/03-hed.md) for details.
10191019
anyOf:
10201020
- type: string
10211021
- type: object
@@ -1067,7 +1067,7 @@ HeadCoilCoordinateSystem:
10671067
description: |
10681068
Defines the coordinate system for the head coils.
10691069
See
1070-
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
1070+
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
10711071
for a list of restricted keywords for coordinate systems.
10721072
If `"Other"`, provide definition of the coordinate system in
10731073
`HeadCoilCoordinateSystemDescription`.
@@ -1139,7 +1139,7 @@ ImageAcquisitionProtocol:
11391139
name: ImageAcquisitionProtocol
11401140
description: |
11411141
Description of the image acquisition protocol or
1142-
[URI](/02-common-principles.html#uniform-resource-indicator)
1142+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
11431143
(for example from [protocols.io](https://www.protocols.io/)).
11441144
type: string
11451145
ImageDecayCorrected:
@@ -1440,7 +1440,7 @@ License:
14401440
description: |
14411441
The license for the dataset.
14421442
The use of license name abbreviations is RECOMMENDED for specifying a license
1443-
(see [Appendix II](/99-appendices/02-licenses.html)).
1443+
(see [Appendix II](SPEC_ROOT/99-appendices/02-licenses.md)).
14441444
The corresponding full license text MAY be specified in an additional
14451445
`LICENSE` file.
14461446
type: string
@@ -1487,7 +1487,7 @@ MEGCoordinateSystem:
14871487
name: MEGCoordinateSystem
14881488
description: |
14891489
Defines the coordinate system for the MEG sensors.
1490-
See [Appendix VIII](/99-appendices/08-coordinate-systems.html)
1490+
See [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
14911491
for a list of restricted keywords for coordinate systems.
14921492
If `"Other"`, provide definition of the coordinate system in
14931493
`"MEGCoordinateSystemDescription"`.
@@ -2119,7 +2119,7 @@ ReferencesAndLinks:
21192119
description: |
21202120
List of references to publications that contain information on the dataset.
21212121
A reference may be textual or a
2122-
[URI](/02-common-principles.html#uniform-resource-indicator).
2122+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator).
21232123
items:
21242124
type: string
21252125
type: array
@@ -2175,7 +2175,7 @@ RepetitionTimePreparation:
21752175
The data type array provides a value for each volume in a 4D dataset and
21762176
should only be used when the volume timing is critical for interpretation of
21772177
the data, such as in
2178-
[ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html\
2178+
[ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md\
21792179
#arterial-spin-labeling-perfusion-data).
21802180
anyOf:
21812181
- type: number
@@ -2228,7 +2228,7 @@ SampleExtractionProtocol:
22282228
name: SampleExtractionProtocol
22292229
description: |
22302230
Description of the sample extraction protocol or
2231-
[URI](/02-common-principles.html#uniform-resource-indicator)
2231+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
22322232
(for example from [protocols.io](https://www.protocols.io/)).
22332233
type: string
22342234
SampleFixation:
@@ -2313,7 +2313,7 @@ ScanDate:
23132313
description: |
23142314
Date of scan in the format `"YYYY-MM-DD[Z]"`.
23152315
This field is DEPRECATED, and this metadata SHOULD be recorded in the `acq_time` column of the
2316-
corresponding [Scans file](/03-modality-agnostic-files.html#scans-file).
2316+
corresponding [Scans file](SPEC_ROOT/03-modality-agnostic-files.md#scans-file).
23172317
type: string
23182318
format: date
23192319
ScanOptions:
@@ -2477,7 +2477,7 @@ SourceDatasets:
24772477
description: |
24782478
Used to specify the locations and relevant attributes of all source datasets.
24792479
Valid keys in each object include `"URL"`, `"DOI"` (see
2480-
[URI](/02-common-principles.html#uniform-resource-indicator)), and
2480+
[URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)), and
24812481
`"Version"` with
24822482
[string](https://www.w3schools.com/js/js_json_datatypes.asp)
24832483
values.
@@ -2775,7 +2775,7 @@ Units:
27752775
description: |
27762776
Measurement units for the associated file.
27772777
SI units in CMIXF formatting are RECOMMENDED
2778-
(see [Units](/02-common-principles.html#units)).
2778+
(see [Units](SPEC_ROOT/02-common-principles.md#units)).
27792779
type: string
27802780
format: unit
27812781
VascularCrushing:
@@ -2934,7 +2934,7 @@ iEEGCoordinateSystem:
29342934
description: |
29352935
Defines the coordinate system for the iEEG sensors.
29362936
See
2937-
[Appendix VIII](/99-appendices/08-coordinate-systems.html)
2937+
[Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
29382938
for a list of restricted keywords for coordinate systems.
29392939
If `"Other"`, provide definition of the coordinate system in
29402940
`iEEGCoordinateSystemDescription`.

src/schema/objects/suffixes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ blood:
463463
name: Blood recording data
464464
description: |
465465
Blood measurements of radioactivity stored in
466-
[tabular files](/02-common-principles.html#tabular-files)
466+
[tabular files](SPEC_ROOT/02-common-principles.md#tabular-files)
467467
and located in the `pet/` directory along with the corresponding PET data.
468468
bold:
469469
name: Blood-Oxygen-Level Dependent image
@@ -579,11 +579,11 @@ pet:
579579
phase:
580580
name: Phase image
581581
description: |
582-
[DEPRECATED](/02-common-principles.html#definitions).
582+
[DEPRECATED](SPEC_ROOT/02-common-principles.md#definitions).
583583
Phase information associated with magnitude information stored in BOLD
584584
contrast.
585585
This suffix should be replaced by the
586-
[`part-phase`](/99-appendices/09-entities.html#part)
586+
[`part-phase`](SPEC_ROOT/99-appendices/09-entities.md#part)
587587
in conjunction with the `bold` suffix.
588588
anyOf:
589589
- unit: arbitrary

0 commit comments

Comments
 (0)