this should be a simple one for some who using komodo edit for a while. I've a rails html.erb file in the editor and the indentation has gone a bit wild. Is there a function to automatically indent my code so it's easier to read?
feedback
|
|
Not directly. However, the "Run Commands" system (and possibly the use of macros) can be used to help run an external script that will massage the contents of the current buffer. So, if you have a script that can do good .html.erb formatting then you should be able to integrate that. Aside: Komodo IDE (the commercial relative of Komodo Edit) has a framework for integration code formatters into Komodo. It ships with an "HTML Tidy" formatter that might do an okay job of .html.erb formatting. | |||
|
feedback
|
|
I use this slightly edited version of other posted code. Variations have been floating around the Komodo Forums for some time. I've updated the macro for both Komodo Edit 7.0 and 6.X, it usually works well enough. I changed some of the tidy and csstidy options, added the XML support, and altered the undefined syntax alert. I also had to create a very ugly kludge to get astyle working, as astyle does not accept stdin. At this point the entire macro needs to be completely redone, as its limitations have become obvious. As for Ruby Support, check out rbeautify, I have finally integrated support for Ruby, You must have rbeautify installed in your PATH. I must warn you, I don't have Ruby installed so I'm unable to fully test. I should also mention my JS is dreadful, but I did verify what I could and the macro worked. This should finally answer this question, it might be time to accept my answer. Format_Syntax.js
| ||||
|
feedback
|
|
I found this formatting script (macro) and adapted it for my personal use with the latest Komodo Edit (v6.1.0). It works well (assuming you've got HTML Tidy available on your system) and I included the JavaScript formatting code provided by a commentator but I think it may only work with Komodo IDE. It's unimportant for my purposes. Perhaps someone out there can find a universal improvement (using something like html tidy).
| |||
|
feedback
|
|
To reformat code to your liking try astyle You might be able to find this as a package, e.g. ap | ||||
|
feedback
|
