Skip to content

Commit

Permalink
add relpath for suffix tables
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed Apr 25, 2022
1 parent 754875a commit f89aa5c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ and a guide for using macros can be found at
"PDT2",
"UNIT1",
"angio",
]
],
".."
)
}}

Expand Down Expand Up @@ -412,7 +413,8 @@ and a guide for using macros can be found at
"RB1map",
"S0map",
"M0map",
]
],
".."
)
}}

Expand Down Expand Up @@ -449,7 +451,8 @@ and a guide for using macros can be found at
"T2star",
"FLASH",
"PD",
]
],
".."
)
}}

Expand All @@ -469,7 +472,8 @@ and a guide for using macros can be found at
"bold",
"cbv",
"phase",
]
],
".."
)
}}

Expand Down Expand Up @@ -736,7 +740,8 @@ and a guide for using macros can be found at
[
"dwi",
"sbref",
]
],
".."
)
}}

Expand Down Expand Up @@ -1172,7 +1177,8 @@ and a guide for using macros can be found at
"phasediff",
"fieldmap",
"epi",
]
],
".."
)
}}

Expand Down
3 changes: 2 additions & 1 deletion src/04-modality-specific-files/10-microscopy.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ and a guide for using macros can be found at
"NLO",
"OCT",
"SPIM",
]
],
".."
)
}}

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](PATH_TO_SRC/02-common-principles.html#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](PATH_TO_SRC/02-common-principles.html#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`](PATH_TO_SRC/99-appendices/09-entities.html#part)
in conjunction with the `bold` suffix.
anyOf:
- unit: arbitrary
Expand Down
7 changes: 5 additions & 2 deletions tools/mkdocs_macros_bids/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ def make_glossary(relpath=None):
return text


def make_suffix_table(suffixes):
def make_suffix_table(suffixes, relpath=None):
"""Generate a markdown table of suffix information.
Parameters
----------
suffixes : list of str
A list of the suffixes to include in the table.
relpath : str | None
path from file where this func is called to src/
Returns
-------
Expand All @@ -107,7 +110,7 @@ def make_suffix_table(suffixes):
"""
schemapath = utils.get_schema_path()
schema_obj = schema.load_schema(schemapath)
table = render.make_suffix_table(schema_obj, suffixes)
table = render.make_suffix_table(schema_obj, suffixes, relpath)
return table


Expand Down
7 changes: 6 additions & 1 deletion tools/schemacode/schemacode/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,15 @@ def _remove_numeric_suffixes(string):
return table_str


def make_suffix_table(schema, suffixes, tablefmt="github"):
def make_suffix_table(schema, suffixes, relpath=None, tablefmt="github"):
"""Produce suffix table (markdown) based on requested suffixes.
Parameters
----------
schema : dict
suffixes : list of str
relpath : str | None
path from file where this func is called to src/
tablefmt : str
Returns
Expand Down Expand Up @@ -445,6 +447,9 @@ def make_suffix_table(schema, suffixes, tablefmt="github"):
description = description.replace("\n\n", "<br>")
# Otherwise a newline corresponds to a space
description = description.replace("\n", " ")
# Spec internal links need to be replaced
if relpath is not None:
description = description.replace("PATH_TO_SRC", relpath)

df.loc[suffix] = [suffix_info["name"], description]

Expand Down

0 comments on commit f89aa5c

Please sign in to comment.