#!/usr/bin/perl $depth = 0; $section = 1; $note = 1; $abstract = 0; $current = fh000; $tag = "content000"; $back = "white"; $fore = "black"; $subtitle = ''; $affilation = ''; $closing = ""; $opening = '
\n"; next line; } if (/^--*author:/) { for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) { ; } $tmp += 7; $author = substr($_, $tmp, length($_) - $tmp + 1); next line; } if (/^--*affilation:/) { for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) { ; } $tmp += 11; $affilation = substr($_, $tmp, length($_) - $tmp + 1); next line; } if (/^--*subtitle:/) { for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) { ; } $tmp += 9; $subtitle = substr($_, $tmp, length($_) - $tmp + 1); next line; } if (/^--*abstract:/) { $abstract = 1; # printf $fh "\n"; next line; } if (/^-/) { if ($ul) { print $fh "\n"; $ul = 0; } if ($title && $title ne 'done') { &title($title); $title = 'done'; } if ($abstract == 1) { # printf $fh "\n"; $abstract = 0; } if ($note) { if ($note == 2) { # printf $fh "\n"; $note = 0; } } for ($depth = 1; substr($_, $depth, 1) eq '-'; $depth++) { ; } $section_title = substr($_, $depth, length($_) - $depth + 1); if ($section) { print $fh <<"RogueRogue"; $closing RogueRogue } print $fh <$section_title RogueRogue $section++; $content{$tag} = " " x $depth . $section_title; $tag++; next line; } next if ($title ne 'done'); if (/^\t/) { if (! $ul) { $ul = 1; print $fh " "; } print $fh "
- $_\n
\n"; $paragraph = 0; } elsif (/^\s/) { if(! $pre) { $pre = 1; print $fh ""; } $paragraph = 0; print $fh $_,"
\n"; } elsif (/^$/) { if(! $pre && ! $paragraph) { print $fh $_,""; $paragraph = 1; } } else { print $fh $_,"
\n"; $paragraph = 0; } } # if (defined $section_title) { # } } foreach $arg (@ARGV) { my $fd; # $fdbase = $current; $fdbase ++; open($fd,"<$arg") || die("$arg cannot open"); $fdbase = $fd; $out = $arg; $out =~ s/\.ind$//; $out =~ s/\.index$//; $out .= ".html"; # $fh = "out00"; if($arg eq $out) { $out .= ".html"; } my $ofd; open($ofd,"|nkf -w >$out"); $fh = $ofd; do o2s5($fdbase); } close($fh); sub init { open(IN,"| tar zxf -"); my $tmp = << 'EOFEOF'; REPLACED-BY-FILE EOFEOF print IN unpack("u*",$tmp); close IN; } # sub title { $title = $_[0]; &title_init; # # print $fh $init; } # end