#!/bin/sh
#
# .mkindex.sh - Script acquires a list of files to be
# processed from the current directory
# and generate an index.html and even an
# all-index.html file (there's a list of
# core names to suppress in the .hide file
# that won't be placed in the default
# index file).
# Author: Jack C Lipton, cupasoup@pele.cx
#
# $Id: .mkindex.sh,v 1.21 2005/02/15 02:20:46 jcl Exp jcl $
# $Log: .mkindex.sh,v $
# Revision 1.21 2005/02/15 02:20:46 jcl
# added logic to generate an index file of incomplete works...
#
# Revision 1.20 2005/01/21 06:03:32 jcl
# modified the "other author" and "collection" links and corrected the
# ASSTR "Donate" button graphic to use the one on pele.
#
# Revision 1.19 2004/12/18 19:50:11 jcl
# futher fine-tuned the difference between index and all-index
#
# Revision 1.18 2004/12/18 19:46:46 jcl
# a whole raft of minor corrections that I put off checking in.
#
# Revision 1.17 2004/07/10 12:59:10 jcl
# added some fairly cosmetic items.
#
# Revision 1.16 2004/07/03 14:06:47 jcl
# added all kinds of stuff and deferred the save too damn long.
#
# Revision 1.15 2003/12/31 01:14:09 jcl
# corrected some of my mistakes in trying to make it quicker.
#
# Revision 1.14 2003/12/27 14:36:11 jcl
# performance changes made and the RCSINFO part of the file has been changed.
#
# Revision 1.13 2003/12/27 13:52:10 jcl
# changed to handle new NiS index page since it's been relocated.
#
# Revision 1.12 2003/11/10 18:09:39 jcl
# added link to personally liked spotlights
#
# Revision 1.11 2003/10/16 16:36:02 jcl
# Yet more tuning of webpage contents. I really need to break out the
# list of links to external files and think about grouping stories into
# other index files, just to cut down on the clutter of this page.
#
# Yeah, there's a lot missing in terms of aesthetics, but this page is
# designed to be as accessible as possible by avoiding the use of
# graphics.
#
# Revision 1.10 2003/10/16 15:59:49 jcl
# dropped extraneous HR line and changed to "true" copyright symbol.
#
# Revision 1.9 2003/10/16 15:33:22 jcl
# moved link to maintenance script info _and_ dropped extraneous stuff.
#
# Revision 1.8 2003/09/29 20:38:13 jcl
# added Reader Spotlight link to index page
#
# Revision 1.7 2003/07/14 12:49:54 jcl
# added handling for the Palm e-Book formats
#
# Revision 1.6 2003/05/24 17:00:02 jcl
# moved the date info around a little bit and some other bullshit that
# doesn't affect the way things look.
#
# Revision 1.5 2003/05/05 14:42:17 jcl
# added a timestamp to the index file
#
# Revision 1.4 2003/04/27 20:54:36 jcl
# added more "useful" links
#
# Revision 1.3 2003/04/25 02:41:53 jcl
# added logic to provide RCS information in the index file
#
# Revision 1.2 2003/03/14 21:19:16 jcl
# updated for cleaner sectioning
#
# Revision 1.1 2003/01/20 21:14:48 jcl
# Initial revision
#
#
HTML=index.html # target file
INFO=.sort
TMP=/tmp/mkindexT.$$
ICQPAGE=jclICQ.html # ICQ Panel file, pasted from ICQ
CVPAGE=CV.html # Curriculum Vitae (yeah, right)
HUMORPAGE=Humor.html # Potentially humorous material
EMAILTO=cupasoup@pele.net # Author's e-Mail
#
# Here's the index file prefix. You can tell that I like
# shell "here" documents, can't you?
#
cat >${HTML}+ <<INDEXHTML
<HTML>
<HEAD>
<TITLE>Jack C Lipton's Story Page</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Jack C Lipton's Story Page</H1>
<BR> <BR>
<A HREF="https://www.asstr-mirror.org/cgi-bin/ah_feedback.cgi?id=CXNRITNZQLQQBDITGAVD" TARGET="_new" onClick="remote=window.open('https://www.asstr-mirror.org/cgi-bin/ah_feedback.cgi?id=CXNRITNZQLQQBDITGAVD','_new', 'toolbar=no,width=570,height=700,status=no,scrollbars=yes,resizable=1');remote.opener=self;return false">Email Me</A>
<B>ICQ#:</B>
<A HREF="http://web.icq.com/wwp?Uin=174178749">
<TT>174178749</TT>
</A> <BR>
INDEXHTML
#
# ICQ Panel is optional- named and existing
#
false && [ ! -z "$ICQPAGE" ] && [ -f $ICQPAGE ] && \
cat >>${HTML}+ <<INDEXHTML
(or use my <A HREF="$ICQPAGE">panel</A>) <BR>
INDEXHTML
#
# CV (Background) Page optional - named and existing
#
[ ! -z "$CVPAGE" ] && [ -f $CVPAGE ] && \
cat >>${HTML}+ <<INDEXHTML
<B>More Personal information:</B>
<A HREF="$CVPAGE"> CV </A> <BR>
INDEXHTML
#
# A humor page is optional, but must be both named and exist
#
[ ! -z "$HUMORPAGE" ] && [ -f $HUMORPAGE ] && \
cat >>${HTML}+ <<INDEXHTML
<B>Potentially Humorous Items:</B>
<A HREF="$HUMORPAGE"> Humor </A> <BR>
INDEXHTML
#
# Insert the baseline for w/ some "favorites" and the like
#
cat >>${HTML}+ <<INDEXHTML
<BR> <BR>
<I>Last Modified: `date`</I> <BR>
There is a page w/ stories sorted in reverse chronological order
<A HREF="byage.html"> <B><FONT SIZE=+2> here </FONT></B> </A>.
<BR> <BR>
Additionally, I maintain a <A HREF=diary.html> <B><FONT SIZE=+2> Diary </FONT></B> </A>.
<BR> <BR>
<H2>Warning: Caveat Lector</H2>
<TT>
This page links to <B><I><FONT SIZE="+2">adult</FONT></I></B> material. <BR>
<BR>
If you are under 18 years of age you really <BR>
*should* use the "BACK" button to leave NOW. <BR>
<BR>
If you live somewhere where the perusal <BR>
of adult-oriented material is illegal it <BR>
might be time to consider a revolution. <BR>
For now, though, hit the "BACK" button. <BR>
<BR>
Material linked here likely to be offensive to <BR>
*somebody*. If you're uncomfortable with sex <BR>
and sexual issues, you also should "BACK" out <BR>
of this page too. It's your choice to proceed. <BR>
<BR>
<B>You have been warned.</B> <BR>
</TT>
</CENTER>
<BR><BR>
<H2>ASSTR</H2>
<UL>
<LI> <A HREF="https://www.asstr-mirror.org/main.html"> Main </A>,
<A HREF="https://www.asstr-mirror.org/authors.html"> Authors </A>,
<A HREF="https://www.asstr-mirror.org/authors_new.html"> New Authors </A>,
<A HREF="https://www.asstr-mirror.org/profiles.html"> Author Profiles </A>
<LI> <A HREF="https://www.asstr-mirror.org/archives.html"> Collections </A>,
<A HREF="https://www.asstr-mirror.org/search.html"> Search </A>
<LI> <B>Story Themes / "Universes"</B> (Multiple Authors)
<UL>
<LI> Naked In School
<A HREF="https://www.asstr-mirror.org/files/Authors/NIS/www/Naked.htm">
Main Page
</A> and
<A HREF="https://www.asstr-mirror.org/files/Authors/Naked_In_School/www/NiS_hotcoded.html">
Hot-Coded
</A> stories
<LI> <A HREF="https://www.asstr-mirror.org/files/Authors/Wiseguy/www/html/pcruisemain.html"> Pleasure Cruise </A>
<LI> <A HREF="https://www.asstr-mirror.org/files/Authors/JR_Parz/www/MasterPCUniverse.htm"> Master PC </A>
<LI> <A HREF="https://www.asstr-mirror.org/~mcstories/"> Mind Control Story Archive </A>
</UL>
<LI> <B>My Favorite Authors:</B>
<A HREF="https://www.asstr-mirror.org/files/Authors/artie/www/"> Artie </A>
(his <A HREF="https://www.asstr-mirror.org/files/Authors/artie/www/diary.html"> diary </A>),
<A HREF="https://www.asstr-mirror.org/files/Authors/Dorsai/www/"> Dorsai </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/dotB_StoryTyme/www/storyindex.html"> .B </A>
( <A HREF="https://www.asstr-mirror.org/files/Authors/dotB_StoryTyme/www/changes.html"> changes </A>),
<A HREF="https://www.asstr-mirror.org/files/Authors/Dyslexic_One/www/">
The Dyslexic One
</A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/eskimo1958/www/stories.html"> eskimo1958 </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Frank_Downey/www/index2.htm"> Frank Downey </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/gary/www/Stories.htm"> Gary Jordan </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Gina_Marie_Wylie/www/main.htm"> Gina Marie Wylie </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/LawrenceDavid/www/nstories.html"> Lawrence David </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Morgan/www/main.html"> Morgan </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Net_Wolf/www/stories.html"> Net Wolf </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Night_Hawk/www/Stories.html"> Night Hawk </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Thinkers_tales/www/"> Thinking Horndog </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Trybble/www/"> Trybble </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/Wiseguy/www/"> Wiseguy </A>
<BR>
<BR>
Also:
<A HREF="https://www.asstr-mirror.org/files/Authors/Apache/www/"> Apache (Collection) </A>,
<A HREF="https://www.asstr-mirror.org/files/Authors/davidb234/"> davidb234 </A>
<BR>
<BR>
I look for the following authors in Paper Space:
<BR>
Lois McMaster Bujold,
David Drake,
James P. Hogan,
S.M. Stirling,
David Weber.
<BR>
<BR>
In addition to the above active authors,
the following authors have left indelible marks on me:
<BR>
Isaac Asimov,
John Brunner,
Arthur C. Clarke,
Robert Heinlein,
Larry Niven,
H. Beam Piper,
Mack Reynolds.
<BR>
<BR>
"For I have stood upon the shoulders of giants..."
<BR>
<BR>
<LI> <B>Story Archives</B>
<A HREF="https://www.asstr-mirror.org/files/Authors/Kristen/www/@/"> Kristen's Illustrated Story Archive </A>
<LI> <B>FTP:</B>
<A HREF="https://www.asstr-mirror.org/files/Authors/"> Authors </A>,
<A HREF="https://www.asstr-mirror.org/files/Collections/"> Collections </A>,
<LI> <B>Story SpotLights</B>
<A HREF="https://www.asstr-mirror.org/reader_spotlights.html"> Reader </A>,
<A HREF="SpotLights.html"> Mine </A>
<LI> <B>Author Body Parts</B>
<A HREF="/files/Authors/Dryad/www/bodyparts.html"> challenge </A> and
<A HREF="bodyparts.html"> answers </A>
<LI> <B>Other useful resources:</B>
<A HREF="http://www.grammartips.homestead.com/articleindex.html"> Grammar </A>,
<A HREF="http://humorpages.virtualave.net/apihna/apihna-1.htm"> APIHNA Dictionary </A>
<LI> <B>e-Book formats</B>
for Palm devices may be found in my <A HREF="palmstuff.html">Palm Resources</A> page.
<LI> <A HREF="scripts.html">Scripts I use to maintain this website</A>
</UL>
<H2>Useful Links</H2>
<UL>
<LI> <B>Searching:</B>
<A HREF="http://www.google.com/">Google</A>
(<A HREF="http://www.google.com/advanced_search">Advanced</A>),
<A HREF="http://groups.google.com/">UseNet News</A>
(<A HREF="http://groups.google.com/advanced_group_search">Advanced</A>)
</UL>
<BR>
<H2>Other Resources</H2>
<P>
A set "plucker" compatible PDB files (for Palm Viewing)
of this (and selected other) site(s) may be found on:
<A HREF="palmstuff.html">Palm Resources</A>. <BR>
<P>
Please note that <A HREF="all-index.html">all-index</A> includes
more of my incomplete or otherwise fragmentary works, many of which
I believe to not be ready for prime time.
<P>
Of more embarrasing note is the <A HREF="inc-index.html">inc-index</A>
of story <B>files</B> that are incomplete.
An incomplete series will not be listed.
<P>
<BR>
<H2>And now for a word from our sponsor...</H2>
<P>
asstr-mirror.org is kind enough to consider hosting my written works to be
effectively in lieu of payment; if I had currency I could funnel
into the accounts needed to pay for space/power/AC <B>and</B>
bandwidth, I would do so (but My Finer Half keeps track of cash flows
too closely).
<P>
<CENTER>
<A HREF="/donations.html">
<IMG SRC="http://www.pele.cx/files/Authors/CupaSoup/www/AsstrDonateSmall.jpg"> <BR>
So... please donate.
</A>
<BR>
</CENTER>
<BR>
<P>
Thank you.
<P>
<BR>
<H2>My Stories</H2>
<P>
<B>Please Note:</B>
My preferred themes are fairly narrow given the quantity of
things that squick me.
I also like the idea of <B>romance</B> despite my poor showing in Real Life,
which kind of conflicts with the old "in-out, in-out" some may prefer to
read.
<P>
An astute reader will realize that my protagonist is not, well,
completely "with it" and has problems to overcome.
A case of art reflecting life.
<P>
Warning:<P>
Many of the stories you find on this website will fall into the
following rating: <BR>
<P><SPAN STYLE="color: white; background-color: black; font-size: 200%;">D</span>
The author has voluntarily coded this story D. It contains adult themes
of such sticky sweetness that Insulin may be required to prevent
Diabetic Coma. Please comply with age and content restrictions for your
locality.</P>
<BR>
<BR>
INDEXHTML
#
# OK, here's where the fun begins. We copy the prefix to
# the all-index file to reduce the points of maintenance.
#
# Yes, I *am* that lazy.
#
cp ${HTML}+ all-${HTML}+
cp ${HTML}+ inc-${HTML}+
#
# This works through the file names. If I really wanted
# to be subtle I'd probably map each file into the titles
# and sort against that. Perhaps another day I'll do so.
# But not today, obviously. Again, I slapped this together
# pretty quickly.
#
>$INFO # make sure the file is empty
echo "Bringing in header information:"
for F in *.x
do
echo -e "\r \r$F \c"
# isolate name so we can check whether this should be displayed
CORENAME=`echo $F | awk -F. '{print $1}'` # independant of ext
#CORENAME=`basename $F .x`
#
# grab information from the SHS headers...
# This is most convenient using the text file...
#
TITLE="`head -15 $F | grep '^Title: ' | sed 's/^Title: //'`"
INCOMPLETE="`echo "$TITLE" | grep -i incomplete | wc -l | sed 's/ *//'`"
if [ $INCOMPLETE != 0 ]
then
TITLE=`echo "$TITLE" | sed 's/ ([Ii]ncomplete)//'`
fi
MAINTTL="`echo $TITLE | sed 's/:..*$//'`"
SUBTTL="`echo $TITLE | sed 's/^..*: //'`"
if [ "$MAINTTL" = "$SUBTTL" ]
then
SUBTTL=""
fi
if [ -z "$TITLE" ]
then
#
# If SHS headers not in place we'll need to cheat.
# This does that. (I hope)
#
TITLE=`head -15 $F | grep -v '^$' | head -1 | sed 's/^[ ][ ]*//'`
PART=""
CODES=""
SUMMARY=""
UNIVERSE=""
RCSVERSION=
RCSCHGDATE=
RCSCHGTIME=
RCSINFO=
WORDS=`cat $F.wc` # grab the word count
else
PART="`head -15 $F | grep '^Part: ' | sed 's/^Part: //'`"
CODES="`head -15 $F | grep '^Keywords: ' | sed 's/^Keywords: //'`"
SUMMARY="`head -15 $F | grep '^Summary: ' | sed 's/^Summary: //'`"
UNIVERSE="`head -15 $F | grep '^Universe: ' | sed 's/^Universe: //'`"
[ "$UNIVERSE" = "n/a" ] && UNIVERSE=
RCSLINE="`head -15 $F | grep '^RCS: ' | sed 's/RCS: \$Id: //'`"
if [ ! -z "$RCSLINE" ]
then
RCSVERSION="`echo $RCSLINE | awk '{print $2}'`"
RCSCHGDATE="`echo $RCSLINE | awk '{print $3}'`"
RCSCHGTIME="`echo $RCSLINE | awk '{print $4}'`"
RCSINFO="$RCSCHGDATE $RCSCHGTIME $RCSVERSION"
else
RCSINFO=
fi
WORDS=`cat $F | wc -w` # count the words
fi
echo "$CORENAME|$UNIVERSE|$MAINTTL|$PART|$SUBTTL|$CODES|$SUMMARY|$WORDS|$INCOMPLETE|$RCSINFO" >>$INFO
done
echo -e "\r \r\c"
#
# OK, we have extracts of all files now in $INFO; We'll sort this
# by the universe & title...
#
cp $INFO $INFO.raw
sort -t '|' +1 $INFO >${INFO}+
cutover $INFO
cp $INFO $INFO.sorted
FILES=`cat $INFO | awk '-F|' '{print $1}'` # sorted list of files
#
# Now we'll build the actual linkages for the web page from the sorted
# file- which simplifies matters enormously...
#
INLIST=0 # record that we've got a UL in place
LASTSECTION=
for CORENAME in $FILES
do
>$TMP
# isolate name so we can check whether this should be displayed
F=$CORENAME.x # text version of file
WF=$CORENAME.html # HTML version of file
SORTLINE="`grep "^$CORENAME|" $INFO`"
HIDDEN=`grep "^$CORENAME$" .hide | wc -l`
echo -e "$F ... \c" >/dev/tty
# echo "$CORENAME|$UNIVERSE|$MAINTTL|$PART|$SUBTTL|$CODES|$SUMMARY|$WORDS|$INCOMPLETE|$RCSINFO"
MAINTTL="`echo $SORTLINE | awk '-F|' '{print $3}'`"
PART="`echo $SORTLINE | awk '-F|' '{print $4}'`"
SUBTTL="`echo $SORTLINE | awk '-F|' '{print $5}'`"
CODES="`echo $SORTLINE | awk '-F|' '{print $6}'`"
UNIVERSE="`echo $SORTLINE | awk '-F|' '{print $2}'`"
SUMMARY="`echo $SORTLINE | awk '-F|' '{print $7}'`"
WORDS="`echo $SORTLINE | awk '-F|' '{print $8}'`"
INCOMPLETE="`echo $SORTLINE | awk '-F|' '{print $9}'`"
RCSINFO="`echo $SORTLINE | awk '-F|' '{print $10}'`"
#
# Report the title associated with the file name
#
echo -e "$MAINTTL $PART $SUBTTL \c" >/dev/tty
#
# We encapsulate the following to reduce the need for
# individual redirections of stdout; Also, it goes to
# a temporary file so that it can be conditionally
# appended to the index files under construction...
#
SECNAME="`echo $UNIVERSE | awk '{print $1}'`"
# echo "$WF [$LASTSECTION] > [$UNIVERSE] > [$SECNAME]" >>.log/mkindex
if [ -z "$LASTSECTION" ] || [ "$LASTSECTION" != "$SECNAME" ]
then
(
if [ $INLIST != 0 ]
then
echo -e "</UL><BR><BR>\n"
INLIST=0
fi
[ "$UNIVERSE" = "n/a" ] && UNIVERSE="Nothing Special"
[ -z "$UNIVERSE" ] && UNIVERSE="Other (unspecified)"
echo -e "<H3> $UNIVERSE </H3>\n<UL>\n"
#
# If a section preface has been defined, present it.
#
if [ -f $SECNAME.preface ]
then
cat $SECNAME.preface
echo "<BR><BR>"
fi
) >>$TMP
INLIST=1
cat $TMP >>${HTML}+
cat $TMP >>all-${HTML}+
cat $TMP >>inc-${HTML}+
>$TMP
fi
LASTSECTION="$SECNAME" # remember this for the next pass
(
echo -e " <LI> <A HREF=\"$WF\">\n\t\t<B>$MAINTTL\c"
[ ! -z "$SUBTTL" ] && echo -e ": \c"
[ ! -z "$PART" ] && echo -e " [$PART] \c"
[ ! -z "$SUBTTL" ] && echo -e " $SUBTTL \c"
echo -e "\n\t</B> </A> \c"
[ $INCOMPLETE != 0 ] && echo -e "<B><I>In Progress</B></I> \c"
[ ! -z "$CODES" ] && echo -e "($CODES) \c"
[ ! -z "$SUMMARY" ] && echo -e "<BR>\n\t$SUMMARY"
if [ ! -z "$RCSINFO" ]
then
RCSVERSION=`echo $RCSINFO | awk '{print $3}'`
RCSDATE=`echo $RCSINFO | awk '{print $1}'`
RCSTIME=`echo $RCSINFO | awk '{print $2}'`
echo -e "<BR> <B>Version</B> $RCSVERSION\n"
echo -e " <B>Changed:</B> <TT>$RCSDATE</TT> at <TT>$RCSTIME</TT>\n"
fi
[ ! -z "$WORDS" ] && echo -e "<BR>\n\t$WORDS words"
false && cat <<REVIEWSTY
<form method=POST action="http://cgi.tripod.com/lixdw1192/cgi-bin/loadeval.pl">
<input type="hidden" name="hr" value="https://www.asstr-mirror.org/files/Authors/CupaSoup/www/$WF">
<input type="hidden" name="em" value="$EMAILTO">
<input type="submit" value="Rate/Review">
</form>
REVIEWSTY
echo -e "<BR>\n"
) >>$TMP
#
# The "all" index file gets it regardless, but if it's
# amongst the "hidden" it won't be seen on the default
# index file...
#
cat $TMP >>all-${HTML}+
#
# Note: stories marked as "incomplete" will not be
# present in the 'regular' index page.
#
[ $HIDDEN = 0 ] \
&& [ $INCOMPLETE = 0 ] \
&& cat $TMP >>${HTML}+
[ $HIDDEN = 0 ] \
&& [ $INCOMPLETE != 0 ] \
&& cat $TMP >>inc-${HTML}+
echo "" >/dev/tty
done
#
# Each index file needs to be closed out. We'll do that here.
#
cat >$TMP <<INDEXHTML
</UL>
<BR>
<BR>
<HR SIZE=5>
<CENTER>
I live near Saint Petersburg in Florida (USA) and work in Tampa.
Just to be annoying to those in different climes
(especially in Winter) here's a little something to let you know
how the weather is here.<BR>
<a href="http://www.wunderground.com/US/FL/Saint_Petersburg.html">
<img src="http://banners.wunderground.com/banner/bigwx_both_cond/language/www/US/FL/Saint_Petersburg.gif" alt="Click for Saint Petersburg, Florida Forecast" height=60 width=468></a><BR>
Yeah, I know... y'all will be laughing at <B>ME</B> when it's Summer.
</CENTER>
<HR SIZE=5>
<CENTER>
Copyright © 2002, 2003, 2004 - Jack C. Lipton <BR>
<IMG SRC="anydamn2.gif" LABEL="Viewable in any damn browser"> <BR>
</CENTER>
</BODY>
</HTML>
INDEXHTML
cat $TMP >>${HTML}+
cat $TMP >>all-${HTML}+
cat $TMP >>inc-${HTML}+
#
# If any actual changes have been made to the newly generated files
# bring them "current" so we're live with the updated file. This
# keeps the index files from being updated at the published site
# UNLESS actual changes have been made.
#
for F in ${HTML} all-${HTML} inc-${HTML}
do
diff ${F} ${F}+ >$TMP
if [ -s $TMP ]
then
cutover $F
else
rm -f ${F}+
touch $F
fi
done
#
# Perform clean-up of volatile files
#
rm -f $TMP
exit 0 # all done!
.mkindex