Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 1999 23:22:22 +0100 (BST)
From:      Andrew Boothman <andrew@cream.org>
To:        Nik Clayton <nik@freebsd.org>
Cc:        ports@freebsd.org, doc@freebsd.org
Subject:   RE: Building a page of installed software docs
Message-ID:  <XFMail.990918232222.andrew@cream.org>
In-Reply-To: <19990915231305.A31588@kilt.nothing-going-on.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 15-Sep-99 Nik Clayton wrote:
> Thinking about it, this should probably not be limited to just the HTML
> documentation that's installed.  There's no reason why bzip2 couldn't
> have a pkg/URLS file that looked something like
> 
>     ${PREFIX}/share/doc/bzip2/manual_toc.html:HTML:User manual
>     ${PREFIX}/share/doc/bzip2/manual.ps:PS:User manual
>     ${PREFIX}/share/doc/bzip2/manual.txt:TXT:User manual
> 
> which would turn in to
> 
>     <h3>archivers/bzip2</h3>
> 
>     <ul>
>       <li>User Manual [<a href="file:/.../manual_toc.html">HTML</a>]
>                       [<a href="file:/.../manual.txt">TXT</a>]
>                       [<a href="file:/.../manual.ps">PS</a>]</li>
>     </ul>

OK. I had a spare few minutes, so I threw together the following script :

#!/usr/bin/perl -w

# Produces an HTML list of documentation installed by
# the FreeBSD ports system. Intended to be run daily
# from /var/periodic/daily

# By Andrew Boothman <andrew@cream.org>

opendir 'portsdir', '/var/db/pkg' or die "docindex: Can't open /var/db/pkg";

@allfiles = readdir 'portsdir';

closedir 'portsdir';

print '<HTML>
<HEAD>
<TITLE>Installed FreeBSD Documentation</TITLE>
</HEAD>
<BODY>
<H2>Installed FreeBSD Documentation</H2>
<HR>
<UL>';

foreach(@allfiles){
        if (-e "/var/db/pkg/$_/+DOCS") {
                open 'DOCS',"/var/db/pkg/$_/+DOCS";
                @docs = <DOCS>;
                close 'DOCS';
                chomp @docs;
                print "<LI>$_ <UL>";
                foreach(@docs) {
                        @docinfo = split(/ /);
                        print "<LI>$docinfo[0] - [<A
HREF=\"$docinfo[2]\">$docinfo[1]</A>]\n";
                };
                print "</UL>\n"         
        };
};

print "</UL></BODY></HTML>";



It goes through the /var/db/pkg directory, looking for the ports that have our
new 'DOCS' file, which is in the format of :

FAQ txt /usr/local/share/doc/Sharity-Light/FAQ
README txt /usr/local/share/doc/Sharity-Light/README

I made this file up for Sharity Light as an example. If the port has a docs
file, then the script produces a nice set of links to each type of
documentation.

Nik, is this what you had in mind?

Any comments gladly recieved!!

---
Andrew Boothman <andrew@cream.org>
http://sour.cream.org
Unmetered Telecoms. Join the Fight!
http://www.unmetered.org.uk


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.990918232222.andrew>