Skip to content

Sort the language menus by language name#656

Merged
tannewt merged 1 commit into
adafruit:masterfrom
Neradoc:sort-languages-menu
Mar 25, 2021
Merged

Sort the language menus by language name#656
tannewt merged 1 commit into
adafruit:masterfrom
Neradoc:sort-languages-menu

Conversation

@Neradoc
Copy link
Copy Markdown
Contributor

@Neradoc Neradoc commented Mar 24, 2021

The language menus are in an arbitrary order, making it potentially confusing when looking for one. The order used is the one from the files.json file, which in turn depends on the way languages are listed with os.scandir in the circuitpython repository (build_board_info.py).

The displayed language names are in the board.html template. To sort by name the code uses Liquid's {%capture%} and split to make a new list with the name and the language code, so it can be sorted. This requires a little bit of manipulations to avoid whitespaces interfering with the sort.

Copy link
Copy Markdown
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you!

@tannewt tannewt merged commit d9a26b1 into adafruit:master Mar 25, 2021
@Neradoc Neradoc deleted the sort-languages-menu branch May 5, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants