Menu

Collapse Fix

2007-02-24
2012-11-13
  • Nobody/Anonymous

    Does anyone know if there's a way to make collapse work by parens vs language.  Like in this example:

    <?php

    function home() {

    ?>
    <title>TITLE GOES HERE</title>
    <?php

    }

    ?>

    Collapsing 'function' should collapse the whole chunk, but instead it only collapses to the end of the php section.

     
    • M. B. Huffman

      M. B. Huffman - 2007-03-02

      Are you sure all your start tags have matching end tags? HTML does not require end tags on various elements, including head, body, and html, and will validate as HTML 4.01 Transitional without them. The collapse feature, on the other hand, will get confused as soon as ANY element is not properly closed.

       
      • Matthieu Larcher

        On the other hand, you CAN'T validate code as HTML 4.01 Transitional WITH self-closing tags for certain elements (like the META tag in the headers for example) and you will get validation warnings if you have any self-closing tags at all (even on elements like <img>).

        You would get this warning :

        > NET-enabling start-tag requires SHORTTAG YES
        >
        > The sequence <FOO /> can be interpreted in at least two different ways, depending on the DOCTYPE of the document.
        > For HMTL 4.01 Strict, the '/' terminates the tag <FOO (with an implied '>'). However, since many browsers don't
        > interpret it this way, even in the presence of an HMTL 4.01 Strict DOCTYPE, it is best to avoid it completely in
        > pure HTML documents and reserve its use solely for those written in XHTML.

        It seems that for HTML we have to choose between total w3c validity OR the use of that neat collapse function :(

        That would be nice if Notepad++ could have a list of autoclosing tags (meta, img, br... there isn't that many!) and auto-close them (if they're not) before collapsing and auto-unclose them (if that was previously the case) when uncollapsing !

        That doesn't seem that hard to code, specifically on a tool that has so many nice features implemented...

        Who do I need to pay a beer to in order to have it done ??

         
    • Nobody/Anonymous

      I have this same problem with HTML, sometimes I try to collapse a DIV and it closes the whole HTML file. I think the "collapse" feature is buggy, because my HTML was validated and passed.