--- loncom/build/lpml_parse.pl 2001/11/29 15:01:04 1.23 +++ loncom/build/lpml_parse.pl 2001/12/01 16:51:07 1.25 @@ -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.23 2001/11/29 15:01:04 harris41 Exp $ +# $Id: lpml_parse.pl,v 1.25 2001/12/01 16:51:07 harris41 Exp $ ### ############################################################################### @@ -49,7 +49,7 @@ Only the 1st argument is mandatory for t Example: cat ../../doc/loncapafiles.lpml |\\ -perl lpml_parse.pl html default /home/sherbert/loncapa /tmp/install +perl lpml_parse.pl html development default /home/sherbert/loncapa /tmp/install END # ------------------------------------------------- Grab command line arguments @@ -198,6 +198,7 @@ my $category_att_name; my $category_att_type; my $chown; my $chmod; +my $abbreviation; # space-free abbreviation; esp. for image names my $rpm; my $rpmSummary; my $rpmName; @@ -255,6 +256,7 @@ $parser->{textify}={ sourceroot => \&format_sourceroot, categories => \&format_categories, category => \&format_category, + abbreviation => \&format_abbreviation, targetdir => \&format_targetdir, chown => \&format_chown, chmod => \&format_chmod, @@ -317,7 +319,7 @@ exit; # ------------------------ Final output at end of markup parsing and formatting sub end { if ($mode eq 'html') { - return "
THE END\n"; + return "\n"; } if ($mode eq 'install') { return ''; @@ -336,19 +338,29 @@ sub format_lpml { my (@tokeninfo)=@_; my $date=`date`; chop $date; if ($mode eq 'html') { - $lpml = "
LPML Description Page (dist=$dist, ". - "$date)". + $lpml=< + +LPML Description Page +(dist=$dist, categorytype=$categorytype, $date) + + +END + $lpml .= "
LPML Description Page (dist=$dist, ". + "categorytype=$categorytype, $date)". ""; $lpml .=< -
  • About this file
  • -
  • Software Package Description
  • -
  • Directory Structure
  • -
  • File Type Ownership and Permissions
  • -
  • File and Directory Structure
  • +
  • About this file
  • +
  • File Type Ownership and Permissions +Descriptions
  • +
  • Software Package Description
  • +
  • Directory Structure
  • +
  • File and Directory Structure
  • END $lpml .=< 
    About this file

    This file is generated dynamically by lpml_parse.pl as @@ -440,8 +452,28 @@ sub format_categories { my $text=&trim($parser->get_text('/categories')); $parser->get_tag('/categories'); if ($mode eq 'html') { - return $categories="\n
    BEGIN CATEGORIES\n$text\n". - "
    END CATEGORIES\n"; + return $categories="\n
     
    ". + "\n
    ". + "\nFile Type Ownership and Permissions". + " Descriptions". + "\n

    This table shows what permissions and ownership settings ". + "correspond to each category.

    ". + "\n\n". + "". + "". + "". + "". + "". + "\n$text\n". + "
    IconCategory NamePermissions ". + "($categorytype)
    \n"; + } + elsif ($mode eq 'text') { + return $categories="\n". + "\nFile Type Ownership and Permissions". + " Descriptions". + "\n$text". + "\n"; } else { return ''; @@ -452,12 +484,21 @@ sub format_category { my (@tokeninfo)=@_; $category_att_name=$tokeninfo[2]->{'name'}; $category_att_type=$tokeninfo[2]->{'type'}; - $chmod='';$chown=''; + $abbreviation=''; $chmod='';$chown=''; $parser->get_text('/category'); $parser->get_tag('/category'); if ($mode eq 'html') { - return $category="\n
    CATEGORY $category_att_name ". - "$category_att_type $chmod $chown"; + if ($category_att_type eq $categorytype) { + return $category="". + "\n". + "${category_att_name}\n". + "$chmod $chown\n". + "". + "\n"; +# return $category="\n
    CATEGORY $category_att_name ". +# "$category_att_type $chmod $chown"; + } } else { if ($category_att_type eq $categorytype) { @@ -468,6 +509,17 @@ sub format_category { return ''; } } +# --------------------------------------------------- Format categories section +sub format_abbreviation { + my @tokeninfo=@_; + $abbreviation=''; + my $text=&trim($parser->get_text('/abbreviation')); + if ($text) { + $parser->get_tag('/abbreviation'); + $abbreviation=$text; + } + return ''; +} # -------------------------------------------------------- Format chown section sub format_chown { my @tokeninfo=@_; @@ -496,6 +548,8 @@ sub format_rpm { $parser->get_tag('/rpm'); if ($mode eq 'html') { return $rpm=< 
    +
    Software Package Description

    @@ -535,7 +589,10 @@ sub format_rpmName { my $text=&trim($parser->get_text('/rpmName')); $parser->get_tag('/rpmName'); if ($mode eq 'html') { - return $rpmName="\n
    RPMNAME $text"; + return $rpmName="\nName : $text"; + } + elsif ($mode eq 'text') { + return $rpmName="\nName : $text"; } else { return ''; @@ -546,7 +603,10 @@ sub format_rpmVersion { my $text=$parser->get_text('/rpmVersion'); $parser->get_tag('/rpmVersion'); if ($mode eq 'html') { - return $rpmVersion="\n
    RPMVERSION $text"; + return $rpmVersion="\nVersion : $text"; + } + elsif ($mode eq 'text') { + return $rpmVersion="\nVersion : $text"; } else { return ''; @@ -557,7 +617,10 @@ sub format_rpmRelease { my $text=$parser->get_text('/rpmRelease'); $parser->get_tag('/rpmRelease'); if ($mode eq 'html') { - return $rpmRelease="\n
    RPMRELEASE $text"; + return $rpmRelease="\nRelease : $text"; + } + elsif ($mode eq 'text') { + return $rpmRelease="\nRelease : $text"; } else { return ''; @@ -568,7 +631,10 @@ sub format_rpmVendor { my $text=$parser->get_text('/rpmVendor'); $parser->get_tag('/rpmVendor'); if ($mode eq 'html') { - return $rpmVendor="\n
    RPMVENDOR $text"; + return $rpmVendor="\nVendor : $text"; + } + elsif ($mode eq 'text') { + return $rpmVendor="\nVendor : $text"; } else { return ''; @@ -579,7 +645,10 @@ sub format_rpmBuildRoot { my $text=$parser->get_text('/rpmBuildRoot'); $parser->get_tag('/rpmBuildRoot'); if ($mode eq 'html') { - return $rpmBuildRoot="\n
    RPMBUILDROOT $text"; + return $rpmBuildRoot="\nBuild Root : $text"; + } + elsif ($mode eq 'text') { + return $rpmBuildRoot="\nBuild Root : $text"; } else { return ''; @@ -590,7 +659,10 @@ sub format_rpmCopyright { my $text=$parser->get_text('/rpmCopyright'); $parser->get_tag('/rpmCopyright'); if ($mode eq 'html') { - return $rpmCopyright="\n
    RPMCOPYRIGHT $text"; + return $rpmCopyright="\nLicense : $text"; + } + elsif ($mode eq 'text') { + return $rpmCopyright="\nLicense : $text"; } else { return ''; @@ -601,7 +673,10 @@ sub format_rpmGroup { my $text=$parser->get_text('/rpmGroup'); $parser->get_tag('/rpmGroup'); if ($mode eq 'html') { - return $rpmGroup="\n
    RPMGROUP $text"; + return $rpmGroup="\nGroup : $text"; + } + elsif ($mode eq 'text') { + return $rpmGroup="\nGroup : $text"; } else { return ''; @@ -612,7 +687,10 @@ sub format_rpmSource { my $text=$parser->get_text('/rpmSource'); $parser->get_tag('/rpmSource'); if ($mode eq 'html') { - return $rpmSource="\n
    RPMSOURCE $text"; + return $rpmSource="\nSource : $text"; + } + elsif ($mode eq 'text') { + return $rpmSource="\nSource : $text"; } else { return ''; @@ -623,7 +701,10 @@ sub format_rpmAutoReqProv { my $text=$parser->get_text('/rpmAutoReqProv'); $parser->get_tag('/rpmAutoReqProv'); if ($mode eq 'html') { - return $rpmAutoReqProv="\n
    RPMAUTOREQPROV $text"; + return $rpmAutoReqProv="\nAutoReqProv : $text"; + } + if ($mode eq 'text') { + return $rpmAutoReqProv="\nAutoReqProv : $text"; } else { return ''; @@ -634,7 +715,14 @@ sub format_rpmdescription { my $text=$parser->get_text('/rpmdescription'); $parser->get_tag('/rpmdescription'); if ($mode eq 'html') { - return $rpmdescription="\n
    RPMDESCRIPTION $text"; + $text=~s/\n//g; + $text=~s/\\n/\n/g; + return $rpmdescription="\nDescription : $text"; + } + elsif ($mode eq 'text') { + $text=~s/\n//g; + $text=~s/\\n/\n/g; + return $rpmdescription="\nDescription : $text"; } else { return ''; @@ -645,7 +733,8 @@ sub format_rpmpre { my $text=$parser->get_text('/rpmpre'); $parser->get_tag('/rpmpre'); if ($mode eq 'html') { - return $rpmpre="\n
    RPMPRE $text"; +# return $rpmpre="\n
    RPMPRE $text"; + return ''; } else { return ''; @@ -656,8 +745,15 @@ sub format_directories { my $text=$parser->get_text('/directories'); $parser->get_tag('/directories'); if ($mode eq 'html') { - return $directories="\n
    BEGIN DIRECTORIES\n$text\n
    ". - "END DIRECTORIES\n"; + return $directories="\n
     
    ". + "". + "Directory Structure". + "\n$text\n
    ". + "\n"; + } + elsif ($mode eq 'text') { + return $directories="\nDirectory Structure\n$text\n". + "\n"; } elsif ($mode eq 'install') { return "\n".'directories:'."\n".$text; @@ -722,7 +818,17 @@ sub format_files { my $text=$parser->get_text('/files'); $parser->get_tag('/files'); if ($mode eq 'html') { - return $directories="\n
    BEGIN FILES\n$text\n
    END FILES\n"; + return $directories="\n
     
    ". + "
    ". + "File and Directory Structure". + "\n$text\n
    ". + "\n"; + } + elsif ($mode eq 'text') { + return $directories="\n". + "File and Directory Structure". + "\n$text\n". + "\n"; } elsif ($mode eq 'install') { return "\n".'files:'."\n".$text.