#!/usr/bin/perl use Getopt::Long; use Time::CTime; use Time::ParseDate; my $input = ""; my $output = ""; my $help = ""; &usage() if $ARGV[0] eq ""; GetOptions( 'input|i=s' => \$input, 'output|o=s' => \$output, 'help|?|h' => \$help ); &usage() if $help; &usage() if ( $input eq '' ); if ( $output eq '' ) { $output = "-"; } open INPUT, "<$input"; open OUTPUT, ">$output" || die 'Could not create output file'; print "Processing $input to $output\n"; print OUTPUT "\n"; print OUTPUT '' . "\n"; print OUTPUT ') { if ($begin) { # get the beginning data if ( !/^

Last updated: / ) { next; } my $rawdate = $_; chomp($rawdate); $rawdate =~ s/

Last updated: //; $rawdate =~ s/<\/b>//; # revdate is in seconds since 1970 # use Time::CTime to create output my $revdate = parsedate("$rawdate"); print OUTPUT " revdate='" . strftime( "%Y-%m-%d", localtime($revdate) ) . "'>\n"; until ( $test eq /

/ ) {
            $test = ;
        }

        print OUTPUT "  \n";

        print OUTPUT "    \n";
        print OUTPUT "    Awaiting Author Action\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT "   Documents are in \"authors 48 hours\" period\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT
          "    Approved by IESG, awaiting processing and publishing, no\n";
        print OUTPUT
          "    \"APPR\" note means that it was approved on date received\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT "    Independent Submission\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT "    RFC-Editor/IANA Registration Coordination\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT "    Holding for IESG Action\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT "    Independent Submission Review\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT
          "    Independet Submission awaiting author update, or in\n";
        print OUTPUT "    discussion between author and RFC Editor\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT
          "    Holding for normative reference (followed by ID string of\n";
        print OUTPUT "    referenced document)\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT
          "    Pending rfc-editor final review before authors 48 hours\n";
        print OUTPUT "    \n";

        print OUTPUT "    \n";
        print OUTPUT
          "    Time-out period during which the IESG reviews document for\n";
        print OUTPUT
          "    conflict/concurrence with other IETF working group work\n";
        print OUTPUT "    \n";

        print OUTPUT "  \n";
        $begin = 0;
    }
    else {

        # process the queue data

        if (/^\s*$/) { next; }

        if (/^<\/pre>

/) { &all_done(); } if (/^-----/) { if ($in_set) { print OUTPUT " \n"; } $category = ; chomp($category); print OUTPUT " \n"; # eat the separator $category = ; $in_set = 1; next; } # main processing loop if (/^//; $docname =~ s/>//; $datein = ""; my $filename = ""; my $url = ""; $datein = ; chomp($datein); $url = $datein; $filename = $datein; if ( $datein =~ /\-I/ ) { $individual = 1; $datein =~ s/-I//; } $datein =~ s/([0-9\/]*).*$/$1/; $datein =~ s#/#-#g; $filename =~ s/^.*">//; $filename =~ s###; $url =~ s/^.*.*$//; # call process main # if it returns, you are at the author record print OUTPUT " \n"; $next = ; chomp $next; $next = &process_main($next); # $next now contains the author field process and write out # this item, and then move on print OUTPUT " \n"; # four-five lines: author, title (possible two lines), bytes, blank $temp = ; $temp = ; if ( $temp =~ /^Bytes/ ) { $temp = ; if ( $temp =~ /^<\/pre>

/ ) { &all_done(); } } else { $temp = ; if ( $temp =~ /^<\/pre>

/ ) { &all_done(); } $temp = ; if ( $temp =~ /^<\/pre>

/ ) { &all_done(); } } } #end of lower loop next; } } sub process_main { my $next = $_[0]; # things that are only the keyword if ( ( $next =~ /^AUTH/ ) || ( $next =~ /^IANA/ ) ) { s/\s*$//; # both auth and auth48 print OUTPUT " \n"; } elsif ( $next =~ /^EDIT/ ) { # if no date, imply date from submission my $otherstuff = $next; $otherstuff =~ s/EDIT\s*//; $next =~ s/([A-Z]*)\s*.*$/$1/; if ( $otherstuff =~ /[0-9\/]/ ) { my $tempdate = parsedate("$otherstuff"); $otherstuff = strftime( "%Y-%m-%d", localtime($tempdate) ); } else { $otherstuff = $datein; } print OUTPUT " \n"; } elsif (( $next =~ /^I/ ) || ( $next =~ /^RFC-EDITOR/ ) || ( $next =~ /^TO/ ) ) { my $otherstuff = $next; $otherstuff =~ s/([A-Z-]*)\s*//; $next =~ s/([A-Z-]*).*$/$1/; #next rev: keep the other stuff, make it a text node $otherstuff =~ s/.*([0-9\/]*).*$/$1/; if ( $otherstuff eq '' ) { print OUTPUT " \n"; } else { my $tempdate = parsedate("$otherstuff"); $otherstuff = strftime( "%Y-%m-%d", localtime($tempdate) ); print OUTPUT " \n"; } } if ( $next =~ /^REF/ ) { my $ref = $next; $next =~ s/REF.*$/REF/; $ref =~ s/^REF\s*//; print OUTPUT " \n"; print OUTPUT " $ref\n"; LABEL: $next = ; chomp($next); if ( $next =~ /^[^\s]/ ) { print OUTPUT " \n"; } else { $next =~ s/\s*//; print OUTPUT " $next\n"; goto LABEL; } } else { # peak ahead $next = ; chomp($next); } if ( ( $next =~ /^[A-Z][A-Z][A-Z]/ ) || ( $next =~ /^TO/ ) ) { &process_main($next); } else { return $next; } } sub usage { print <<"_____EoI2_____"; Usage: $0 Process the queue.html file from the RFC Editor. -h -help -? - print this message -i - input file [required] -o - output file (default is input.xml) _____EoI2_____ exit; } sub all_done { # all done print OUTPUT " \n"; print OUTPUT "\n"; close INPUT; close OUTPUT; exit; }