readthedocs-fr / bin-server

Un outil pour héberger des snippets de code et les partager via une URL.
https://bin.readthedocs.fr
MIT License
14 stars 15 forks source link

feat(highlight): allow all languages #156

Closed Mesteery closed 2 years ago

Mesteery commented 2 years ago

This allow to use any supported language by Pygments. These additionals languages are not displayed in the frontend.

To achieve this, highlight "utils" has been greatly refactored.

Closes https://github.com/readthedocs-fr/bin-server/issues/119

Julien00859 commented 2 years ago

I really don't like to changes... The more I see those two parse_extension and parse_language functions, the more I feel like the two are dump. Maybe we should just use langtoext and exttolang directly in controller.py. Also IMO we should move all that langage stuff into hightlight.py.

The changes you did in new are very odd, like I really don't understand why you had to change all the existing code. Also ext = DEFAULT_LANGAGE wtf ??

Mesteery commented 2 years ago

The changes you did in new are very odd, like I really don't understand why you had to change all the existing code. Also ext = DEFAULT_LANGAGE wtf ??

I don't know. I don't even know if this branch is really ready, this commit has been done since many months and I don't remember much.

This would be an opportunity to rework this from scratch I think.

Julien00859 commented 2 years ago

@Mesteery I did re-write it from scratch, there are new unittests and I also manually tested the /new route (both x-form-urlencoded and multipart). Can you review the code?