#!/usr/bin/perl ############################################################################### # # Usage: generate_html.pl # # Recursively searches for any *.png files and uses text in corresponding # *.net file to create html documentation. # # R.S. Weigel 02/17/2005. ############################################################################### use File::Find; use Cwd; $num = scalar(@ARGV); $dir1 = "."; $js = "demoFramelessNodes.js"; open(DATA_js,">>$js"); @directory = ($dir1); open(DATA_out,">index.txt"); find(\&wanted, @directory); close(DATA_out); close(DATA_js); sub wanted { ########################################################################## # If a file with a .net extension is found ########################################################################## if ( ($_ =~ m/\.net/) && ($_ !~ m/\.svn/) ) { $network = $_; $image = $_; $html = $_; # If in macros directory, don't generate html if "Demo" is # not in name. $curr_dir = getcwd(); if ($curr_dir =~ m/macros/) { if ($_ !~ m/Demo/) { return; } } $BASE_URI = "cismdx://"; $BASE_DIR = $curr_dir; $BASE_DIR =~ s/.*(OpenDX.*)/$1/; $BASE_DIR =~ s/.*(modules.*)/OpenDX\/$1/; $image =~ s/\.net/\.png/; # replace string .net with .png $html =~ s/\.net/\.htm/; # replace string .net with .htm open(DATA_in,"$network"); open(DATA_html,">$html"); #################################################################### # html stuff ##################################################################### $i = 0; print(DATA_js "aux1 = insFld(foldersTree, gFld(\"$network\", \"demoFrameless.html?pic=%22$html%22\"))\n"); # Deal with case of .png but not _[0-9].png if (-e "$image") { print(DATA_js "insDoc(aux1, gLnk(\"S\", \"$image\", \"demoFrameless.html?pic=%22$image%22\"))\n"); $i = 1; } $image =~ s/\.png/_1\.png/; while (-e "$image") { if ($i == 0) { # Case of no .png but _[0-9].png print(DATA_js "insDoc(aux1, gLnk(\"S\", \"$image\", \"demoFrameless.html?pic=%22$image%22\"))\n"); } else { print(DATA_js "insDoc(aux1, gLnk(\"S\", \"$image\", \"demoFrameless.html?pic=%22$image%22\"))\n"); } $i = $i + 1; $image =~ s/(.*)_[0-9].png/$1_$i\.png/; if ($i == 10) { print "Warning from generate_html.pl: "; print "Only 9 images are used but more than 9 found.\n"; last; # exit loop } } #################################################################### ################################################################ # Grab comments and annotation from network file ################################################################ print(DATA_html "Execute Network\n"); print(DATA_html " | \n"); print(DATA_html "Edit Network "); while ($line = ){ # Assumes string _Author_ is on the first line of the README page if ($line =~ m/annotation.*Author/) { # Remove leading .net markup text $line =~ s/.*\/\/ annotation user: (.*)$/
$1/; # Color key words $line =~ s/Author\:/Author\:<\/font>/; print(DATA_html $line); # $line =~ s/.*\/\/ comment: (.*)$/
$1/; while ( ($line = ) && ($line !~ m/user_end/) ){ # Remove string $line =~ s//

/; $line =~ s/.*\/\/ annotation user: (.*)$/$1/; # Color key words $line =~ s/Category\:/Category\:<\/font>/; $line =~ s/Date\:/Date\:<\/font>/; $line =~ s/Modified\:/Modified\:<\/font>/; $line =~ s/Function\:/Function\:<\/font>/; $line =~ s/To Do\:/To Do\:<\/font>/i; $line =~ s/See also\:/See also\:<\/font>/i; print(DATA_html $line); } } } ################################################################ print(DATA_html $line); close(DATA_in); close(DATA_html); } ########################################################################### }