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

Complex if statement parsing incorrectly #1

Open
fritzkeyzer opened this issue Nov 21, 2024 · 1 comment
Open

Complex if statement parsing incorrectly #1

fritzkeyzer opened this issue Nov 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@fritzkeyzer
Copy link
Owner

fritzkeyzer commented Nov 21, 2024

An if statement like this:
{{ if or (.FTEHeadline) (.RevenueHeadline) (.EbitdaHeadline) }}
Fails to parse correctly.
Combination of builtin functions and round brackets.

Template:

{{ if or (.FTEHeadline) (.RevenueHeadline) (.EbitdaHeadline) }}
    <div class="flex flex-wrap items-center gap-4">
        {{.FTEHeadline}}
        {{.RevenueHeadline}}
        {{.EbitdaHeadline}}
    </div>
{{end}}

Fails to generate:

type SearchResult( struct{
	 EbitdaHeadline) any 
	
}

gohtml -v output:

DEBUG: parsed node
	path: [SearchResult]
	fields: [{Path:[SearchResult] Name:FTEHeadline Type:any}]
	node: {{.FTEHeadline}}
DEBUG: parsed node
	path: [SearchResult]
	fields: [{Path:[SearchResult] Name:RevenueHeadline Type:any}]
	node: {{.RevenueHeadline}}
DEBUG: parsed node
	path: [SearchResult]
	fields: [{Path:[SearchResult] Name:EbitdaHeadline Type:any}]
	node: {{.EbitdaHeadline}}
DEBUG: parsed node
	path: [SearchResult]
	fields: [{Path:[SearchResult (] Name:EbitdaHeadline) Type:any} {Path:[SearchResult] Name:FTEHeadline Type:any} {Path:[SearchResult] Name:RevenueHeadline Type:any} {Path:[SearchResult] Name:EbitdaHeadline Type:any}]
	node: {{if or (.FTEHeadline) (.RevenueHeadline) (.EbitdaHeadline)}}
                    <div class="flex flex-wrap items-center gap-4">
                        {{.FTEHeadline}}
                        {{.RevenueHeadline}}
                        {{.EbitdaHeadline}}
                    </div>
                {{end}}
@fritzkeyzer fritzkeyzer self-assigned this Nov 21, 2024
@fritzkeyzer fritzkeyzer added the bug Something isn't working label Jan 11, 2025
@fritzkeyzer
Copy link
Owner Author

Note that this is due to a limited syntax subset being supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant