0
|
1 #!/usr/bin/perl
|
|
2
|
|
3
|
|
4
|
|
5 $depth = 0;
|
|
6 $section = 1;
|
|
7 $note = 1;
|
|
8 $abstract = 0;
|
|
9 $current = fh000;
|
|
10 $tag = "content000";
|
|
11
|
|
12 $back = "white";
|
|
13 $fore = "black";
|
|
14
|
|
15 $subtitle = '';
|
|
16 $affilation = '';
|
|
17 $closing = "</li>";
|
|
18 $opening = '<li class="slide">';
|
|
19 $xoxo = '';
|
|
20
|
|
21 $tfont = 1;
|
|
22
|
|
23 $ul = 0;
|
|
24 $theme = "default";
|
|
25
|
|
26 @opt = grep(! /\.ind/,@ARGV);
|
|
27 @ARGV = grep( /\.ind/,@ARGV);
|
|
28
|
|
29 sub title_init {
|
|
30
|
|
31 if (grep(/-p/,@opt)) {
|
|
32 $theme = "pixel";
|
|
33 } elsif (grep(/-f/,@opt)) {
|
|
34 $theme = "flower";
|
|
35 } elsif (grep(/-2/,@opt)) {
|
|
36 $closing = "</div>";
|
|
37 $opening = '<div class="slide">';
|
|
38 } else {
|
|
39 $xoxo = '<ol class="xoxo presentation">'
|
|
40 }
|
|
41
|
|
42 $slidy_init = <<"RogueRogue";
|
|
43 <?xml version="1.0" encoding="utf-8"?>
|
|
44 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
45 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
46 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
|
|
47 <head>
|
|
48 <meta name="generator" content=
|
|
49 "HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org" />
|
|
50 <title>HTML Slidy</title>
|
|
51 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
52 <meta name="copyright" content=
|
|
53 "Copyright © 2005-2010 W3C (MIT, ERCIM, Keio)" />
|
|
54 <meta name="duration" content="5" />
|
|
55 <meta name="font-size-adjustment" content="-2" />
|
|
56 <link rel="stylesheet" href="ui/slidy2/styles/slidy.css" type="text/css" />
|
|
57 <link rel="stylesheet" href="ui/slidy2/styles/w3c-blue.css" type="text/css" />
|
|
58 <script src="ui/slidy2/scripts/slidy.js" charset="utf-8" type="text/javascript">
|
|
59 </script>
|
|
60 </head>
|
|
61 <body>
|
|
62 <div class="background"><img alt="" id="head-icon"
|
|
63 src="ui/slidy2/graphics/icon-blue.png" /><object id="head-logo"
|
|
64 data="ui/slidy2/graphics/w3c-logo-white.svg" type="image/svg+xml"
|
|
65 title="W3C logo"><a href="http://www.w3.org/"><img
|
|
66 alt="W3C logo" id="head-logo-fallback"
|
|
67 src="ui/slidy2/graphics/w3c-logo-white.gif" /></a></object></div>
|
|
68
|
|
69 <div class="background slanty">
|
|
70 <img src="ui/slidy2/graphics/w3c-logo-slanted.jpg" alt="slanted W3C logo" />
|
|
71 </div>
|
|
72 <div class="slide cover title">
|
|
73 <!-- hidden style graphics to ensure they are saved with other content -->
|
|
74 <img class="hidden" src="ui/slidy2/graphics/bullet.png" alt="" />
|
|
75 <img class="hidden" src="ui/slidy2/graphics/fold.gif" alt="" />
|
|
76 <img class="hidden" src="ui/slidy2/graphics/unfold.gif" alt="" />
|
|
77 <img class="hidden" src="ui/slidy2/graphics/fold-dim.gif" alt="" />
|
|
78 <img class="hidden" src="ui/slidy2/graphics/nofold-dim.gif" alt="" />
|
|
79 <img class="hidden" src="ui/slidy2/graphics/unfold-dim.gif" alt="" />
|
|
80 <img class="hidden" src="ui/slidy2/graphics/bullet-fold.gif" alt="" />
|
|
81 <img class="hidden" src="ui/slidy2/graphics/bullet-unfold.gif" alt="" />
|
|
82 <img class="hidden" src="ui/slidy2/graphics/bullet-fold-dim.gif" alt="" />
|
|
83 <img class="hidden" src="ui/slidy2/graphics/bullet-nofold-dim.gif" alt="" />
|
|
84 <img class="hidden" src="ui/slidy2/graphics/bullet-unfold-dim.gif" alt="" />
|
|
85
|
|
86 <img src="ui/slidy2/graphics/keys2.jpg" alt="Cover page images (keys)"
|
|
87 class="cover" /><br clear="all" />
|
|
88 <h1>$title</h1>
|
|
89
|
|
90 <p><a>$author</a>,
|
|
91 <br />
|
|
92 <br />
|
|
93 <br />
|
|
94 </div>
|
|
95 RogueRogue
|
|
96
|
|
97 $init = <<"RogueRogue";
|
|
98 <html>
|
|
99 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
|
100 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
101 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
102
|
|
103 <html xmlns="http://www.w3.org/1999/xhtml">
|
|
104
|
|
105 <head>
|
|
106 <title>$title</title>
|
|
107 <!-- metadata -->
|
1
|
108 <meta name="generator" content="o2s5" />
|
|
109 <meta name="version" content="0.1" />
|
|
110 <meta name="author" content="Shinji KONO" />
|
|
111 <meta name="company" content="" />
|
0
|
112 <!-- configuration parameters -->
|
|
113 <meta name="defaultView" content="slideshow" />
|
|
114 <meta name="controlVis" content="hidden" />
|
|
115 <!-- style sheet links -->
|
1
|
116 <link href="ui/syntax.css" id="syntaxStyle" media="all" rel="stylesheet" type="text/css" />
|
|
117 <link href="ui/core/outline.css" id="outlineStyle" media="screen" rel="stylesheet" type="text/css" />
|
|
118 <link href="ui/core/print.css" id="slidePrint" media="print" rel="stylesheet" type="text/css" />
|
|
119 <link href="ui/core/opera.css" id="operaFix" media="projection" rel="stylesheet" type="text/css" />
|
|
120 <link href="ui/core/math.css" id="mathStyle" media="all" rel="stylesheet" type="text/css" />
|
|
121 <link href="ui/themes/$theme/slides.css" id="slideProj" media="projection" rel="stylesheet" type="text/css" />
|
0
|
122 <!-- S5 JS -->
|
1
|
123 <script src="ui/prototype.js" type="text/javascript"></script>
|
|
124 <script type="text/x-mathjax-config">
|
|
125 MathJax.Hub.Config({
|
|
126 MathML: { useMathMLspacing: true },
|
|
127 "HTML-CSS": { scale: 90 }
|
|
128 });
|
|
129 if (window._onload_fired_) MathJax.Hub.Startup.onload();
|
|
130 </script>
|
|
131 <script type="text/javascript">
|
|
132 if (!(Prototype.Browser.Gecko || navigator.userAgent.match(/MathPlayer/))) {
|
|
133 var s = document.createElement('script');
|
|
134 s.src = "ui/MathJax/MathJax.js?config=MML_HTMLorMML";
|
|
135 document.querySelector('head').appendChild(s);
|
|
136 window.addEventListener("load", function(){window._onload_fired_ = true} , false);
|
|
137 };
|
|
138 </script>
|
|
139 <script src="ui/core/slides.js" type="text/javascript"></script>
|
0
|
140 </head>
|
|
141 <body>
|
|
142
|
|
143 <div class="layout">
|
|
144 <div id="controls"><!-- DO NOT EDIT --></div>
|
|
145 <div id="currentSlide"><!-- DO NOT EDIT --></div>
|
|
146 <div id="header"></div>
|
|
147 <div id="footer">
|
|
148 <h1>$title</h1>
|
|
149 <h2>$author</h2>
|
|
150 </div>
|
|
151 </div>
|
|
152 $xoxo
|
|
153 <div class="presentation">
|
|
154 <div class="slide">
|
|
155 <h1>$title</h1>
|
|
156 <h2>$subtitle</h2>
|
|
157 <h3>$author</h3>
|
|
158 <h4>$affilation</h4>
|
|
159
|
|
160 RogueRogue
|
|
161
|
|
162 if (grep(/-2/,@opt)) {
|
|
163 $closing = "</div>";
|
|
164 $opening = '<div class="slide">';
|
|
165 $init = $slidy_init;
|
|
166 }
|
|
167 &init();
|
|
168 }
|
|
169
|
|
170 sub o2s5 {
|
|
171 local($current) = @_;
|
|
172 %content = ();
|
|
173
|
|
174 my $in_comment = 0;
|
|
175
|
|
176 line: while (<$current>) {
|
|
177 if (/^<!---/) {
|
|
178 $in_comment = 1;
|
|
179 next;
|
|
180 }
|
|
181 if ($in_comment) {
|
|
182 if (/^<.*--->/) {
|
|
183 $in_comment = 0;
|
|
184 }
|
|
185 next;
|
|
186 }
|
|
187 chop; # strip record separator
|
|
188 s/([^\\])\\n/\1\n/g;
|
|
189 s/\\\\/\\/g;
|
|
190 if( (!/^\s/) && (!/^$/) && $pre) {
|
|
191 print $fh "</pre>\n";
|
|
192 $pre = 0;
|
|
193 }
|
|
194 if (/^-*input: (.*)/) {
|
|
195 my $fd;
|
|
196 # $fdbase = $current; $fdbase ++;
|
|
197 open($fd,"<$1");
|
|
198 $fdbase = $fd;
|
|
199 push(@depend,$1);
|
|
200 # print STDOUT "$1 ";
|
|
201 do o2s5($fdbase);
|
|
202 next line;
|
|
203 }
|
|
204 if (/^-title:/) {
|
|
205 $title = substr($_, 8, length($_) - 7);
|
|
206 # &title($title);
|
|
207 next line;
|
|
208 }
|
|
209 if (/^--*date:/) {
|
|
210 for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) {
|
|
211 ;
|
|
212 }
|
|
213 $tmp += 5;
|
|
214 $day = substr($_, $tmp, length($_) - $tmp + 1);
|
|
215 next line;
|
|
216 }
|
|
217 if (/^--*number:/) {
|
|
218 for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) {
|
|
219 ;
|
|
220 }
|
|
221 $tmp += 7;
|
|
222 $number = substr($_, $tmp, length($_) - $tmp + 1);
|
|
223 next line;
|
|
224 }
|
|
225 if (/^--*note:/) {
|
|
226 $note = 2;
|
|
227 # printf $fh "<quote>\n";
|
|
228 next line;
|
|
229 }
|
|
230 if (/^--*author:/) {
|
|
231 for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) {
|
|
232 ;
|
|
233 }
|
|
234 $tmp += 7;
|
|
235 $author = substr($_, $tmp, length($_) - $tmp + 1);
|
|
236 next line;
|
|
237 }
|
|
238 if (/^--*affilation:/) {
|
|
239 for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) {
|
|
240 ;
|
|
241 }
|
|
242 $tmp += 11;
|
|
243 $affilation = substr($_, $tmp, length($_) - $tmp + 1);
|
|
244 next line;
|
|
245 }
|
|
246 if (/^--*subtitle:/) {
|
|
247 for ($tmp = 1; substr($_, $tmp, 1) eq '-'; $tmp++) {
|
|
248 ;
|
|
249 }
|
|
250 $tmp += 9;
|
|
251 $subtitle = substr($_, $tmp, length($_) - $tmp + 1);
|
|
252 next line;
|
|
253 }
|
|
254 if (/^--*abstract:/) {
|
|
255 $abstract = 1;
|
|
256 # printf $fh "\n";
|
|
257 next line;
|
|
258 }
|
|
259 if (/^-/) {
|
|
260 if ($ul) {
|
|
261 print $fh "</ul>\n";
|
|
262 $ul = 0;
|
|
263 }
|
|
264 if ($title && $title ne 'done') {
|
|
265 &title($title);
|
|
266 $title = 'done';
|
|
267 }
|
|
268 if ($abstract == 1) {
|
|
269 # printf $fh "\n";
|
|
270 $abstract = 0;
|
|
271 }
|
|
272 if ($note) {
|
|
273 if ($note == 2) {
|
|
274 # printf $fh "\n";
|
|
275 $note = 0;
|
|
276 }
|
|
277 }
|
|
278 for ($depth = 1; substr($_, $depth, 1) eq '-'; $depth++) {
|
|
279 ;
|
|
280 }
|
|
281 $section_title = substr($_, $depth, length($_) - $depth + 1);
|
|
282 if ($section) {
|
|
283 print $fh <<"RogueRogue";
|
|
284 $closing
|
|
285 RogueRogue
|
|
286 }
|
|
287 print $fh <<RogueRogue;
|
|
288 $opening
|
|
289 <h1>$section_title</h1>
|
|
290 RogueRogue
|
|
291 $section++;
|
|
292 $content{$tag} = " " x $depth . $section_title;
|
|
293 $tag++;
|
|
294 next line;
|
|
295 }
|
|
296 next if ($title ne 'done');
|
|
297
|
|
298 if (/^\t/) {
|
|
299 if (! $ul) {
|
|
300 $ul = 1;
|
|
301 print $fh "<ul>";
|
|
302 }
|
|
303 print $fh "<li>$_\n</li>\n";
|
|
304 $paragraph = 0;
|
|
305 } elsif (/^\s/) {
|
|
306 if(! $pre) {
|
|
307 $pre = 1;
|
|
308 print $fh "<pre>";
|
|
309 }
|
|
310 $paragraph = 0;
|
|
311 print $fh $_,"<br>\n";
|
|
312 } elsif (/^$/) {
|
|
313 if(! $pre && ! $paragraph) {
|
|
314 print $fh $_,"<p>";
|
|
315 $paragraph = 1;
|
|
316 }
|
|
317 } else {
|
|
318 print $fh $_,"<br>\n";
|
|
319 $paragraph = 0;
|
|
320 }
|
|
321 }
|
|
322 # if (defined $section_title) {
|
|
323 # }
|
|
324
|
|
325 }
|
|
326
|
|
327
|
|
328 foreach $arg (@ARGV) {
|
|
329 my $fd;
|
|
330 # $fdbase = $current; $fdbase ++;
|
|
331 open($fd,"<$arg") || die("$arg cannot open");
|
|
332 $fdbase = $fd;
|
|
333 $out = $arg;
|
|
334 $out =~ s/\.ind$//;
|
|
335 $out =~ s/\.index$//;
|
|
336 $out .= ".html";
|
|
337 # $fh = "out00";
|
|
338 if($arg eq $out) {
|
|
339 $out .= ".html";
|
|
340 }
|
|
341 my $ofd;
|
|
342 open($ofd,"|nkf -w >$out");
|
|
343 $fh = $ofd;
|
|
344 do o2s5($fdbase);
|
|
345 }
|
|
346
|
|
347 close($fh);
|
|
348
|
|
349
|
|
350
|
|
351
|
|
352
|
|
353
|
|
354 sub init {
|
|
355
|
|
356 open(IN,"| tar zxf -");
|
|
357
|
|
358 my $tmp = << 'EOFEOF';
|
|
359 REPLACED-BY-FILE
|
|
360 EOFEOF
|
|
361
|
|
362 print IN unpack("u*",$tmp);
|
|
363 close IN;
|
|
364
|
|
365 }
|
|
366
|
|
367 # <!--入口--->
|
|
368
|
|
369 sub title {
|
|
370 $title = $_[0];
|
|
371 &title_init;
|
|
372
|
|
373 # <!-- embedded styles -->
|
|
374 # <style type="text/css" media="all">
|
|
375 # .imgcon {width: 525px; margin: 0 auto; padding: 0; text-align: center;}
|
|
376 # #anim {width: 270px; height: 320px; position: relative; margin-top: 0.5em;}
|
|
377 # #anim img {position: absolute; top: 42px; left: 24px;}
|
|
378 # img#me01 {top: 0; left: 0;}
|
|
379 # img#me02 {left: 23px;}
|
|
380 # img#me04 {top: 44px;}
|
|
381 # img#me05 {top: 43px;left: 36px;}
|
|
382 # </style>
|
|
383
|
|
384 print $fh $init;
|
|
385
|
|
386
|
|
387 }
|
|
388
|
|
389
|
|
390
|
|
391
|
|
392
|
|
393
|
|
394 # end
|