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

[ENH] Link to filename element definitions in filename templates #1228

Merged
merged 29 commits into from
Aug 23, 2022

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Aug 17, 2022

Closes None, but will help with #612.

Changes proposed:

  • Filename elements (e.g., suffixes, entities, extensions, datatypes) in the filename templates throughout the specification now link to the definitions of those elements. For example, if a filename allows the task entity, that portion of the filename template will link to the task entity definition in the Entities appendix page.

This feels really close. The problem is that the paths aren't working properly.

Basically, hrefs like SPEC_ROOT/99-appendices/09-entities.md#subject are resolving to https://bids-specification--1228.org.readthedocs.build/en/1228/04-modality-specific-files/99-appendices/09-entities.md#subject. Note the 04-modality-specific-files.

@tsalo tsalo added formatting Aesthetics and formatting of the spec schema-code Updates or changes to the code used to parse, filter, and render the schema. labels Aug 17, 2022
@tsalo tsalo requested a review from Remi-Gau August 17, 2022 19:37
Copy link
Collaborator

@Remi-Gau Remi-Gau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG. This looks amazing already.

Definitely worth trying to make this last bit work I think (no pressure)

@Remi-Gau
Copy link
Collaborator

Technically we could also link to the suffixes, right?

@tsalo
Copy link
Member Author

tsalo commented Aug 18, 2022

Yes, ultimately I'd like to link to the (1) entities, (2) datatypes, (3) entity value formats (index vs. label vs. enum), (4) suffixes, and (5) extensions. Adding in new links won't be too hard, so once I actually have the links working I'll add a whole bunch of other ones.

@tsalo
Copy link
Member Author

tsalo commented Aug 18, 2022

It seems to be working, and it is GLORIOUS!!

@sappelhoff
Copy link
Member

amazing 👏 🚀

@tsalo
Copy link
Member Author

tsalo commented Aug 18, 2022

Oh but now the PDF looks awful. 😞

image

@sappelhoff
Copy link
Member

can you selectively switch this behavior off for the pdf build?

@tsalo tsalo changed the title [ENH] Try linking to entities in make_filename_template. [ENH] Link to filename element definitions in filename templates Aug 18, 2022
@tsalo
Copy link
Member Author

tsalo commented Aug 18, 2022

@sappelhoff I have refactored things a bit to toggle the formatting based on a new function argument (pdf_format). I need to figure out how to get the pdf build to use this new argument now.

Copy link
Collaborator

@Remi-Gau Remi-Gau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @tsalo

@sappelhoff
Copy link
Member

Thanks @tsalo!

@sappelhoff sappelhoff merged commit ea25a5f into bids-standard:master Aug 23, 2022
@sappelhoff sappelhoff added this to the 1.8.0 milestone Aug 23, 2022
@tsalo tsalo deleted the link-in-templates branch August 23, 2022 12:34
@tsalo
Copy link
Member Author

tsalo commented Aug 23, 2022

Uh oh, it looks like the new links don't point to the specific language and version. They were fine in the CI build, but I guess that this specific issue wasn't covered.

So instead of:

https://bids-specification.readthedocs.io/en/latest/99-appendices/09-entities.html#sub

Links go to:

https://bids-specification.readthedocs.io/99-appendices/09-entities.html#sub

@tsalo
Copy link
Member Author

tsalo commented Aug 23, 2022

This seems to be the relevant part of the mkdocs documentation: https://www.mkdocs.org/user-guide/writing-your-docs/#linking-from-raw-html. Unfortunately, I still don't know how to "manually format the link appropriately".

@effigies
Copy link
Collaborator

We can't. We'll need to figure out the SPEC_ROOT stuff.

@tsalo
Copy link
Member Author

tsalo commented Aug 23, 2022

I think I have SPEC_ROOT rendering correctly. I assumed that the problem was more complicated than it seems to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatting Aesthetics and formatting of the spec schema-code Updates or changes to the code used to parse, filter, and render the schema.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants