-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
tpl/transform: Add template func for TOML/JSON/YAML docs examples conversion #4395
Conversation
Serlify? Where did you come up with that? 😆 |
Here. |
Seriously, I welcome better suggestions (however I suspect this will be a classic. So TOML, JSON etc. are data serialization formats ... serlify). But this func is kind of a special purpose "Hugo docs func", but I guess others will pick up on it ... |
tpl/transform/serlify.go
Outdated
|
||
// Serlify is used in the Hugo documentation to convert configuration | ||
// examples from YAML to JSON, TOML (and possibly the other way around). | ||
// The is primary a helper for the Hugo docs site which is why it got this stupid name. |
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.
"This is primarily"
tpl/transform/serlify.go
Outdated
// Serlify is used in the Hugo documentation to convert configuration | ||
// examples from YAML to JSON, TOML (and possibly the other way around). | ||
// The is primary a helper for the Hugo docs site which is why it got this stupid name. | ||
// It is not general purpose YAML to TOML converter etc., and may |
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.
"not a"
@regisphilibert I will merge this into master some time during this weekend. It should work, but I want to test it a little. There may be some date issues that could be improved. Not sure. |
@bep Sure I'll try it once it's on master and will go back to the hugoDocs repo to add the toggling config shortcode issue where we'll talk more about front end. Thanks a ton! You were super fast with this. |
Yes, I have been annoyed by the "example situation" for a long time -- and if someone wants to do something about it, I will try to keep that momentum going ... |
How about serialize, or remarshal (there's even a GitHub repo named that, that does exactly this - TOML/YAML/JSON conversion)? |
"remarshal" I kind of like, but ... |
I like that it ends with ...fy. Reminds of jsonify which everybody knows. |
My take is that in jsonify, removing "ify", the "json" part makes sense, and similarly "markdown" + "ify" = markdownify. The same logic doesn't work here.. "serl" doesn't mean anything. If sticking to "-ify" is the aim, then may be.. serialify. But then the question is.. is this process technically serialization/marshalling? JSON, or TOML, or YAML, each of those is already marshalled, or converted from raw data into some sort of format, a spec, an object. If we are converting among these formats, something like remarshall, reformat, transform (though, the library is also called the same) sounds more correct. |
hint hint |
Or if the package name will always be present:
Or even:
The latter works even if the package name is optional:
|
@vassudanagunta thanks, but it needs to be one method so it can be (easy to) dynamically invoked. |
And the winner is @kaushalmodi {{ "title = \"Hello World\"" | transform.Remarshal "json" | safeHTML }} |
…version Usage: ```html {{ "title = \"Hello World\"" | transform.Remarshal "json" | safeHTML }} ``` Fixes gohugoio#4389
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Usage:
Fixes #4389
/cc @regisphilibert