Skip to content

Commit d61df88

Browse files
authored
fix: Add or correct URL fragments in internal links (#2241)
* fix: Autogenerate correct link anchors * fix: Update hand-written links * fix: Add default anchor for sense 1 * chore: Exclude README and pregh-changes.md from being rendered
1 parent 9e62f05 commit d61df88

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ nav:
5151
- Website: https://bids-standard.github.io/bids-starter-kit/
5252
- Tutorials: https://bids-standard.github.io/bids-starter-kit/tutorials/tutorials.html
5353
- GitHub repository: https://github.com/bids-standard/bids-starter-kit
54+
exclude_docs: |
55+
README.md
56+
pregh-changes.md
5457
theme:
5558
name: material
5659
favicon: images/favicon.png

src/common-principles.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ Example:
591591
```
592592

593593
Each level can be described with a string as in the example above,
594-
or with an object containing the fields [`Description`](./glossary.md#description-metadata)
594+
or with an object containing the fields [`Description`](./glossary.md#description-sense-1-metadata)
595595
and [`TermURL`](./glossary.md#termurl-metadata)
596596
like in the example below.
597597

@@ -1159,8 +1159,8 @@ to suppress warnings or provide interpretations of your filenames.
11591159

11601160
<!-- Link Definitions -->
11611161

1162-
[dataset-description]: modality-agnostic-files/data-summary-files.md
1163-
[dataset_description.json]: modality-agnostic-files/data-summary-files.md#dataset_descriptionjson
1164-
[derived-dataset-description]: modality-agnostic-files/data-summary-files.md#derived-dataset-and-pipeline-description
1162+
[dataset-description]: modality-agnostic-files/dataset-description.md
1163+
[dataset_description.json]: modality-agnostic-files/dataset-description.md#dataset_descriptionjson
1164+
[derived-dataset-description]: modality-agnostic-files/dataset-description.md#derived-dataset-and-pipeline-description
11651165
[deprecated]: #definitions
11661166
[uris]: #uniform-resource-indicator

src/modality-specific-files/positron-emission-tomography.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Knudsen et al. 2020
314314
recommends recording participant body weight.
315315
If recorded once per participant, these data SHOULD be included in the
316316
[Participants file](../modality-agnostic-files/data-summary-files.md#participants-file) or as
317-
[Phenotypic and assessment data](../modality-agnostic-files/data-summary-files.md#phenotypic-and-assessment-data).
317+
[Phenotypic and assessment data](../modality-agnostic-files/phenotypic-and-assessment-data.md#phenotypic-and-assessment-data).
318318

319319
For example:
320320

tools/schemacode/src/bidsschematools/render/tables.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def _make_object_table(
7373
# except for subobjects (if table_type) and
7474
# "additional columns" (field_name.startswith("**"))
7575
if table_type and not field_name.startswith("**"):
76-
field_name = f"[{field_name}]({GLOSSARY_PATH}.md#objects.{table_type}.{element})"
76+
sub = table_type if table_type != "subobject" else "metadata"
77+
field_name = f"[{field_name}]({GLOSSARY_PATH}.md#objects.{sub}.{element})"
7778

7879
# Grab any requirement level information and text to be added to the description string
7980
requirement_info, description_addendum = field_info[element]["table_info"]
@@ -297,6 +298,10 @@ def make_entity_table(schema, tablefmt="github", src_path=None, **kwargs):
297298
formats = ["Format"]
298299
table = [formats]
299300

301+
suffix_map = {
302+
obj.value: key for key, obj in schema.objects.suffixes.items()
303+
}
304+
300305
# Compose header and formats first
301306
for long_name in schema.rules.entities:
302307
entity = schema.objects.entities[long_name]
@@ -320,7 +325,7 @@ def make_entity_table(schema, tablefmt="github", src_path=None, **kwargs):
320325

321326
for (dtype, entities), suffixes in rows.items():
322327
suf_str = " ".join(
323-
f"[{suffix}]({GLOSSARY_PATH}.md#objects.suffixes.{suffix})" for suffix in suffixes
328+
f"[{suffix}]({GLOSSARY_PATH}.md#objects.suffixes.{suffix_map[suffix]})" for suffix in suffixes
324329
)
325330
# TODO: <br> is specific for html form
326331
fmt_str = f"[{dtype}]({GLOSSARY_PATH}.md#objects.datatypes.{dtype})<br>({suf_str})"

tools/schemacode/src/bidsschematools/render/text.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ def make_glossary(schema, src_path=None):
152152
if obj_desc is None:
153153
raise ValueError(f"{obj_marker} has no description.")
154154

155+
if "sense 1" in obj_key:
156+
text += f'\n<a name="{obj_marker.split("__", 1)[0]}"></a>'
155157
text += f'\n<a name="{obj_marker}"></a>'
156158
text += f"\n## {obj_key}\n\n"
157159
text += f"**Name**: {obj_def['display_name']}\n\n"

0 commit comments

Comments
 (0)