Converts  (makes HTML Encoding) files in folder recursively and 
          creates a web-site mirroring source folder in
          RESULT_FILES folder.
Creates   front page as an index for converted folder:
              front page contains:
                list of subfolders,
                list if entire site contents;
          index.htm in each result subfolder with local contents;
          former index.htm renamed to original_index.htm;
                 (little drawback, if file "original_index.htm"
                  exist, it will be "overwritten";)
     
Adds      .htm extensions to all result files names.
          navigation buttons home, top, up, next, ...

Usage     Click on menu\Go and when conversion is completed,
          go to RESULT_FILES and browse to front page.

Features: - layout controlled by file ...global.css.txt file which can be
            edited/set before or edited after conversion.
          - entities in contents are indented to reflect deepness in folder tree.

          - units order in contents is uncertain,
            in any case, files listed first and folders next. 
            after conversion, order can be edited manually in
               - front_page (which does not change the order
                             coded in "previous" and "next" links);
               - "previous" and "next" links, which can pose to much
                 work and is disadvantage.

Schema-variables
        
     UN       - Unit Number of file or folder. 
                Master Index through all site.
     FP       - front page name

     contents - list if folders placed in front page
     local    - local list - the contents of local index
     list     - global list - the contents of front page

     zebra    - class of zebra stripe's 
     H        - HTML header beginning
     E        - HTML ending tags                    
     this_folder - folder in which scope parsing goes

     Links to .. 
          H_L      .. to home site
          FP_L     .. to front page
          back_L   .. to front page folder
          C_L      .. to own place in contents
          this_L   .. to itself: to folder or file
          this_LL  .. to itself, local link;
          P_LL     .. to previous sibling, local link;
     constN   - is reserved, N>=2

'=====================================================================       
\\|=schema_version."folder2html 14 for S2S Rev 22.2 and higher"
'=====================================================================


'set your own site parameters:
  |=FP."examples.htm" 'set front page name -
                      'this will be an index file for converted folder;

  'generated index name in subfolders:
  'put "default.htm" for Microsoft platform:
  |=index."index.htm" 

  'set home link:
  |=H_L."http://www.pharmease.com/development/"
  'select style:
  |=styles_file."colored_global.css.txt"

  'this sets characters and their number in indent-unit:
  |indent."  " 
  'actual indent = indent-unit * deepness in folder tree;

'==============================================================
' comment out or remove this instruction to disable its effect:
'--------------------------------------------------------------
|include."custom.txt"  
'==============================================================


'set converter mode:
|output_text_to_console.f 
|native_separators.false  
|=lindex."\L$index"
|=An."<a class=""navi"" href=""" 'shortcut for navigation liks


'prepare data:
  
  |=H."<html><head><title>" 
  |=E."</pre></body></html>" 
  'variables for subfolders of folder RESULT_FILES:
  |=P_LL.FP
  |=zebra."fl" 
  |=list."<div class=""cont_title""><pre>\l\l" 
  |&list." Contents\l\l</div>" 

  |=upper_index_L_top.FP
  |=upper_index_L.index
  |=const2."_top"
  'constN by default will be ""

