-
Notifications
You must be signed in to change notification settings - Fork 7
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
Pre-commit (prettier + black) #73
Pre-commit (prettier + black) #73
Conversation
Added black and prettier
Accidentally introduced breaking changes to |
caaf571
to
c277745
Compare
Thanks for starting this PR, @VeckoTheGecko. While it looks nice for index.html (and I guess we do need to refactor that; it's gotten a bit out of control!), I'm not sure about all the changes in the other files (e.g. the json files for the drifter data). This red has become somewhat of a catch-all for when we need a lace to put material/data online, and all the reformatting might unintentionally break workflows downstream. Also, quite a few files are legacy, e.g. from older conferences such as the vegu21. Not sure they need updating either.. So please don't touch files other than the core ones for the website, in the refactoring? |
c277745
to
b2f300d
Compare
Can do, didn't realise that json data files were in the repo. Switched the prettier ignore file to an allowlist instead, looking at:
Much smaller diff this time 😄 |
OK, this looks much better! But now |
Read in index.html using beautiful soup, and write out. This automatically fixes some errors like unclosed tags. ```py from bs4 import BeautifulSoup html_file = "index.html" with open(html_file, 'r') as file: html_content = file.read() soup = BeautifulSoup(html_content, 'html.parser') with open(html_file, 'w', encoding="utf-8") as file: file.write(str(soup)) ```
Side by side comparison has been used to ensure that these manual changes don't visually change the website.
There were quite a few errors within the file (see https://validator.w3.org/nu/?doc=https%3A%2F%2Foceanparcels.org%2F) including tags that weren't closed, and incorrect nesting of elements (e.g. Managed to fix these now I think (with the caveat that the tooling I used in b8301be made a nasty diff making it difficult to see where the parser inserted the missing closing tags). 09daaba used prettier to catch remaining errors (some where beautiful soup misplaced 2 closing tags). Comparing the final page to the current website, they are visually indistinguishable to me. So I guess the parsing done in b8301be is the same as how web-browsers parse broken HTML. This is definitely a messy PR with messy diffs. I'm not even sure if doing these fixes to introduce formatting helps from a maintainence POV, or is just noise. Feel free to close this if its more headache than its worth (no hard feelings from this end) 🙂. Feel free to specify any prettier config options you'd like in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good! Just one minor comment. And then I guess we (I?) need to set up something local for the pre-commit to work?
Either in CI (pre-commit ci which is free for open source projects), or local through brew, pypi, or conda (installation). Local setup is just a matter of installing then running |
I thought auto-formatters would help with maintaining the site.
Maintainer TODO:
Feel free to reject this PR if change if too invasive.
*
index.html
has many unclosed tags which I couldn't fix. Added to.prettier-ignore
for now so that pre-commit doesn't error out.