From 094ca96844842928810f14844413109fc6cdd890 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 3 Feb 2013 00:59:38 -0700 Subject: Initial Alpine Version --- doc/tech-notes/pnuts.4tech-notes | 134 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100755 doc/tech-notes/pnuts.4tech-notes (limited to 'doc/tech-notes/pnuts.4tech-notes') diff --git a/doc/tech-notes/pnuts.4tech-notes b/doc/tech-notes/pnuts.4tech-notes new file mode 100755 index 00000000..33e8d49f --- /dev/null +++ b/doc/tech-notes/pnuts.4tech-notes @@ -0,0 +1,134 @@ +#!/usr/local/bin/perl +################################################# +#pnuts version 0.4 part of the WN server package +################################################# +# for more info, see http://hopf.math.nwu.edu/docs/utility.html#pnuts +# Modified by Stefan Kramer for use with Pine Technical Notes +# Last modified on 1995 Nov. 02 + + +require "getopts.pl"; + +# Edit to specify what should appear as text of navigation bar. Note: +# If the HTML files processed by PNUTS will be converted to plain-text files, +# the PNUTS-generated link text will probably be stripped out, so this +# text should be unique (i.e., not expected to occur elsewhere in text). + +# This is the original link appearance, without graphic buttons +# $prevw="Previous"; +# $nextw="Next"; +# $upw="Up one level"; +# $topw="Table of Contents"; +# $searchw="Search"; +# $indexw="Index"; + +$prevw='[Previous]'; +$nextw='[Next]'; +$upw=''; # not needed and don't have a graphic for UP +$topw='[Table of Contents]'; +$searchw='[Search]'; +$indexw=''; # no index here and no graphic for it + + + +$VERSION = "0.4"; + + &Getopts('s:i:'); + $search = $opt_s if $opt_s ne ""; + $index = $opt_i if $opt_i ne ""; + + $file = shift; + $marker = ""; + + + open( LIST, "<$file") || die "Can't open file: $!"; + + + $nextfile = ; + print $nextfile; + chop( $nextfile); + $top = $nextfile; + + while ( &getnextfile() ) { + $curcopy = $currentfile."~"; + + rename( $currentfile, $curcopy) + || die "Can't rename file: $currentfile"; + open( OLDCURR, "<$curcopy" ) || die "Can't open file: $!"; + open( NEWCURR, ">$currentfile" ) || die "Can't open file: $!"; + while ( $line = ) { + if ( $line =~ "^$marker") { + &pnutline(); + } + else { + print NEWCURR $line; + } + } + close( OLDCURR); + close( NEWCURR); + } + + +close( LIST); +exit(0); + +sub pnutline { + printf( NEWCURR "$marker"); + printf( NEWCURR "


"); + if ( $previous ) { + printf( NEWCURR " $prevw", $previous); + } + if ( $nextfile ) { + printf( NEWCURR " $nextw", $nextfile); + } + if ( $up[$curlevel - 1] ) { + printf( NEWCURR " $upw", + $up[$curlevel-1]); + } + if ( $top && ( $top ne $currentfile) ) { + printf( NEWCURR " $topw", $top); + } + if ( $search ) { + printf( NEWCURR " $searchw", $search); + } + if ( $index ) { + printf( NEWCURR " $indexw", $index); + } + printf( NEWCURR "\n"); +} + +sub getnextfile { + if ( $nextfile eq "") { + return 0; + } + $previous = $currentfile; + $up[$curlevel] = $currentfile; + + $currentfile = $nextfile; + while ( 1 ) { + ($nextfile = ) || ($nextfile = ""); + $nextfile =~ s/(\t*)//; + last if $nextfile eq ""; + print $nextfile; + chop( $nextfile); + if ( -d $nextfile ) { + print "$nextfile is directory, ignoring it\n"; + next; + } + last; + } + $curlevel = $nextlevel; + $nextlevel = length( $1); + return 1; +} + + + + + + + + + + + -- cgit v1.2.3-70-g09d2