-   .bop  :
                           
       ..&contents."<div class=""contents"">\l" :
       ..&contents."<div class=""cont_title""><pre>\l\l" :
       ..&contents." $p_source  folders\l\l</div><pre>\l" :

       |read$global_styles."$styles_file" :
       ..save$global_styles."$styles_file" 


  .bof : 

       ..=this_folder : 'save token for safety
       'swich colors:   
       ..?zebra."fd" ..=zebra."fl"  ..=zebra."fd" :
       ..?zebra."fd" ..=Fzebra."dd" ..=Fzebra."dl" :

       +.advance_master_index :
       ..=this_LL."$index" :
       ..=this_L."\R\\./,$p_local_path /$this_LL" : 'to index
       +.complete_delayed :

       'put this folder into the parent index:
       ..&local." <a class=""$Fzebra"" href=""$this_folder /$index"">$ </a>\l" :
       'save current parent's values:
       ..=@.local :


       'prepare data for children:
       'initiate this folder's index:
          ..=local."<div class=""$zebra""><pre>" :

          'make a subtitle of folder name:
          ..&local."<div class=""$Fzebra"" id=""$HASH""><pre>" :
          ..&list."$local  $Indent" :

          ..&list."<a class=""$Fzebra"" href=""$this_L"">$ </a>" :
          ..&local." $this_folder" :

          ..=wlowcase."\L$this_folder" :
          ..&list."</pre></div>" :
          ..&local."</pre></div>$suppl_$wlowcase" :

       ..&contents." $Indent <a class=""cont"" href=""#$HASH "">$this_folder </a>\l" :

       >-s :


       'store values of this folder in folder's level:

         'make back path:
         ..=w.# :
         ..-w.1 :
         ..=back_L$#."\e$w .\p\p/," :
  
         ..=FP_L$#."$back_L$# $FP" :
         ..=C_L$#."$FP_L$# #$HASH" :
         ..=P_LL$#.P_LL :
                    
       'Variable Indent restored at beginning and end of
       'folder to reflect nesting structure of folder tree.
       'Remove CRLF from indent and assign result to Indent:
       'Indent will be used in list and contents:
        
       ..=P_LL.index :
       "$indent ".=Indent."\l"."" 


  .eof :
      
       .=this_folder :
       ..=this_LL."$index" :
       +.complete_delayed :
              
       ..&local."</pre></div>" :
       ..&list."</pre></div>" :

       ..=w."$H $this_folder </title>\l\F
         <link rel=stylesheet type=""text/css"" href=""$back_L$# $styles_file"">\l\F
         </head><body>\l<a name=""top""><br />\l

         <!-- navigation -->
          <div class=""navig"">
            $An $H_L"">home</a>
            $An $FP_L$#"">top</a>
            $An $C_L$#"">contents</a> 
            $An ../$P_LL$#"">previous</a>
            $An ../$upper_index_L$const$#"">up</a>
            <!-- no next done yet: use up instead -->
          </div>\l\F
         $local \l\F
         </body></html>" :
       ..?$p_local_path."" ..=ww."\\$p_local_path \\" ..=ww."" :
       ..save$w."$p_umbrella \\$p_shield  \\$ww $this_folder \\index.htm" :

        < :
       
       'Restore 
         ..=local.@ :                    'parent local_list:
         "$indent ".=Indent."\l"."" :    'Indent after ending folder:
         ..=P_LL."$this_folder /$index" 

  .bot  :
        ..=hash."" :
        *"\L$".BOT :
        .end

        '===================================================
        ' files with this extensions are simply 
        ' copied, not converted, and
        ' optionally included in front page;
        ' add more extensions if needed here, or
        ' comment out to disable conversion:
        ' 
        ' .include_to_lists event does not affect added
        '       navigation buttons structure and links;
        '
        '---------------------------------------------------
        "zip".BOT    "$in"  +.include_to_lists 
        "htm".BOT    "$in" :
                     ..=w."\L$p_file" :
                     ..?w."$lindex" :
                        +.preserve_original_index :
                        +.include_to_lists  
        "html".BOT   "$in"  :                     
                     ..=w."\L$p_file" :
                     ..?w."$lindex" :
                         +.preserve_original_index :
                         +.include_to_lists  
        "gif".BOT    "$in" 
        "jpg".BOT    "$in"
        "class".BOT  "$in"
        "bmp".BOT    "$in"
        "tif".BOT    "$in"
        "wav".BOT    "$in"
        
        'to completely exclude *.frx files from result:
        "ico".BOT
        "frx".BOT
        '===================================================

  .BOT  ..=p_rextension."$p_rextension .htm" :  
        +.advance_master_index :
        ..=C_L."$FP_L$# #$HASH" :
        ..=hash." id=""$HASH"" " :

        +.include_to_lists :
        +.complete_delayed :

        'prepare own data for delayed output:
        ..=delayed."$H $p_file </title>
          <link rel=stylesheet type=""text/css"" href=""$back_L$# $styles_file"">\l\F
          </head><body> \l\F
          <div class=""navig"">
            $An $H_L"">home</a>
            $An $FP_L$#"">top</a>
            $An $C_L"">contents</a> 
            $An $P_LL"">previous</a>
            $An $index"">up</a>" :
        ..=delayed_body."\h$in" :  '-this does html-encoding
        ..&delayed_body."$E" :
        ..=delayed_dos_path."$p_umbrella \\$p_shield \\$p_local_path \\$p_rfile " :

        ..=P_LL."$this_LL" :
        ..=out."" 'to disable saving delayed file now
        

  .preserve_original_index :  'rename it and include in new index:
        ..=p_rbasic."original_index." :
        +.include_to_lists


  .include_to_lists : 
  
        'also, generates two variables:
        ..=this_L."\R\\./,$p_local_path /$p_rfile" :
        ..=this_LL."$p_rfile" :

        'check will be unit highlighted --------->>>>
        ' adds <span> tag 
        ..=w."$p_local_path \\$p_file" :
        ..}files_to_highlight.w :
           ..=wleft."<span class=""highlight"">" :
           ..=wleft."" :
        ..?wleft."" :
           ..=wright."" :
           ..=wright."</span>" :
        '----------------------------------------<<<<

        ..&list." $Indent" :
        ..&local." " :
        ..&list."<a $hash  href=""$this_L"">" :
        ..&local."<a $hash  href=""$this_LL"">" :
        ..=w."$wleft $p_file $wright </a>\l" :
        ..&local.w :
        ..&list.w

  .complete_delayed :
      ..?delayed."" : +.finish_delayed 

  .finish_delayed :
        'take care about delayed page:
        ..=w."$delayed " :
        ..&w." <a class=""navi"" " :
        ..&w."href=""$this_LL"">next</a></div><pre>\l" :
        ..&w."$delayed_body" :
        ..save$w."$delayed_dos_path" :
        ..=delayed.""

  .advance_master_index :

        ..+UN.1 : 'index unit
        ..=w.UN : 
        ..%w.30 :
        ..?w.0  : 'put "return to top of the page" in front page if time:
          ..&list."\l<div><pre> $Indent $An #top"">top</a>\l</pre></div>\l" :
          .n :
        ..=HASH."n$UN" 

                 
- .eop  ..=this_L."$FP" :
        +.complete_delayed :
        ..=out."$H $this_folder </title>\l\F
          <link rel=stylesheet type=""text/css"" href=""$styles_file"">\l\F
         </head><body>\l<a name=""top"">\l$preface $contents \l\l</pre></div>\l\l$list <pre>
                    
  Converted by <a href=""http://pharmease.com/development"">$p_version </a>
  Schema version $schema_version .
                    </pre></body></html>" :
        ..save$out."$FP"