# HG changeset patch # User Shinji KONO # Date 1316758518 -32400 # Node ID b0c6281822f5f06147a2c946808e3312c01c6396 o2s5 with theme and slidy diff -r 000000000000 -r b0c6281822f5 Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Fri Sep 23 15:15:18 2011 +0900 @@ -0,0 +1,7 @@ +o2s5: + tar zcf ui.tgz ui + uuencode ui.tgz < ui.tgz > ui.uu + perl f.pl o2s5.source > o2s5 + +clean: + rm ui.tgz ui.uu diff -r 000000000000 -r b0c6281822f5 f.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/f.pl Fri Sep 23 15:15:18 2011 +0900 @@ -0,0 +1,7 @@ +while(<>) { + if (/REPLACED-BY-FILE/) { + open(I,"; + print @line[1 .. $#line-2]; + } else { print;} +} diff -r 000000000000 -r b0c6281822f5 o2s5.source --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/o2s5.source Fri Sep 23 15:15:18 2011 +0900 @@ -0,0 +1,379 @@ +#!/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 "