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

Indentation/Whitespace retention option #76

sporkisfaster opened this issue May 7, 2019 · 2 comments


None yet
2 participants
Copy link

commented May 7, 2019

Currently it appears that ManTL only supports stripping of indentation and whitespace on generation. There are some use cases where it would be preferred to keep or more specifically be able to set indentation on the template so the generated code will honor the spacing and indentation the user decides. An example of this is a feature covered in StringTemplate here:

Describe the solution you'd like
It is desired that there be some kind of syntax available to adjust indentation and whitespace as the user creating the template sees fit.

Additional context
Below is a snippet from the discussion of options in the manifold gtiter chat:

after more consideration I think perhaps the one problem you'll have will be indentation

where I see the problem is when you'd be using include to nest a sub-template; when you're generating code you want to retain the indentation immediately preceding the <%@ include ... %>
I can add support for that in a number of ways, not sure which, i'm thinking:

<%@ nest ... %>
where it behaves exactly as include, but retains indentation
i prefer this over adding an argument or some other overload for include

rsmckinney added a commit that referenced this issue May 7, 2019

ManTL changes
- Define a new directive: `nest`. Behaves exactly like `include` but retains and distributes the indentation whitespace immediately preceding the `nest` directive, and retains whitespace immediately following the directive.  The indentation is applied to each line in the resulting `nest`ed template or section. This behavior facilitates the code generation use-case where whitespace formatting, esp. indentation, is significant.

This comment has been minimized.

Copy link

commented May 8, 2019

In progress


This comment has been minimized.

Copy link

commented May 8, 2019

Feature available in release 0.65-alpha

@rsmckinney rsmckinney closed this May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.