public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
@ 2007-07-03 22:19 Kevin O'Gorman
  2007-07-04  3:19 ` Naga
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Kevin O'Gorman @ 2007-07-03 22:19 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 700 bytes --]

I emerge with the doc USE flag and generally have a bunch of stuff in
/usr/share/doc.  Most of the time it's the HTML stuff I want to read, but
it's a annoyingly laborious to wade through unindexed directgories and get a
browser pointing to the right thing.  So I wrote a little Perl script to
create a top-level "index.html", organized by package and with a bit of
rudimentary pruning.  I bookmarked it in Firefox, and can get to things a
lot faster now.  I like the result, and will continue to tweak it here and
there.

Did I just reinvent a wheel? If not, is there any point it trying to make
this part of gentoo?  If so, how would one do that?

Current script attached.

-- 
Kevin O'Gorman, PhD

[-- Attachment #1.2: Type: text/html, Size: 786 bytes --]

[-- Attachment #2: makeindex.perl --]
[-- Type: application/octet-stream, Size: 2470 bytes --]

#!/usr/bin/perl -w
# Create an index of all index files.  Do not index sub-indexes.

$DEBUG = 0;
$needeol = "";

chdir "/usr/share/doc" or die "Cannot cd to /usr/share/doc: $!";

open FIND, "find . -name index.html |sort|" or die "Cannot fork: $!";

print "<head><title>Index of /usr/share/doc index files</title>\n";
print "<style type=\"text/css\">\n";
print "    li, p { margin-top: 0in; margin-bottom: 0in; }\n";
print "</style>\n";
print "</head>\n";
print "<body>\n";
$date = scalar localtime;
print "<h1>External docs:</h1>\n";
print "<ul>\n";
    print "<li><p>Gentoo web resource: <a \n";
    print "      href=\"http://www.gentoo.org/doc/en/index.xml\">Gentoo\n";
    print "      Documentation Project</a></p></li>\n";
print "</ul>\n";
print "\n";
print "<h1>Index of /usr/share/doc index files, generated $date</h1>\n";

while (<FIND>) {
    chomp;
    $file = $_;
    s:^\./::;
    $name = $_;
    ($basename = $name) =~ s:^\./::;
    print "$needeol   File: \"$file\"  Basename: $basename\n" if $DEBUG;
    $needeol = "";
    ($path = $basename) =~ s|/index\.html$||;
    $files{$basename} = 1;
    open NAME, "<$name" or warn "Cannot open $name";
    while (<NAME>) {
	chomp;
	if ($_ eq "./index.html") {next;}
	if (m/href=\"[^"]+\/(index.html)?\"/i) {
	    print "$needeol    From line \"$_\"\n" if $DEBUG;
	    $needeol = "";
	    while (m/href=\"([^"]+\/(index.html)?)\"/i) {
		$ref = $1;
		s/href=\"[^"]+\/(index.html)?\"//i;
		if ($ref =~ m|^https?://|) {
		    if ($DEBUG > 9) {
			print "         Ditching absolute reference $ref\n"
		    }
		    next;
		}
		if ($ref =~ m:^\.\./:) { # dot dot slash
		    print "         Ditching up-reference $ref\n" if $DEBUG > 9;
		    next;
		}
		if ($ref =~ m:/\.\./:) { # slash dot dot slash
		    print "         Ditching up-reference $ref\n" if $DEBUG > 9;
		    next;
		}
		($hyper = $ref) =~ s:^\./::;  # strip "here" from ref
		print "      blocking: $path/$hyper\n" if $DEBUG;
		$links{"$path/$hyper"} = 1;
    }
	} elsif ($DEBUG) {
	    print ".";
	    $needeol = "\n";
	}
    }
}
close FIND;

print "<ul>\n";
    if ($DEBUG) {
	for $i (sort keys %links) {
	    print("Exclude Link $i\n");
	}
    }
    $p1 = "";
    for $i (sort keys %files) {
	($p2 = $i) =~ s:/.*::;
	if ($p2 ne $p1) {
	    if ($p1) { print "\n"; }
	    print "   <li><p>$p2: ";
	    $p1 = $p2;
	}
	if (! defined $links{$i}) {
	    print " &nbsp; <a href=\"$i\">$i</a>";
	}
    }
    print "\n";
print "</ul>\n";
print "</body>\n";

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-03 22:19 [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel? Kevin O'Gorman
@ 2007-07-04  3:19 ` Naga
  2007-07-04 14:59   ` Kevin O'Gorman
  2007-07-04  6:22 ` Kent Fredric
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Naga @ 2007-07-04  3:19 UTC (permalink / raw
  To: gentoo-user

On Wednesday 04 July 2007 00:19:14 Kevin O'Gorman wrote:
> Did I just reinvent a wheel? If not, is there any point it trying to make
> this part of gentoo?  If so, how would one do that?

See DOC_SYMLINKS_DIR in make.conf (man page I think, or .example)

-- 
Naga
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-03 22:19 [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel? Kevin O'Gorman
  2007-07-04  3:19 ` Naga
@ 2007-07-04  6:22 ` Kent Fredric
  2007-07-04 14:28 ` David Relson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Kent Fredric @ 2007-07-04  6:22 UTC (permalink / raw
  To: gentoo-user

On 7/4/07, Kevin O'Gorman <kogorman@gmail.com> wrote:
> I emerge with the doc USE flag and generally have a bunch of stuff in
> /usr/share/doc.  Most of the time it's the HTML stuff I want to read, but
> it's a annoyingly laborious to wade through unindexed directgories and get a
> browser pointing to the right thing.  So I wrote a little Perl script to
> create a top-level " index.html", organized by package and with a bit of
> rudimentary pruning.  I bookmarked it in Firefox, and can get to things a
> lot faster now.  I like the result, and will continue to tweak it here and
> there.
>
> Did I just reinvent a wheel? If not, is there any point it trying to make
> this part of gentoo?  If so, how would one do that?
>
> Current script attached.
>
> --
> Kevin O'Gorman, PhD
>
>

debian have a similar and much nicer tool  called dwww which merges
all html-doc, htmlized infopages, and htmlized manpages into one
uniform system. I think gentoo being better should have an equivelant.
 But as  of yet, no such equivelant exists, which I think is sad, as
in my experience, the documentation available to gentoo as a whole is
/much/ superior to that on competing distros I have encounted.

-- 
Kent
ruby -e '[1, 2, 4, 7, 0, 9, 5, 8, 3, 10, 11, 6, 12, 13].each{|x|
print "enNOSPicAMreil kdrtf@gma.com"[(2*x)..(2*x+1)]}'
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-03 22:19 [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel? Kevin O'Gorman
  2007-07-04  3:19 ` Naga
  2007-07-04  6:22 ` Kent Fredric
@ 2007-07-04 14:28 ` David Relson
  2007-07-04 16:27   ` Kevin O'Gorman
  2007-07-04 16:39   ` Willie Wong
  2007-07-05  1:40 ` Walter Dnes
  2007-07-06 23:31 ` Paul Gibbons
  4 siblings, 2 replies; 15+ messages in thread
From: David Relson @ 2007-07-04 14:28 UTC (permalink / raw
  To: gentoo-user

On Tue, 3 Jul 2007 15:19:14 -0700
Kevin O'Gorman wrote:

> I emerge with the doc USE flag and generally have a bunch of stuff in
> /usr/share/doc.  Most of the time it's the HTML stuff I want to read,
> but it's a annoyingly laborious to wade through unindexed
> directgories and get a browser pointing to the right thing.  So I
> wrote a little Perl script to create a top-level "index.html",
> organized by package and with a bit of rudimentary pruning.  I
> bookmarked it in Firefox, and can get to things a lot faster now.  I
> like the result, and will continue to tweak it here and there.
> 
> Did I just reinvent a wheel? If not, is there any point it trying to
> make this part of gentoo?  If so, how would one do that?
> 
> Current script attached.
> 
> -- 
> Kevin O'Gorman, PhD

Hi Kevin,

After saving your script to /var/www/localhost/cgi-bin/makeindex.perl
and running "chmod +x ...", I pointed firefox at
http://localhost/cgi-bin/makeindex.perl and got the following:

    Internal Server Error

    The server encountered an internal error or misconfiguration and
    was unable to complete your request.

    Please contact the server administrator, root@localhost and inform
    them of the time the error occurred, and anything you might have
    done that may have caused the error.

    More information about this error may be available in the server
    error log.

Looking in /var/log/apache2/error_log I found

    [Wed Jul 04 10:22:06 2007] [error] [client 127.0.0.1] malformed
header from script. Bad header=<head><title>Index of /usr/sha:
makeindex.perl


Looking at other simple scripts lead me to add

    print "Content-type: text/html; charset=iso-8859-1\n\n";

All is good now!

Cheers,

David
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04  3:19 ` Naga
@ 2007-07-04 14:59   ` Kevin O'Gorman
  2007-07-04 15:15     ` Galevsky
  0 siblings, 1 reply; 15+ messages in thread
From: Kevin O'Gorman @ 2007-07-04 14:59 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

On 7/3/07, Naga <nagatoro@gmail.com> wrote:
>
> On Wednesday 04 July 2007 00:19:14 Kevin O'Gorman wrote:
> > Did I just reinvent a wheel? If not, is there any point it trying to
> make
> > this part of gentoo?  If so, how would one do that?
>
> See DOC_SYMLINKS_DIR in make.conf (man page I think, or .example)


Thanks, I was able to track it down from that hint.

For the record:
   Read about it in "man make.conf".

The description there is quite sparse, and I haven't done any emerges since
I set it,
so I'm not sure exactly how it works.  I think it just sets
version-independent symlinks,
and leaves it up to you whether to bookmark them.

Unless there's more going on, I'm going to prefer my little script.  It
builds a web page
with current links, organized by package.  I run it in a cron job several
times a week,
so it's pretty much up-to-date.    These are all listed unless they are
linked from another
index.html higher in the directory structure.  This makes most of the
entries pretty clean, with
a few notable exceptions: boost, java, apache, drscheme, python-docs and
mplayer among the packages I have.  I'll probably tweak these when I get
some time.

For me the main advantage is in doing a quick check to see if a given
package actually has
any "index.html" files anywhere under /usr/share/doc.  Just browsing to the
index
file can be a pain sometimes, and my patience is usually thinner than usual
when
I'm desperately seeking documentation.

So: am I the only one who likes this?

++ kevin


-- 
Kevin O'Gorman, PhD

[-- Attachment #2: Type: text/html, Size: 2047 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04 14:59   ` Kevin O'Gorman
@ 2007-07-04 15:15     ` Galevsky
  0 siblings, 0 replies; 15+ messages in thread
From: Galevsky @ 2007-07-04 15:15 UTC (permalink / raw
  To: gentoo-user

surely not all the gentooers. Not me, since my bookmarks are
day-to-day matters but the doc.

2007/7/4, Kevin O'Gorman <kogorman@gmail.com>:
> On 7/3/07, Naga <nagatoro@gmail.com> wrote:
[snip]
> So: am I the only one who likes this?
>
>  ++ kevin
>
>
> --
> Kevin O'Gorman, PhD
>
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04 14:28 ` David Relson
@ 2007-07-04 16:27   ` Kevin O'Gorman
  2007-07-04 20:26     ` David Relson
  2007-07-04 16:39   ` Willie Wong
  1 sibling, 1 reply; 15+ messages in thread
From: Kevin O'Gorman @ 2007-07-04 16:27 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

On 7/4/07, David Relson <relson@osagesoftware.com> wrote:
>
> On Tue, 3 Jul 2007 15:19:14 -0700
> Kevin O'Gorman wrote:
>
> > I emerge with the doc USE flag and generally have a bunch of stuff in
> > /usr/share/doc.  Most of the time it's the HTML stuff I want to read,
> > but it's a annoyingly laborious to wade through unindexed
> > directgories and get a browser pointing to the right thing.  So I
> > wrote a little Perl script to create a top-level "index.html",
> > organized by package and with a bit of rudimentary pruning.  I
> > bookmarked it in Firefox, and can get to things a lot faster now.  I
> > like the result, and will continue to tweak it here and there.
> >
> > Did I just reinvent a wheel? If not, is there any point it trying to
> > make this part of gentoo?  If so, how would one do that?
> >
> > Current script attached.
> >
> > --
> > Kevin O'Gorman, PhD
>
> Hi Kevin,
>
> After saving your script to /var/www/localhost/cgi-bin/makeindex.perl
> and running "chmod +x ...", I pointed firefox at
> http://localhost/cgi-bin/makeindex.perl and got the following:
>
>     Internal Server Error
>
>     The server encountered an internal error or misconfiguration and
>     was unable to complete your request.
>
>     Please contact the server administrator, root@localhost and inform
>     them of the time the error occurred, and anything you might have
>     done that may have caused the error.
>
>     More information about this error may be available in the server
>     error log.
>
> Looking in /var/log/apache2/error_log I found
>
>     [Wed Jul 04 10:22:06 2007] [error] [client 127.0.0.1] malformed
> header from script. Bad header=<head><title>Index of /usr/sha:
> makeindex.perl
>
>
> Looking at other simple scripts lead me to add
>
>     print "Content-type: text/html; charset=iso-8859-1\n\n";
>
> All is good now!
>
> Cheers,
>
> David
> --
> gentoo-user@gentoo.org mailing list
>
>
Hmm.  I never intended to run it that way.  I run a cronjob as root, with
output directed to "index.html".  I'd worry that your way would be too slow.

-- 
Kevin O'Gorman, PhD

[-- Attachment #2: Type: text/html, Size: 2995 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04 14:28 ` David Relson
  2007-07-04 16:27   ` Kevin O'Gorman
@ 2007-07-04 16:39   ` Willie Wong
  2007-07-04 17:26     ` Jerry McBride
  1 sibling, 1 reply; 15+ messages in thread
From: Willie Wong @ 2007-07-04 16:39 UTC (permalink / raw
  To: gentoo-user

On Wed, Jul 04, 2007 at 10:28:30AM -0400, Penguin Lover David Relson squawked:
> After saving your script to /var/www/localhost/cgi-bin/makeindex.perl
> and running "chmod +x ...", I pointed firefox at
> http://localhost/cgi-bin/makeindex.perl and got the following:
> 
>     Internal Server Error
> 
>     The server encountered an internal error or misconfiguration and
>     was unable to complete your request.
> 
>     Please contact the server administrator, root@localhost and inform
>     them of the time the error occurred, and anything you might have
>     done that may have caused the error.
> 
>     More information about this error may be available in the server
>     error log.
> 
> Looking in /var/log/apache2/error_log I found
> 
>     [Wed Jul 04 10:22:06 2007] [error] [client 127.0.0.1] malformed
> header from script. Bad header=<head><title>Index of /usr/sha:
> makeindex.perl
> 
> 
> Looking at other simple scripts lead me to add
> 
>     print "Content-type: text/html; charset=iso-8859-1\n\n";
> 

I doubt that his script (which he mentions is to be run in cron) is
meant to actually be placed in the cgi-bin directory for apache. 

It would certainly be annoying to need to have an apache server
running just to read documentation.

W
-- 
When two egotists meet, it's an I for an I.
Sortir en Pantoufles: up 208 days, 15:01
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04 16:39   ` Willie Wong
@ 2007-07-04 17:26     ` Jerry McBride
  2007-07-21 15:50       ` Kevin O'Gorman
  0 siblings, 1 reply; 15+ messages in thread
From: Jerry McBride @ 2007-07-04 17:26 UTC (permalink / raw
  To: gentoo-user

On Wednesday 04 July 2007 12:39:48 pm Willie Wong wrote:

> I doubt that his script (which he mentions is to be run in cron) is
> meant to actually be placed in the cgi-bin directory for apache.
>
> It would certainly be annoying to need to have an apache server
> running just to read documentation.
>

There are some advantages serving the index out via httpd. Anyone you allow 
can read your documents...

I've been working on (in my very spare time) on a similar project. Mine is in 
python. It scans an entire hard drive for index.html's, chm's and pdf's... 
then pours it's findings into a single index.html. 

The script is no where complete, free for the asking though wth setup tips...


-- 


From the Desk of: Jerome D. McBride
--
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04 16:27   ` Kevin O'Gorman
@ 2007-07-04 20:26     ` David Relson
  0 siblings, 0 replies; 15+ messages in thread
From: David Relson @ 2007-07-04 20:26 UTC (permalink / raw
  To: gentoo-user

On Wed, 4 Jul 2007 09:27:20 -0700
Kevin O'Gorman wrote:

> On 7/4/07, David Relson <relson@osagesoftware.com> wrote:
> >
> > On Tue, 3 Jul 2007 15:19:14 -0700
> > Kevin O'Gorman wrote:
> >
> > > I emerge with the doc USE flag and generally have a bunch of
> > > stuff in /usr/share/doc.  Most of the time it's the HTML stuff I
> > > want to read, but it's a annoyingly laborious to wade through
> > > unindexed directgories and get a browser pointing to the right
> > > thing.  So I wrote a little Perl script to create a top-level
> > > "index.html", organized by package and with a bit of rudimentary
> > > pruning.  I bookmarked it in Firefox, and can get to things a lot
> > > faster now.  I like the result, and will continue to tweak it
> > > here and there.

...[snip]...

> Hmm.  I never intended to run it that way.  I run a cronjob as root,
> with output directed to "index.html".  I'd worry that your way would
> be too slow.

Fair enough :->  

Evidently I misinterpreted "wrote a little Perl script to create
... index.html ... bookmarked it in Firefox" to mean "bookmarked
the scrip"t rather than "bookmarked index.html".

My mistake.

David

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-03 22:19 [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel? Kevin O'Gorman
                   ` (2 preceding siblings ...)
  2007-07-04 14:28 ` David Relson
@ 2007-07-05  1:40 ` Walter Dnes
  2007-07-06 23:31 ` Paul Gibbons
  4 siblings, 0 replies; 15+ messages in thread
From: Walter Dnes @ 2007-07-05  1:40 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1635 bytes --]

On Tue, Jul 03, 2007 at 03:19:14PM -0700, Kevin O'Gorman wrote
> I emerge with the doc USE flag and generally have a bunch of stuff in
> /usr/share/doc.  Most of the time it's the HTML stuff I want to read, but
> it's a annoyingly laborious to wade through unindexed directgories and get a
> browser pointing to the right thing.  So I wrote a little Perl script to
> create a top-level "index.html", organized by package and with a bit of
> rudimentary pruning.  I bookmarked it in Firefox, and can get to things a
> lot faster now.  I like the result, and will continue to tweak it here and
> there.
> 
> Did I just reinvent a wheel? If not, is there any point it trying to make
> this part of gentoo?  If so, how would one do that?
> 
> Current script attached.

  Here's mine.  It uses strictly bash; no perl at all.  The setup...
  - following files sit in the ~/.docpointer/  directory
    - docpointer (executable script)
    - docpointer.css
    - header
    - footer

  - from a console execute...
    ~/.docpointer/docpointer n
    where "n" is an integer specifying the number of columns across you
    want in the output.  You *MUST* specify a number.  I use between 1
    and 3, depending on my mood.  It only takes a couple of seconds on
    an old 450 mhz PIII

  - I point browser to file:///home/waltdnes/.docpointer/docpointer.html
    and get a list of html docs.  The pathname will obviously be
    different om your system

  The files are attached...

-- 
Walter Dnes <waltdnes@waltdnes.org> In linux /sbin/init is Job #1
Q. Mr. Ghandi, what do you think of Microsoft security?
A. I think it would be a good idea.

[-- Attachment #2: docpointer --]
[-- Type: text/plain, Size: 2815 bytes --]

#!/bin/bash

makelinktext() {

# Search for matches
find ${1} -iname ${2} > workfile.000

# Generate text for link and append it and the match to workfile.001
while read
do
# Strip the prefix off the filespec
  xoffset=$(( ${#1} + 1 ))
  commenttext=${REPLY:${xoffset}}

# If the stripped filespec contains the string "/html/", get rid of that
  commenttext=`echo ${commenttext} | sed "s/\/html\//\//g"`

# Get rid of the string "/HTML/" too
  commenttext=`echo ${commenttext} | sed "s/\/HTML\//\//g"`

# Get rid of the string "/doc/" too
  commenttext=`echo ${commenttext} | sed "s/\/doc\//\//g"`

# Get rid of the string "/DOC/" too
  commenttext=`echo ${commenttext} | sed "s/\/DOC\//\//g"`

# Get rid of the string "/doc/" too
  commenttext=`echo ${commenttext} | sed "s/\/docs\//\//g"`

# Get rid of the string "/doc/" too
  commenttext=`echo ${commenttext} | sed "s/\/DOCS\//\//g"`

# Strip the suffix off the filespec
  xlength=$(( ${#commenttext} - ${#2} - 1 ))
  commenttext=${commenttext:0:${xlength}}

# Send the stripped filespec, along with the original, to workfile.001
  echo ${commenttext} ${REPLY} >> workfile.001
done < workfile.000

}

# Get parameter which specifies how many columns across
columncount=${1}

# Change to ~/.docpointer directory
cd ~/.docpointer

# Get rid of workfile.001 if it exists.
if [[ -a workfile.001 ]]; then
  rm workfile.001
fi

# Get raw search results
makelinktext "/usr/share/doc" "index.html"
makelinktext "/usr/share/doc" "index.htm"
# Repeat the above lines for any additional searches you want to throw in.

# Generate a sorted workfile
sort -u workfile.001 > workfile.002

# Create the beginning of the docpointer.html file
cp header docpointer.html

# Put creation date into the link page
date >> docpointer.html

# Open the table
echo '<table class="t1" cellspacing="4">' >> docpointer.html

# Initialize column pointer
columnpointer=0

# Read each line in workfile.002 and generate a link
while read commenttext urltext
do

# Increment column pointer
  columnpointer=$(( ${columnpointer} + 1 ))

# If this is the first cell of a row, open the row first
  if [[ ${columnpointer} -eq 1 ]]; then
    echo '<tr>' >> docpointer.html
    rowstatus="open"
  fi

# Do the cell
  echo "<td><a href=\"${urltext}\">" "${commenttext}" '</a></td>' >> docpointer.html

# If this is the  last cell of a row, close the row, and reset the
# column pointer to zero
  if [[ ${columnpointer} -eq ${columncount} ]]; then
    echo '</tr>' >> docpointer.html
    rowstatus="closed"
    columnpointer=0
  fi

done < workfile.002

# If the last row hasn't been closed, close it now
if [[ "${rowstatus}" = "open" ]]; then
  echo '</tr>' >> docpointer.html
fi

# Close the table
echo '</table>' >> docpointer.html

# Append the footer to docpointer.html
cat footer >> docpointer.html

[-- Attachment #3: docpointer.css --]
[-- Type: text/css, Size: 1040 bytes --]

div.nav_menu {
  color:             #000000;
  background-color:  #b4dade;
  font-weight:       bold;
  font-family:       monospace;
  top:               1px;
  left:              1px;
  border-style:      groove;
  padding:           0;
}

td.tab_cell {
  background-color:  #b4dade;
  background-image:  url(tabimage.gif);
  background-repeat: no-repeat;
  font-family:       "Courier New","Courier",monospace;
}

pre.listing {
  font-size:         larger;
}

.bluelight {
  color:             #000000;
  background-color:  #c0d0ff;
}

.highlight {
  color:             #000000;
  background-color:  #b4ffb4;
  font-weight:       bold;
  text-align:        left;
  border-style:      none;
}

table.t1 {
  border-style:      ridge;
  border-color:      #0000c0;
  border-spacing:    9px;
  border-width:      8px;
  color:             #000000;
  background-color:  #f0f0f0;
}

table.t1 td {
  border-style:      solid;
  border-color:      #0000c0;
  border-width:      1px;
  color:             #000000;
  background-color:  #f0f0f0;
}

[-- Attachment #4: header --]
[-- Type: text/plain, Size: 405 bytes --]

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<link rel="stylesheet" href="docpointer.css" type="text/css" />
<title>The docpointer linkpage to html documentation on your system</title>
</head>
<body>
<div class="nav_menu">
This page created 

[-- Attachment #5: footer --]
[-- Type: text/plain, Size: 23 bytes --]

</div>
</body>
</html>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-03 22:19 [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel? Kevin O'Gorman
                   ` (3 preceding siblings ...)
  2007-07-05  1:40 ` Walter Dnes
@ 2007-07-06 23:31 ` Paul Gibbons
  2007-07-07 13:59   ` Dan Farrell
  2007-07-07 15:30   ` Kevin O'Gorman
  4 siblings, 2 replies; 15+ messages in thread
From: Paul Gibbons @ 2007-07-06 23:31 UTC (permalink / raw
  To: gentoo-user

On Tue, 3 Jul 2007 15:19:14 -0700
"Kevin O'Gorman" <kogorman@gmail.com> wrote:

> I emerge with the doc USE flag and generally have a bunch of stuff in
> /usr/share/doc.  Most of the time it's the HTML stuff I want to read,
> but it's a annoyingly laborious to wade through unindexed
> directgories and get a browser pointing to the right thing.  So I
> wrote a little Perl script to create a top-level "index.html",
> organized by package and with a bit of rudimentary pruning.  I
> bookmarked it in Firefox, and can get to things a lot faster now.  I
> like the result, and will continue to tweak it here and there.
> 
> Did I just reinvent a wheel? If not, is there any point it trying to
> make this part of gentoo?  If so, how would one do that?
> 
> Current script attached.
> 
 Thanks for the script - it seems to create the index file fine.
However the index.html files are only readable by root. 
Is there a treat when running emerge to ensure files are readable by
others?



-- 
                                                 
	##### ##                        ###     
     ######  /###                        ###    
    /#   /  /  ###                        ##    
   /    /  /    ###                       ##    
       /  /      ##                       ##    
      ## ##      ##  /###   ##   ####     ##    
      ## ##      ## / ###  / ##    ###  / ##     paul@pkami.e7even.com
    /### ##      / /   ###/  ##     ###/  ##     mobile: 07972184336
   / ### ##     / ##    ##   ##      ##   ##    
      ## ######/  ##    ##   ##      ##   ##    
      ## ######   ##    ##   ##      ##   ##    
      ## ##       ##    ##   ##      ##   ##    
      ## ##       ##    /#   ##      /#   ##    
      ## ##        ####/ ##   ######/ ##  ### / 
 ##   ## ##         ###   ##   #####   ##  ##/  
###   #  /                                      
 ###    /                                       
  #####/                                        
    ###                                         

Linux 2.6.20-gentoo-r8 
x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-06 23:31 ` Paul Gibbons
@ 2007-07-07 13:59   ` Dan Farrell
  2007-07-07 15:30   ` Kevin O'Gorman
  1 sibling, 0 replies; 15+ messages in thread
From: Dan Farrell @ 2007-07-07 13:59 UTC (permalink / raw
  To: gentoo-user

On Sat, 7 Jul 2007 00:31:53 +0100
Paul Gibbons <paul@pkami.e7even.com> wrote:

> On Tue, 3 Jul 2007 15:19:14 -0700
> "Kevin O'Gorman" <kogorman@gmail.com> wrote:
> 
> > I emerge with the doc USE flag and generally have a bunch of stuff
> > in /usr/share/doc.  Most of the time it's the HTML stuff I want to
> > read, but it's a annoyingly laborious to wade through unindexed
> > directgories and get a browser pointing to the right thing.  So I
> > wrote a little Perl script to create a top-level "index.html",
> > organized by package and with a bit of rudimentary pruning.  I
> > bookmarked it in Firefox, and can get to things a lot faster now.  I
> > like the result, and will continue to tweak it here and there.
> > 
> > Did I just reinvent a wheel? If not, is there any point it trying to
> > make this part of gentoo?  If so, how would one do that?
> > 
> > Current script attached.
> > 
>  Thanks for the script - it seems to create the index file fine.
> However the index.html files are only readable by root. 
> Is there a treat when running emerge to ensure files are readable by
> others?
> 
> 
> 
Try running the script as a different user, and/or maybe appending to
the end a command to change the group to the webserver group (probably
apache) and to group permissions to allow reading.  
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-06 23:31 ` Paul Gibbons
  2007-07-07 13:59   ` Dan Farrell
@ 2007-07-07 15:30   ` Kevin O'Gorman
  1 sibling, 0 replies; 15+ messages in thread
From: Kevin O'Gorman @ 2007-07-07 15:30 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 1490 bytes --]

On 7/6/07, Paul Gibbons <paul@pkami.e7even.com> wrote:
>
> On Tue, 3 Jul 2007 15:19:14 -0700
> "Kevin O'Gorman" <kogorman@gmail.com> wrote:
>
> > I emerge with the doc USE flag and generally have a bunch of stuff in
> > /usr/share/doc.  Most of the time it's the HTML stuff I want to read,
> > but it's a annoyingly laborious to wade through unindexed
> > directgories and get a browser pointing to the right thing.  So I
> > wrote a little Perl script to create a top-level "index.html",
> > organized by package and with a bit of rudimentary pruning.  I
> > bookmarked it in Firefox, and can get to things a lot faster now.  I
> > like the result, and will continue to tweak it here and there.
> >
> > Did I just reinvent a wheel? If not, is there any point it trying to
> > make this part of gentoo?  If so, how would one do that?
> >
> > Current script attached.
> >
> Thanks for the script - it seems to create the index file fine.
> However the index.html files are only readable by root.
> Is there a treat when running emerge to ensure files are readable by
> others?


That's an artifact of your umask.  I run root with a umask of 022, so I
didn't notice the problem.

You can add the line
    umask(0133);
to the script (before the open call) to get a sensible 0644 (rw-r--r--)
mode.

As I've also modified the sorting of entries on each line, in an attempt to
make each index.html come first in its directory, I've attached my latest
copy to this email.

-- 
Kevin O'Gorman, PhD

[-- Attachment #1.2: Type: text/html, Size: 2036 bytes --]

[-- Attachment #2: makeindex.perl --]
[-- Type: application/octet-stream, Size: 2960 bytes --]

#!/usr/bin/perl -w
# Create an index of all index files.  Do not index sub-indexes.

$RCSID = <<'EOF';
$Id: makeindex.perl,v 1.1 2007/07/07 15:28:45 root Release root $
EOF
chomp $RCSID;

$DEBUG = 0;
$needeol = "";
umask(0133);	# create the file with mode 0644

chdir "/usr/share/doc" or die "Cannot cd to /usr/share/doc: $!";

open FIND, "find . -name index.html |sort|" or die "Cannot fork: $!";

$date = scalar localtime;
print <<EOF;
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Index of /usr/share/doc index files</title>
    <style type=\"text/css\">
	li, p { margin-top: 0in; margin-bottom: 0in; }
    </style>
</head>

<body>
<h1>External docs:</h1>
<ul>
    <li><p>Gentoo web resource: <a
          href=\"http://www.gentoo.org/doc/en/index.xml\">Gentoo
          Documentation Project</a></p></li>
</ul>

<h1>Index of /usr/share/doc index files, generated $date</h1>
EOF

while (<FIND>) {
    chomp;
    $file = $_;
    s:^\./::;
    $name = $_;
    ($basename = $name) =~ s:^\./::;
    print "$needeol   File: \"$file\"  Basename: $basename\n" if $DEBUG;
    $needeol = "";
    ($path = $basename) =~ s|/index\.html$||;
    $files{$basename} = 1;
    open NAME, "<$name" or warn "Cannot open $name";
    while (<NAME>) {
	chomp;
	if ($_ eq "./index.html") {next;}
	if (m/href=\"[^"]+\/(index.html)?\"/i) {
	    print "$needeol    From line \"$_\"\n" if $DEBUG;
	    $needeol = "";
	    while (m/href=\"([^"]+\/(index.html)?)\"/i) {
		$ref = $1;
		s/href=\"[^"]+\/(index.html)?\"//i;
		if ($ref =~ m|^https?://|) {
		    if ($DEBUG > 9) {
			print "         Ditching absolute reference $ref\n"
		    }
		    next;
		}
		if ($ref =~ m:^\.\./:) { # dot dot slash
		    print "         Ditching up-reference $ref\n" if $DEBUG > 9;
		    next;
		}
		if ($ref =~ m:/\.\./:) { # slash dot dot slash
		    print "         Ditching up-reference $ref\n" if $DEBUG > 9;
		    next;
		}
		($hyper = $ref) =~ s:^\./::;  # strip "here" from ref
		print "      blocking: $path/$hyper\n" if $DEBUG;
		$links{"$path/$hyper"} = $name;
    }
	} elsif ($DEBUG) {
	    print ".";
	    $needeol = "\n";
	}
    }
}
close FIND;

print "<ul>\n";
    if ($DEBUG) {
	for $i (sort keys %links) {
	    print("Exclude Link $i\n");
	}
    }
    # Sort files after trimming off any trailing "index.html" (so it sorts first).
    # Don't modify the originals, however.
    @files = sort {
		    my ($a1, $b1);
		    ($a1 = $a) =~ s|index\.html$||;
		    ($b1 = $b) =~ s|index\.html$||;
		    $a1 cmp $b1
	    } keys %files;
    $p1 = "";
    for $i (@files) {
	print "<$i>\n" if $DEBUG;
	($p2 = $i) =~ s:/.*::;	# to compare package names
	if ($p2 ne $p1) {
	    if ($p1) { print "\n"; }
	    print "   <li><p>$p2: ";
	    $p1 = $p2;
	}
	if (! defined $links{$i}) {
	    print " &nbsp; <a href=\"$i\">$i</a>";
	} elsif ($DEBUG) {
	    print " <excluded by $links{$i}>\n";
	}
    }
    print "\n";
print "</ul>\n";
print "</body>\n";

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel?
  2007-07-04 17:26     ` Jerry McBride
@ 2007-07-21 15:50       ` Kevin O'Gorman
  0 siblings, 0 replies; 15+ messages in thread
From: Kevin O'Gorman @ 2007-07-21 15:50 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

On 7/4/07, Jerry McBride <mcbrides9@comcast.net> wrote:
>
> On Wednesday 04 July 2007 12:39:48 pm Willie Wong wrote:
>
> > I doubt that his script (which he mentions is to be run in cron) is
> > meant to actually be placed in the cgi-bin directory for apache.
> >
> > It would certainly be annoying to need to have an apache server
> > running just to read documentation.
> >
>
> There are some advantages serving the index out via httpd. Anyone you
> allow
> can read your documents...
>
> I've been working on (in my very spare time) on a similar project. Mine is
> in
> python. It scans an entire hard drive for index.html's, chm's and pdf's...
> then pours it's findings into a single index.html.
>
> The script is no where complete, free for the asking though wth setup
> tips...


Hey, thanks for this script.  It's an interesting start, at least.  A couple
of points:
1)  Your copyright notice is kind of hidden in the html <head> tag.  I
couldn't
    immediatedly identify the author when looking at the code.  I don't
think
    you can copyright the output anyway...

2) As it stands, the code is not much use to me because of the copyright.
If
   you'd license it under your favorite Open Source license, this would be
pretty
   handy.

3) It outputs everything in the order found, which makes it hard to browse.




-- 
Kevin O'Gorman, PhD

[-- Attachment #2: Type: text/html, Size: 1851 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-07-21 15:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-03 22:19 [gentoo-user] Index to /usr/share/doc/...html... a reinvented wheel? Kevin O'Gorman
2007-07-04  3:19 ` Naga
2007-07-04 14:59   ` Kevin O'Gorman
2007-07-04 15:15     ` Galevsky
2007-07-04  6:22 ` Kent Fredric
2007-07-04 14:28 ` David Relson
2007-07-04 16:27   ` Kevin O'Gorman
2007-07-04 20:26     ` David Relson
2007-07-04 16:39   ` Willie Wong
2007-07-04 17:26     ` Jerry McBride
2007-07-21 15:50       ` Kevin O'Gorman
2007-07-05  1:40 ` Walter Dnes
2007-07-06 23:31 ` Paul Gibbons
2007-07-07 13:59   ` Dan Farrell
2007-07-07 15:30   ` Kevin O'Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox