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 with contents.
Adds      .htm extensions to all result files names.
Usage     Click on menu\Go and when conversion is completed,
          go to RESULT_FILES and browse from index.htm.

Features: - layout controlled by file ...global.css.txt file which can be
            edited/set before or edited after conversion.
          - entities 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.
          list     - main part of front page.
          zebra    - class of zebra stripe's                     

'=====================================================================       
\\|=schema_version."folder2html 12"
'=====================================================================


'set your own site parameters:
|=FP."examples.htm" 'set front page name -
                    'this will be an index file for converted folder;
|=home_link."http://www.pharmease.com/development/"
|=styles_file."colored_global.css.txt"

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


'set converter mode:
|output_text_to_console.f 
|native_separators.false  


-   .bop  :
       ..=head1."<html><head><title>" :
       ..=end."</pre></body></html>" :

       'this sets characters and their number in indent-unit:
       ..indent."  " :   
       'actual indent = indent-unit * deepness in folder tree;
                           
       ..=zebra."fl" :
       ..&contents."<div class=""contents"">\l" :
       ..&contents."<div class=""cont_title""><pre>\l\l" :
       ..&contents." Contents of $p_source .\l\l</div><pre>\l" :
       |read$global_styles."$styles_file" :
       ..save$global_styles."$styles_file"

  .bof : 
       'swich colors:
       ..?zebra."fd" ..=zebra."fl"  ..=zebra."fd" :
       ..?zebra."fd" ..=Fzebra."dd" ..=Fzebra."dl" :

       +.advance_master_index :
       ..=wlowcase."\L$" :
       ..&list."<div class=""$zebra""><pre>" :
          'make a subtitle of folder name:
          ..&list."<div class=""$Fzebra""><pre>" :
          ..&list." $Indent <a name=""n$UN "">$ "  :
          ..&list."</pre></div>$suppl_$wlowcase" :
       ..&contents." $Indent <a class=""cont"" href=""#n$UN "">$ </a>\l" :
       >-s :
                    
       '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:

       "$indent ".=Indent."\l"."" 


  .eof :
       < .=last_folder :
       ..&list."</pre></div>" :

       'Restore Indent after ending folder:
       "$indent ".=Indent."\l"."" 

  .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:
        '---------------------------------------------------
        "zip".BOT    "$in"  +.include_in_front_page 
        '"htm".BOT   "$in"  +.include_in_front_page 
        '"html".BOT  "$in"  +.include_in_front_page
        "gif".BOT    "$in" 
        "jpg".BOT    "$in"
        "class".BOT  "$in"
        '===================================================

  .BOT  ..=p_rextension."$p_rextension .htm" :  

        'this page navigation parameters:
        +.advance_master_index :

        ..=w.# :
        ..-w.1 :
        ..=back_path."\e$w .\p\p/," :      
        ..=front_page_link."$back_path $FP" :
        ..=place_in_content."$front_page_link #n$UN" :
        ..=hash."<a name=""n$UN"">" :

        +.include_in_front_page :
        ..?delayed."" : +.complete_delayed :

        'prepare own data for delayed output:
        ..?previous_link."" ..=previous_link."$FP" : :
        '..?previous_back_path."" is correct
        ..=delayed."$head1 $p_file </title>
          <link rel=stylesheet type=""text/css"" href=""$back_path $styles_file"">\l\F
          </head><body> \l\F
          <div class=""navig"">
          <a class=""navi"" href=""$home_link"">home</a>
          <a class=""navi"" href=""$front_page_link"">top</a>
          <a class=""navi"" href=""$place_in_content"">contents</a> 
          <a class=""navi"" href=""$back_path $previous_link"">previous</a>
          " : 
        ..=delayed_body."\h$in" :  '-this does html-encoding
        ..&delayed_body."$end" :
        ..=delayed_dos_path."$p_umbrella \\$p_shield \\$p_local_path \\$p_rfile " :

        ..=previous_link."$this_link" :
        ..=previous_back_path."$back_path" :
        ..=out."" 'to disable saving delayed file now
        

  .include_in_front_page :

        'check will be unit highlighted --------->>>>
        ' creates wleft and wright filled with 
        ' space and <b> tag:
        ..=w."$p_local_path \\$p_file" :
        ..}files_to_highlight.w :
           ..=wleft."\l<b>" :
           ..=wleft."" :
        ..?wleft."" ..=wright."" ..=wright."</b>" :
        '----------------------------------------<<<<

        ..=this_link."\R\\./,$p_local_path /$p_rfile" :
        ..&list."$wleft  $Indent $hash" :
        ..&list."<a href=""$this_link"">" :
        ..&list."$p_file </a>$wright \l" 


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

  .advance_master_index :

        ..+UN.1 : 'index unit
        ..=w.UN : 
        ..%w.30 :
        ..?w.0  :
          ..&list."\l<div><pre> $Indent <a class=""navi"" href=""#top"">top</a>\l</pre></div>\l" :
          : :
                 
- .eop  ..=this_link."$FP" :
        ..?delayed."" : +.complete_delayed :
        ..=out."$head1 $last_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"