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

html: Fix typo in JavaScript example #386

Merged
merged 1 commit into from
May 30, 2024
Merged

html: Fix typo in JavaScript example #386

merged 1 commit into from
May 30, 2024

Conversation

sno2
Copy link
Contributor

@sno2 sno2 commented May 30, 2024

No description provided.

@sno2 sno2 requested a review from a team as a code owner May 30, 2024 02:01
@sno2 sno2 requested review from gaby, sixcolors, ReneWerner87 and efectn and removed request for a team May 30, 2024 02:01
Copy link

coderabbitai bot commented May 30, 2024

Walkthrough

The change addresses a syntax error in a JavaScript object declaration within Go templates by fixing a missing colon in a key-value pair. This correction ensures that the JavaScript code embedded in the templates will execute correctly, preventing potential runtime errors and improving the overall robustness of the application.

Changes

Files Change Summary
html/TEMPLATES_CHEATSHEET.md Fixed a syntax error in a JavaScript object declaration within Go templates by adding a missing colon in the key-value pair.

Poem

In the land of code, a bug did hide,
A missing colon, syntax denied.
With a swift fix, the error was gone,
Now templates shine, code marches on.
🎉✨ Hooray for clean code, robust and strong! 🚀🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the ☢️ Bug Something isn't working label May 30, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (4)
html/TEMPLATES_CHEATSHEET.md (4)

Line range hint 3-3: Consider adding a comma before "but" to improve readability.

- Both packages use the same interface but the following examples of the core features are directed towards HTML applications.
+ Both packages use the same interface, but the following examples of the core features are directed towards HTML applications.

Line range hint 25-25: Add a comma after "Finally" to clarify the sentence structure.

- Finally analysis of large Go codebases finds that `.tpl` is often used by developers.
+ Finally, analysis of large Go codebases finds that `.tpl` is often used by developers.

Line range hint 95-95: Capitalize "Internet Explorer" to refer correctly to the browser.

- detecting internet explorer.
+ detecting Internet Explorer.

Line range hint 129-129: Correct the possessive pronoun to "its".

- then it’s fields can be accessed using the dot with the field name `{{ .FieldName }}`.
+ then its fields can be accessed using the dot with the field name `{{ .FieldName }}`.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6ab7cd6 and 321980e.
Files selected for processing (1)
  • html/TEMPLATES_CHEATSHEET.md (1 hunks)
Additional Context Used
LanguageTool (45)
html/TEMPLATES_CHEATSHEET.md (45)

Near line 3: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...ks. Both packages use the same interface but the following examples of the core feat...
Rule ID: COMMA_COMPOUND_SENTENCE_2


Near line 25: A comma may be missing after the conjunctive/linking adverb ‘Finally’.
Context: ...ing in both Atom and GoSublime editors. Finally analysis of large Go codebases finds th...
Rule ID: SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA


Near line 25: Consider adding a comma here.
Context: ... developers. While the extension is not important it is still good to be consistent withi...
Rule ID: IF_THAT_S_NOT_POSSIBLE_COMMA


Near line 45: Consider adding a comma.
Context: ...emplate Once a template has been parsed there are two options to execute them. A sing...
Rule ID: IF_THERE_COMMA


Near line 59: The auxiliary verb ‘do’ requires the base form of the verb.
Context: ...coding Go’s html/template package does encoding based on the context of the code. As a ...
Rule ID: DID_BASEFORM


Near line 61: After the expression ‘for example’ a comma is usually used.
Context: ...encoding to be rendered correctly. For example the < and > in "<h1>A header!</h1>" w...
Rule ID: COMMA_FOR_EXAMPLE


Near line 95: Possible missing comma found.
Context: ...This can cause issues when comments are necessary such as detecting internet explorer. `...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 95: The proper noun “Internet Explorer” (= Microsoft browser) needs to be capitalized.
Context: ...omments are necessary such as detecting internet explorer. ```html <!--[if IE]> Place content ...
Rule ID: MICROSOFT_PRODUCTS


Near line 127: Loose punctuation mark.
Context: ... the template can be accessed using dot {{ . }}. If the data is a complex type then ...
Rule ID: UNLIKELY_OPENING_PUNCTUATION


