#!/usr/bin/perl my($f, $s, $l, $base, $root, $title, $fname, $month, $xml_src, $html_src); my($i, $j) = 0; # used for HOWTOs for which we do not have SGML # @_fallback_dates = (); $_base_path = '/public/vhost/t/tldp/html/HOWTO'; if( $ARGV[0] ne '' ) { $_base_path = $ARGV[0]; } # read in template for top part # $_template_top = join('', ); close(DATA); # compute 35 days out, prepare date string # $i = 0 + time() - (24 * 60 * 60 * 35); my(@t_c) = localtime($i); $i = (($t_c[5])+0) + 1900; $j = (($t_c[4])+0) + 1; $month = "$i" . (length("$j") == 1 ? '0' : '') . "$j" . (length($t_c[3]) == 1 ? '0' : '') . "$t_c[3]"; # must specify top-level directory; e.g., /public/vhost/t/tldp/html/HOWTO # $_base_ht = '/public/ftp/pub/linux/docs/HOWTO/'; $_base_sgml = 'other-formats/docbook/'; $_base_cvs = '/export/sunsite/users/gferg/howto/ldp_cvs/LDP/howto'; $_base_web_cvs = 'http://cvsview.tldp.org/index.cgi/'; # For testing purposes: # ## &proc_sgml($ARGV[0], "$root/HOWTO-HOWTO/index.html", 'HOWTO-HOWTO'); ## exit(0); # now read/parse the howtos # my(@dirs, @howtos, @sbuf) = (); push(@dirs, $_base_path); foreach $root (@dirs) { foreach $f (`cd $root; find -maxdepth 1 -print | sed 's/\\.html//' | sed 's/^\\.\\///' | sort --unique`) { chop($f); # ignore these; add to/remove from this list as appropriate # if( $f =~ /^\./ || $f =~ /^\!/ || $f =~ /\-[\d]+$/ || $f eq 'mini' || $f eq 'images' || $f eq 'html_single' || $f eq 'text' || $f =~ /README/i || $f =~ /COPYRIGHT/i || $f =~ /^INDEX/i || $f =~ /\.gif$/ || $f =~ /\.tar$/ || $f =~ /\.gz$/ || $f =~ /\.bz/ ) { next; } if( -f "$root/${f}/index.html" ) { if( -s "$root/${f}/index.html" < 300 ) { next; # redirect files and such... } } elsif( -f "$root/${f}.html" ) { if( -s "$root/${f}.html" < 300 ) { next; # redirect files and such... } } # find source file # $xml_src = ''; $html_src = ''; if( -f "$_base_cvs/linuxdoc/${f}.sgml" ) { $xml_src = "$_base_cvs/linuxdoc/${f}.sgml"; $html_src = "$root/${f}.html"; } elsif( -f "$_base_cvs/docbook/${f}.xml" ) { $xml_src = "$_base_cvs/docbook/${f}.xml"; $html_src = "$root/${f}/index.html"; } elsif( -f "$_base_cvs/docbook/${f}.sgml" ) { $xml_src = "$_base_cvs/docbook/${f}.sgml"; $html_src = "$root/${f}/index.html"; } elsif( -f "$_base_cvs/docbook/${f}/${f}.xml" ) { $xml_src = "$_base_cvs/docbook/${f}/${f}.xml"; $html_src = "$root/${f}/index.html"; } elsif( -f "$_base_cvs/docbook/${f}/${f}.sgml" ) { $xml_src = "$_base_cvs/docbook/${f}/${f}.sgml"; $html_src = "$root/${f}/index.html"; } elsif( -f "$_base_cvs/linuxdoc/${f}/${f}.sgml" ) { $xml_src = "$_base_cvs/linuxdoc/${f}/${f}.sgml"; $html_src = "$root/${f}.html"; } elsif( -f "$_base_cvs/linuxdoc/archived/${f}.sgml" ) { $xml_src = "$_base_cvs/linuxdoc/archived/${f}.sgml"; $html_src = "$root/${f}.html"; } elsif( -f "$_base_cvs/docbook/archived/${f}.sgml" ) { $xml_src = "$_base_cvs/docbook/archived/${f}.sgml"; $html_src = "$root/${f}/index.html"; } if( $xml_src ne '' ) { &proc_sgml($xml_src, $html_src, $f); } else { # fallback to processing the HTML # print "mk_sortedht: no SGML for $f, using the HTML file\n"; &proc_html("$root/${f}.html", $f); } } } # # 0 1 2 3 4 5 6 7 8 # date | type | title | html | plain | pdf | author | email | version | # # 9 10 11 12 13 14 # title | fname_lc | fname | html (tar) | pluckerdb | cvs # # now we need to sort & output accordingly # @howtos = reverse(sort(@howtos)); # the data file... # open(DF, "> /public/vhost/t/tldp/html/howto.d/sorted_howtos") || die "cannot open:$!\n"; foreach $s (@howtos) { $s =~ s/\t/\ /g; $s =~ s/<[;]*//gi; $s =~ s/&[;]*/\&/gi; $s =~ s/&lowbar[;]/_/gi; $s =~ s/[\s\ ]+$//g; $s =~ s/^[\s\ ]+//g; $s =~ s/\[\d\]//g; $s =~ s/\r/\ /g; $s =~ s/[\ ]{2,}/\ /g; @sbuf = split(/\|/, $s); print DF "$sbuf[0]\t$sbuf[1]\t$sbuf[2]\t$sbuf[3]\t$sbuf[6] $sbuf[7]\n"; } close(DF); system("gzip -f /public/vhost/t/tldp/html/howto.d/sorted_howtos"); system("chmod 664 /public/vhost/t/tldp/html/howto.d/sorted_howtos.gz"); system("chgrp ldp /public/vhost/t/tldp/html/howto.d/sorted_howtos.gz"); # sorted file number 1 - by modify date / 30 day window # &print_detail("/public/vhost/t/tldp/html/sorted_howtos.html"); # sorted file number 2 - by modify date - all list # &print_detail("/public/vhost/t/tldp/html/sorted_howtos_full.html"); # sorted file number 3 - by title # @sbuf = map { $_->[0] } sort { $a->[10] cmp $b->[10] } map { [ $_, (split /\|/)[0,1,2,3,4,5,6,7,8,9,10,11,12,13] ] } @howtos; @howtos = @sbuf; &print_detail("/public/vhost/t/tldp/html/sorted_howtos_title.html"); # sorted file number 4 - by filename # @sbuf = map { $_->[0] } sort { $a->[11] cmp $b->[11] } map { [ $_, (split /\|/)[0,1,2,3,4,5,6,7,8,9,10,11,12,13] ] } @howtos; @howtos = @sbuf; &print_detail("/public/vhost/t/tldp/html/sorted_howtos_quick.html"); exit(0); # # # sub print_detail { my($f) = @_; my($s,$tmp_str); my(@sbuf) = (); open(HTFILE, "> $f") || die "cannot open $f: $!\n"; $s = $_template_top; if ($f =~ /sorted_howtos\.html$/) { $s =~ s/Sorted\ HOWTOs/Recent Updates/g; } print HTFILE "$s\n", "\n

