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