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

refactor: move website examples into data files #2972

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

not-my-profile
Copy link
Collaborator

The examples showcased on the website were previously all defined in the the YAML front matter of _index.md. This commit moves them to separate data files1, which are easier to edit and test.

The examples showcased on the website were previously all defined in the
the YAML front matter of _index.md. This commit moves them to separate
data files[1], which are easier to edit and test.

[1]: https://gohugo.io/templates/data-templates/
@not-my-profile not-my-profile force-pushed the split-website-examples branch from 30b9dab to f1e8bef Compare July 14, 2023 09:34
@aljazerzen
Copy link
Member

Thank you for the contribution!

Do you think that it is worth splitting the new .yaml files into separate .prql and .sql files, so we get syntax highlighting when editing them? We do something similar with integration tests and book tests.

@not-my-profile
Copy link
Collaborator Author

Currently the example metadata also includes a label, so I think it makes sense to have everything together (i.e. label, prql and sql) in one file.

@aljazerzen
Copy link
Member

Could we put the label into _index.md?

@not-my-profile
Copy link
Collaborator Author

Yeah we could but then the data for one example would be split up across three different files, which I think would make editing examples more cumbersome.

@aljazerzen
Copy link
Member

I'm -0.5 on merging this, as the examples equality accessible as before as since they are still in YAML, but spread over multiple file.

@max-sixty I'll defer this one to you.

@not-my-profile
Copy link
Collaborator Author

I want to note that the refactor did enable the test code to be simplified since it no longer has to extract the tests from _index.md or special case the hero example.

@max-sixty
Copy link
Member

Oh I'm +1 on this, test code is much simpler.

I would be even keener if they were .prql files we could snapshot; then we get the benefits of editing PRQL files directly, and zero test code. But that requires running the compilation as part of building the website (unless we instead extract from the snapshot files mitsuhiko/insta#353)

@max-sixty max-sixty merged commit 445ded1 into PRQL:main Jul 19, 2023
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.

3 participants