head	1.10;
access;
symbols
	HRS_XML_CLEANUP:1.10
	HRS_XML_CLEANUP_PRE:1.9
	EMILYBOYD_REDESIGN:1.9
	PRE_REDESIGN:1.8
	XML_XSL_XP:1.2.0.2
	XML_XSL_XP_BP:1.2;
locks; strict;
comment	@# @;


1.10
date	2006.08.19.21.25.53;	author hrs;	state Exp;
branches;
next	1.9;

1.9
date	2005.10.05.20.59.56;	author simon;	state Exp;
branches;
next	1.8;

1.8
date	2004.03.23.23.07.16;	author phantom;	state Exp;
branches;
next	1.7;

1.7
date	2003.12.31.11.17.43;	author andy;	state Exp;
branches;
next	1.6;

1.6
date	2003.12.13.09.30.39;	author andy;	state Exp;
branches;
next	1.5;

1.5
date	2003.09.22.02.57.28;	author kuriyama;	state Exp;
branches;
next	1.4;

1.4
date	2002.02.17.13.57.30;	author phantom;	state Exp;
branches;
next	1.3;

1.3
date	2001.12.13.21.17.13;	author phantom;	state Exp;
branches;
next	1.2;

1.2
date	2000.10.27.12.14.11;	author phantom;	state Exp;
branches;
next	1.1;

1.1
date	2000.01.05.15.34.16;	author phantom;	state Exp;
branches;
next	;


desc
@@


