head	1.28;
access;
symbols;
locks; strict;
comment	@# @;


1.28
date	2011.06.04.06.59.43;	author baccala;	state Exp;
branches;
next	1.27;

1.27
date	2011.05.30.02.22.09;	author baccala;	state Exp;
branches;
next	1.26;

1.26
date	2011.04.26.01.24.40;	author baccala;	state Exp;
branches;
next	1.25;

1.25
date	2011.04.20.20.27.34;	author baccala;	state Exp;
branches;
next	1.24;

1.24
date	2011.04.02.11.13.12;	author baccala;	state Exp;
branches;
next	1.23;

1.23
date	2011.04.02.08.16.39;	author baccala;	state Exp;
branches;
next	1.22;

1.22
date	2011.04.02.07.17.45;	author baccala;	state Exp;
branches;
next	1.21;

1.21
date	2011.03.28.23.05.33;	author baccala;	state Exp;
branches;
next	1.20;

1.20
date	2011.03.28.21.49.50;	author baccala;	state Exp;
branches;
next	1.19;

1.19
date	2011.03.28.21.46.05;	author baccala;	state Exp;
branches;
next	1.18;

1.18
date	2011.03.28.21.41.52;	author baccala;	state Exp;
branches;
next	1.17;

1.17
date	2011.03.22.21.28.10;	author baccala;	state Exp;
branches;
next	1.16;

1.16
date	2011.03.16.22.22.24;	author baccala;	state Exp;
branches;
next	1.15;

1.15
date	2011.02.23.22.52.43;	author baccala;	state Exp;
branches;
next	1.14;

1.14
date	2011.02.23.22.38.01;	author baccala;	state Exp;
branches;
next	1.13;

1.13
date	2011.02.22.21.29.36;	author baccala;	state Exp;
branches;
next	1.12;

1.12
date	2011.02.22.21.25.05;	author baccala;	state Exp;
branches;
next	1.11;

1.11
date	2011.02.22.21.24.18;	author baccala;	state Exp;
branches;
next	1.10;

1.10
date	2011.02.19.23.50.44;	author baccala;	state Exp;
branches;
next	1.9;

1.9
date	2011.02.19.23.35.53;	author baccala;	state Exp;
branches;
next	1.8;

1.8
date	2011.02.19.21.19.33;	author baccala;	state Exp;
branches;
next	1.7;

1.7
date	2011.02.19.20.53.33;	author baccala;	state Exp;
branches;
next	1.6;

1.6
date	2011.02.19.20.42.26;	author baccala;	state Exp;
branches;
next	1.5;

1.5
date	2011.02.19.20.34.15;	author baccala;	state Exp;
branches;
next	1.4;

1.4
date	2011.02.19.20.31.51;	author baccala;	state Exp;
branches;
next	1.3;

1.3
date	2011.02.19.20.27.43;	author baccala;	state Exp;
branches;
next	1.2;

1.2
date	2011.02.19.01.28.45;	author baccala;	state Exp;
branches;
next	1.1;

1.1
date	2011.02.18.23.14.25;	author baccala;	state Exp;
branches;
next	;


desc
@@


1.28
log
@*** empty log message ***
@
text
@#! /usr/bin/perl
#
# This is a Perl script used to convert the Icarus Wing source to latex

my $speaker;
my $counter = 0;

sub insertTOC {

    print q|

\vfill\eject

\thispagestyle{empty}

{
\fontsize{16pt}{20pt}
\selectfont
\centerline{Requirements}
\centerline{for}
\centerline{The Great anti-American Novel}
}

\begin{verbatim}
|;

    open(ICARUSWING, "<IcarusWing");
    while (<ICARUSWING>) {
	if (/^T / or /^Launch Day/) {
	    s/^.*    //;
	    print unless (/^T / or /^Launch Day/);
	}
    }
    close(ICARUSWING);

    print "\\end{verbatim}\n";
}

