s l a m
SITE LOGGING & MONITORING
last updated: 6/26/02; 3:15:16 PM

renderCss macro

on renderCss ( filePath, cssName = "l", depth = 0, length = 0 )
 {
 local ( ol );
 op.xmlToOutline ( file.readWholeFile ( filePath ), @ol, true );
 target.set ( @ol );
 op.firstSummit ();
 op.fullExpand ();
 local ( level = 0 );
 local ( node = 0 );
 on visit ()
  {
  loop
   {
   local ( s = "" );
   local ( u = "" );
   local ( hassubs = op.countSubs ( 1 ) > 0 );
   local ( hasurl = op.attributes.getOne ( "url", @u ) );
   s = s + "<p class='" + cssName + ( level + 1 ) + "'>";
   if hasurl
    {
    s = s + "<a class='" + cssName + ( level + 1 ) + "' href='" + u + "'>";
    };
   s = s + op.getLineText ();
   if hasurl
    {
    s = s + "</a>";
    };
   s = s + "</p>";
   if ( ( depth > 0 ) and ( level >= depth ) ) or ( ( length > 0 ) and ( node >= length ) )
    {
    op.deleteLine ();
    hassubs = false;
    }
   else
    {
    op.setLineText ( s );
    };
   if hassubs
    {
    op.go ( right, 1 );
    level++;
    visit ();
    level--;
    op.go ( left, 1 );
    };
   if not op.go ( down, 1 )
    {
    break;
    }
   else
    {
    if ( level == 0 )
     {
     node++;
     };
    };
   };
  };
 visit ();
 local ( s = string ( ol ) + " " );
 return ( s );
 };

© copyright 2002
by Marc Barrot.