sort:", "   ", ($f =~ /sorted_howtos\.html$/ ? "recent updates (past 30 days)" : "recent updates (past 30 days)"), "  |  ", ($f =~ /sorted_howtos_full\.html$/ ? "modify date (full list)" : "modify date (full list)"), "  |  ", ($f =~ /sorted_howtos_title\.html$/ ? "title" : "title"), "  |  ", ($f =~ /sorted_howtos_quick\.html$/ ? "filename (condensed)" : "filename (condensed)"), "

\n"; if( !($f =~ /sorted_howtos_quick\.html$/) ) { print HTFILE "\n", "\n", "\n", "\n", "\n", "\n\n"; } else { print HTFILE "


\n", "\n\n", "\n", "\n\n\n"; } else { print HTFILE "
  • $sbuf[11] : $sbuf[2]
    \n", ($sbuf[3] ne '' ? "html (multiple)" : "html (multiple)"), " | ", ($html_single ne '' ? "html (single)" : "html (single)"), " | ", ($sbuf[12] ne '' ? "html (tar)" : "html (tar)"), " | ", ($sbuf[4] ne '' ? "text" : "text"), " | ", ($sbuf[5] ne '' ? "PDF" : "PDF"), " | ", ($sbuf[14] ne '' ? "source (cvs)" : "source (cvs)"), " | ", ($sbuf[13] ne '' ? "PluckerDB" : "PluckerDB"), "\n

  • \n"; } } my(@t_comps) = localtime(time()); my($y) = (($t_comps[5])+0) + 1900; # year my($m) = (($t_comps[4])+0) + 1; # month $s = $y . '-' . ($m < 10 ? '0' : '') . $m . '-' . (($t_comps[3] + 0) < 10 ? '0' : '') . $t_comps[3]; if( !($f =~ /sorted_howtos_quick\.html$/) ) { print HTFILE "
    \n", "updated\n", "title / available formats\n", "author(s)
    \n", $sbuf[0], "
    v", $sbuf[8], "
    \n", "", $sbuf[11], " : ", $sbuf[2], "
    \n", ($sbuf[3] ne '' ? "html (multiple)" : "html (multiple)"), " | ", ($html_single ne '' ? "html (single)" : "html (single)"), " | ", ($sbuf[12] ne '' ? "html (tar)" : "html (tar)"), " | ", ($sbuf[4] ne '' ? "text" : "text"), " | ", ($sbuf[5] ne '' ? "PDF" : "PDF"), " | ", ($sbuf[14] ne '' ? "source (cvs)" : "source (cvs)"), " | ", ($sbuf[13] ne '' ? "pluckerDB" : "PluckerDB"), "\n
    \n", ($sbuf[6] ne '' ? $sbuf[6] : " "), "
    \n"; } else { print HTFILE "\n


    "; } print HTFILE "

    \n", "


    \n", "\n\n", "\n\n\n\n"; close(HTFILE); system("chmod 664 ${f}; chgrp ldp ${f}"); } # # # sub proc_sgml { my($f,$html_f,$base) = @_; my($buf,$title,$vers,$tmp,$auth,$y,$m,$d,$s) = ''; my($i) = 0; my($strip_f) = $base; $strip_f =~ s/\.html$//; if( !($base =~ /\.html$/) ) { $base .= '/'; } my($strip_f_lc) = lc($strip_f); # read in file (abstract only) # my($notfound) = 0; open(HTF, "$f") || return; while() { if($notfound == 0) { if( $_ =~ /

    \n$/)) { chop; } if($_ =~ /<\/artheader/i || /<\/articleinfo/i || $_ =~ /<\/bookinfo/i || $_ =~ //i || $_ =~ /\s*(.*?)\s*#is); # LINUXDOC if( $title eq '' ) { ($title) = ($buf =~ m#\s*(.*?)\s*<#is); } $title =~ s/\n//g; $title =~ s/<subtitle>\s*(.*?)\s*<\/subtitle>//gi; $title =~ s/<[^>]*>//gs; $title =~ s/[\s\.\ ]+$//g; $title =~ s/^[\s\.\ ]+//g; $title =~ s/_/_/g; # grab author/email # ($auth) = ($buf =~ m#<author>\s*(.*?)\s*</author>#is); # LINUXDOC if( $auth eq '' ) { ($auth) = ($buf =~ m#<author>\s*(.*?)\s*<#is); } # clean up # $auth =~ s/<[^>]*>/\ /gs; $auth =~ s/\([^\)]*\)//gs; $auth =~ s/\&\#[\w]+\;//g; $auth =~ s/authored\ //i; $auth =~ s/_\)_/\@/i; $auth =~ s/copyright\ //i; $auth =~ s/[\ ]*[Bb]+y[\ :]+//i; $auth =~ s/current\ //i; $auth =~ s/author\:\ //i; $auth =~ s/antispam\.//gi; $auth =~ s/REMOVE_ME//gi; $auth =~ s/nospam\-//gi; $auth =~ s/\(\)//g; $auth =~ s/\n/\ /g; $auth =~ s/^[\s\.\,\;\ \"\>]+//g; $auth =~ s/[\s\.\ \,\;]+$//g; $auth =~ s/[\ ]{2,}/\ /g; $auth =~ s/<>//g; # grab rev/date; take the last entry # $vers = ''; $tmp = ''; # use of <pubdate> takes precedence, except when looking at docbook # ($tmp) = ($buf =~ m#<pubdate[^>]*>\s*(.*?)\s*</pubdate>#is); # LINUXDOC if( $tmp eq '' && $f =~ /linuxdoc/ ) { ($tmp) = ($buf =~ m#<date>\s*(.*?)\s*<#is); } if( $tmp eq '' || $buf =~ /<revhistory>/i ) { # grab rev/date; take the first entry, or should it be the last?! # if( $buf =~ m#<revnumber>\s*(.*?)\s*</revnumber>#gis ) { $vers = $1; } if( $buf =~ m#<date>\s*(.*?)\s*</date>#gis ) { $tmp = $1; } elsif( $buf =~ m#<releaseinfo>\s*(.*?)\s*</releaseinfo>#gis ) { $tmp = $1; } } if( $vers eq '' && $tmp ne '' ) { # pull the version out of the <{pub}date> specification # if( $tmp =~ /[Rr]+evision:[\ ]+([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv]+ersion[\ ]+([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv]+([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv\.\,]+\ ([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv]+er[\.\ ]+([\w]+)\-([\w]+)\-([\w]+)\-([\w]+)/ ) { $vers = $4; } elsif( $tmp =~ /^ver[\ ]+([\d\.]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /^([\d\.]+)[,\ ]+/ ) { $vers = $1; } if( $tmp =~ /[Vv]+[\,\ ]+[\d]+[\ ]+[A-Za-z]+[\ ]+[\d]{4}/ || $tmp =~ /draft[\,\ ]+/i ) { # date is the version, so null it # $vers = ''; } } if( $vers eq '' || !($vers =~ /\d+/) || $vers =~/\d\d\d\d/ ) { if( open(HTF_REV, "grep -i '<revnumber>' $f |") ) { $vers = <HTF_REV>; chop($vers); close(HTF_REV); $vers =~ s/<[^>]*>//gs; $vers =~ s/^[Vv]//; $vers =~ s/^[\s\.\,\;\ \"\>]+//g; # same for date if( $tmp eq '' && open(HTF_REV, "grep -i '<date>' $f |") ) { $tmp = <HTF_REV>; chop($tmp); close(HTF_REV); } } if( $vers eq '' ) { ($vers) = ($buf =~ m#<edition>\s*(.*?)\s*</edition>#is); $vers =~ s/revision//i; $vers =~ s/version//i; $vers =~ s/ver//i; $vers =~ s/v//i; $vers =~ s/^[\s\.\,\;\ \"\>]+//g; } if( $vers eq '' ) { $vers = '(?)'; } } else { $vers =~ s/^[Vv]//; $vers =~ s/^\.//; } $tmp =~ s/(?:rd|nd|st|th)[\ \,]+/,\ /g; if( $tmp =~ /(\d\d\d\d)[\/\-]+(\d\d)[\/\-]+(\d\d)/ ) { $y = $1; $m = $2; $d = $3; } elsif( $tmp =~ /\w+[\ ]+([\w]+)[\ ]+([\d]+)[\ ]+[\d\:]+[\ ]+\w+[\ ]+(\d\d\d\d)/ ) { $y = $3; $m = &get_date($1); $d = $2; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /(\w+)[\.,\ ]+(\d+)[,\ ]+(\d\d\d\d)/ ) { $m = &get_date($1); $d = $2; $y = $3; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /[\ ]+(\w+)[\,\.\ ]+(\d\d\d\d)/ ) { $y = $2; $m = &get_date($1); $d = '01'; if( $tmp =~ /(\d+)[\ ]+[\w\.]+[\ ]+\d\d\d\d/ ) { $d = $1; if( length($d) == 1 ) { $d = "0$d"; } } } elsif( $tmp =~ /(\d+)[\/\.]+(\d+)[\/\.]+(\d\d\d\d)/ ) { $y = $3; $m = $1; if( length($m) == 1 ) { $m = "0$m"; } $d = $2; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /[Vv]+er[\.\ ]+([\w]+)\-([\w]+)\-([\w]+)\-([\w]+)/ ) { $y = $1; $m = &get_date($2); if( length($m) == 1 ) { $m = "0$m"; } $d = $3; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /(\d\d\d\d)\-([\w]+)\-(\d\d)/ ) { $y = $1; $m = &get_date($2); $d = $3; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /([\d]+)[\ ]+([\w]+)[,\ ]+(\d\d\d\d)/ ) { $y = $3; $m = &get_date($2); $d = $1; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /([\w]+)[\ \,]+(\d\d\d\d)/ ) { $y = $2; $m = &get_date($1); $d = '01'; } if( !($y =~ /^2/ || $y =~ /^1/) ) { $y = ''; } if( !($y =~ /^\d\d\d\d$/) ) { $y = ''; } if( $m eq '00' ) { $y = ''; } my($d_str) = "$y-$m-$d"; if( $y eq '' ) { $d_str = &get_fallback_date("$base"); } if( $title ne '' ) { $f_html = $html_f; $f_html =~ s/\/public\/html\/LDP\///; $f_plain = "HOWTO/text/${strip_f}"; $f_pdf = $_base_ht . "other-formats/pdf/${strip_f}.pdf"; $f_htmlt = $_base_ht . "other-formats/html/${strip_f}-html.tar.gz"; $f_plucker = "/public/ftp/pub/linux/docs/linux-doc-project/pluckerdb/${strip_f}.pdb"; if( !(-e $f_pdf) ) { $f_pdf = ''; } if( !(-e $f_htmlt) ) { $f_htmlt = ''; } if( !(-e $f_plucker) ) { $f_plucker = ''; } $tmp = $title; $tmp =~ s/^A\ //i; $tmp =~ s/^The\ //i; $tmp =~ s/^Linux\ //i; $tmp =~ s/^[\s\-\"\']+//g; $tmp = lc($tmp); $f = substr($f, length("/export/sunsite/users/gferg/howto/ldp_cvs/")); $to_add = "${d_str}|HOWTO|${title}|${f_html}|${f_plain}|${f_pdf}|"; $my_test = "${auth}| |${vers}|"; $to_add .= "${auth}| |${vers}|"; $to_add .= "${tmp}|${strip_f_lc}|${strip_f}|${f_htmlt}|${f_plucker}|${f}"; $to_add =~ s/public\/ftp\/pub\/linux/pub\/Linux/g; push(@howtos, $to_add); } else { print "mk_sortedht: ERROR (sgml) - not adding: $f\n"; } } # # # sub proc_html { my($f,$base) = @_; my($title,$vers,$desc,$tmp,$email,$auth,$d_str,$s,$y,$m,$d) = ''; my($i,$bDone) = 0; my(@wrds) = (); my($strip_f) = $base; $strip_f =~ s/\.html$//; if( !($base =~ /\.html$/) ) { $base .= '/'; } my($strip_f_lc) = lc($strip_f); open(HTF, $f) || return; while(<HTF>) { chop; $s = $_; if( $s =~ /<title/i ) { # grab the title # $tmp = $s; while( !($s =~ /<\/title/i) && !(eof(HTF)) ) { $s = <HTF>; chop($s); $tmp .= ' ' . $s; } $title =~ s/^[>]//; ($title) = ($tmp =~ m#<title>\s*(.*?)\s*</title#is); if( $title eq '' ) { ($title) = ($tmp =~ m#<title[\ ]>\s*(.*?)\s*</title#is); } $title =~ s/[\s\.\ ]+$//g; } } close(HTF); if( $title eq '' ) { $title = $strip_f; } my(@flines) = (); $f_plain = $_base_ht . $strip_f; if( -e $f_plain ) { open(HTP, "head -20 $f_plain |") || return; } else { open(HTP, "lynx -dump $f | head -20 |") || return; } while(<HTP>) { chop; $_ =~ s/^[\s\ ]+//g; if( $_ =~ /HOWTO/i || $_ eq '' ) { next; } push(@flines, $_); } close(HTP); # grab author, email, rev/date # foreach $tmp (@flines) { if( $auth eq '' && $tmp =~ /\@/ ) { ($auth, $s) = split(/(?:,|\&l|<|\(|\ \-)/, $tmp, 2); $auth =~ s/^[\s\.\ ]+//g; $auth =~ s/^maintained\ //i; $auth =~ s/^authored\ //i; $auth =~ s/^copyright\ //i; $auth =~ s/^table\ of\ contents//i; $auth =~ s/^[Bb]+y[\ :]+//i; $auth =~ s/^current\ //i; $auth =~ s/^author\:\ //i; $auth =~ s/[\s\.\ ]+$//g; if( $tmp =~ /([\w\.\-]+\@[\w\.\-]+)/ ) { $s = $1; if( !($auth =~ /$s/) ) { $auth .= ' ' . $s; } } next; } if( $vers eq '' ) { if( $tmp =~ /[Rr]+evision:[\ ]+([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv]+ersion[\ ]+([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv]+([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } elsif( $tmp =~ /[Vv\.\,]+\ ([\w\.\-]+)[,\ ]+/ ) { $vers = $1; } $vers =~ s/^\.//; $vers =~ s/\.$//; } if( $y eq '' ) { if( $tmp =~ /(\w+)[\.,\ ]+(\d+)[,\ ]+(\d\d\d\d)/ ) { $m = &get_date($1); $d = $2; $y = $3; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /(\d\d\d\d)[\/\-]+(\d\d)[\/\-]+(\d\d)/ ) { $y = $1; $m = $2; $d = $3; } elsif( $tmp =~ /[\ ]+(\w+)[\,\.\ ]+(\d\d\d\d)/ ) { $y = $2; $m = &get_date($1); $d = '01'; if( $tmp =~ /(\d+)[\ ]+[\w\.]+[\ ]+\d\d\d\d/ ) { $d = $1; if( length($d) == 1 ) { $d = "0$d"; } } } elsif( $tmp =~ /(\d+)\/(\d+)\/(\d\d\d\d)/ ) { $y = $3; $m = $1; if( length($m) == 1 ) { $m = "0$m"; } $d = $2; if( length($d) == 1 ) { $d = "0$d"; } } elsif( $tmp =~ /(\d+)\/(\d+)\/(\d\d)/ ) { $y = '19' . $3; $m = $1; if( length($m) == 1 ) { $m = "0$m"; } $d = $2; if( length($d) == 1 ) { $d = "0$d"; } } } } if( $vers eq '' || !($vers =~ /\d+/) ) { $vers = '(?)'; } if( !($y =~ /^2/ || $y =~ /^1/) ) { $y = ''; } if( !($y =~ /^\d\d\d\d$/) ) { $y = ''; } if( $m eq '00' ) { $y = ''; } $d_str = "$y-$m-$d"; if( $y eq '' ) { $d_str = &get_fallback_date("$base"); } if( $title ne '' ) { $email =~ s/<//g; $email =~ s/>//g; if( $auth eq '' ) { $auth = $email; } $f_html = $f; $f_html =~ s/\/public\/html\/LDP\///; $f_plain = "HOWTO/text/${strip_f}"; $f_pdf = $_base_ht . "other-formats/pdf/${strip_f}.pdf"; $f_htmlt = $_base_ht . "other-formats/html/${strip_f}-html.tar.gz"; if( !(-e $f_pdf) ) { $f_pdf = ''; } if( !(-e $f_htmlt) ) { $f_htmlt = ''; } $tmp = $title; $tmp =~ s/^A\ //i; $tmp =~ s/^The\ //i; $tmp =~ s/^Linux\ //i; $tmp =~ s/^[\s\-\"\']+//g; $tmp = lc($tmp); $s = "$d_str|HOWTO|$title|$f_html|$f_plain|$f_pdf|$auth| |$vers|$tmp|" . "$strip_f_lc|$strip_f|$f_htmlt"; $s =~ s/public\/ftp\/pub\/linux/pub\/Linux/g; push(@howtos, $s); } else { print "mk_sortedht: ERROR (html) - not adding: $f\n"; } } # # # sub get_date { my($str) = @_; if($str =~ /^Jan/i ) { return '01'; } elsif($str =~ /^Feb/i ) { return '02'; } elsif($str =~ /^Mar/i ) { return '03'; } elsif($str =~ /^Apr/i ) { return '04'; } elsif($str =~ /^May/i ) { return '05'; } elsif($str =~ /^Jun/i ) { return '06'; } elsif($str =~ /^Jul/i ) { return '07'; } elsif($str =~ /^Aug/i ) { return '08'; } elsif($str =~ /^Sep/i ) { return '09'; } elsif($str =~ /^Oct/i ) { return '10'; } elsif($str =~ /^Nov/i ) { return '11'; } elsif($str =~ /^Dec/i ) { return '12'; } return '00'; } # # # sub get_fallback_date { my($f) = @_; my($y,$m,$d,$s,$tmp,$d_str) = ''; if($f =~ /\/$/) { $f .= 'index.html'; } if( (@_fallback_dates + 0) == 0 ) { ($y,$m,$d) = ''; open(HT_INDEX, "$_base_path/index.html") || return "1900-00-00"; while(<HT_INDEX>) { chop; if( $_ =~ /^<A[\ ]+HREF/i ) { ($tmp) = ($_ =~ m/\=\s*[\'\"]+([^\">\']+?)[\'\"]+/s); $s = <HT_INDEX>; if( $s =~ /^<b>/i && ($s =~ m/(\w+)[\ ]+(\d\d\d\d)/) ) { $m = &get_date($1); $d = '01'; $y = $2; $d_str = "$y-$m-$d"; push(@_fallback_dates, $tmp); push(@_fallback_dates, $d_str); } } } close(HT_INDEX); } ($d_str) = ''; my($i) = 0; for($i=0; $i < (@_fallback_dates + 0); $i++ ) { if( $f eq $_fallback_dates[$i] ) { $d_str = $_fallback_dates[($i + 1)]; $i = (@_fallback_dates + 0); } } if( $d_str eq '' ) { $d_str = '1900-00-00'; } return "$d_str"; } # __END__ delimits the script from the data section # __END__ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE>The Linux Documentation Project: Sorted HOWTOs
    The Linux Documentation Project
    home  |   HOWTOs  |   Guides  |   FAQs  |   man pages  |   Linux Gazette  |   LinuxFocus

     TLDP : Sorted HOWTOs