sub ProcessLine {

    s/\$/\\\$/;				# quote $

    s/Christian1/Christian\$^1\$/;	# add superscripts to "Christian"
    s/Christians1/Christians\$^1\$/;
    s/Christian2/Christian\$^2\$/;
    s/Christians2/Christians\$^2\$/;

    s/^al-Nass:/alNass:/;		# handle the hyphen like this

    # The speaking character can be indicated by a notation at the
    # beginning of the line or paragraph like "Alister:".  Note
    # if this is the case, or undef $speaker if we're at a blank
    # line (in between paragraphs)

    $speaker=$1 if (/^((\w|-)+):/);
    undef $speaker if (/^$/);
    $counter=0 if (/^$/);

    # Remove speaker indication now that we've processed it.
    s/^(\w+)://;

    # Set text color for material in quotes according to speaker
    # Actual colors are defined above in the LaTeX preamble.

    while (/"/ and defined $speaker) {
	if ($counter % 2 == 0) {
	    my $speaker1 = $speaker;
	    if ($speaker =~ s/([^_]+)_(.*)/$2/) {
		$speaker1 = $1;
	    }
	    s/"/\\textcolor{$speaker1}{``/;
	} else {
	    s/"/''}/;
	}

	$counter ++;
    }

    while (/"/) {
	if ($counter % 2 == 0) {
	    s/"/``/;
	} else {
	    s/"/''/;
	}

	$counter ++;
    }

    s/_([-\w',!.?;]+)_/{\\it \1}/g;	# convert _ to italics
    s/_/ /g;				# convert interior _ to spaces

    # Change '    ' in chapter title lines to hskip
    s/    /\\hskip 0.5in/  if (/^T [+-] [0-9]+/);

    # Put chapter titles on new pages in typewriter font
    #   the centerline is there to make T + 1 day overfill
    s/^T [+-] [0-9]+.*$/\\vfill\\eject\\centerline{\\tt \\hfill $&}\\vskip 0.5in/;

    # Ditto for Launch Day
    s/    /\\hskip 0.5in/  if (/^Launch Day/);
    s/^Launch Day+.*$/\\vfill\\eject{\\tt \\hfill $&}\\vskip 0.5in/;

    # Ditto for Epilog
    s/    /\\hskip 0.5in/  if (/^Epilog/);
    s/^Epilog+.*$/\\vfill\\eject{\\tt \\hfill $&}\\vskip 0.5in/;

    # Format poetry at beginning - with italics {{ }}
    s/^{{([^}]*)}}$/\\centerline{\\it \1}/;

    # Format poetry at beginning - without italics {
    s/^{([^}]*)$/\\centerline{\1}/;

    if (/Requirements for The Great anti-American Novel/) {
	&insertTOC;
    } else {
	print;
    }
}

sub ProcessFile {
    my ($FILE) = @@_;

    while (<$FILE>) {
	my $filename = $_;
	chomp $filename;

	if ($filename =~ m/^[A-Z0-9]*$/ and -r $filename) {
	    open(NESTED_FILE, "<$filename");
	    ProcessFile(\*NESTED_FILE);
	    close(NESTED_FILE);
	} else {
	    ProcessLine;
	}
    }
}

print q|

\documentclass{book}

\usepackage{vmargin}
\usepackage{times}
\usepackage[pdftex]{color}

\usepackage[koi8-ru]{inputenc}
\usepackage[russian,english]{babel}

\setpapersize{custom}{6 in}{9 in}
\setmargrb{20mm}{20mm}{20mm}{20mm}

\pdfinfo{
  /Title	(Icarus' Wing)
  /Author	(Brent Baccala)
}

\begin{document}

\pagestyle{empty}

\parindent 0pt
\parskip 12pt

% default seems to be 10/12
% \fontsize{12pt}{14pt}
% \selectfont

\title{Icarus' Wing}
\author{Brent Baccala}
\date{}

% No title page for e-reader version
% \maketitle

\definecolor{Bible}{rgb}{0.7,0,0}

\definecolor{Mercuriou}{rgb}{0.4,0.2,0}
\definecolor{Burns}{rgb}{0.3,0.3,0}
\definecolor{Vic}{rgb}{0.4,0,0.4}
\definecolor{Alister}{rgb}{0,0.4,0}
\definecolor{Andrea}{rgb}{0,0,0.4}

\definecolor{Kyle}{rgb}{0,0,0}
\definecolor{David}{rgb}{0,0,0}

\definecolor{Ecks}{rgb}{0,0,0}
\definecolor{Wye}{rgb}{0,0,0}
\definecolor{Zee}{rgb}{0,0,0}

\definecolor{Beth}{rgb}{0,0,0}
\definecolor{James}{rgb}{0,0,0}
\definecolor{Jill}{rgb}{0,0,0}
\definecolor{Jeff}{rgb}{0,0,0}

\definecolor{Reginard}{rgb}{0,0,0}
\definecolor{alNass}{rgb}{0,0,0}

\frontmatter

\quad
\vskip 1in
\begin{center}
{\Huge Icarus' Wing}

{\small The Great anti-American Novel}
\vskip 5in {\Large by Brent Baccala}
\end{center}

\mainmatter
\pagestyle{plain}
\setcounter{page}{2}

|;


ProcessFile(\*STDIN);

print q|
\end{document}
|;
@


1.27
log
@Added epilog
@
text
@d127 2
a128 1
	if (-r $filename) {	    open(NESTED_FILE, "<$filename");
@


1.26
log
@*** empty log message ***
@
text
@d43 5
d79 10
d103 4
d182 1
@


1.25
log
@*** empty log message ***
@
text
@a42 3
    s/_([-\w',!.?;]+)_/{\\it \1}/g;	# convert _ to italics
    s/_/ /g;				# convert interior _ to spaces

d62 5
a66 1
	    s/"/\\textcolor{$speaker}{``/;
d73 3
@


1.24
log
@*** empty log message ***
@
text
@d121 3
@


1.23
log
@*** empty log message ***
@
text
@d16 3
d22 1
@


1.22
log
@*** empty log message ***
@
text
@d117 3
d133 2
a134 2
\fontsize{12pt}{14pt}
\selectfont
@


1.21
log
@*** empty log message ***
@
text
@d39 1
a39 1
    s/_([\w',!.?;]+)_/{\\it \1}/g;	# convert _ to italics
d42 2
d160 1
a160 1
\definecolor{al-Nass}{rgb}{0,0,0}
@


1.20
log
@*** empty log message ***
@
text
@d162 2
d166 3
a168 1
\vskip 0.5in {\Large Brent Baccala}
@


1.19
log
@put page numbers on title pages; going to trash the extra blank page now
@
text
@d169 1
a169 1
\setcounter{page}{3}
@


1.18
log
@getting ready to put page numbers back on chapter pages
@
text
@d72 1
a72 1
    s/^T [+-] [0-9]+.*$/\\vfill\\eject\\thispagestyle{empty}\\centerline{\\tt \\hfill $&}\\vskip 0.5in/;
d76 1
a76 1
    s/^Launch Day+.*$/\\vfill\\eject\\thispagestyle{empty}{\\tt \\hfill $&}\\vskip 0.5in/;
@


1.17
log
@*** empty log message ***
@
text
@d122 2
d168 2
@


1.16
log
@*** empty log message ***
@
text
@d153 1
@


1.15
log
@*** empty log message ***
@
text
@d47 1
a47 1
    $speaker=$1 if (/^(\w+):/);
d154 2
a155 1
\definecolor{Husband}{rgb}{0,0,0}
@


1.14
log
@*** empty log message ***
@
text
@d71 2
a72 1
    s/^T [+-] [0-9]+.*$/\\vfill\\eject\\thispagestyle{empty}{\\tt \\hfill $&}\\vskip 0.5in/;
@


1.13
log
@*** empty log message ***
@
text
@d8 27
d77 11
a87 1
    print;
d97 1
a97 2
	if (-r $filename) {
	    open(NESTED_FILE, "<$filename");
d165 1
@


1.12
log
@*** empty log message ***
@
text
@d12 1
a12 1
    s/_([\w',!]+)_/{\\it \1}/g;		# convert _ to italics
@


1.11
log
@add page breaks and tt text
@
text
@d12 1
a12 1
    s/_([\w'!]+)_/{\\it \1}/g;		# convert _ to italics
@


1.10
log
@*** empty log message ***
@
text
@d40 10
@


1.9
log
@*** empty log message ***
@
text
@d12 1
a12 1
    s/_([\w'!]+)_/{\\it \1}/;		# convert _ to italics
@


1.8
log
@*** empty log message ***
@
text
@d5 55
d120 1
a120 33
while (<>) {

    s/_(\w+)_/{\\it \1}/;			# convert _ to italics
    s/_/ /g;					# convert interior _ to spaces

    # The speaking character can be indicated by a notation at the
    # beginning of the line or paragraph like "Alister:".  Note
    # if this is the case, or undef $speaker if we're at a blank
    # line (in between paragraphs)

    $speaker=$1 if (/^(\w+):/);
    undef $speaker if (/^$/);
    $counter=0 if (/^$/);

    # Remove speaker indication now that we've processed it.
    s/^(\w+)://;

    # Set text color for material in quotes according to speaker
    # Actual colors are defined above in the LaTeX preamble.

    while (/"/ and defined $speaker) {
	if ($counter % 2 == 0) {
	    s/"/\\textcolor{$speaker}{``/;
	} else {
	    s/"/''}/;
	}

	$counter ++;
    }

    print;

}
@


1.7
log
@*** empty log message ***
@
text
@d34 1
a34 1
\definecolor{Bible}{rgb}{0.8,0,0}
d36 1
a36 1
\definecolor{Mercuriou}{rgb}{0.4,0,0}
@


1.6
log
@*** empty log message ***
@
text
@d77 1
d84 10
a93 1
    s/"(.*)"/\\textcolor{$speaker}{"\1"}/g if defined $speaker;
@


1.5
log
@*** empty log message ***
@
text
@a8 2
%\usepackage{nopageno}

d37 1
a37 1
\definecolor{Burns}{rgb}{0.5,0.5,0.1}
d70 14
a83 1
    s/^(\w+):(.*)"(.*)"/\2 \\textcolor{\1}{"\3"}/g;
@


1.4
log
@*** empty log message ***
@
text
@d5 62
d77 4
@


1.3
log
@*** empty log message ***
@
text
@d1 3
d5 1
a5 1
# This is a sed script-file used to convert the source to latex
d7 2
a8 2
s/_(\w+)_/{\\it \1}/			# convert _ to italics
s/_/ /g					# convert interior _ to spaces
d10 5
a14 1
s/^(\w+):(.*)"(.*)"/\2 \\textcolor{\1}{"\3"}/g
@


1.2
log
@*** empty log message ***
@
text
@d7 1
a7 1
s/^(\w+):(.*)$/\\textcolor{\1}{\2}/
@


1.1
log
@Initial revision
@
text
@d7 1
@