1.10
log
@www cleanup mega commit:

 - Move includes.nav*.sgml to share/sgml/navibar.ent and
   <lang>/share/sgml/navibar.l10n.ent.

 - Move includes.sgml and includes.xsl to
   share/sgml/common.ent, share/sgml/header.ent, <lang>/share/sgml/l10n.ent,
   and <lang>/share/sgml/header.l10n.ent.

 - Move most of XSLT libraries to share/sgml/*.xsl and
   <lang>/share/sgml/*.xsl.

 - Move news.xml and other *.xml files for the similar purpose
   to share/sgml/*.xml and <lang>/share/sgml/*.xml.

 - Switch to use a custom DTD for HTML document.  Now we use
   "-//FreeBSD//DTD HTML 4.01 Transitional-Based Extension", which is
   HTML 4.01 + some entities previously pulled via
   "<!ENTITY % includes SYSTEM "includes.sgml"> %includes;" line.
   The location of entity file will be resolved by using catalog file.

 - Add DOCTYPE declearation to XML documents.  This makes the followings
   possible:

   * Use of &foo; entities for SGML in an XML file instead of defining
     {$foo} as the same content.

   * &symbolic; entities for Latin characters.

 - Duplicated information between SGML and XML, or English and
   translated doc, has been removed as much as possible.
@
text
@#!/usr/bin/perl

# convert a ports INDEX file to HTML
#
# by John Fieber <jfieber@@freebsd.org>
# Mon May 13 10:31:58 EST 1996

#
# The FreeBSD Russian Documentation Project
#
# $FreeBSD: www/ru/ports/portindex,v 1.9 2005/10/05 20:59:56 simon Exp $
# $FreeBSDru: frdp/www/ru/ports/portindex,v 1.14 2004/03/23 21:10:07 phantom Exp $
#
# Original revision: 1.49
#

############################################################

# Load local config file. You can override in portindex.conf
# the variables for the default web and the ftp server. This
# make it easy to maintain a local web mirror and let the
# URL point to yourself and not to the standard FreeBSD FTP server.
$config = $0 . '.' . 'conf';
do $config if -f $config;

# This is the base of where we ftp stuff from
if ($ENV{'MASTER_FTP_SERVER'}) {
    $ftpserver = $ENV{'MASTER_FTP_SERVER'};
} else {
    $ftpserver = 'ftp://ftp.FreeBSD.org' if !$ftpserver;
}
$base = "" if !$base;
$baseHTTP = $base if !$baseHTTP;
$baseFTP = "$ftpserver/pub/FreeBSD/ports/ports";
$baseCVSWEB = 'http://www.FreeBSD.org/cgi/cvsweb.cgi/';
$urlcgi = 'http://www.freebsd.org/cgi/url.cgi' if !$urlcgi;
$packagesURL = "$ftpserver/pub/FreeBSD/ports/i386/packages-stable/All/"
    if !$packagesURL;
# support tar on the fly or gzip'ed tar on the fly
$ftparchive = '';
$ftparchive = 'tar' if !defined $ftparchive;


# ports download sources script
$pds = 'http://www.FreeBSD.org/cgi/pds.cgi';

# better layout and link to the sources
if ($urlcgi) {
    $baseHTTP = $urlcgi . '?' . $baseHTTP;
}

$today = &getdate;

&packages_exist('packages.exists', *packages);
&category_description(($ARGV[1] || '.') . '/categories', *category_description);
&main;

sub getdate {
    @@months = ("", "", "", "", "","",
	       "", "", "", "", "", "");
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
    $year += 1900;
    return " : $mday $months[$mon], $year";
}

sub header {
    local ($fh, $htext) = @@_;
    print $fh "<!DOCTYPE HTML PUBLIC \"-//FreeBSD//DTD HTML 4.01 Transitional-Based Extension//EN\" [\n";
    print $fh "<!ENTITY base CDATA '..'>\n";
    print $fh "<!ENTITY date  \"<em>$today</em>\">\n";
    print $fh "<!ENTITY title '$htext'>\n";
    print $fh "<!ENTITY blurb  SYSTEM \"ports.inc\">\n";
    print $fh "<!ENTITY % navinclude.ports \"INCLUDE\">\n";
    print $fh "<!ENTITY email 'ports'>\n";
    print $fh "]>\n";
    print $fh "<html>&header;\n";
}

sub footer {
    local ($fh, $ftext) = @@_;
    print $fh "\n$ftext\n";
    print $fh "&footer;\n";
    print $fh "</BODY>\n</HTML>\n";
}

sub packages_exist {
    local($file, *p) = @@_;

    open(P, $file) || do {
	warn "open $file: $!\n";
	warn "Cannot create packages links\n";
	return 1;
    };

    while(<P>) {
	chop;
	$p{$_} = 1;
    }
    close P;
    return 0;
}

sub category_description {
    local($file, *p) = @@_;

    open(P, $file) || do {
	warn "open $file: $!\n";
	warn "Cannot find category description\n";
	return 1;
    };

    local($category, $description);
    while(<P>) {
	# ignore comments
	next if /^\s*#/;

       ($category, $description) = /^\s*"([^"]+)",\s*"([^"]+)/;
	$p{$category} = $description;
    }
    close P;
    return 0;
}

sub main {

    $sep = "<B>:</B>";

    open(INDEX, $ARGV[0]);
    while (<INDEX>) {
	chop;
	s/&/&amp;/g;
    	s/</&lt;/g;
    	s/>/&gt;/g;

    	# Read a record
	($name, $loc, $prefix, $desc, $ldesc, $owner, $cats, 
	    $bdep, $rdep, $www) = split('\|');

	# Check for double hyphens in the name (--).
	$name =~ s/--/-/g;

    	# Split the categories into an array
	@@cat = split("[ \t]+", $cats);

    	$catkey{$name} = $cat[0];

	local($sourcepath) = $loc;
	$sourcepath =~ s%/usr/%%;

	foreach $i (@@cat) {

	    $stats{$i}++;

    	    # figure out the FTP url
	    $loc =~ s/\/usr\//$baseCVSWEB/;
	    $ldesc =~ s/\/usr/$baseHTTP/;

    	    # The name description and maintainer
	    $data{$i} .= "<DT><B><A NAME=\"$name\"></A><A HREF=\"$loc$ftparchive\">$name</A></B> ";
     

	    $data{$i} .= "<DD>$desc<BR><A HREF=\"$ldesc\"> </A>";
	    if ($packages{"$name.tbz"}) { 
		$data{$i} .= qq{ | <a href="$packagesURL$name.tbz"></a>};
	    } elsif ($packages{"$name.tgz"}) { 
		$data{$i} .= qq{ | <a href="$packagesURL$name.tgz"></a>};
	    }

	    $data{$i} .= qq{ | <A HREF="$pds?$sourcepath"> </A>};

            if ($www ne "") {
		$data{$i} .= qq{ | <a href="$www"> Web </a>};
            }

    	    $ownerurl = $owner;
    	    $ownerurl =~ s/&lt;/</g;
    	    $owenrurl =~ s/&gt;/>/g;
	    $data{$i} .= 
		"<BR><I> :</I> <A HREF=\"mailto:$ownerurl\">$owner</A>";

    	    # If there are any dependencies, list them
    	    if ($bdep ne "" || $rdep ne "") {
    	    	$data{$i} .= "<BR><I>:</I> ";
    	    	@@dep = split(/ /, "$bdep $rdep");
		local($last) = '';
    	    	foreach $j (sort @@dep) {
		    next if $j eq $last;
		    $last = $j;
    	    	    $data{$i} .= " <A HREF=\"##$j##.html#$j\">$j</A>,";
    	    	}
    	    	# remove the trailing comma
    	    	chop $data{$i};
    	    }

    	    # If the port is listed in more than one category, throw
    	    # in some cross references
    	    if ($#cat > 0) {
    	    	$data{$i} .= "<BR><EM>  :</EM> ";
    	    	foreach $j (@@cat) {
    	    	    if ($j ne $i) {
			if ($j eq $cat[0]) {
			    $data{$i} .= " <STRONG><A HREF=\"$j.html#$name\">\u$j</A></STRONG>,";
			}
			else {
			    $data{$i} .= " <A HREF=\"$j.html#$name\">\u$j</A>,";
			}
    	    	    }
    	    	}
    	    	# remove the trailing comma
    	    	chop($data{$i});
    	    }
    	    $data{$i} .= "<P></P></DD>\n"
	}

        # Add an entry to the master index

        # workaround for SGML bug, `--' is not allowed in comments
	local ($sname) = $name; 
	$sname =~ s/--/-=/g;
    	$master[$portnumber] = 
    	    "<!-- $sname --><STRONG><A HREF=\"$cat[0].html#$name\">$name</A></STRONG> " .
    	    " -- <EM>$desc</EM><BR>\n";
	$portnumber++;
    }

    open(MOUTF, ">index.sgml");

    &header(MOUTF, " FreeBSD");
#    print MOUTF "<!--#include virtual=\"./ports.inc\" -->\n";
    print MOUTF "&blurb;";
    print MOUTF "<hr><P>    FreeBSD   
 $portnumber   FreeBSD .<br>
<A HREF=\"$baseFTP/ports.tar.gz\"> gzip-,  
$portnumber </A> ( 21 )   
:\n";

    print MOUTF "<UL>\n";

    @@foos = sort(keys %stats);
    foreach $key  (@@foos) {
	# For the master file...
	print MOUTF 
	    "<LI><A HREF=\"$key.html\">\u$key</A> <em>($stats{$key})</em>";
	if ($category_description{$key}) {
	    print MOUTF " -- " . $category_description{$key};
	}

	# Someone forgot to add a category to the description file
	# or there is a typo in the category field.
	else {
	   warn "No description found for category: ``$key''!\n";
	   warn "Please fix me or send an E-Mail to doc\@@FreeBSD.org\a\n";
	   sleep(3);
	}
 
	print MOUTF "</LI>\n";

	# Create the category file
	open(OUTF, ">$key.sgml");
	&header(OUTF, " FreeBSD: \u$key");
	if ($category_description{$key}) {
	    print OUTF "<h3>", $category_description{$key}, "</h3>\n";
	}
	print OUTF "<DL>\n";
	$d = join("\n", sort(split(/\n/, $data{$key})));
    	$d =~ s/##([^#]*)##/$catkey{$1}/g;
	print OUTF $d;
	print OUTF "</DL>\n";
	&footer(OUTF, "<p></p><A HREF=\"index.html\"> </A>" .
	    " -- <A HREF=\"master-index.html\"></A>");
	close(OUTF);

    }
    print MOUTF "</UL>\n";
    print MOUTF 
    	"<UL><LI><A HREF=\"master-index.html\">   $portnumber </A></LI></UL>\n";
    &footer(MOUTF, "");
    close(MOUTF);

    # Create the master index file
    open(MINDEX, ">master-index.sgml");
    &header(MINDEX, "   FreeBSD");
    print MINDEX "<P>\n";
    print MINDEX sort @@master;
    print MINDEX "</P>";
    &footer(MINDEX, "<A HREF=\"index.html\"> </A>");
    close(MINDEX);
    close(INDEX);
}
@


1.9
log
@MFP4: Merge new layout.

Submitted by:	Emily Boyd <emilyboyd@@emilyboyd.com>
Sponsored by:	Google Summer of Code 2005
@
text
@d11 1
a11 1
# $FreeBSD: www/ru/ports/portindex,v 1.8 2004/03/23 23:07:16 phantom Exp $
d68 1
a68 1
    print $fh "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" [\n";
d73 1
a73 2
    print $fh "<!ENTITY % navincludes SYSTEM \"../includes.navdownload.sgml\"> %navincludes;\n";
    print $fh "<!ENTITY % includes SYSTEM \"../includes.sgml\">\n";
a74 1
    print $fh "%includes;\n";
@


1.8
log
@comments.ru is very outdated right now.  Remove it to avoid confusion.
@
text
@d11 1
a11 1
# $FreeBSD$
d73 1
@


1.7
log
@MFen 1.49
@
text
@d12 1
a12 1
# $FreeBSDru: frdp/www/ru/ports/portindex,v 1.13 2003/12/31 11:16:51 andy Exp $
a128 13
    # 'COMMENT' translation database
    if (open(COMF, "comments.ru")) {
    	while(<COMF>) {
		($a, $b) = split('\|');
		next if !defined($b);
		chop($b);
		$b =~ s/&/&amp;/g;
		$b =~ s/</&lt;/g;
		$b =~ s/>/&gt;/g;
		$descLANG{$a} = $b;
	}
    }
    
a150 5
	# desc translation
	($lloc = $loc) =~ s@@^/usr/ports/@@@@;
	$desc = $descLANG{$lloc}
		if ($descLANG{$lloc} ne '');
	
@


1.6
log
@Synchronize with English 1.48.

Fix typo - Submitted by: Maxim Konovalov <maxim@@FreeBSD.org>
@
text
@d8 3
d12 4
a15 3
# The FreeBSD Russian Documentation Project
# $FreeBSDru: frdp/www/ru/ports/portindex,v 1.12 2003/12/13 09:28:29 andy Exp $
# Original revision: 1.48
d253 1
a253 1
$portnumber </A> ( 19 )   
@


1.5
log
@One more fix of build breakage by HTML 4.01 transition.
@
text
@d8 1
a8 1
# $FreeBSD: www/ru/ports/portindex,v 1.4 2002/02/17 13:57:30 phantom Exp $
d10 2
a11 2
# $FreeBSDru: frdp/www/ru/ports/portindex,v 1.7 2001/12/26 09:52:40 phantom Exp $
# Original revision: 1.42
d30 2
a31 1
$baseFTP = "$ftpserver/pub/FreeBSD/branches/-current";
d170 1
a170 1
	    $loc =~ s/\/usr/$baseFTP/;
d178 4
a181 2
	    if ($packages{"$name.tgz"}) { 
		$data{$i} .= qq{ | <a href="$packagesURL$name.tgz"></a>};
d243 1
a243 1
    &header(MOUTF, "FreeBSD Ports");
d247 3
a249 3
 $portnumber   FreeBSD .<br>
<A HREF=\"$baseFTP/ports.tar.gz\"> gzip   
$portnumber </A> ( 15 )   
@


1.4
log
@Synchronize with FreeBSD Russian Documentation Project CVS Repository
@
text
@d8 1
a8 1
# $FreeBSD$
d63 1
a63 1
    print $fh "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\" [\n";
@


1.3
log
@MFen:

        1.30 -> 1.34    Makefile
        1.14 -> 1.17    categories
        1.33 -> 1.42    portindex
        1.51 -> 1.60    ports.inc

Obtained from: The FreeBSD Russian Documentation Project CVS Repository
@
text
@d10 1
a10 1
# $FreeBSDru: frdp/www/ru/ports/portindex,v 1.6 2001/12/06 11:32:17 phantom Exp $
d294 1
a294 1
    &header(MINDEX, "   FreeBSD");
@


1.2
log
@Mega-update of Russian Web pages to current FreeBSD Russian Doc Project's CVS
Repository state.  This commit mostly brings in a lot of translation synches,
spelling fixes, adds new translations.

Obtained from:	FreeBSD Russian Documentation Project CVS Repository
@
text
@d10 2
a11 2
# $FreeBSDru: frdp/www/ru/ports/portindex,v 1.5 2000/10/12 10:02:51 phantom Exp $
# Original revision: 1.33
d26 1
a26 1
    $ftpserver = 'ftp://ftp.freebsd.org' if !$ftpserver;
d28 1
a28 1
$base = "$ftpserver/pub/FreeBSD/branches/-current" if !$base;
d30 1
d35 2
a36 1
$ftparchive = 'tar' if !$ftparchive;
d40 1
a40 1
$pds = 'http://www.freebsd.org/cgi/pds.cgi';
d50 1
a50 2
&category_description(($ARGV[2] || '.') . '/categories', *category_description);
&y2k_statements;
a52 14
sub y2k_statements {

    open(Y2K, $ARGV[1]);
    while(<Y2K>) {
      chop();
      ( $dir, $url ) = split(/\s+/);
      $dir = $base . "/" . $dir;
      $y2k{$dir} = $url;
      
    }
    close(Y2K);

}

d64 1
a64 1
    print $fh "<!ENTITY base CDATA '..'>";
d66 1
a66 1
    print $fh "<!ENTITY title '$htext'>";
d69 1
a69 1
    print $fh "<!ENTITY email 'ports'>";
d169 1
a169 1
	    $loc =~ s/\/usr/$base/;
d173 1
a173 1
	    $data{$i} .= "<DT><B><A NAME=\"$name\"></A><A HREF=\"$loc.$ftparchive\">$name</A></B> ";
a182 4
            if ($y2k{"$loc"}) {
		$data{$i} .= qq{ | <a href="$y2k{$loc}">Y2K</a>};
            }

d245 3
a247 2
<A HREF=\"$base/ports.tar.gz\"> gzip    $portnumber
</A> ( 10 )    :\n";
@


1.1
log
@Add new directory: www/ru/ports
@
text
@d7 1
d10 2
a11 1
# Original revision: 1.30
d48 1
a48 1
&category_description('categories', *category_description);
d137 13
d171 5
d244 1
a244 1
    	# Add an entry to the master index
d246 1
a246 1
	# workaround for SGML bug, `--' is not allowed in comments
d261 3
a263 3
 $portnumber   FreeBSD .<br>
<A HREF=\"$base/ports.tar.gz\"> gzip    $portnumber
</A> ( 7 )    :\n";
d297 2
a298 2
	&footer(OUTF, "<p></p><HR><A HREF=\"index.html\"> </A>" .
	    " -- <A HREF=\"master-index.html\">Index</A>");
@

