Mercurial > hg > Applications > o2s5
view o2s5.source @ 0:b0c6281822f5
o2s5 with theme and slidy
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 23 Sep 2011 15:15:18 +0900 |
parents | |
children | 450bcedf4ed4 |
line wrap: on
line source
#!/usr/bin/perl $depth = 0; $section = 1; $note = 1; $abstract = 0; $current = fh000; $tag = "content000"; $back = "white"; $fore = "black"; $subtitle = ''; $affilation = ''; $closing = "</li>"; $opening = '<li class="slide">'; $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 = "</div>"; $opening = '<div class="slide">'; } else { $xoxo = '<ol class="xoxo presentation">' } $slidy_init = <<"RogueRogue"; <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US"> <head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org" /> <title>HTML Slidy</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="copyright" content= "Copyright © 2005-2010 W3C (MIT, ERCIM, Keio)" /> <meta name="duration" content="5" /> <meta name="font-size-adjustment" content="-2" /> <link rel="stylesheet" href="ui/slidy2/styles/slidy.css" type="text/css" /> <link rel="stylesheet" href="ui/slidy2/styles/w3c-blue.css" type="text/css" /> <script src="ui/slidy2/scripts/slidy.js" charset="utf-8" type="text/javascript"> </script> </head> <body> <div class="background"><img alt="" id="head-icon" src="ui/slidy2/graphics/icon-blue.png" /><object id="head-logo" data="ui/slidy2/graphics/w3c-logo-white.svg" type="image/svg+xml" title="W3C logo"><a href="http://www.w3.org/"><img alt="W3C logo" id="head-logo-fallback" src="ui/slidy2/graphics/w3c-logo-white.gif" /></a></object></div> <div class="background slanty"> <img src="ui/slidy2/graphics/w3c-logo-slanted.jpg" alt="slanted W3C logo" /> </div> <div class="slide cover title"> <!-- hidden style graphics to ensure they are saved with other content --> <img class="hidden" src="ui/slidy2/graphics/bullet.png" alt="" /> <img class="hidden" src="ui/slidy2/graphics/fold.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/unfold.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/fold-dim.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/nofold-dim.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/unfold-dim.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/bullet-fold.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/bullet-unfold.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/bullet-fold-dim.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/bullet-nofold-dim.gif" alt="" /> <img class="hidden" src="ui/slidy2/graphics/bullet-unfold-dim.gif" alt="" /> <img src="ui/slidy2/graphics/keys2.jpg" alt="Cover page images (keys)" class="cover" /><br clear="all" /> <h1>$title</h1> <p><a>$author</a>, <br /> <br /> <br /> </div> RogueRogue $init = <<"RogueRogue"; <html> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>$title</title> <!-- metadata --> <meta name="generator" content="S5" /> <meta name="version" content="S5 1.2a2" /> <meta name="author" content="Eric A. Meyer" /> <meta name="company" content="Complex Spiral Consulting" /> <!-- configuration parameters --> <meta name="defaultView" content="slideshow" /> <meta name="controlVis" content="hidden" /> <!-- style sheet links --> <link rel="stylesheet" href="ui/$theme/slides.css" type="text/css" media="projec tion" id="slideProj" /> <link rel="stylesheet" href="ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" /> <link rel="stylesheet" href="ui/$theme/print.css" type="text/css" media="print" id="slidePrint" /> <link rel="stylesheet" href="ui/$theme/opera.css" type="text/css" media="project ion" id="operaFix" /> <!-- S5 JS --> <script src="ui/$theme/slides.js" type="text/javascript"></script> </head> <body> <div class="layout"> <div id="controls"><!-- DO NOT EDIT --></div> <div id="currentSlide"><!-- DO NOT EDIT --></div> <div id="header"></div> <div id="footer"> <h1>$title</h1> <h2>$author</h2> </div> </div> $xoxo <div class="presentation"> <div class="slide"> <h1>$title</h1> <h2>$subtitle</h2> <h3>$author</h3> <h4>$affilation</h4> RogueRogue if (grep(/-2/,@opt)) { $closing = "</div>"; $opening = '<div class="slide">'; $init = $slidy_init; } &init(); } sub o2s5 { local($current) = @_; %content = (); my $in_comment = 0; line: while (<$current>) { if (/^<!---/) { $in_comment = 1; next; } if ($in_comment) { if (/^<.*--->/) { $in_comment = 0; } next; } chop; # strip record separator s/([^\\])\\n/\1\n/g; s/\\\\/\\/g; if( (!/^\s/) && (!/^$/) && $pre) { print $fh "</pre>\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 "<quote>\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 "</ul>\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 <<RogueRogue; $opening <h1>$section_title</h1> RogueRogue $section++; $content{$tag} = " " x $depth . $section_title; $tag++; next line; } next if ($title ne 'done'); if (/^\t/) { if (! $ul) { $ul = 1; print $fh "<ul>"; } print $fh "<li>$_\n</li>\n"; $paragraph = 0; } elsif (/^\s/) { if(! $pre) { $pre = 1; print $fh "<pre>"; } $paragraph = 0; print $fh $_,"<br>\n"; } elsif (/^$/) { if(! $pre && ! $paragraph) { print $fh $_,"<p>"; $paragraph = 1; } } else { print $fh $_,"<br>\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; # <!-- embedded styles --> # <style type="text/css" media="all"> # .imgcon {width: 525px; margin: 0 auto; padding: 0; text-align: center;} # #anim {width: 270px; height: 320px; position: relative; margin-top: 0.5em;} # #anim img {position: absolute; top: 42px; left: 24px;} # img#me01 {top: 0; left: 0;} # img#me02 {left: 23px;} # img#me04 {top: 44px;} # img#me05 {top: 43px;left: 36px;} # </style> print $fh $init; } # end