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] Render code blocks with language "tsv" as tables #1794

Merged
merged 6 commits into from
Dec 18, 2024
Merged

Conversation

effigies
Copy link
Collaborator

@effigies effigies commented Apr 18, 2024

Rendered: https://bids-specification--1794.org.readthedocs.build/en/1794/

This is another go at #644 along the lines of #1783 (comment).

It's not working 100% for me, but I've maxed out my time on this. Pushed to upstream so others can take it up or open PRs against it.

The code for this does not need to live in bidsschematools, but that's the quickest way to get something into the import namespace.

cc @Remi-Gau

@effigies effigies added enhancement New feature or request formatting Aesthetics and formatting of the spec labels Apr 18, 2024
@effigies

This comment was marked as outdated.

@Remi-Gau
Copy link
Collaborator

that's way quicker than anything I would have done

I can try tweaking this to see if I can make it work

@Remi-Gau Remi-Gau added the exclude-from-changelog This item will not feature in the automatically generated changelog label Apr 19, 2024
@effigies
Copy link
Collaborator Author

FWIW I think this is not an exclude-from-changelog contribution, as it affects how to interpret what's seen in the spec.

@Remi-Gau Remi-Gau removed the exclude-from-changelog This item will not feature in the automatically generated changelog label Apr 21, 2024
@Remi-Gau
Copy link
Collaborator

FWIW I think this is not an exclude-from-changelog contribution, as it affects how to interpret what's seen in the spec.

that's fair

@effigies effigies force-pushed the tsv-fences branch 5 times, most recently from 75f1968 to bc86f79 Compare December 17, 2024 19:09
@effigies effigies marked this pull request as ready for review December 17, 2024 19:13
@effigies effigies force-pushed the tsv-fences branch 2 times, most recently from 0f1b9fd to 7f33895 Compare December 17, 2024 19:32
Copy link
Collaborator Author

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Links and screenshots of all affected locations.

Comment on lines +68 to 71
```tsv
session_id acq_time systolic_blood_pressure
ses-predrug 2009-06-15T13:45:30 120
ses-postdrug 2009-06-16T13:45:30 100
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +489 to 492
```tsv
filename acq_time
func/sub-control01_task-nback_bold.nii.gz 1877-06-15T13:45:30
func/sub-control01_task-motor_bold.nii.gz 1877-06-15T13:55:33
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +525 to 528
```tsv
session_id acq_time systolic_blood_pressure
ses-predrug 2009-06-15T13:45:30 120
ses-postdrug 2009-06-16T13:45:30 100
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +81 to 84
```tsv
trial response response_time stim_file
congruent red 1.435 images/word-red_color-red.jpg
incongruent red 1.739 images/word-red_color-blue.jpg
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

Comment on lines +29 to 32
```tsv
volume_type
control
label
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +97 to 101
```tsv
34 110 0
44 112 0
23 100 1
```
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +90 to 93
```tsv
onset duration trial_type response_time stim_file channel annots
1.23 0.65 start 1.435 images/red_square.jpg n/a n/a
5.65 0.65 stop 1.739 images/blue_square.jpg n/a n/a
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +249 to 254
```tsv
participant_id age sex handedness group
sub-01 34 M right read
sub-02 12 F right write
sub-03 33 F n/a read
```
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +323 to 330
```tsv
sample_id participant_id sample_type derived_from
sample-01 sub-01 tissue n/a
sample-02 sub-01 tissue sample-01
sample-03 sub-01 tissue sample-01
sample-04 sub-02 tissue n/a
sample-05 sub-02 tissue n/a
```
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +447 to 460
```tsv
time plasma_radioactivity whole_blood_radioactivity metabolite_parent_fraction metabolite_polar_fraction
0 0 0 1 0
145 43.31 33.79 0.5749 0.1336
292 48.96 37.42 0.3149 0.2746
602 39.84 32.05 0.1469 0.3548
1248 37.38 31.52 0.073 0.444
1785 36.40 28.83 0.078 0.429
2390 33.13 26.32 0.061 0.453
3059 30.83 25.22 0.049 0.473
4196 27.28 21.98 0.036 0.503
5407 22.70 19.49 0.032 0.523
7193 19.71 15.70 0.02 0.559
```
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

I guess original description should get this sentence crossed-out/removed?

It's not working 100% for me, but I've maxed out my time on this. Pushed to upstream so others can take it up or open PRs against it.

I have tested a cut on linux producing tab separated representation somehow, so as to me it is everything anyone could hope for.

Well done @effigies . Thanks for posting all previews!

custom_fences:
- name: tsv
class: tsv
format: !!python/name:bidsschematools.render.tsv.fence
Copy link
Collaborator

Choose a reason for hiding this comment

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

image

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.

Heck yes!!!
Let's go (just because of the sheer number of things this closes)

@Remi-Gau
Copy link
Collaborator

@effigies effigies changed the title ENH: Render code blocks with language "tsv" as tables [ENH] Render code blocks with language "tsv" as tables Dec 18, 2024
@effigies effigies merged commit e6d1c56 into master Dec 18, 2024
24 of 25 checks passed
@effigies effigies deleted the tsv-fences branch December 18, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request formatting Aesthetics and formatting of the spec needs review
Projects
None yet
3 participants