Compare commits
3 Commits
cleaning-l
...
fake-time-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb0f3e9908 | ||
|
|
3626593fad | ||
|
|
4a1e1a5529 |
@@ -602,7 +602,7 @@ This command is used to reflect new pages to `oddmuse-pages-hash'."
|
||||
("{{{.*?}}}"
|
||||
0 '(face shadow
|
||||
help-echo "Creole code"))
|
||||
("^{{{\\(.*\n\\)+?}}}\n"
|
||||
("^{{{\n\\(.*\n\\)+?}}}\n"
|
||||
0 '(face shadow
|
||||
help-echo "Creole multiline code")))
|
||||
"Implement markup rules for the Creole markup extension.
|
||||
@@ -841,9 +841,7 @@ WIKI is the name of the wiki as defined in `oddmuse-wikis',
|
||||
PAGENAME is the pagename of the page you want to edit. If the
|
||||
page is already in a buffer, pop to that buffer instead of
|
||||
loading the page Use a prefix argument to force a reload of the
|
||||
page. Use \\[oddmuse-reload] to reload the list of pages
|
||||
available if you changed the URL in `oddmuse-wikis' or if other
|
||||
people have been editing the wiki in the mean time."
|
||||
page."
|
||||
(interactive (oddmuse-pagename))
|
||||
(make-directory (concat oddmuse-directory "/" wiki) t)
|
||||
(let ((name (concat wiki ":" pagename)))
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
undef $/; # slurp
|
||||
|
||||
my %index = ();
|
||||
my $verbose = '';
|
||||
|
||||
sub write_file {
|
||||
my ($file, $data) = @_;
|
||||
return unless $data;
|
||||
open(my $fh, '>:utf8', $file) or die "Cannot write $file: $!";
|
||||
print $fh $data;
|
||||
close($fh);
|
||||
}
|
||||
|
||||
sub replacement_block {
|
||||
my ($block, $pos, @no_go) = @_;
|
||||
|
||||
while (@no_go) {
|
||||
my $first = shift @no_go;
|
||||
print "Is $pos between " . $first->[0] . " and " . $first->[1] . "?\n" if $verbose;
|
||||
return $block if $pos >= $first->[0] and $pos <= $first->[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
sub translate_file {
|
||||
my ($data) = @_;
|
||||
my @no_go = ();
|
||||
|
||||
while ($data =~ /( <nowiki>.*?<\/nowiki>
|
||||
| <code>.*?<\/code>
|
||||
| ^ <pre> (.*\n)+ <\/pre>
|
||||
| ^ {{{ (.*\n)+ }}} )/gmx) {
|
||||
push @no_go, [pos($data) - length $1, pos($data)];
|
||||
print "no go from " . $no_go[-1]->[0] . ".." . $no_go[-1]->[1] . " for $1\n" if $verbose;
|
||||
}
|
||||
|
||||
# The problem is that these replacements don't adjust @no_go! Perhaps it is good enough?
|
||||
my $subs = '';
|
||||
$subs = $subs || $data =~ s/ ( \[\/quote\] \n \n \[quote\] ) /replacement_block($1, pos($data), @no_go)/gex;
|
||||
return $data if $subs;
|
||||
}
|
||||
|
||||
sub read_file {
|
||||
my $file = shift;
|
||||
open(my $fh, '<:utf8', $file) or die "Cannot read $file: $!";
|
||||
my $data = <$fh>;
|
||||
close($fh);
|
||||
return $data;
|
||||
}
|
||||
|
||||
sub main {
|
||||
my ($dir) = @_;
|
||||
mkdir($dir . '-new') or die "Cannot create $dir-new: $!";
|
||||
print "Indexing files\n";
|
||||
foreach my $file (glob("$dir/.* $dir/*")) {
|
||||
next unless $file =~ /$dir\/(.+)/;
|
||||
my $id = $1;
|
||||
next if $id eq ".";
|
||||
next if $id eq "..";
|
||||
$index{$id} = 1;
|
||||
}
|
||||
print "Converting files\n";
|
||||
foreach my $id (sort keys %index) {
|
||||
# this is where you debug a particular page
|
||||
# $verbose = $id eq '2014-12-18_Emacs_Wiki_Migration';
|
||||
write_file("$dir-new/$id", translate_file(read_file("$dir/$id")));
|
||||
}
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my $dir = 'raw';
|
||||
my $help = '';
|
||||
|
||||
GetOptions ("dir=s" => \$dir,
|
||||
"help" => \$help);
|
||||
|
||||
if ($help) {
|
||||
print qq{
|
||||
Usage: $0 [--dir=DIR]
|
||||
|
||||
You need to use the raw.pl script to create a directory full of raw
|
||||
wiki text files.
|
||||
|
||||
--dir=DIR is where the raw wiki text files are. Default: raw. The
|
||||
converted files will be stored in DIR-new, ie. in raw-new by
|
||||
default.
|
||||
|
||||
Example: $0 --dir=~/alexschroeder/raw
|
||||
}
|
||||
} else {
|
||||
main ($dir);
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
undef $/; # slurp
|
||||
|
||||
my %index = ();
|
||||
my $verbose = '';
|
||||
|
||||
my $LinkPattern = '(\p{Uppercase}+\p{Lowercase}+\p{Uppercase}\p{Alphabetic}*)';
|
||||
my $FreeLinkPattern = "([-,.()'%&?;<> _1-9A-Za-z\x{0080}-\x{fffd}]|[-,.()'%&?;<> _0-9A-Za-z\x{0080}-\x{fffd}][-,.()'%&?;<> _0-9A-Za-z\x{0080}-\x{fffd}]+)";
|
||||
my $UrlProtocols = 'http|https|ftp|afs|news|nntp|mid|cid|mailto|wais|prospero|telnet|gopher|irc|feed';
|
||||
my $UrlChars = '[-a-zA-Z0-9/@=+$_~*.,;:?!\'"()&#%]'; # see RFC 2396
|
||||
my $FullUrlPattern="((?:$UrlProtocols):$UrlChars+)"; # when used in square brackets
|
||||
|
||||
# either a single letter, or a string that begins with a single letter and ends with a non-space
|
||||
my $words = '([A-Za-z\x{0080}-\x{fffd}](?:[-%.,:;\'"!?0-9 A-Za-z\x{0080}-\x{fffd}]*?[-%.,:;\'"!?0-9A-Za-z\x{0080}-\x{fffd}])?)';
|
||||
# zero-width assertion to prevent km/h from counting
|
||||
my $nowordstart = '(?:(?<=[^-0-9A-Za-z\x{0080}-\x{fffd}])|^)';
|
||||
# zero-width look-ahead assertion to prevent km/h from counting
|
||||
my $nowordend = '(?=[^-0-9A-Za-z\x{0080}-\x{fffd}]|$)';
|
||||
|
||||
my $IrcNickRegexp = qr{[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*};
|
||||
|
||||
sub FreeToNormal { # trim all spaces and convert them to underlines
|
||||
my $id = shift;
|
||||
return '' unless $id;
|
||||
$id =~ s/ /_/g;
|
||||
$id =~ s/__+/_/g;
|
||||
$id =~ s/^_//;
|
||||
$id =~ s/_$//;
|
||||
return $id;
|
||||
}
|
||||
|
||||
sub parse_local_names {
|
||||
my $filename = shift;
|
||||
print "Reading $filename\n";
|
||||
open(my $fh, '<:utf8', $filename) or die "Cannot read $filename: $!";
|
||||
my $data = <$fh>;
|
||||
close($fh);
|
||||
print "Parsing $filename\n";
|
||||
my %names = ();
|
||||
while ($data =~ m/\[$FullUrlPattern\s+([^\]]+?)\]/g) {
|
||||
my ($page, $url) = ($2, $1);
|
||||
my $id = FreeToNormal($page);
|
||||
$names{$id} = $url;
|
||||
}
|
||||
return \%names;
|
||||
}
|
||||
|
||||
sub write_file {
|
||||
my ($file, $data) = @_;
|
||||
return unless $data;
|
||||
open(my $fh, '>:utf8', $file) or die "Cannot write $file: $!";
|
||||
print $fh $data;
|
||||
close($fh);
|
||||
}
|
||||
|
||||
sub replacement {
|
||||
my ($names, $id, $pos, @no_go) = @_;
|
||||
|
||||
while (@no_go) {
|
||||
my $first = shift @no_go;
|
||||
print "Is $pos between " . $first->[0] . " and " . $first->[1] . "?\n" if $verbose;
|
||||
return $id if $pos >= $first->[0] and $pos <= $first->[1];
|
||||
}
|
||||
|
||||
return "[[$id]]" if exists $index{$id}; # local page exists
|
||||
return $id unless $names->{$id};
|
||||
return '[' . $names->{$id} . ' ' . $id . ']';
|
||||
}
|
||||
|
||||
sub translate_file {
|
||||
my ($names, $data) = @_;
|
||||
my @no_go = ();
|
||||
|
||||
while ($data =~ /( <nowiki>.*?<\/nowiki>
|
||||
| <code>.*?<\/code>
|
||||
| ^ <pre> (.*\n)+ <\/pre>
|
||||
| ^ {{{ (.*\n)+ }}}
|
||||
| ${nowordstart} \* ${words} \* ${nowordend}
|
||||
| ${nowordstart} \/ ${words} \/ ${nowordend}
|
||||
| ${nowordstart} \_ ${words} \_ ${nowordend}
|
||||
| ${nowordstart} \! ${words} \! ${nowordend}
|
||||
| \[\[ $FreeLinkPattern .*? \]\]
|
||||
| \[ $FullUrlPattern \s+ [^\]]+? \]
|
||||
| ^( \h+.+\n )+
|
||||
| ^(?: \[? \d\d?:\d\d (?:am|pm)? \]? )? \s* < $IrcNickRegexp > )/gmx) {
|
||||
push @no_go, [pos($data) - length $1, pos($data)];
|
||||
print "no go from " . $no_go[-1]->[0] . ".." . $no_go[-1]->[1] . " for $1\n" if $verbose;
|
||||
}
|
||||
|
||||
my $subs = $data =~ s/(?<![:![])\b$LinkPattern(?![:])/replacement($names, $1, pos($data), @no_go)/ge;
|
||||
return $data if $subs;
|
||||
}
|
||||
|
||||
sub read_file {
|
||||
my $file = shift;
|
||||
open(my $fh, '<:utf8', $file) or die "Cannot read $file: $!";
|
||||
my $data = <$fh>;
|
||||
close($fh);
|
||||
return $data;
|
||||
}
|
||||
|
||||
sub main {
|
||||
my ($dir, $local_names) = @_;
|
||||
mkdir($dir . '-new') or die "Cannot create $dir-new: $!";
|
||||
my $names = parse_local_names("$dir/$local_names");
|
||||
print "Indexing files\n";
|
||||
foreach my $file (glob("$dir/.* $dir/*")) {
|
||||
next unless $file =~ /$dir\/(.+)/;
|
||||
my $id = $1;
|
||||
next if $id eq ".";
|
||||
next if $id eq "..";
|
||||
next if $id eq "$local_names";
|
||||
$index{$id} = 1;
|
||||
}
|
||||
print "Converting files\n";
|
||||
foreach my $id (sort keys %index) {
|
||||
# this is where you debug a particular page
|
||||
# $verbose = $id eq '2014-12-18_Emacs_Wiki_Migration';
|
||||
write_file("$dir-new/$id", translate_file($names, read_file("$dir/$id")));
|
||||
}
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my $names = 'LocalNames';
|
||||
my $dir = 'raw';
|
||||
my $help = '';
|
||||
|
||||
GetOptions ("names=s" => \$names,
|
||||
"dir=s" => \$dir,
|
||||
"help" => \$help);
|
||||
|
||||
if ($help) {
|
||||
print qq{
|
||||
Usage: $0 [--dir=DIR] [--names=LocalNames]
|
||||
|
||||
You need to use the raw.pl script to create a directory full of raw
|
||||
wiki text files.
|
||||
|
||||
--dir=DIR is where the raw wiki text files are. Default: raw. The
|
||||
converted files will be stored in DIR-new, ie. in raw-new by
|
||||
default.
|
||||
|
||||
--names=LocalNames is the page name with all the local names on
|
||||
it. Default: LocalNames
|
||||
|
||||
Example: $0 --dir=~/alexschroeder/raw --names=Names
|
||||
}
|
||||
} else {
|
||||
main ($dir, $names);
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
undef $/; # slurp
|
||||
|
||||
my %index = ();
|
||||
my $verbose = '';
|
||||
|
||||
sub write_file {
|
||||
my ($file, $data) = @_;
|
||||
return unless $data;
|
||||
open(my $fh, '>:utf8', $file) or die "Cannot write $file: $!";
|
||||
print $fh $data;
|
||||
close($fh);
|
||||
}
|
||||
|
||||
sub replacement_block {
|
||||
my ($block, $pos, @no_go) = @_;
|
||||
|
||||
while (@no_go) {
|
||||
my $first = shift @no_go;
|
||||
print "Is $pos between " . $first->[0] . " and " . $first->[1] . "?\n" if $verbose;
|
||||
return $block if $pos >= $first->[0] and $pos <= $first->[1];
|
||||
}
|
||||
|
||||
return "[quote]\n" . join("\n", split(/ \n :+ \h? /x, $block)) . "[/quote]\n";
|
||||
}
|
||||
|
||||
sub replacement {
|
||||
my ($block, $tag, $pos, @no_go) = @_;
|
||||
|
||||
while (@no_go) {
|
||||
my $first = shift @no_go;
|
||||
print "Is $pos between " . $first->[0] . " and " . $first->[1] . "?\n" if $verbose;
|
||||
return $block if $pos >= $first->[0] and $pos <= $first->[1];
|
||||
}
|
||||
|
||||
return $tag . $block . $tag;
|
||||
}
|
||||
|
||||
sub translate_file {
|
||||
my ($data) = @_;
|
||||
my @no_go = ();
|
||||
|
||||
while ($data =~ /( <nowiki>.*?<\/nowiki>
|
||||
| <code>.*?<\/code>
|
||||
| ^ <pre> (.*\n)+ <\/pre>
|
||||
| ^ {{{ (.*\n)+ }}} )/gmx) {
|
||||
push @no_go, [pos($data) - length $1, pos($data)];
|
||||
print "no go from " . $no_go[-1]->[0] . ".." . $no_go[-1]->[1] . " for $1\n" if $verbose;
|
||||
}
|
||||
|
||||
# The problem is that these replacements don't adjust @no_go! Perhaps it is good enough?
|
||||
my $subs = '';
|
||||
$subs = $subs || $data =~ s/ ''' (.*?) ''' /replacement($1, '**', pos($data), @no_go)/gxe;
|
||||
$subs = $subs || $data =~ s/ '' (.*?) '' /replacement($1, '\/\/', pos($data), @no_go)/gxe;
|
||||
$subs = $data =~ s/ ^ :+ \h? ( .* \n (?: .+ \n ) * ) /replacement_block($1, pos($data), @no_go)/gmxe;
|
||||
return $data if $subs;
|
||||
}
|
||||
|
||||
sub read_file {
|
||||
my $file = shift;
|
||||
open(my $fh, '<:utf8', $file) or die "Cannot read $file: $!";
|
||||
my $data = <$fh>;
|
||||
close($fh);
|
||||
return $data;
|
||||
}
|
||||
|
||||
sub main {
|
||||
my ($dir) = @_;
|
||||
mkdir($dir . '-new') or die "Cannot create $dir-new: $!";
|
||||
print "Indexing files\n";
|
||||
foreach my $file (glob("$dir/.* $dir/*")) {
|
||||
next unless $file =~ /$dir\/(.+)/;
|
||||
my $id = $1;
|
||||
next if $id eq ".";
|
||||
next if $id eq "..";
|
||||
$index{$id} = 1;
|
||||
}
|
||||
print "Converting files\n";
|
||||
foreach my $id (sort keys %index) {
|
||||
# this is where you debug a particular page
|
||||
# $verbose = $id eq '2014-12-18_Emacs_Wiki_Migration';
|
||||
write_file("$dir-new/$id", translate_file(read_file("$dir/$id")));
|
||||
}
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my $dir = 'raw';
|
||||
my $help = '';
|
||||
|
||||
GetOptions ("dir=s" => \$dir,
|
||||
"help" => \$help);
|
||||
|
||||
if ($help) {
|
||||
print qq{
|
||||
Usage: $0 [--dir=DIR]
|
||||
|
||||
You need to use the raw.pl script to create a directory full of raw
|
||||
wiki text files.
|
||||
|
||||
--dir=DIR is where the raw wiki text files are. Default: raw. The
|
||||
converted files will be stored in DIR-new, ie. in raw-new by
|
||||
default.
|
||||
|
||||
Example: $0 --dir=~/alexschroeder/raw
|
||||
}
|
||||
} else {
|
||||
main ($dir);
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Symbola';
|
||||
src: local('Symbola'), url('/fonts/Symbola.woff') format('woff'), url('/fonts/Symbola.ttf') format('truetype');
|
||||
src: local('Symbola'), url('/fonts/Symbola.woff') format('woff') url('/fonts/Symbola.ttf') format('truetype');
|
||||
}
|
||||
|
||||
body, rss {
|
||||
@@ -271,7 +271,7 @@ label[for="searchlang"], #searchlang, .header input[type="submit"] {
|
||||
visibility: hidden; position: absolute;
|
||||
}
|
||||
/* wrap on the iphone */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
@media media only screen and (max-device-width: 480px) {
|
||||
}
|
||||
|
||||
.header input {
|
||||
|
||||
@@ -188,7 +188,7 @@ div.footer hr {
|
||||
|
||||
div.content > div.comment {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
padding-top: none;
|
||||
border-left: 1ex solid #bbb;
|
||||
padding-left: 1ex;
|
||||
}
|
||||
@@ -213,12 +213,7 @@ pre {
|
||||
|
||||
tt, pre, code {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
code {
|
||||
background: #eee;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
};
|
||||
|
||||
@font-face {
|
||||
font-family: 'Gentium Basic';
|
||||
|
||||
|
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 347 B |
|
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 497 B After Width: | Height: | Size: 497 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 372 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 975 B After Width: | Height: | Size: 975 B |
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 434 B |
|
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 730 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 1010 B After Width: | Height: | Size: 1010 B |
|
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
@@ -27,7 +27,7 @@ my @path = split(/\//, $ENV{REDIRECT_URL});
|
||||
my $file = $path[$#path];
|
||||
|
||||
# for dynamic pages
|
||||
our ($NotFoundHandlerExceptionsPage);
|
||||
use vars qw($NotFoundHandlerExceptionsPage);
|
||||
$NotFoundHandlerExceptionsPage = 'NoCachePages';
|
||||
$RunCGI = 0;
|
||||
do $script;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('aawrapperdiv.pl', 'WrapperDiv Module');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('accesskeys.pl', 'Links With AccessKeys Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
our ($q, %Page, %Action, $IndexFile, $PageDir, $KeepDir, @MyAdminCode, $RefererDir);
|
||||
|
||||
@@ -40,7 +39,7 @@ sub AdminPowerDelete {
|
||||
} else {
|
||||
print $q->p(GetPageLink($id) . ' ' . T('deleted'));
|
||||
WriteRcLog($id, Ts('Deleted %s', $id), 0, $Page{revision},
|
||||
GetParam('username', ''), $q->remote_addr(), $Page{languages},
|
||||
GetParam('username', ''), GetRemoteHost(), $Page{languages},
|
||||
GetCluster($Page{text}));
|
||||
}
|
||||
# Regenerate index on next request
|
||||
@@ -89,10 +88,10 @@ sub AdminPowerRename {
|
||||
# RecentChanges
|
||||
OpenPage($new);
|
||||
WriteRcLog($id, Ts('Renamed to %s', $new), 0, $Page{revision},
|
||||
GetParam('username', ''), $q->remote_addr(), $Page{languages},
|
||||
GetParam('username', ''), GetRemoteHost(), $Page{languages},
|
||||
GetCluster($Page{text}));
|
||||
WriteRcLog($new, Ts('Renamed from %s', $id), 0, $Page{revision},
|
||||
GetParam('username', ''), $q->remote_addr(), $Page{languages},
|
||||
GetParam('username', ''), GetRemoteHost(), $Page{languages},
|
||||
GetCluster($Page{text}));
|
||||
print $q->p(Tss('Renamed %1 to %2.', GetPageLink($id), GetPageLink($new)));
|
||||
ReleaseLock();
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('adsense.pl', 'AdSense Module');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('advanced-uploads.pl', 'Advanced File Upload Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('age.pl', 'Age Indication Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('aggregate.pl', 'Front Page Extension');
|
||||
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
# Copyright (C) 2005 Bayle Shanks http://purl.net/net/bshanks
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
our ($Now, @MyMacros, @MyRules, $DefaultStyleSheet, $q, $bol);
|
||||
|
||||
AddModuleDescription('agree-disagree.pl', 'AgreeDisagreePlugin');
|
||||
|
||||
push(@MyRules, \&AgreeDisagreeSupportRule);
|
||||
|
||||
push(@MyMacros, sub{ s/\[\+\]/"[+:" . GetParam('username', T('Anonymous'))
|
||||
. ':' . TimeToText($Now) . "]"/ge });
|
||||
push(@MyMacros, sub{ s/\[\+(:[^]:]+)\]/"[+$1:" . TimeToText($Now) . "]"/ge });
|
||||
push(@MyMacros, sub{ s/\[\-\]/"[-:" . GetParam('username', T('Anonymous'))
|
||||
. ':' . TimeToText($Now) . "]"/ge });
|
||||
push(@MyMacros, sub{ s/\[\-(:[^]:]+)\]/"[-$1:" . TimeToText($Now) . "]"/ge });
|
||||
|
||||
|
||||
$DefaultStyleSheet .= <<'EOT' unless $DefaultStyleSheet =~ /div\.agree/; # mod_perl?
|
||||
div.agreeCount {
|
||||
float: left;
|
||||
clear: left;
|
||||
background-color: Green;
|
||||
padding-left: .5em;
|
||||
padding-right: .5em;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .5em;
|
||||
}
|
||||
div.disagreeCount {
|
||||
float: left;
|
||||
clear: right;
|
||||
background-color: Red;
|
||||
padding-left: .5em;
|
||||
padding-right: .5em;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .5em;
|
||||
}
|
||||
|
||||
div.agreeNames {
|
||||
float: left;
|
||||
background-color: Green;
|
||||
font-size: xx-small;
|
||||
display: none;
|
||||
}
|
||||
div.disagreeNames {
|
||||
float: left;
|
||||
background-color: Red;
|
||||
font-size: xx-small;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EOT
|
||||
|
||||
|
||||
|
||||
|
||||
my %AgreePortraits = ();
|
||||
|
||||
|
||||
sub AgreeDisagreeSupportRule {
|
||||
if ($bol) {
|
||||
if ($bol && m/(\G(\s*\[\+(.*?)\]|\s*\[-(.*?)\])+)/gcs) {
|
||||
|
||||
my $votes = $1;
|
||||
my @ayes = ();
|
||||
my @nayes = ();
|
||||
while ($votes =~ m/\G.*?\[\+(.*?)\]/gcs) {
|
||||
my ($ignore, $name, $time) = split(/:/, $1, 3);
|
||||
push(@ayes, $name);
|
||||
}
|
||||
my $votes2 = $votes;
|
||||
while ($votes2 =~ m/\G.*?\[-(.*?)\]/gcs) {
|
||||
my ($ignore, $name, $time) = split(/:/, $1, 3);
|
||||
push(@nayes, $name);
|
||||
}
|
||||
|
||||
my $html = CloseHtmlEnvironments() ;
|
||||
$html .= $q->div({-class=>'agreeCount'}) . ($#ayes+1) . ' ' . '</div>' ;
|
||||
|
||||
$html .= $q->div({-class=>'agreeNames'}) . printNames(@ayes) . '</div>' ;
|
||||
$html .= $q->div({-class=>'disagreeCount'}) . ' ' . ($#nayes+1) . '</div>' ;
|
||||
$html .= $q->div({-class=>'disagreeNames'}) . printNames(@nayes) . '</div>' ;
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
sub printNames {
|
||||
my @names = @_;
|
||||
|
||||
my $html = '';
|
||||
foreach my $name (@names) {
|
||||
$html .= "$name<br>";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('all.pl', 'All Action');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('anchors.pl', 'Local Anchor Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('antispam.pl', 'Antispam Module');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('archive.pl', 'Archive Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('askpage.pl', 'Ask Page Extension');
|
||||
|
||||
@@ -51,14 +50,12 @@ sub NewAskPageDoPost {
|
||||
OldAskPageDoPost($id, @_); # keep original functionality for regular edits
|
||||
}
|
||||
|
||||
*OldAskPageGetTextArea=\&GetTextArea;
|
||||
*GetTextArea=\&NewAskPageGetTextArea;
|
||||
sub NewAskPageGetTextArea {
|
||||
my ($name, $text, @rest) = @_;
|
||||
if ($name eq 'aftertext' and not $text and GetId() eq $AskPage) {
|
||||
$text = $NewQuestion;
|
||||
}
|
||||
OldAskPageGetTextArea($name, $text, @rest);
|
||||
*OldAskPageGetCommentForm=\&GetCommentForm;
|
||||
*GetCommentForm=\&NewAskPageGetCommentForm;
|
||||
sub NewAskPageGetCommentForm {
|
||||
my ($id, $rev, $comment) = @_;
|
||||
$comment = $NewQuestion if not $comment and $id eq $AskPage;
|
||||
OldAskPageGetCommentForm(@_);
|
||||
}
|
||||
|
||||
*OldAskPageJournalSort=\&JournalSort;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
use XML::Atom::Entry;
|
||||
use XML::Atom::Link;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
# ====================[ autolock.pl ]====================
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# ie: http://search.cpan.org/CPAN/authors/id/C/CH/CHAMAS/MLDBM-2.01.tar.gz
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
use Fcntl;
|
||||
use MLDBM qw( DB_File Storable );
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Backlinks_Extension
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('backlinks.pl', 'Backlinks Extension');
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ the IP or hostname will be added to the C<BannedHosts> page for you.
|
||||
|
||||
=cut
|
||||
use strict;
|
||||
use v5.10;
|
||||
our ($q, $Now, %Page, $OpenPageName, %Action, $UrlPattern, $BannedContent, $BannedHosts, @MyAdminCode);
|
||||
|
||||
AddModuleDescription('ban-contributors.pl', 'Ban Contributors Extension');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2013–2015 Alex Schroeder <alex@gnu.org>
|
||||
# Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -16,11 +16,10 @@
|
||||
# editors will be logged.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('ban-quick-editors.pl', 'Banning Quick Editors');
|
||||
|
||||
our ($q, $Now, %RecentVisitors, $SurgeProtection);
|
||||
our ($Now, %RecentVisitors, $SurgeProtection);
|
||||
|
||||
*BanQuickOldUserIsBanned = \&UserIsBanned;
|
||||
*UserIsBanned = \&BanQuickNewUserIsBanned;
|
||||
@@ -30,7 +29,7 @@ sub BanQuickNewUserIsBanned {
|
||||
if (not $rule
|
||||
and $SurgeProtection # need surge protection
|
||||
and GetParam('title')) {
|
||||
my $name = GetParam('username', $q->remote_addr());
|
||||
my $name = GetParam('username', GetRemoteHost());
|
||||
my @entries = @{$RecentVisitors{$name}};
|
||||
# $entry[0] is $Now after AddRecentVisitor
|
||||
my $ts = $entries[1];
|
||||
|
||||
@@ -13,17 +13,14 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('banned-regexps.pl', 'Banning Regular Expressions');
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 Compatibility
|
||||
=h1 Compatibility
|
||||
|
||||
This extension works with logbannedcontent.pl.
|
||||
|
||||
=head1 Example content for the BannedRegexps page:
|
||||
=h1 Example content for the BannedRegexps page:
|
||||
|
||||
# This page lists regular expressions that prevent the saving of a page.
|
||||
# The regexps are matched against any page or comment submitted.
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('bbcode.pl', 'bbCode Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('big-brother.pl', 'Big Brother Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('blockquote.pl', 'Comments on Text Formatting Rules');
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('calendar.pl', 'Calendar Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('canonical.pl', 'Canonical Names');
|
||||
|
||||
|
||||
180
modules/cart.pl
@@ -1,180 +0,0 @@
|
||||
# Copyright (C) 2008 Eric Hsu <apricotan@gmail.com>
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
use strict;
|
||||
use v5.10;
|
||||
use utf8;
|
||||
|
||||
AddModuleDescription('cart.pl', 'Cart Extension');
|
||||
|
||||
our ($q, %Action, $UserGotoBar, $CookieName);
|
||||
our ($CartPic, $CartName, %Cart, $ShowCart, @CartOrdered);
|
||||
my $LOADED_CART_JS;
|
||||
|
||||
# ============
|
||||
# = cart-bfc =
|
||||
# ============
|
||||
|
||||
# This is a simple shopping cart for pages!
|
||||
# Requires searchpaged-bfc.pl.
|
||||
|
||||
# We make a checkbox that onChange, uses Yahoo! UI Cookie 2.6 (note we need 2.6!) routines to set a subcookie.
|
||||
# We have the cookie "$CartName" (by default $Cookiename . "Cart")
|
||||
# which holds the actual cart and is managed almost entirely
|
||||
# in client-side javascript. That means the checkboxes directly control the cookie.
|
||||
|
||||
# If you want a little picture of a cart, you can set the URL at $CartPic.
|
||||
|
||||
# InitCart loads the cookie values into %Cart. $Cart->{$pagename}=1 if it's in the cart.
|
||||
# In theory cookies are capped at 4K. Our page names are capped around 90ish chars. That leaves room for 40 maximal names in the cart. Probably enough.
|
||||
|
||||
# We'll need the cookie values for
|
||||
# action=cart;subaction=show; along with other future subactions (download in latex, bibtex)
|
||||
# we'll feed this display to a variant of search display.
|
||||
# I'll have to check oddmuse.pl.
|
||||
|
||||
# load Yahoo UI code bit to manage subcookies.
|
||||
|
||||
$Action{cart} = \&DoCart;
|
||||
|
||||
sub DoCart {
|
||||
# foreach $key (keys %Cart) {
|
||||
# push @cart, $key if ($Cart{"$key"});
|
||||
# }
|
||||
DoSearch(\@CartOrdered);
|
||||
}
|
||||
|
||||
$UserGotoBar .= '<a href="?action=cart;cache=0">View Cart</a>';
|
||||
|
||||
# Manage Cart Routines
|
||||
|
||||
#push @MyPrintSearchResultsPrefix, \&PrintCheckboxTableStart;
|
||||
#push @MyPrintSearchResultsSuffix, \&PrintCheckboxTableEnd;
|
||||
|
||||
# I can't hack into Init, so let's tap into InitCookie.
|
||||
# We also tap into Cookie() to arrange writing out our cleaned up Cart.
|
||||
|
||||
*OldInitCookie = *InitCookie;
|
||||
*InitCookie = *InitCookieAndCart;
|
||||
|
||||
# To get a checkbox in the titles of pages, we patch GetHeader.
|
||||
*OldGetHeader = *GetHeader;
|
||||
*GetHeader = *GetHeaderAndCart;
|
||||
|
||||
sub InitCookieAndCart {
|
||||
OldInitCookie();
|
||||
InitCart();
|
||||
}
|
||||
|
||||
sub GetHeaderAndCart {
|
||||
my ($id, $title, $oldId, $nocache, $status) = @_;
|
||||
my $result = OldGetHeader(@_);
|
||||
|
||||
return ($result) unless ($id);
|
||||
|
||||
my $checkbox = MakeCheckbox($id);
|
||||
$checkbox = qq(<span class="cart-checkbox" style="float:right">$checkbox</span>);
|
||||
|
||||
$result =~ s/(<\/h1>)/$checkbox$1/;
|
||||
|
||||
return ($result);
|
||||
}
|
||||
|
||||
|
||||
# We load the contents of our Cart cookie into the global %Cart and @CartOrdered
|
||||
sub InitCart {
|
||||
$CartName = $CookieName . "Cart" unless (defined ($CartName) );
|
||||
my @pairs;
|
||||
|
||||
%Cart = ();
|
||||
@CartOrdered = ();
|
||||
|
||||
if ($q->cookie($CartName)) {
|
||||
# @pairs = split(/&/, $q->cookie($CartName));
|
||||
@pairs = $q->cookie($CartName);
|
||||
foreach my $pair (@pairs) {
|
||||
# my $encodedequals = UrlEncode("=");
|
||||
my ($name, $val)= split(/\=/, $pair);
|
||||
$Cart{"$name"}=$val;
|
||||
push @CartOrdered, $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub PrintCheckboxTableStart {
|
||||
my ($name, $regex, $text, $type) = @_;
|
||||
my $html;
|
||||
|
||||
$html .= "<table><tr>";
|
||||
my $checkbox = MakeCheckbox(@_);
|
||||
$html .= qq(<td valign=top>$checkbox</td>);
|
||||
$html .= "<td valign=top>";
|
||||
print $html;
|
||||
}
|
||||
|
||||
sub PrintCheckboxTableEnd {
|
||||
my ($name, $regex, $text, $type) = @_;
|
||||
my $html;
|
||||
|
||||
$html .= "</td>";
|
||||
$html .= "</tr></table>";
|
||||
|
||||
print $html;
|
||||
}
|
||||
|
||||
|
||||
sub MakeCheckbox {
|
||||
my ($name, $regex, $text, $type) = @_;
|
||||
my $html;
|
||||
|
||||
return unless ($ShowCart);
|
||||
unless ($LOADED_CART_JS) {
|
||||
$html .= '<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.7.0/build/yahoo/yahoo-min.js&2.7.0/build/cookie/cookie-min.js&2.7.0/build/event/event-min.js"></script>';
|
||||
$LOADED_CART_JS=1;
|
||||
}
|
||||
|
||||
my $selected = qq(checked="yes") if ($Cart{"$name"});
|
||||
|
||||
$html .=<<HTMLEND;
|
||||
$CartPic<input type="checkbox" value="cart" id="$name-set" title="Add To Cart" $selected/> <br>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
YAHOO.util.Event.on("$name-set", "change", function(){
|
||||
var value = YAHOO.util.Cookie.getSub("$CartName", "$name");
|
||||
if (value == 1 ) { YAHOO.util.Cookie.removeSub("$CartName", "$name"); }
|
||||
else { YAHOO.util.Cookie.setSub("$CartName", "$name", 1 ); }
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
HTMLEND
|
||||
|
||||
return $html unless ($q->param('action') eq 'edit' || $q->param('Preview'));
|
||||
# no checkboxes for edit pages.
|
||||
return;
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=
|
||||
(0.7) Load JS libraries on first checkbox (so won't load if we are editing).
|
||||
(0.6) Changed the JS source to be Yahoo's CDN.
|
||||
(0.51) Use CSS class cart-checkbox for the cart checkbox! That way, we can remove them for printouts, for instance.
|
||||
(0.5) Our hack of cookies was not working cross-platform. We have a mismatch because our attempts to send out a cookie from oddmuse were getting the contents encoded and unreadable for the YUI routines. Instead,we will use removeSub to avoid ever having to send the cookie back from our server!
|
||||
(0.4) Now every page title has a checkbox floated to the right, which controls the cart status.
|
||||
(0.3) Allow cart editing from cart display. Currently, doesn't seem to affect the cart.
|
||||
(0.2) Cart now displays.
|
||||
(0.1) Cart is now persistent and is edited by the checkboxes.
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('checkbox.pl', 'Checklist Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('clustermap.pl', 'ClusterMap Module');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('comment-div-wrapper.pl', 'Comment Div Wrapper Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('commentcount.pl', 'Comment Count Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('compilation.pl', 'Compilation Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('context.pl', 'Calendar Extension');
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
# Of course, you can customize this to store more information
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('creationdate.pl', 'CreationDate Module');
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
# ====================[ creole.pl ]====================
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
# ====================[ creoleaddition.pl ]====================
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
# ====================[ crossbar.pl ]====================
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('crumbs.pl', 'List Parent Pages Extension');
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('csv.pl', 'Comments on Long Table Markup Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('dates.pl', 'Dates Extension');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('delete-all.pl');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
our ($q, $Now, %IndexHash, %Action, %Page, $OpenPageName, $FS, $BannedContent, $RcFile, $RcDefault, @MyAdminCode, $FullUrlPattern, $DeletedPage, $StrangeBannedContent);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('diff.pl', 'Diff Action Extension');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('div-foo.pl', 'Div Foo Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('dojo.pl', 'Using Dojo Instead Of Wiki Markup');
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# JavaScript enabled for this to work.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('doubleclick.pl', 'Doubleclick Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('download.pl', 'Download Extension');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
use File::Glob ':glob';
|
||||
our ($DraftDir);
|
||||
@@ -29,7 +28,7 @@ push(@MyInitVariables, \&DraftInit);
|
||||
sub DraftInit {
|
||||
if (GetParam('Draft', '')) {
|
||||
SetParam('action', 'draft') ; # Draft button used
|
||||
} elsif (-f "$DraftDir/" . GetParam('username', $q->remote_addr()) # draft exists
|
||||
} elsif (-f "$DraftDir/" . GetParam('username', GetRemoteHost()) # draft exists
|
||||
and $FooterNote !~ /action=draft/) { # take care of mod_perl persistence
|
||||
$FooterNote = $q->p(ScriptLink('action=draft', T('Recover Draft'))) . $FooterNote;
|
||||
}
|
||||
@@ -39,7 +38,7 @@ $Action{draft} = \&DoDraft;
|
||||
|
||||
sub DoDraft {
|
||||
my $id = shift;
|
||||
my $draft = $DraftDir . '/' . GetParam('username', $q->remote_addr());
|
||||
my $draft = $DraftDir . '/' . GetParam('username', GetRemoteHost());
|
||||
if ($id) {
|
||||
my $text = GetParam('text', '');
|
||||
ReportError(T('No text to save'), '400 BAD REQUEST') unless $text;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('duckduckgo-search.pl', 'Use DuckDuckGo For Searches');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('dynamic-comments.pl', 'Dynamic Comments Extension');
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('dynlogo.pl', 'Dynamic Logo');
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('edit-assist.pl', 'Edit Assist Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('edit-cluster.pl', 'Edit Cluster Extension');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('edit-paragraphs.pl', 'Edit Paragraphs Extension');
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Email_Quote_Extension
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('emailquote.pl', 'Email Quote Extension');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('emoji.pl', 'Smilies');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('enclosure.pl', 'Podcasting');
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
# the css classes div.question and div.answer.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('faq.pl', 'FAQ Extension');
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA,
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('fckeditor.pl', 'Using FCKeditor In Addition To Wiki Markup');
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Field_List_Extension
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('fieldlist.pl', 'Field List Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('find.pl', 'Find Extension');
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('fix-encoding.pl', 'Fix Encoding');
|
||||
|
||||
|
||||
257
modules/flashbox.pl
Normal file
@@ -0,0 +1,257 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
|
||||
# ====================[ flashbox.pl ]====================
|
||||
|
||||
=head1 NAME
|
||||
|
||||
flashbox - An Oddmuse module for embedding offsite-hosted Flash videos within
|
||||
an Oddmuse Wiki page - especially those hosted by Google Videos,
|
||||
YouTube, and SlideShare.
|
||||
|
||||
=head1 INSTALLATION
|
||||
|
||||
flashbox is easily installable: move this file into the B<wiki/modules/>
|
||||
directory of your Oddmuse Wiki.
|
||||
|
||||
=cut
|
||||
AddModuleDescription('flashbox.pl', 'Flashbox Extension');
|
||||
|
||||
our ($bol, @MyRules, %RuleOrder);
|
||||
|
||||
# ....................{ CONFIGURATION }....................
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
flashbox is easily configurable: set these variables in the B<wiki/config.pl>
|
||||
file for your Oddmuse Wiki.
|
||||
|
||||
=cut
|
||||
our ($FlashboxWidth,
|
||||
$FlashboxHeight);
|
||||
|
||||
=head2 $FlashboxWidth
|
||||
|
||||
The width of the HTML object "frame" for Flash videos, in pixels.
|
||||
|
||||
The default value for this variable is (usually) fine.
|
||||
|
||||
=cut
|
||||
$FlashboxWidth = 420;
|
||||
|
||||
=head2 $FlashboxHeight
|
||||
|
||||
The height of the HTML object "frame" for Flash videos, in pixels. For any
|
||||
specific width, a height roughly 83.33% of that width tends to provide a
|
||||
respectable frame for viewing Flash videos.
|
||||
|
||||
The default value for this variable is (usually) fine.
|
||||
|
||||
=cut
|
||||
$FlashboxHeight = 350;
|
||||
|
||||
# ....................{ MARKUP }....................
|
||||
|
||||
=head1 MARKUP
|
||||
|
||||
flashbox provides a few new markup rules. These are:
|
||||
|
||||
=over
|
||||
|
||||
=item [[GoogleVideo:${GoogleVideoID}]]
|
||||
|
||||
=over
|
||||
|
||||
=item Embeds the Google Video uniquely identified by ${GoogleVideoID} into the
|
||||
Oddmuse Wiki page, where ${GoogleVideoID} is the signed integer
|
||||
following the "docID" parameter in the Google Video URL for that video;
|
||||
for example, [[GoogleVideo:8649250863235826256]] embeds Derrick Jensen's
|
||||
"Endgame: Part I" Google Video into the Oddmuse Wiki page.
|
||||
|
||||
=back
|
||||
|
||||
=item [[YouTube:${YouTubeVideoID}]]
|
||||
|
||||
=over
|
||||
|
||||
=item Embeds the YouTube video uniquely identified by ${YouTubeVideoID} into the
|
||||
Oddmuse Wiki page, where ${YouTubeVideoID} is the string following the
|
||||
"watch?v" parameter in the YouTube URL for that video; for example,
|
||||
[[YouTube:Q1ZeXnmDZMQ]] embeds James Howard Kunstler's "The Tragedy of
|
||||
Suburbia TED Talk" YouTube video into the Oddmuse Wiki page.
|
||||
|
||||
=back
|
||||
|
||||
=item [[SlideShare:${SlideSharePresentationID}]]
|
||||
|
||||
=over
|
||||
|
||||
=item Embeds the SlideShare presentation uniquely identified by
|
||||
${SlideSharePresentationID} into the Oddmuse Wiki page, where
|
||||
${SlideSharePresentationID} is a string composed of the title for that
|
||||
presentation and an arbitrary signed integer. Unfortunately, this string
|
||||
is more difficult to obtain than for Google Video and YouTube; for any
|
||||
given presentation, see the small "Embed" box on that presentation's
|
||||
SlideShare page and the string following the "doc" parameter in that
|
||||
box. For example,
|
||||
[[SlideShare:the-tyranny-of-human-civilization-13479]] embeds
|
||||
huer1278ft's "The Tyranny of Human Civilization" SlideShare presentation
|
||||
into the Oddmuse Wiki page.
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
push(@MyRules, \&FlashboxRule);
|
||||
|
||||
# "FlashboxRule" conflicts with "CreoleRule"-style interpretation of "[[...]]"
|
||||
# syntax; and must, thus, be applied before that rule.
|
||||
$RuleOrder{\&FlashboxRule} = -11;
|
||||
|
||||
sub FlashboxRule {
|
||||
if (/\G\[\[googlevideo:([0-9-]+)\]\]/cgi) {
|
||||
return FlashboxHtml('googlevideo',
|
||||
"http://video.google.com/googleplayer.swf?docId=${1}&hl=en");
|
||||
}
|
||||
elsif (/\G\[\[slideshare:([a-z0-9-]+)\]\]/cgi) {
|
||||
return FlashboxHtml('slideshare',
|
||||
"http://static.slideshare.net/swf/ssplayer2.swf?doc=${1}");
|
||||
}
|
||||
elsif (/\G\[\[youtube:([a-z0-9-_]{11})\]\]/cgi) {
|
||||
return FlashboxHtml('youtube',
|
||||
"http://www.youtube.com/v/${1}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub FlashboxHtml {
|
||||
my ($paragraph_class, $flashbox_url) = @_;
|
||||
return
|
||||
($bol
|
||||
? CloseHtmlEnvironments().AddHtmlEnvironment('p', qq~class="flashbox ${paragraph_class}"~)
|
||||
: '').qq~
|
||||
<object width="${FlashboxWidth}" height="${FlashboxHeight}">
|
||||
<param name="movie" value="${flashbox_url}"/>
|
||||
<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"/>
|
||||
<param name="quality" value="high"/>
|
||||
<param name="wmode" value="transparent"/>
|
||||
<param name="allowFullScreen" value="true"/>
|
||||
<param name="allowScriptAccess" value="always"/>
|
||||
<embed type="application/x-shockwave-flash"
|
||||
width="${FlashboxWidth}" height="${FlashboxHeight}"
|
||||
src="${flashbox_url}"
|
||||
wmode="transparent"
|
||||
allowscriptaccess="always" allowfullscreen="true"/>
|
||||
</object>~;
|
||||
}
|
||||
|
||||
=head1 CSS
|
||||
|
||||
flashbox also provides a few new HTML classes for CSS-stylizing the HTML emitted
|
||||
by these markup rules. Of necessity, flashbox embeds Flash videos in an
|
||||
"<object>...</object>" HTML tag-set; technically, therefore, you can stylize
|
||||
such videos with a CSS selector resembling:
|
||||
|
||||
# This CSS selector selects all HTML-embedded objects (e.g., Flash videos).
|
||||
object {
|
||||
# These CSS properties are supposed to horizontally center such objects;
|
||||
# however, they do not.
|
||||
margin: 1.500em auto;
|
||||
padding: 1.500em 0.000em 0.500em 0.000em;
|
||||
text-align: center;
|
||||
text-indent: 0.000em;
|
||||
}
|
||||
|
||||
Unfortunately, most browsers ignore most CSS properties on the CSS "object"
|
||||
selector (including those in the example, above).
|
||||
|
||||
To circumvent this, flashbox enwraps all block-level, flashbox-specific markup
|
||||
(i.e., flashbox-specific markup preceded by at least two newlines) within an
|
||||
HTML paragraph having two unique classes. This HTML paragraph, unlike the
|
||||
"<object>...</object>" HTML tag-set, is styleable by all browsers via CSS
|
||||
selection of these classes:
|
||||
|
||||
=over
|
||||
|
||||
=item "flashbox"; and
|
||||
|
||||
=item "googlevideo", "youtube", or "slideshare" - according to which offsite host
|
||||
a Flash video is embedded from.
|
||||
|
||||
=back
|
||||
|
||||
Let's illustrate with a crude example. Suppose some Oddmuse Wiki page contains
|
||||
this text markup:
|
||||
|
||||
In this compelling reading of his, perhaps, most well-read poetry, Carl Sagan
|
||||
thunders the truth, Vangelis supplies the angel’s harp and music, and YouTube
|
||||
plies the photo-montage seas of "this pale, blue dot": our Earth, from afar.
|
||||
|
||||
[[YouTube:p86BPM1GV8M]]
|
||||
|
||||
Then, flashbox transmutes that text markup into HTML markup resembling:
|
||||
|
||||
<p>
|
||||
In this compelling reading of his, perhaps, most well-read poetry, Carl Sagan
|
||||
thunders the truth, Vangelis supplies the angel’s harp and music, and YouTube
|
||||
plies the photo-montage seas of "this pale, blue dot": our Earth, from afar.
|
||||
</p>
|
||||
<p class="flashbox youtube">
|
||||
<object width="420" height="350">
|
||||
<param name="movie" value="http://www.youtube.com/v/p86BPM1GV8M"/>
|
||||
<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"/>
|
||||
<embed type="application/x-shockwave-flash"
|
||||
width="420" height="350"
|
||||
src="http://www.youtube.com/v/p86BPM1GV8M"/>
|
||||
</object>
|
||||
</p>
|
||||
|
||||
Then, your CSS stylesheet can style this HTML markup with CSS resembling:
|
||||
|
||||
# This CSS selector selects flashbox-embedded Flash videos.
|
||||
p.flashbox {
|
||||
# These CSS properties horizontally center such videos.
|
||||
margin: 1.500em auto;
|
||||
padding: 1.500em 0.000em 0.500em 0.000em;
|
||||
text-align: center;
|
||||
text-indent: 0.000em;
|
||||
}
|
||||
|
||||
# This CSS selector selects flashbox-embedded, YouTube-specific Flash videos.
|
||||
p.youtube {
|
||||
# These CSS properties background and border such videos.
|
||||
background: #334466;
|
||||
border: #112255 0.125em solid;
|
||||
}
|
||||
|
||||
Wew! There; that wasn't so gruesomely detailed, was it?
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
The oddmuse.org "YouTube" page off which this Oddmuse extension was founded, at:
|
||||
|
||||
L<http://www.oddmuse.org/cgi-bin/oddmuse/YouTube>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
The information below applies to everything in this distribution,
|
||||
except where noted.
|
||||
|
||||
Copyleft 2008 by B.w.Curry <http://www.raiazome.com>.
|
||||
|
||||
This file is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this file; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
=cut
|
||||
@@ -17,7 +17,6 @@
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('flickrgallery.pl', 'FlickrGallery Module');
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
# ====================[ footnotes.pl ]====================
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
footnotes - An Oddmuse module for adding footnotes to Oddmuse Wiki pages.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
AddModuleDescription('form_timeout.pl', 'Form Timeout Extension');
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use v5.10;
|
||||
|
||||
# ====================[ forms.pl ]====================
|
||||
|
||||
|
||||