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

Allow load_data to take a literal #1794

Merged
merged 1 commit into from
Mar 21, 2022
Merged

Allow load_data to take a literal #1794

merged 1 commit into from
Mar 21, 2022

Conversation

asimpletune
Copy link
Contributor

@asimpletune asimpletune commented Mar 11, 2022

Relevant discussion: https://zola.discourse.group/t/allow-load-data-to-take-a-literal/1165

I posted on the Zola discourse site but I don't think anyone responded. In any case, I've being using POST + an "echo server" to essentially do the same thing, which is kind of less than ideal. The change was relatively easy to make, so I just did it.

Basically, I just think this is relatively harmless and would make Zola a tiny bit more flexible and easy to use. It could be something as simple as prototyping and not wanting to have to load from an actual file, or there could be something very complicated that you're doing perhaps, for example maybe you need to deviate from something that's stored in a file, like it's beyond your control, but you still need it in object format.

In any case, I ran into some circumstances that weren't pleasant to deal with without it, and my best solution was the echo server I mentioned above, which isn't super fun to use.

IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

@asimpletune asimpletune changed the title Add literal Allow load_data to take a literal Mar 11, 2022
@Keats
Copy link
Collaborator

Keats commented Mar 15, 2022

Can you remove the unrelated commits?

@asimpletune
Copy link
Contributor Author

asimpletune commented Mar 15, 2022 via email

@asimpletune asimpletune deleted the origin_next branch March 16, 2022 12:45
@asimpletune asimpletune restored the origin_next branch March 16, 2022 12:46
@asimpletune asimpletune reopened this Mar 16, 2022
@asimpletune asimpletune deleted the origin_next branch March 16, 2022 12:48
@asimpletune asimpletune restored the origin_next branch March 16, 2022 12:49
@asimpletune asimpletune reopened this Mar 16, 2022
@asimpletune asimpletune deleted the origin_next branch March 16, 2022 12:51
@asimpletune asimpletune restored the origin_next branch March 16, 2022 12:52
@asimpletune asimpletune reopened this Mar 16, 2022
@asimpletune
Copy link
Contributor Author

@Keats I fixed the commit history like you asked, so should be ready to review. Thanks.

components/templates/src/global_fns/load_data.rs Outdated Show resolved Hide resolved
components/templates/src/global_fns/load_data.rs Outdated Show resolved Hide resolved
* Add `literal` as a new entry for `data source`, to be used by the `load_data` function

* Add tests to the module for plain text, json, xml, toml, and csv

* Update error messaging to include literal as a potential choice

* Update site documentation to include instructions for using `load_data` with a literal
@asimpletune asimpletune requested a review from Keats March 18, 2022 10:18
@Keats Keats merged commit a13d41b into getzola:next Mar 21, 2022
@Keats
Copy link
Collaborator

Keats commented Mar 21, 2022

Thanks!

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