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

Includes to accept expressions not just String literals #17

Open
obviam opened this issue Jul 30, 2018 · 2 comments
Open

Includes to accept expressions not just String literals #17

obviam opened this issue Jul 30, 2018 · 2 comments

Comments

@obviam
Copy link
Collaborator

obviam commented Jul 30, 2018

Consider the following code that iterates through a huge array of sections to include a list of generated files.

{{for section in sections}}
  <code>{{ include section.get_example_curl}}</code>
  <code>{{ include section.post_example_curl}}</code>
{{end}}

There only way to achieve it is to hardcode the path.

<code>{{ include "../target/generated-snippets/section1/get-example/curl-request.md"}}</code>
<code>{{ include "../target/generated-snippets/section1/post-example/curl-request.md"}}/code>
...
<code>{{ include "../target/generated-snippets/sectionX/get-example/curl-request.md"}}</code>
<code>{{ include "../target/generated-snippets/sectionX/post-example/curl-request.md"}}/code>

I haven't properly understood the code so far, but it looks like the Parser#parseInclude is the place to do it. I raised this issue as an improvement, as it's not really an issue.
If I come up with a solution I will do a PR if it gets accepted as an improvement.

@badlogic
Copy link
Owner

badlogic commented Jul 30, 2018 via email

@obviam
Copy link
Collaborator Author

obviam commented Jul 31, 2018

It's not trivial indeed and thanks for the pointers. It's a rare use-case, so have to weight that in.

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

No branches or pull requests

2 participants