Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

He wants automatic detection of nesting?

Good luck with that, considering I find it hard to manually decide how to indent mixed PHP, HTML and Javascript code. I can't imagine an automatic tool having any success.



That's the idea man, somebody's gotta imagine it.


That's more or less what I told him on his other question. He originally wanted to make it more general-purpose, so that this same editor interface would be used for programming languages in general. I did my best to talk him out of that madness and he has since narrowed his scope to XML.


The point is to have multiple layout/decoration algorithms to toggle between, depending on which aspect of the code the user wants to focus on.


Tell me how it could indent this correctly:

    <?if(bool):?>
      <TABLE class="foo">
    <?else:?>
      <TABLE class="bar">
    <?endif;?>
        <TR><TD></TD></TR>
      </TABLE>
If you only look at the HTML it looks like a doubly nested table.

If you only look at the PHP the inner elements of the table will not be indented correctly.

And this is a very simple example. Real code can be far more complex - for example the table tag could be generated by a function, and not even visible in this file.

If you took my indenting, and converted it into some kind of graphical display that might be cool. But automatic detection? Good luck.


This is not the question asked. The question is specifically about XML documents, where there is a single and quite easy correct answer for the indentation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: