diff --git a/pdf_build_src/remove_admonitions.py b/pdf_build_src/remove_admonitions.py index 1942f8b5b0..efcc7e60d2 100644 --- a/pdf_build_src/remove_admonitions.py +++ b/pdf_build_src/remove_admonitions.py @@ -10,7 +10,7 @@ INDENT = " " -ADMONITION_DELIMITERS = ["!!!", "???", "???+"] +ADMONITION_DELIMITERS = ["???+", "!!!", "???"] def remove_admonitions( @@ -34,17 +34,12 @@ def remove_admonitions( with open(output_file, "w", encoding="utf8") as f: is_admonition = False - counter = 0 for line in content: if any(line.startswith(x) for x in ADMONITION_DELIMITERS): is_admonition = True - counter = 0 - continue - - # skip first line after admonition - if is_admonition and counter == 0: - counter += 1 + line = process_admonition_heading(line) + f.write(line) continue if line != "\n" and not line.startswith(indent): @@ -56,6 +51,18 @@ def remove_admonitions( f.write(line) +def process_admonition_heading(line: str) -> str: + line = line.replace("\n", "") + line = line.replace('"', "") + for x in ADMONITION_DELIMITERS: + line = line.replace(x, "", 1) + line = line.lstrip() + words = line.split(" ") + words[0] = f"{words[0].capitalize()}:" + line = "**" + " ".join(words) + "**\n" + return line + + if __name__ == "__main__": """If run as a script this will just run the main function on test data.""" input_folder = Path(__file__).parent / "tests" / "data" / "input" diff --git a/pdf_build_src/tests/data/expected/README.md b/pdf_build_src/tests/data/expected/README.md index 37fadc295d..4c27a41a56 100644 --- a/pdf_build_src/tests/data/expected/README.md +++ b/pdf_build_src/tests/data/expected/README.md @@ -4,6 +4,8 @@ This input directory contains data to use for testing the pdf build code of the For example the following admonition should be removed by `pdf_build_src/remove_admonitions.py`. +**Note:** + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, @@ -15,13 +17,19 @@ as they should look like after processing. [Mkdocs admonitions](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#inline-blocks-inline-end) come in different type. In aaddtion of the classical admonitions show above you have also: +**Note: Collapsible admonitions** + Collapsible admonitions start with 3 questions marks (`???`). +**Note: Expanded collapsible admonitions** + Collapsible admonitions that will be shown as expanded start with 3 questions marks and a plus sign (`???+`). +**Example: non ordered list should be handle properly** + Let's see - [`UK biobank`](https://github.com/bids-standard/bids-examples/tree/master/genetics_ukbb) diff --git a/pdf_build_src/tests/data/expected/modality-specific-files/magnetic-resonance-imaging-data.md b/pdf_build_src/tests/data/expected/modality-specific-files/magnetic-resonance-imaging-data.md index d70af64a49..78aa241db1 100644 --- a/pdf_build_src/tests/data/expected/modality-specific-files/magnetic-resonance-imaging-data.md +++ b/pdf_build_src/tests/data/expected/modality-specific-files/magnetic-resonance-imaging-data.md @@ -2,6 +2,8 @@ ## Common metadata fields +**Warning: foo bar** + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, diff --git a/pdf_build_src/tests/data/input/README.md b/pdf_build_src/tests/data/input/README.md index cab4817282..d044bc9f09 100644 --- a/pdf_build_src/tests/data/input/README.md +++ b/pdf_build_src/tests/data/input/README.md @@ -28,7 +28,7 @@ come in different type. In aaddtion of the classical admonitions show above you -!!! example "non ordered list should be handle propeler" +!!! example "non ordered list should be handle properly" Let's see diff --git a/src/index.md b/src/index.md index ade6162157..8713499ae8 100644 --- a/src/index.md +++ b/src/index.md @@ -15,3 +15,11 @@ Alternatively, to get started please read [the introduction to the specification For an overview of the BIDS ecosystem, visit the [BIDS homepage](https://bids.neuroimaging.io). The entire specification can also be [downloaded as PDF](https://doi.org/10.5281/zenodo.3686061). + +::: note +FOO barr +::: + +::: warning +FOO barr +:::