Customized Code Folding for HTML

Customized Code Folding for HTML

2
NewbieNewbie
2

    May 25, 2006#1

    I've tried to get code folding to work in the past and given up and am now trying again. I'm using the default wordfile for the moment just trying to make things as simple as possible. On a plain html file my folding always folds one line under the tag and that's it nothing else. I can't get it to include the whole body of the text between the open and close tags.

    Am I missing something, shouldn't it fold everything between simple tags such as the header, body, and divs?

    I just installed the latest upgrade so I'm on 12.10+ whatever. Love the new FTP stuffs.

    6,683583
    Grand MasterGrand Master
    6,683583

      May 26, 2006#2

      I guess, you use the Collapse All command. If nothing is selected collapse all collapse only the highest level which is for HTML

      <html>
      </html>

      This is normally not very useful. You can use following macro to fold the head and select the body so you can use Collapse All only on the body content.

      InsertMode
      ColumnModeOff
      HexOff
      Top
      Find "<head"
      Key HOME
      StartSelect
      Find Select "</head>"
      EndSelect
      HideOrShowLines
      Find "<body"
      Find ">"
      EndSelect
      Key LEFT ARROW
      Key RIGHT ARROW
      StartSelect
      Find Select "</body"
      Key HOME
      EndSelect

      With v12 of UE and v5.50 of UES a new language definition can be used to disable folding of <html></html> and <body></body>. With the setting below Collapse All then collapse the <head></head> section and the block elements inside the body, but not the whole html and body section anymore.

      1) Open Configuration - Editor Display - Syntax Highlighting.

      2) Click on the Open button right the wordfile specification.

      3) Close the configuration dialog with Cancel.

      4) Scroll down in the wordfile to the language definition for HTML. In standard wordfile.txt the line starts with /L3"HTML" HTML_LANG.

      5) Set the cursor before the first color specification /C1"Tags" and insert following line here.

      /Ignore Fold Strings = "<html>" "<html" "<body" "<body>"

      6) Save your wordfile and close it. This change is immediatelly active. You can use Collapse All on a HTML file to test it.


      For details about Ignore Fold Strings see help of UE/UES about Syntax Highlighting or look at syntax.txt in the UE/UES program directory.
      Best regards from an UC/UE/UES for Windows user from Austria