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
XSLT extensions for beautification #139
Comments
Thanks for opening the issue. Would you also be kind of to create a gist with a complete XSLT code sample that includes a bunch of possible edge cases? All that you asked for is easily achievable, but I want to make sure I get it right and do not introduce any harmful regression along the way. |
No worries. See https://gist.github.com/spodzone/675e40505b70c34fe5ee No doubt some folks consider me a heathen for some of these, but a few things I would particularly draw your attention to:
Thanks! |
Here is what I can do:
|
Yep, that's a pretty good start. The n-space indent should be taken from the global config, agreed. We might need to be careful about two of the options: I don't always newline+indent attributes, as the ul/li/a subtree shows. It's only when the line is going to wrap otherwise, then I will. Second: "force a blank line above xsl tags", well, careful how that interacts with forcing an empty line around comments... I was thinking this morning:
It would make an interesting test to join all the above XSLT into one long line, beautify it and see what falls out. |
This is available for you to test out via my web tool. http://prettydiff.com/ignore/testlocation/prettydiff.com.xhtml?m=beautify I created two new options:
You can find these options if you scroll down the page and look for the markup specific options. I am not actually setting these options to true yet, but I am automatically putting newlines above xsl tags. |
Hi,
This follows from the thread over at Glavin001/atom-beautify#480 (comment)
Desirable features for XSLT-specific beautification over and above XML:
generally retain the XML-style 2-space indent (or 4-space, or whatever)
blank lines between xsl-specific nodes, especially xsl:template, xsl:output
blank lines before comments, especially comments immediately preceding an xsl:template
indent attributes, especially when there's a long list of xmlns decls on an xsl:transform.
double-check that it never breaks XML markup, especially regarding inserting bogus spaces in
<xsl : text>
.Something like what this little shell-script achieves, except it doesn't get point 2 quite right:
The text was updated successfully, but these errors were encountered: