1 #!/usr/local/bin/perl -w
11 'search' => 'M<[^<>]+>',
15 $text =~ s|M<([^<>]+)>|<SPAN CLASS="stem">$1</SPAN>|sg;
23 'search' => 'QUOTE<(.*?)>',
27 $text =~ /QUOTE<(.*?)>/gs;
33 $quote =~ s/\\/<BR>/sg;
36 "<P><TABLE BORDER='0' ALIGN='CENTER' CELLPADDING='3'" .
37 " CELLSPACING='0' BGCOLOR='FORESTGREEN'><TR><TD>" .
38 "<TABLE WIDTH='100%' CELLPADDING='3' CELLSPACING='2'" .
39 " BORDER='0' BGCOLOR='#CFE7CF'><TR><TH> $quote" .
40 "</TH></TR></TABLE></TD></TR></TABLE>" .
62 print_section_page() ;
67 sub process_faq_text {
69 my ( $section, $quest_text, $answer_text, $curr_faq ) ;
76 if ( /^([SQ]):\s*(.+)$/ ) {
82 $curr_faq->{'answer'} =
83 markup_text( $answer_text ) ;
87 unless ( $curr_faq->{'question'} &&
88 $curr_faq->{'answer'} ) {
93 "bad FAQ entry before line $. in $ARGV\n" ;
96 push( @{$section->{'faqs'}}, $curr_faq ) ;
102 my $section_title = $2 ;
104 push( @sections, $section ) if $section ;
108 'plain_title' => $section_title,
109 'title' => markup_text( $section_title ),
120 if ( /^A:\s*(.+)$/ ) {
122 $answer_text = markup_text( $1 ) ;
125 'question' => markup_text( $quest_text ),
141 push( @sections, $section ) ;
145 sub process_sections {
150 foreach my $sect_ref ( @sections ) {
153 my $title = $sect_ref->{'title'} ;
155 $sect_ref->{'num'} = $sect_num ;
158 $sect_num <A HREF="faq$sect_num.html">$title</A>
161 $sect_ref->{'link'} = $link ;
165 foreach my $faq_ref ( @{$sect_ref->{'faqs'}} ) {
167 my $quest = $faq_ref->{'question'} ;
169 my $answer = $faq_ref->{'answer'} ;
171 $faq_ref->{'num'} = $quest_num ;
172 $faq_ref->{'index'} = "$sect_num.$quest_num" ;
174 $faq_ref->{'link'} = <<LINK ;
175 $sect_num.$quest_num <A HREF="faq$sect_num.html#FAQ$quest_num">$quest</A>
186 sub print_section_page {
188 my $page_text = <<HTML ;
190 title => "$page_title_base"
193 <A HREF="index.html">Home</A> > <B>FAQ</B>
197 <H1>Frequently Asked Questions</H1>
199 <UL STYLE="list-style-type:none">
202 foreach my $sect_ref ( @sections ) {
204 my $link = $sect_ref->{'link'} ;
206 $page_text .= "<LI>$link" ;
208 print_faq_pages( $sect_ref ) ;
211 $page_text .= "</UL>";
213 write_file( 'faq.html', $page_text ) ;
217 sub print_faq_pages {
219 my ( $sect_ref ) = @_ ;
225 my $plain_title = $sect_ref->{'plain_title'} ;
226 my $title = $sect_ref->{'title'} ;
227 my $sect_num = $sect_ref->{'num'} ;
229 my $page_text = <<HTML ;
231 title => "$page_title_base > $plain_title"
234 <A HREF="index.html">Home</A> > <A HREF="faq.html">FAQ</A> > <B>$title</B>
238 <H1><A NAME="top">$title</A></H1>
245 $quest_list .= <<HTML ;
246 <UL STYLE="list-style-type:none">
249 foreach my $faq_ref ( @{$sect_ref->{'faqs'}} ) {
251 my $quest = $faq_ref->{'question'} ;
252 my $answer = $faq_ref->{'answer'} ;
254 my $faq_num = $faq_ref->{'num'} ;
255 my $faq_ind = $faq_ref->{'index'} ;
257 $quest_list .= <<HTML ;
258 <LI>$faq_ref->{'link'}
262 $faq_text .= <<HTML ;
264 <A NAME="FAQ$faq_num"></A>
271 <DIV CLASS="toplink"><A HREF="#top">Top</A></DIV>
279 $quest_list .= "</UL>" ;
282 my $section_list = '<UL STYLE="list-style-type:none">' ;
284 foreach my $s_ref ( @sections ) {
286 $section_list .= <<HTML ;
290 if ( $s_ref == $sect_ref ) {
292 $section_list .= $quest_list ;
297 $section_list .= "</UL>" ;
299 $page_text .= $section_list ;
301 $page_text .= $faq_text ;
303 write_file( "faq$sect_num.html", $page_text ) ;
307 sub set_header_text {
309 $page_title_base = 'Stem Systems, Inc. > Stem > FAQ'
315 my( $file_name ) = shift ;
319 open( FH, ">$file_name" ) || carp "can't create $file_name $!" ;
332 if ($text =~ /$_->{'search'}/s) {
334 $text = $_->{'replace'}->($text);