Near line 129: Consider adding a comma.
Context: ...{{ . }}`. If the data is a complex type then it’s fields can be accessed using the d...
Rule ID: IF_THEN_COMMA


Near line 129: Did you mean to use the possessive pronoun “its”?
Context: ...}`. If the data is a complex type then it’s fields can be accessed using the dot wi...
Rule ID: IT_S_ITS


Near line 137: Possible missing comma found.
Context: ...= .}}We use the$number` to create a variable then initialize it with the value passe...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 137: It seems that a comma is missing.
Context: ...alue passed to the template. To use the variable we call it in the template with `{{$num...
Rule ID: IN_ORDER_TO_VB_COMMA


Near line 152: It appears that a comma is missing.
Context: ...tdout, "templateName", 23) ``` In this example we pass 23 to the template and stored i...
Rule ID: DURING_THAT_TIME_COMMA


Near line 160: It seems that a comma is missing.
Context: ...ment to check for values, if it doesn’t exist we can use an else value. The empty val...
Rule ID: IF_COMMA


Near line 174: “out” (outside) seems less likely than “our” (belonging to us).
Context: ...or we can use the minus sign - within out template. `

Hello, {{if .Name}} {{....
Rule ID: AI_HYDRA_LEO_CP_OUT_OUR


Near line 209: Consider adding a comma after this introductory phrase.
Context: ...l for each Item automatically. Within a range each Item becomes the {{.}} and the i...
Rule ID: AS_A_NN_COMMA


Near line 221: Possible missing comma found.
Context: ...sed to the template is a map, slice, or array it can be indexed from the template. We...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 221: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...he keyword, x is the data and number is a integer for the index value. If we had ...
Rule ID: EN_A_VS_AN


Near line 247: It appears that a noun is missing after “The”.
Context: ...s slice. --- #### The and Function The and function returns the boolean AND of...
Rule ID: THE_CC


Near line 260: Consider using “who” when you are referring to a person instead of an object.
Context: ... } ``` Pass a ViewData with a User that has Admin set true to the following tem...
Rule ID: THAT_WHO


Near line 271: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...esult will be You are an admin user!. However if the ViewData did not include a *Use...
Rule ID: SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA


Near line 271: Comparison is written ‘as false as’.
Context: ...*User object or Admin was set as false then the result will be Access denied!. -...
Rule ID: AS_ADJ_AS


Near line 276: It appears that a noun is missing after “The”.
Context: ...denied!. --- #### The or` Function The or function operates similarly to the a...
Rule ID: THE_CC


Near line 277: It appears that a noun is missing after “the”.
Context: ... The or function operates similarly to the and function however will stop at the f...
Rule ID: THE_CC


Near line 277: Did you mean “end”?
Context: ...e or function operates similarly to the and function however will stop at the first...
Rule ID: AND_END


Near line 277: Consider adding two commas here.
Context: ...n operates similarly to the and function however will stop at the first true. or x y i...
Rule ID: HOWEVER_COMMA


Near line 277: Did you mean the noun “truth”?
Context: ...function however will stop at the first true. or x y is equivalent to `if x then x...
Rule ID: TRUE_TRUTH


Near line 297: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...s The html/template package provides a variety of functions to do comparisons between ope...
Rule ID: A_VARIETY_OF


Near line 316: Possible missing comma found.
Context: ...ple. Rather than updating each template separately we can use a nested template that all o...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 353: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...me range to loop through Items as before but we pass the name to the header template...
Rule ID: COMMA_COMPOUND_SENTENCE


Near line 361: Possible missing comma found.
Context: ...as a {{define “templateName”}} within it then that name will be usable. A speci...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 361: Do not mix variants of the same word (‘usable’ and ‘useable’) within a single text.
Context: ...me”}}` within it then that name will be usable. A specific template can be executed u...
Rule ID: EN_WORD_COHERENCY


Near line 363: This sentence should probably be started with a verb instead of the noun ‘Writer’. If not, consider inserting a comma for better clarity.
Context: ...object of type Template, w is type io.Writer such as an http.ResponseWriter, Then ...
Rule ID: SENT_START_NN_DT


Near line 389: Possible missing comma found.
Context: ...s are parsed in main. When route / is reached the template defined as bootstrap is ...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 438: Consider inserting a comma for improved readability.
Context: ...ype User has been passed to the template we can then call this method from the temp...
Rule ID: INITIAL_ADVP_COMMA


Near line 460: Possible missing comma found.
Context: ...e Method HasPermission has to change at times then the Function Variables (Methods) i...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 460: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ... implementation may not fit the design. Instead a HasPermission func(string) bool att...
Rule ID: SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA


Near line 513: Possible missing comma found.
Context: ...er a single return value, or two return values where the second has type error. ```go...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 526: Possible missing comma found.
Context: ... }).ParseFiles("hello.gohtml") ``` Here the function to check if a user has per...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 541: The phrase ‘in many cases’ is used quite frequently. Consider using a less frequent alternative to set your writing apart.
Context: ...eing passed to the template. This works in many cases but in a large application passing too ...
Rule ID: IN_MANY_STYLE_CASES


Near line 541: Possible missing comma found.
Context: ...o the template. This works in many cases but in a large application passing too many...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 553: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... The default function just returns false but it defines the function and implementat...
Rule ID: COMMA_COMPOUND_SENTENCE


Near line 555: Possible missing comma found.
Context: ...assed to it. Within the handler for the template you can redefine any functions to use t...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 580: It appears that a comma is missing.
Context: ...lServerError) } } ``` In this handler a User is created with ID and Email, ...
Rule ID: DURING_THAT_TIME_COMMA

Markdownlint (61)
html/TEMPLATES_CHEATSHEET.md (61)

23: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


43: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


57: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


125: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


158: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


219: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


295: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


314: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


419: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time


72: Column: 5
Hard tabs


73: Column: 5
Hard tabs


107: Column: 5
Hard tabs


108: Column: 5
Hard tabs


188: Column: 5
Hard tabs


189: Column: 5
Hard tabs


193: Column: 5
Hard tabs


194: Column: 5
Hard tabs


231: Column: 5
Hard tabs


232: Column: 5
Hard tabs


237: Column: 5
Hard tabs


238: Column: 5
Hard tabs


321: Column: 5
Hard tabs


374: Column: 5
Hard tabs


375: Column: 5
Hard tabs


376: Column: 5
Hard tabs


377: Column: 5
Hard tabs


378: Column: 5
Hard tabs


380: Column: 5
Hard tabs


381: Column: 5
Hard tabs


385: Column: 5
Hard tabs


400: Column: 5
Hard tabs


405: Column: 5
Hard tabs


476: Column: 5
Hard tabs


477: Column: 5
Hard tabs


478: Column: 5
Hard tabs


479: Column: 5
Hard tabs


480: Column: 5
Hard tabs


481: Column: 5
Hard tabs


482: Column: 5
Hard tabs


483: Column: 5
Hard tabs


484: Column: 5
Hard tabs


485: Column: 5
Hard tabs


486: Column: 5
Hard tabs


487: Column: 5
Hard tabs


559: Column: 5
Hard tabs


561: Column: 5
Hard tabs


562: Column: 5
Hard tabs


563: Column: 5
Hard tabs


564: Column: 5
Hard tabs


565: Column: 5
Hard tabs


566: Column: 5
Hard tabs


567: Column: 5
Hard tabs


568: Column: 5
Hard tabs


569: Column: 5
Hard tabs


570: Column: 5
Hard tabs


571: Column: 5
Hard tabs


572: Column: 5
Hard tabs


573: Column: 5
Hard tabs


574: Column: 5
Hard tabs


575: Column: 5
Hard tabs


576: Column: 5
Hard tabs

Additional comments not posted (1)
html/TEMPLATES_CHEATSHEET.md (1)

88-88: Corrected the missing colon in the JavaScript object declaration. This fix is crucial for proper syntax and functionality.

@gaby gaby changed the title fix typo in javascript example html: Fix typo in JavaScript example May 30, 2024
@gaby gaby added 📒 Documentation Improvements or additions to documentation and removed ☢️ Bug Something isn't working labels May 30, 2024
@gaby
Copy link
Member

gaby commented May 30, 2024

@sno2 Thanks! 💪

@gaby gaby merged commit 8fc0016 into gofiber:master May 30, 2024
16 checks passed
@sno2 sno2 deleted the patch-1 branch May 30, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📒 Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants