--- loncom/build/lpml_parse.pl 2001/12/01 16:51:07 1.25 +++ loncom/build/lpml_parse.pl 2001/12/05 01:39:08 1.26 @@ -8,7 +8,7 @@ # 9/17,9/18 - Scott Harrison # 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison # -# $Id: lpml_parse.pl,v 1.25 2001/12/01 16:51:07 harris41 Exp $ +# $Id: lpml_parse.pl,v 1.26 2001/12/05 01:39:08 harris41 Exp $ ### ############################################################################### @@ -238,6 +238,8 @@ my $dependencies; my $dependency; my @links; my %categoryhash; +my $dpathlength; +my %fab; # file category abbreviation my @buildall; my @buildinfo; @@ -251,6 +253,7 @@ $parser = HTML::TokeParser->new(\$cleans $parser->xml_mode('1'); # Define handling methods for mode-dependent text rendering + $parser->{textify}={ targetroot => \&format_targetroot, sourceroot => \&format_sourceroot, @@ -356,7 +359,7 @@ END Descriptions
  • Software Package Description
  • Directory Structure
  • -
  • File and Directory Structure
  • +
  • Files
  • END $lpml .=<get_text('/category'); $parser->get_tag('/category'); + $fab{$category_att_name}=$abbreviation; if ($mode eq 'html') { if ($category_att_type eq $categorytype) { return $category="". @@ -745,11 +749,18 @@ sub format_directories { my $text=$parser->get_text('/directories'); $parser->get_tag('/directories'); if ($mode eq 'html') { + $text=~s/\[\{\{\{\{\{DPATHLENGTH\}\}\}\}\}\]/$dpathlength/g; return $directories="\n
     
    ". "". "Directory Structure". - "\n$text\n
    ". - "\n"; + "\n
     
    ". + "\n". + "". + "\n". + "\n". + "\n". + "\n$text\n
    CategoryStatusExpected Permissions & OwnershipTarget Directory ". + "Path

    "."\n"; } elsif ($mode eq 'text') { return $directories="\nDirectory Structure\n$text\n". @@ -769,7 +780,22 @@ sub format_directory { $parser->get_text('/directory'); $parser->get_tag('/directory'); if ($mode eq 'html') { - return $directory="\n
    DIRECTORY $targetdir $categoryname ". + my @a; + @a=($targetdir=~/\//g); + my $d=scalar(@a)+1; + $dpathlength=$d if $d>$dpathlength; + my $thtml=$targetdir; + $thtml=~s/\//\<\/td\>\/g; + return $directory="\n". + "$categoryname". + " ". + "$chmod
    $chown". + "$thtml". + "". + "$description"; + } + if ($mode eq 'text') { + return $directory="\nDIRECTORY $targetdir $categoryname ". "$description"; } elsif ($mode eq 'install') { @@ -820,8 +846,15 @@ sub format_files { if ($mode eq 'html') { return $directories="\n
     
    ". "
    ". - "File and Directory Structure". - "\n$text\n
    ". + "Files
     
    ". + "

    All source and target locations are relative to the ". + "sourceroot and targetroot values at the beginning of this ". + "document.

    ". + "\n". + "". + "". + "". + "$text
    StatusCategoryName/LocationDescriptionNotes
    \n". "\n"; } elsif ($mode eq 'text') { @@ -918,10 +951,19 @@ sub format_file { if ($source) { $parser->get_tag('/file'); if ($mode eq 'html') { - return ($file="\n
    BEGIN FILE\n". - "$source $target $categoryname $description $note " . - "$build $status $dependencies" . - "\nEND FILE"); + return ($file="\n". + "". + " ". + "$categoryname". + "SOURCE: $source
    TARGET: $target". + "$description". + "$note". + ""); +# return ($file="\n
    BEGIN FILE\n". +# "$source $target $categoryname $description $note " . +# "$build $status $dependencies" . +# "\nEND FILE"); } elsif ($mode eq 'install' && $categoryname ne 'conf') { if ($build) { @@ -974,16 +1016,6 @@ $buildtest \@if !(test -e "${sourceroot} perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\ fi END -# return "\t".'@test -e '.$sourceroot.'/'.$source. -# ' && perl filecompare.pl -b '.$sourceroot.'/'.$source.' '. -# $targetroot.'/'.$target. -# ' && install '. -# $categoryhash{$categoryname}.' '. -# $sourceroot.'/'.$source.' '. -# $targetroot.'/'.$target. -# ' || echo "**** WARNING '. -# '**** CVS source file does not exist: '.$sourceroot.'/'. -# $source.'"'."\n"; } elsif ($mode eq 'configinstall' && $categoryname eq 'conf') { push @configall,$targetroot.'/'.$target; @@ -1040,10 +1072,10 @@ sub format_link { if ($linkto) { $parser->get_tag('/link'); if ($mode eq 'html') { - return $link="\n
    BEGIN LINK\n". + return $link="\nBEGIN LINK\n". "$linkto $target $categoryname $description $note " . "$build $status $dependencies" . - "\nEND LINK"; + "\nEND LINK"; } elsif ($mode eq 'install') { my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target); @@ -1070,10 +1102,10 @@ sub format_fileglob { if ($sourcedir) { $parser->get_tag('/fileglob'); if ($mode eq 'html') { - return $fileglob="\n
    BEGIN FILEGLOB\n". + return $fileglob="\nBEGIN FILEGLOB\n". "$glob sourcedir $targetdir $categoryname $description $note ". "$build $status $dependencies $filenames" . - "\nEND FILEGLOB"; + "\nEND FILEGLOB"; } elsif ($mode eq 'install') { return "\t".'install '. @@ -1124,9 +1156,25 @@ sub format_source { sub format_note { my @tokeninfo=@_; $note=''; - my $text=&trim($parser->get_text('/note')); +# my $text=&trim($parser->get_text('/note')); + my $aref; + my $text; + while ($aref=$parser->get_token()) { + if ($aref->[0] eq 'E' && $aref->[1] eq 'note') { + last; + } + elsif ($aref->[0] eq 'S') { + $text.=$aref->[4]; + } + elsif ($aref->[0] eq 'E') { + $text.=$aref->[2]; + } + else { + $text.=$aref->[1]; + } + } if ($text) { - $parser->get_tag('/note'); +# $parser->get_tag('/note'); $note=$text; } return '';