Chris@82: ## POST output Chris@82: # Copyright (C) 1993-1995 Ian Jackson. Chris@82: Chris@82: # This file is free software; you can redistribute it and/or modify Chris@82: # it under the terms of the GNU General Public License as published by Chris@82: # the Free Software Foundation; either version 2, or (at your option) Chris@82: # any later version. Chris@82: Chris@82: # It is distributed in the hope that it will be useful, Chris@82: # but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@82: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@82: # GNU General Public License for more details. Chris@82: Chris@82: # You should have received a copy of the GNU General Public License Chris@82: # along with GNU Emacs; see the file COPYING. If not, write to Chris@82: # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Chris@82: # Boston, MA 02111-1307, USA. Chris@82: Chris@82: # (Note: I do not consider works produced using these BFNN processing Chris@82: # tools to be derivative works of the tools, so they are NOT covered Chris@82: # by the GPL. However, I would appreciate it if you credited me if Chris@82: # appropriate in any documents you format using BFNN.) Chris@82: Chris@82: sub post_init { Chris@82: open(POST,">$prefix.post"); Chris@82: } Chris@82: Chris@82: sub post_startmajorheading { Chris@82: print POST '='x79,"\n\n"; Chris@82: $post_status= 'h'; Chris@82: &post_text($_[0] ? "Section $_[0]. " : ''); Chris@82: } Chris@82: Chris@82: sub post_startminorheading { Chris@82: print POST '-'x77,"\n\n"; Chris@82: $post_status= 'h'; Chris@82: } Chris@82: Chris@82: sub post_italic { &post_text('*'); } Chris@82: sub post_enditalic { $post_para .= '*'; } Chris@82: Chris@82: sub post_email { &post_text('<'); } sub post_endemail { &post_text('>'); } Chris@82: Chris@82: sub post_ftpon { } sub post_endftpon { } Chris@82: sub post_ftpin { } sub post_endftpin { } Chris@82: sub post_docref { } sub post_enddocref { } Chris@82: sub post_courier { } sub post_endcourier { } Chris@82: sub post_newsgroup { } sub post_endnewsgroup { } Chris@82: sub post_ftpsilent { $post_ignore++; } Chris@82: sub post_endftpsilent { $post_ignore--; } Chris@82: Chris@82: sub post_text { Chris@82: return if $post_ignore; Chris@82: if ($post_status eq '') { Chris@82: $post_status= 'p'; Chris@82: } Chris@82: $post_para .= $_[0]; Chris@82: } Chris@82: Chris@82: sub post_tab { Chris@82: local ($n) = $_[0]-length($post_para); Chris@82: $post_para .= ' 'x$n if $n>0; Chris@82: } Chris@82: Chris@82: sub post_newline { Chris@82: return unless $post_status eq 'p'; Chris@82: &post_writepara; Chris@82: } Chris@82: Chris@82: sub post_writepara { Chris@82: local ($thisline, $thisword, $rest); Chris@82: for (;;) { Chris@82: last unless $post_para =~ m/\S/; Chris@82: $thisline= $post_indentstring; Chris@82: for (;;) { Chris@82: last unless $post_para =~ m/^(\s*\S+)/; Chris@82: unless (length($1) + length($thisline) < 75 || Chris@82: length($thisline) == length($post_indentstring)) { Chris@82: last; Chris@82: } Chris@82: $thisline .= $1; Chris@82: $post_para= $'; Chris@82: } Chris@82: $post_para =~ s/^\s*//; Chris@82: print POST $thisline,"\n"; Chris@82: $post_indentstring= $post_nextindent; Chris@82: last unless length($post_para); Chris@82: } Chris@82: $post_status= ''; $post_para= ''; Chris@82: } Chris@82: Chris@82: sub post_endpara { Chris@82: return unless $post_status eq 'p'; Chris@82: &post_writepara; Chris@82: print POST "\n"; Chris@82: } Chris@82: Chris@82: sub post_endheading { Chris@82: $post_para =~ s/\s*$//; Chris@82: print POST "$post_para\n\n"; Chris@82: $post_status= ''; Chris@82: $post_para= ''; Chris@82: } Chris@82: Chris@82: sub post_endmajorheading { &post_endheading(@_); } Chris@82: sub post_endminorheading { &post_endheading(@_); } Chris@82: Chris@82: sub post_startverbatim { Chris@82: $post_vstatus= $post_status; Chris@82: &post_writepara; Chris@82: } Chris@82: Chris@82: sub post_verbatim { Chris@82: print POST $_[0],"\n"; Chris@82: } Chris@82: Chris@82: sub post_endverbatim { Chris@82: $post_status= $post_vstatus; Chris@82: } Chris@82: Chris@82: sub post_finish { Chris@82: close(POST); Chris@82: } Chris@82: Chris@82: sub post_startindex { $post_status= ''; } Chris@82: sub post_endindex { $post_status= 'p'; } Chris@82: Chris@82: sub post_endindexitem { Chris@82: printf POST " %-11s %-.66s\n",$post_left,$post_para; Chris@82: $post_status= 'p'; Chris@82: $post_para= ''; Chris@82: } Chris@82: Chris@82: sub post_startindexitem { Chris@82: $post_left= $_[1]; Chris@82: } Chris@82: Chris@82: sub post_startindexmainitem { Chris@82: $post_left= $_[1]; Chris@82: print POST "\n" if $post_status eq 'p'; Chris@82: } Chris@82: Chris@82: sub post_startindent { Chris@82: $post_istatus= $post_status; Chris@82: &post_writepara; Chris@82: $post_indentstring= " $post_indentstring"; Chris@82: $post_nextindent= " $post_nextindent"; Chris@82: } Chris@82: Chris@82: sub post_endindent { Chris@82: $post_indentstring =~ s/^ //; Chris@82: $post_nextindent =~ s/^ //; Chris@82: $post_status= $post_istatus; Chris@82: } Chris@82: Chris@82: sub post_startpackedlist { $post_plc=0; } Chris@82: sub post_endpackedlist { &post_newline if !$post_plc; } Chris@82: sub post_packeditem { Chris@82: &post_newline if !$post_plc; Chris@82: &post_tab($post_plc*40+5); Chris@82: $post_plc= !$post_plc; Chris@82: } Chris@82: Chris@82: sub post_startlist { Chris@82: &post_endpara; Chris@82: $post_indentstring= " $post_indentstring"; Chris@82: $post_nextindent= " $post_nextindent"; Chris@82: } Chris@82: Chris@82: sub post_endlist { Chris@82: &post_endpara; Chris@82: $post_indentstring =~ s/^ //; Chris@82: $post_nextindent =~ s/^ //; Chris@82: } Chris@82: Chris@82: sub post_item { Chris@82: &post_newline; Chris@82: $post_indentstring =~ s/ $/* /; Chris@82: } Chris@82: Chris@82: sub post_pageref { Chris@82: &post_text("Q$_[1] \`"); Chris@82: } Chris@82: Chris@82: sub post_endpageref { Chris@82: &post_text("'"); Chris@82: } Chris@82: Chris@82: 1;