1 # Copyright (C) 2004, 2005 Fletcher T. Penney <fletcher@freeshell.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.
16 # 59 Temple Place, Suite 330
17 # Boston, MA 02111-1307 USA
19 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/slideshow.pl">slideshow.pl</a></p>';
21 use vars
qw($SlideShowDataFolder $SlideShowTheme $SlideShowHeader %SlideShowMeta);
24 my $SlideShowBegun = 0;
28 $SlideShowDataFolder = "/s5/v11b3";
30 $SlideShowHeader = <<'EOT' unless defined $SlideShowHeader;
31 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
32 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
34 <html xmlns="http://www.w3.org/1999/xhtml">
37 $SlideShowTheme = "i18n" unless defined $SlideShowTheme;
39 $SlideShowConfiguration =
40 qq!<meta name
="defaultView" content
="slideshow" />
41 <meta name
="controlVis" content
="hidden" />
43 <link rel
="stylesheet" href
="$SlideShowDataFolder/$SlideShowTheme/slides.css" type
="text/css" media
="projection" id
="slideProj" />
44 <link rel
="stylesheet" href
="$SlideShowDataFolder/default/outline.css" type
="text/css" media
="screen" id
="outlineStyle" />
45 <link rel
="stylesheet" href
="$SlideShowDataFolder/default/print.css" type
="text/css" media
="print" id
="slidePrint" />
46 <link rel
="stylesheet" href
="$SlideShowDataFolder/default/opera.css" type
="text/css" media
="projection" id
="operaFix" />
48 <script src
="$SlideShowDataFolder/default/slides.js" type
="text/javascript"></script
>!;
50 %SlideShowMeta = ( generator
=> "S5",
51 version
=> "S5 1.1b2",
56 ) unless defined %SlideShowMeta;
60 $Action{slideshow
} = \
&DoSlideShow
;
64 print GetSlideShowHeader
($id, Ts
('Slideshow:%s', $id));
68 push(@MyRules, \
&SlideShowRule
);
69 *OldPrintWikiToHTML
= *PrintWikiToHTML
;
70 *PrintWikiToHTML
= *PrintSlideWikiToHTML
;
75 print GetSlideShowFooter
($id);
79 sub GetSlideShowHeader
{
80 my ($id, $title, $oldId, $nocache, $status) = @_;
82 $SlideShowTitle = $title;
83 my $result = GetHttpHeader
('text/html', $nocache ?
$Now : 0, $status);
84 # $result .= GetHtmlHeader($title, $id);
85 # $result .= GetSlideShowHtmlHeader($title, $id);
86 $result .= $SlideShowHeader;
90 sub GetSlideShowHtmlHeader
{
91 my ($title, $id) = @_;
93 $html = $q->head($q->title($q->escapeHTML($SlideShowTitle)) . "\n" . GetSlideShowMeta
($id) . $SlideShowConfiguration);
95 <body><div class="layout"><div id="controls"></div><div id="currentSlide"></div>';
96 $html .= GetSlideHeader
($id) . GetSlideFooter
($id) . '</div>'
97 . '<div class="presentation">';
101 sub GetSlideShowMeta
{
105 foreach my $MetaKey (keys %SlideShowMeta) {
106 next if $MetaKey =~ /^(footer[12])$/;
107 $html .= qq!<meta name
="$MetaKey" content
="$SlideShowMeta{$MetaKey}" />\n!;
114 my $html = '<div id="header">';
122 my $html = '<div id="footer">';
124 $html .= qq!<h1
>$SlideShowMeta{footer1
}</h1><h2>$SlideShowMeta{footer2}</h2
>!;
129 sub GetSlideShowFooter
{
131 my $html = '</div></body></html>';
134 $html = '</div>' . $html;
141 # Don't put slide div's in HtmlEnvironment so they don't get closed
142 if (m/\G(\s*\n)*\<slide[ \t]+([^\n]*?)([ \t]*class\=([^\n]*?))?\>/icg) {
146 $CloseDiv .= "</div>" if ($InSlide);
147 $CloseDiv .= "</div>" if ($InHandout);
150 $class = $4 if ($4 ne "");
152 if ($SlideShowBegun) {
153 return CloseHtmlEnvironments
() . $CloseDiv . qq!<div
class="$class">! . AddHtmlEnvironment
('h1','') . $2 . CloseHtmlEnvironment
();
156 return GetSlideShowHtmlHeader
() . $CloseDiv . qq!<div
class="slide">! . AddHtmlEnvironment
('h1','') . $2 . CloseHtmlEnvironment
(); }
159 if (m/\G(\s*\n)*\<slidelink\s*(.*?)\=(.*?)\>[\s\t\n]*/icg) {
160 return qq!<a href
="#slide$SlideShowIndex{$2}">$3</a
>!;
163 if (m/\G(\s*\n)*\<handout([^\n]*)([ \t]*class\=([^\n]*?))?\>/icg) {
165 my $class = "handout";
166 $class = $4 if ($4 ne "");
168 return CloseHtmlEnvironments
() . qq!<div
class="$class">!;
171 if (m/\G(\s*\n)*\<image\s*(.*?)\=(.*?)\>[\s\t\n]*/icg) {
172 return OpenHtmlEnvironment
('div',1,'imagebox') . qq!<img src
="$3" alt
="$2">!;
175 if (m/\G(\s*\n)*\<inc[ \t]*image\s*(.*?)\=(.*?)\>[\s\t\n]*/icg) {
176 return OpenHtmlEnvironment
('div',1,'imagebox') . qq!<img src
="$3" alt
="$2" class="incremental">!;
179 if (m/\G(\s*\n)*\<meta\s*(.*?)\=(.*?)\>[\s\t\n]*/icg) {
180 $SlideShowMeta{$2}=$3;
184 if ( m/\G(\s*\n)*(inc\*+)[ \t]/cg
185 or InElement
('li') && m/\G(\s*\n)+(inc\*+)[ \t]/cg) {
186 return CloseHtmlEnvironmentUntil
('li') . OpenHtmlEnvironment
('ul',length($2)-3, 'incremental')
187 . AddHtmlEnvironment
('li');
193 sub PrintSlideWikiToHTML
{
194 my ($pageText, $savecache, $revision, $islocked) = @_;
196 $pageText =~ s/$FS//g; # Remove separators (paranoia)
197 $pageText = QuoteHtml
($pageText);
198 my ($blocks, $flags) = ApplyRules
($pageText, 1, $savecache, $revision); # p is start tag!
199 # local links, anchors if cache ok
200 if ($savecache and not $revision) {
201 $Page{blocks
} = $blocks;
202 $Page{flags
} = $flags;
203 if ($islocked or RequestLockDir
('main')) { # not fatal!
205 ReleaseLock
() unless $islocked;
213 my $page = GetPageContent
($id);
215 while ($page =~ /\<slide[ \t]+([^\n]*)\>/isg ) {
216 $SlideShowIndex{$1}=$SlideCounter;