#!/usr/bin/perl $depth = 0; $section = 1; $note = 1; $abstract = 0; $current = fh000; $tag = "content000"; $back = "white"; $fore = "black"; $subtitle = ''; $affilation = ''; $closing = ""; $opening = '
  • '; $xoxo = ''; $tfont = 1; $ul = 0; $theme = "default"; @opt = grep(! /\.ind/,@ARGV); @ARGV = grep( /\.ind/,@ARGV); sub title_init { if (grep(/-p/,@opt)) { $theme = "pixel"; } elsif (grep(/-f/,@opt)) { $theme = "flower"; } elsif (grep(/-2/,@opt)) { $closing = ""; $opening = '
    '; } else { $xoxo = '
      ' } $slidy_init = <<"RogueRogue"; HTML Slidy
      slanted W3C logo
      Cover page images (keys)

      $title

      $author,


      RogueRogue $init = <<"RogueRogue"; $title
      $xoxo

      $title

      $subtitle

      $author

      $affilation

      RogueRogue if (grep(/-2/,@opt)) { $closing = "
      "; $opening = '
      '; $init = $slidy_init; } &init(); } sub o2s5 { local($current) = @_; %content = (); my $in_comment = 0; line: while (<$current>) { if (/^/) { $in_comment = 0; } next; } chop; # strip record separator s/([^\\])\\n/\1\n/g; s/\\\\/\\/g; if( (!/^\s/) && (!/^$/) && $pre) { print $fh "\n"; $pre = 0; } if (/^-*input: (.*)/) { my $fd; # $fdbase = $current; $fdbase ++; open($fd,"<$1"); $fdbase = $fd; push(@depend,$1); # print STDOUT "$1 "; do o2s5($fdbase); next line; } if (/^-title:/) { $title = substr($_, 8, length($_) - 7); # &title($title); next line; } if (/^--*date:/) { for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) { ; } $tmp += 5; $day = substr($_, $tmp, length($_) - $tmp + 1); next line; } if (/^--*number:/) { for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) { ; } $tmp += 7; $number = substr($_, $tmp, length($_) - $tmp + 1); next line; } if (/^--*note:/) { $note = 2; # printf $fh "\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