-
Notifications
You must be signed in to change notification settings - Fork 307
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
cuelang.org: preprocessor: make examples' files available in a repo #2900
Labels
Comments
I think the main suggestion discussed on the call was making these files available in a GitHub repo. So let's discuss how that might work first. |
cueckoo
referenced
this issue
in cue-lang/cuelang.org
Feb 12, 2024
This is a demo for cue-lang/docs-and-content#57. Preview-Path: /docs/howto/use-encoding-base64-decode/file.cue Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I86a5d291dc7e8eca58933c4a0ea1e1745ff83441
cueckoo
referenced
this issue
in cue-lang/cuelang.org-trybot
Feb 12, 2024
This is a demo for cue-lang/docs-and-content#57. Preview-Path: /docs/howto/use-encoding-base64-decode/file.cue Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I86a5d291dc7e8eca58933c4a0ea1e1745ff83441 Dispatch-Trailer: {"type":"trybot","CL":1176769,"patchset":1,"ref":"refs/changes/69/1176769/1","targetBranch":"alpha"}
Now reflected in the initial comment. |
cueckoo
pushed a commit
to cue-lang/cuelang.org
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f
cueckoo
pushed a commit
to cue-lang/cuelang.org-trybot
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f Dispatch-Trailer: {"type":"trybot","CL":1188421,"patchset":1,"ref":"refs/changes/21/1188421/1","targetBranch":"master"}
cueckoo
pushed a commit
to cue-lang/cuelang.org
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f
cueckoo
pushed a commit
to cue-lang/cuelang.org-trybot
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f Dispatch-Trailer: {"type":"trybot","CL":1188421,"patchset":2,"ref":"refs/changes/21/1188421/2","targetBranch":"master"}
cueckoo
pushed a commit
to cue-lang/cuelang.org
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f
cueckoo
pushed a commit
to cue-lang/cuelang.org-trybot
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f Dispatch-Trailer: {"type":"trybot","CL":1188421,"patchset":3,"ref":"refs/changes/21/1188421/3","targetBranch":"master"}
cueckoo
pushed a commit
to cue-lang/cuelang.org
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. For cue-lang/docs-and-content#92 Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f
cueckoo
pushed a commit
to cue-lang/cuelang.org-trybot
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. For cue-lang/docs-and-content#92 Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f Dispatch-Trailer: {"type":"trybot","CL":1188421,"patchset":4,"ref":"refs/changes/21/1188421/4","targetBranch":"master"}
cueckoo
pushed a commit
to cue-lang/cuelang.org
that referenced
this issue
Mar 28, 2024
This adds a small set of representative examples to the playground, replacing the current invalid examples. They are placed in an indicative structure, with the "Introduction" category being intended to hold examples for the user who landed on the playground before reading any other part of the site, and the "Tour" category showing a couple of CUE examples taken directly from the on-page CUE in docs/tour/. The Tour category isn't expanded to include all the docs examples, yet, as both cue-lang/cue#2995 and cue-lang/cue#2900 need resolving to let us avoid spending a *lot* of time on manual content syncing. Formatting notes for as&when the examples are expanded, and if their generation is automated: - Because cue-lang/cue#722 also strikes the playground ("top-level comments are indented") when the playground's default of "cue eval" is selected, care has been taken to make sure that comments are used that don't trigger this bug (as it looks pretty poor for predefined examples to have this problem). Some relevant information: - only the first comment presented at the top of the "eval" output is affected - it doesn't affect comments which aren't included in the output, such as introductory comments which are separated by a blank line from the first field emitted - it doesn't affect fields with a struct or list value - it only affects single-line comments - it can affect a comment that's not the first line of the source, if it's attached to any definition of the first field that's present in the emitted output - Including links from tour-derived examples back to the relevant tour page feels like a win, but they need to be split over two comment lines or the end of the URL disappears from view. This also has the nice effect of pushing the URL to the second line of the editor, which makes the "Follow link (ctrl+click)" mouseover popup *not* get visually truncated by the top edge of the editor pane. For cue-lang/docs-and-content#92 Preview-Path: /play Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I374ee591f767bea3a0e07f29ce7825468661f42f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1188421 Reviewed-by: Paul Jolly <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some pages contain named files inside
code
orupload
blocks, and we could make those files available as stand alone, plain text files in a repo.This would either need to be implemented inside the preprocessor, or authors will need to manually sync content and files.
Purpose
Making these files available would be a low friction way to allow a reader to play with an example's CUE/JSON/YAML files by simply cloning the repo and navigating to the relevant page's directory.
Considerations
Which repo?
If we were to commit the files into
cue-lang/cuelang.org
, this would have several advantages:The only disadvantages I can see are that the
cue-lang/cuelang.org
repo's size would grow a little faster on each (example-altering) change; and that the repo that the inquisitive reader would need to download would be a bit larger than strictly needed, as they'd necessarily pull down the entire site contents and not just the plain text example files. However, both of these size concerns are pretty trivial.Suggestion: include the files in
cue-lang/cuelang.org
in the same commit that introduces/modifies the markdown source of the files.Where, in the
cue-lang/cuelang.org
repo?Whilst we could place the example files alongside the content they're sourced from, we'd probably want to place them in a sub-directory of the content directory so that the user's
cue
commands wouldn't interact with the content directory'ssite.cue
site
package, and so that the user could simply copycue
commands from the the on-page examples and have them work without modification. How this putativecontent/docs/howto/foo-a-bar/examples/
directory would pass through the Hugo processing, however, is not yet known. Would Hugo try to render a page under that path? Or complain about there not being a renderable source file?However, instead of using the
content
directory as the root for the example files, we could place the example files inside a dedicated directory hierarchy, with a structure mirroring the URL paths that readers see on the front end.Furthermore, if we're clever about the example files' location, then we can achieve both this issue's goal and give ourselves a mechanism for (later) linking to the files via HTTP.
If we use Hugo's static files union-fs-like system, we can place the files in scope for the Hugo build whilst also leaving them isolated on disk for
cue
users. We can even instantiate a top-level symlink directory in the repo (examples
) forcue
users to experiment with, as is demonstrated in this CL, simultaneously making this file's URL available for later on-page linkage if we so choose. (The symlink has to be this way round,examples
->hugo/examples
, as Hugo forbids the other way round)Suggestion: serialise into
hugo/examples
and symlinkexamples
into there.code
: overlapping filenamescode
blocks are evaluated by the preprocessor in isolation from one another, meaning that multiple code blocks can contain the same filename. How should such a situation be serialised?script
: mutable file content over the course of the pagescript
blocks build on the context of precedingscript
andupload
blocks. There can be multipleupload
blocks for the same (updated) file, and a script block can create, update and delete files. How should a multi-step script's fake filesystem get serialised? Once for each step? After the last step?Rendering
Nothing on-page, yet. Perhaps a single page should explain that these files exist, but nothing needs changing on the preprocessor's pages emitted into the
hugo
directory.The text was updated successfully, but these errors were encountered: