forked from github/kensanata.oddmuse
Compare commits
104 Commits
fake-time
...
return-obj
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8ac7a2818 | ||
|
|
1cd33b691c | ||
|
|
9d7e5b43c0 | ||
|
|
1c4e082755 | ||
|
|
31c02d6e95 | ||
|
|
26bf8a3043 | ||
|
|
ac21a8e6a4 | ||
|
|
a000937768 | ||
|
|
4eef4d2d76 | ||
|
|
92410a1f5c | ||
|
|
aa89d08e08 | ||
|
|
244ddb5157 | ||
|
|
9c3456c963 | ||
|
|
ad9afbf5ba | ||
|
|
bc079133f7 | ||
|
|
69a0f3ed23 | ||
|
|
1fc3600329 | ||
|
|
c1141cd610 | ||
|
|
300d86b2cd | ||
|
|
d609a857c0 | ||
|
|
8e98298777 | ||
|
|
0642fad8f8 | ||
|
|
d10d76c475 | ||
|
|
8aa2f04995 | ||
|
|
b3a1f199c1 | ||
|
|
9fbf8a6f39 | ||
|
|
c96b9bb71c | ||
|
|
71ff0f7de3 | ||
|
|
89fa22d1c9 | ||
|
|
7582aaaba1 | ||
|
|
58e9a1e240 | ||
|
|
bd39fe5d38 | ||
|
|
1c776e1080 | ||
|
|
d088887337 | ||
|
|
0ba76bafb2 | ||
|
|
c7756a8861 | ||
|
|
5462b215be | ||
|
|
f98374df9b | ||
|
|
4614990e04 | ||
|
|
6658886b72 | ||
|
|
5130a92f9c | ||
|
|
a602bc0678 | ||
|
|
09efd911e6 | ||
|
|
958c118649 | ||
|
|
c031898184 | ||
|
|
d32ebaddc8 | ||
|
|
9c90bba602 | ||
|
|
93cc1578d0 | ||
|
|
79610f7490 | ||
|
|
be2b87635c | ||
|
|
8e38179b66 | ||
|
|
1300cfad52 | ||
|
|
bc6ae67a9a | ||
|
|
c989bdab1d | ||
|
|
3d339a2bf5 | ||
|
|
ac7d68d134 | ||
|
|
a50c2da042 | ||
|
|
6ccf5b7c14 | ||
|
|
7a54eff9b1 | ||
|
|
3c2ff5577b | ||
|
|
d721704a1f | ||
|
|
2ba67e1d8b | ||
|
|
eb0a4b6416 | ||
|
|
7f9b23a704 | ||
|
|
1576c80c9f | ||
|
|
894748b6b8 | ||
|
|
a70618c3be | ||
|
|
7e92227414 | ||
|
|
57788b375a | ||
|
|
b363cb535f | ||
|
|
e31662cda6 | ||
|
|
ec84200a0b | ||
|
|
6f5a4f974c | ||
|
|
7d7383de7f | ||
|
|
892d462e53 | ||
|
|
4e26f0ea37 | ||
|
|
ca0a429027 | ||
|
|
d72ee44c3d | ||
|
|
5b8caecee9 | ||
|
|
9e58992459 | ||
|
|
408df36c0b | ||
|
|
46183d0246 | ||
|
|
3e6de210f8 | ||
|
|
f50b617b76 | ||
|
|
2c4df27922 | ||
|
|
823f518615 | ||
|
|
2a2987ac79 | ||
|
|
dfd97d4958 | ||
|
|
826d1cd6ef | ||
|
|
642cec5e7d | ||
|
|
dfa71cb2e3 | ||
|
|
5ed32a6d3f | ||
|
|
06c7fedec0 | ||
|
|
b29ce6c44d | ||
|
|
ef6d9172f5 | ||
|
|
eaf4433505 | ||
|
|
259dc5c27d | ||
|
|
e606016ece | ||
|
|
c7692fad5b | ||
|
|
3206947b6b | ||
|
|
1eb5bb06a5 | ||
|
|
0b4007ff5a | ||
|
|
92c64bbba9 | ||
|
|
f7d5430451 |
@@ -1,5 +1,5 @@
|
|||||||
This is the README file distributed together with the
|
This is the README file distributed together with the
|
||||||
[[http://oddmuse.org/|Oddmuse]] script.
|
[[https://oddmuse.org/|Oddmuse]] script.
|
||||||
|
|
||||||
== Installing Oddmuse on a Debian System running Apache
|
== Installing Oddmuse on a Debian System running Apache
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ putting their names in {{{[[double square brackets]]}}}.
|
|||||||
|
|
||||||
Enjoy your wiki experience.
|
Enjoy your wiki experience.
|
||||||
|
|
||||||
Visit http://www.oddmuse.org/ to learn more about the translation
|
Visit https://www.oddmuse.org/ to learn more about the translation
|
||||||
files and modules that are part of this package.
|
files and modules that are part of this package.
|
||||||
|
|
||||||
== Apache
|
== Apache
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ sub main {
|
|||||||
Init(); # read config file (no modules!)
|
Init(); # read config file (no modules!)
|
||||||
$ScriptName = $site; # undo setting in the config file
|
$ScriptName = $site; # undo setting in the config file
|
||||||
$FullUrl = $site; #
|
$FullUrl = $site; #
|
||||||
|
InitPageVariables(); # call again: $ScriptName was wrong
|
||||||
binmode(STDOUT,':utf8');
|
binmode(STDOUT,':utf8');
|
||||||
$q->charset('utf8');
|
$q->charset('utf8');
|
||||||
if ($q->path_info eq '/source') {
|
if ($q->path_info eq '/source') {
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ This command is used to reflect new pages to `oddmuse-pages-hash'."
|
|||||||
("{{{.*?}}}"
|
("{{{.*?}}}"
|
||||||
0 '(face shadow
|
0 '(face shadow
|
||||||
help-echo "Creole code"))
|
help-echo "Creole code"))
|
||||||
("^{{{\n\\(.*\n\\)+?}}}\n"
|
("^{{{\\(.*\n\\)+?}}}\n"
|
||||||
0 '(face shadow
|
0 '(face shadow
|
||||||
help-echo "Creole multiline code")))
|
help-echo "Creole multiline code")))
|
||||||
"Implement markup rules for the Creole markup extension.
|
"Implement markup rules for the Creole markup extension.
|
||||||
@@ -841,7 +841,9 @@ 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
|
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
|
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
|
loading the page Use a prefix argument to force a reload of the
|
||||||
page."
|
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."
|
||||||
(interactive (oddmuse-pagename))
|
(interactive (oddmuse-pagename))
|
||||||
(make-directory (concat oddmuse-directory "/" wiki) t)
|
(make-directory (concat oddmuse-directory "/" wiki) t)
|
||||||
(let ((name (concat wiki ":" pagename)))
|
(let ((name (concat wiki ":" pagename)))
|
||||||
|
|||||||
114
contrib/undo-double-quotes.pl
Executable file
114
contrib/undo-double-quotes.pl
Executable file
@@ -0,0 +1,114 @@
|
|||||||
|
#! /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);
|
||||||
|
}
|
||||||
170
contrib/undo-local-names.pl
Executable file
170
contrib/undo-local-names.pl
Executable file
@@ -0,0 +1,170 @@
|
|||||||
|
#! /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);
|
||||||
|
}
|
||||||
128
contrib/undo-usemod.pl
Executable file
128
contrib/undo-usemod.pl
Executable file
@@ -0,0 +1,128 @@
|
|||||||
|
#! /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-face {
|
||||||
font-family: 'Symbola';
|
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 {
|
body, rss {
|
||||||
@@ -271,7 +271,7 @@ label[for="searchlang"], #searchlang, .header input[type="submit"] {
|
|||||||
visibility: hidden; position: absolute;
|
visibility: hidden; position: absolute;
|
||||||
}
|
}
|
||||||
/* wrap on the iphone */
|
/* wrap on the iphone */
|
||||||
@media media only screen and (max-device-width: 480px) {
|
@media only screen and (max-device-width: 480px) {
|
||||||
}
|
}
|
||||||
|
|
||||||
.header input {
|
.header input {
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ div.footer hr {
|
|||||||
|
|
||||||
div.content > div.comment {
|
div.content > div.comment {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
padding-top: none;
|
padding-top: 0;
|
||||||
border-left: 1ex solid #bbb;
|
border-left: 1ex solid #bbb;
|
||||||
padding-left: 1ex;
|
padding-left: 1ex;
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,12 @@ pre {
|
|||||||
|
|
||||||
tt, pre, code {
|
tt, pre, code {
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background: #eee;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Gentium Basic';
|
font-family: 'Gentium Basic';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ my @path = split(/\//, $ENV{REDIRECT_URL});
|
|||||||
my $file = $path[$#path];
|
my $file = $path[$#path];
|
||||||
|
|
||||||
# for dynamic pages
|
# for dynamic pages
|
||||||
use vars qw($NotFoundHandlerExceptionsPage);
|
our ($NotFoundHandlerExceptionsPage);
|
||||||
$NotFoundHandlerExceptionsPage = 'NoCachePages';
|
$NotFoundHandlerExceptionsPage = 'NoCachePages';
|
||||||
$RunCGI = 0;
|
$RunCGI = 0;
|
||||||
do $script;
|
do $script;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('aawrapperdiv.pl', 'WrapperDiv Module');
|
AddModuleDescription('aawrapperdiv.pl', 'WrapperDiv Module');
|
||||||
|
|
||||||
@@ -35,8 +36,7 @@ sub WrapperGetHeader {
|
|||||||
*PrintFooter = \&WrapperPrintFooter;
|
*PrintFooter = \&WrapperPrintFooter;
|
||||||
|
|
||||||
sub WrapperPrintFooter {
|
sub WrapperPrintFooter {
|
||||||
my ($id, $rev, $comment) = @_;
|
|
||||||
print $q->start_div({-class=>'wrapper close'});
|
print $q->start_div({-class=>'wrapper close'});
|
||||||
print $q->end_div(), $q->end_div();
|
print $q->end_div(), $q->end_div();
|
||||||
OldPrintFooter($id, $rev, $comment);
|
OldPrintFooter(@_);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('accesskeys.pl', 'Links With AccessKeys Extension');
|
AddModuleDescription('accesskeys.pl', 'Links With AccessKeys Extension');
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ our (@MyRules, $FreeLinkPattern);
|
|||||||
|
|
||||||
push(@MyRules, \&LinksWithAccessKeys);
|
push(@MyRules, \&LinksWithAccessKeys);
|
||||||
sub LinksWithAccessKeys {
|
sub LinksWithAccessKeys {
|
||||||
if (m/\G(\[\[$FreeLinkPattern\{(.)\}\]\])/cog) {
|
if (m/\G(\[\[$FreeLinkPattern\{(.)\}\]\])/cg) {
|
||||||
my ($id, $key) = ($2, $3);
|
my ($id, $key) = ($2, $3);
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
$id = FreeToNormal($id);
|
$id = FreeToNormal($id);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
our ($q, %Page, %Action, $IndexFile, $PageDir, $KeepDir, @MyAdminCode, $RefererDir);
|
our ($q, %Page, %Action, $IndexFile, $PageDir, $KeepDir, @MyAdminCode, $RefererDir);
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ sub AdminPowerDelete {
|
|||||||
} else {
|
} else {
|
||||||
print $q->p(GetPageLink($id) . ' ' . T('deleted'));
|
print $q->p(GetPageLink($id) . ' ' . T('deleted'));
|
||||||
WriteRcLog($id, Ts('Deleted %s', $id), 0, $Page{revision},
|
WriteRcLog($id, Ts('Deleted %s', $id), 0, $Page{revision},
|
||||||
GetParam('username', ''), GetRemoteHost(), $Page{languages},
|
GetParam('username', ''), $q->remote_addr(), $Page{languages},
|
||||||
GetCluster($Page{text}));
|
GetCluster($Page{text}));
|
||||||
}
|
}
|
||||||
# Regenerate index on next request
|
# Regenerate index on next request
|
||||||
@@ -88,10 +89,10 @@ sub AdminPowerRename {
|
|||||||
# RecentChanges
|
# RecentChanges
|
||||||
OpenPage($new);
|
OpenPage($new);
|
||||||
WriteRcLog($id, Ts('Renamed to %s', $new), 0, $Page{revision},
|
WriteRcLog($id, Ts('Renamed to %s', $new), 0, $Page{revision},
|
||||||
GetParam('username', ''), GetRemoteHost(), $Page{languages},
|
GetParam('username', ''), $q->remote_addr(), $Page{languages},
|
||||||
GetCluster($Page{text}));
|
GetCluster($Page{text}));
|
||||||
WriteRcLog($new, Ts('Renamed from %s', $id), 0, $Page{revision},
|
WriteRcLog($new, Ts('Renamed from %s', $id), 0, $Page{revision},
|
||||||
GetParam('username', ''), GetRemoteHost(), $Page{languages},
|
GetParam('username', ''), $q->remote_addr(), $Page{languages},
|
||||||
GetCluster($Page{text}));
|
GetCluster($Page{text}));
|
||||||
print $q->p(Tss('Renamed %1 to %2.', GetPageLink($id), GetPageLink($new)));
|
print $q->p(Tss('Renamed %1 to %2.', GetPageLink($id), GetPageLink($new)));
|
||||||
ReleaseLock();
|
ReleaseLock();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('adsense.pl', 'AdSense Module');
|
AddModuleDescription('adsense.pl', 'AdSense Module');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('advanced-uploads.pl', 'Advanced File Upload Extension');
|
AddModuleDescription('advanced-uploads.pl', 'Advanced File Upload Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('age.pl', 'Age Indication Extension');
|
AddModuleDescription('age.pl', 'Age Indication Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('aggregate.pl', 'Front Page Extension');
|
AddModuleDescription('aggregate.pl', 'Front Page Extension');
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ our ($q, $bol, %Action, %Page, $OpenPageName, $UseDiff, $UsePathInfo, $RssStyleS
|
|||||||
push(@MyRules, \&AggregateRule);
|
push(@MyRules, \&AggregateRule);
|
||||||
|
|
||||||
sub AggregateRule {
|
sub AggregateRule {
|
||||||
if ($bol && m/\G(<aggregate\s+((("[^\"&]+",?\s*)+)|(sort\s+)?search\s+(.+?))>)/gc) {
|
if ($bol && m/\G(<aggregate\s+((("[^\"&]+",?\s*)+)|(sort\s+)?search\s+(.+?))>)/cg) {
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
my ($oldpos, $old_, $str, $sort, $search) = ((pos), $_, $3, $5, $6);
|
my ($oldpos, $old_, $str, $sort, $search) = ((pos), $_, $3, $5, $6);
|
||||||
@@ -125,8 +126,8 @@ sub DoAggregate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach my $id (@pages) {
|
foreach my $id (@pages) {
|
||||||
my %data = ParseData(ReadFileOrDie(GetPageFile(FreeToNormal($id))));
|
my $data = ParseData(ReadFileOrDie(GetPageFile(FreeToNormal($id))));
|
||||||
my $page = $data{text};
|
my $page = $data->{text};
|
||||||
my $size = length($page);
|
my $size = length($page);
|
||||||
my $i = index($page, "\n=");
|
my $i = index($page, "\n=");
|
||||||
my $j = index($page, "\n----");
|
my $j = index($page, "\n----");
|
||||||
@@ -135,13 +136,13 @@ sub DoAggregate {
|
|||||||
$page =~ s/^=.*\n//; # if it starts with a header
|
$page =~ s/^=.*\n//; # if it starts with a header
|
||||||
my $name = $id;
|
my $name = $id;
|
||||||
$name =~ s/_/ /g;
|
$name =~ s/_/ /g;
|
||||||
my $date = TimeToRFC822($data{ts});
|
my $date = TimeToRFC822($data->{ts});
|
||||||
my $host = $data{host};
|
my $host = $data->{host};
|
||||||
my $username = $data{username};
|
my $username = $data->{username};
|
||||||
$username = QuoteHtml($username);
|
$username = QuoteHtml($username);
|
||||||
$username = $host unless $username;
|
$username = $host unless $username;
|
||||||
my $minor = $data{minor};
|
my $minor = $data->{minor};
|
||||||
my $revision = $data{revision};
|
my $revision = $data->{revision};
|
||||||
my $cluster = GetCluster($page);
|
my $cluster = GetCluster($page);
|
||||||
my $description = ToString(sub { ApplyRules(QuoteHtml($page), 1, 0, undef, 'p') });
|
my $description = ToString(sub { ApplyRules(QuoteHtml($page), 1, 0, undef, 'p') });
|
||||||
$description .= $q->p(GetPageLink($id, T('Learn more...')))
|
$description .= $q->p(GetPageLink($id, T('Learn more...')))
|
||||||
|
|||||||
119
modules/agree-disagree.pl
Normal file
119
modules/agree-disagree.pl
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
# 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) . "]"/eg });
|
||||||
|
push(@MyMacros, sub{ s/\[\+(:[^]:]+)\]/"[+$1:" . TimeToText($Now) . "]"/eg });
|
||||||
|
push(@MyMacros, sub{ s/\[\-\]/"[-:" . GetParam('username', T('Anonymous'))
|
||||||
|
. ':' . TimeToText($Now) . "]"/eg });
|
||||||
|
push(@MyMacros, sub{ s/\[\-(:[^]:]+)\]/"[-$1:" . TimeToText($Now) . "]"/eg });
|
||||||
|
|
||||||
|
|
||||||
|
$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*\[-(.*?)\])+)/cgs) {
|
||||||
|
|
||||||
|
my $votes = $1;
|
||||||
|
my @ayes = ();
|
||||||
|
my @nayes = ();
|
||||||
|
while ($votes =~ m/\G.*?\[\+(.*?)\]/cgs) {
|
||||||
|
my ($ignore, $name, $time) = split(/:/, $1, 3);
|
||||||
|
push(@ayes, $name);
|
||||||
|
}
|
||||||
|
my $votes2 = $votes;
|
||||||
|
while ($votes2 =~ m/\G.*?\[-(.*?)\]/cgs) {
|
||||||
|
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,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('all.pl', 'All Action');
|
AddModuleDescription('all.pl', 'All Action');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('anchors.pl', 'Local Anchor Extension');
|
AddModuleDescription('anchors.pl', 'Local Anchor Extension');
|
||||||
|
|
||||||
@@ -20,13 +21,13 @@ our ($q, %Page, $FootnoteNumber, $FreeLinkPattern, @MyRules, $BracketWiki);
|
|||||||
push(@MyRules, \&AnchorsRule);
|
push(@MyRules, \&AnchorsRule);
|
||||||
|
|
||||||
sub AnchorsRule {
|
sub AnchorsRule {
|
||||||
if (m/\G\[\[\#$FreeLinkPattern\]\]/gc) {
|
if (m/\G\[\[\#$FreeLinkPattern\]\]/cg) {
|
||||||
return $q->a({-href=>'#' . FreeToNormal($1), -class=>'local anchor'}, $1);
|
return $q->a({-href=>'#' . FreeToNormal($1), -class=>'local anchor'}, $1);
|
||||||
} elsif ($BracketWiki && m/\G\[\[\#$FreeLinkPattern\|([^\]]+)\]\]/gc) {
|
} elsif ($BracketWiki && m/\G\[\[\#$FreeLinkPattern\|([^\]]+)\]\]/cg) {
|
||||||
return $q->a({-href=>'#' . FreeToNormal($1), -class=>'local anchor'}, $2);
|
return $q->a({-href=>'#' . FreeToNormal($1), -class=>'local anchor'}, $2);
|
||||||
} elsif ($BracketWiki && m/\G(\[\[$FreeLinkPattern\#$FreeLinkPattern\|([^\]]+)\]\])/cog
|
} elsif ($BracketWiki && m/\G(\[\[$FreeLinkPattern\#$FreeLinkPattern\|([^\]]+)\]\])/cg
|
||||||
or m/\G(\[\[\[$FreeLinkPattern\#$FreeLinkPattern\]\]\])/cog
|
or m/\G(\[\[\[$FreeLinkPattern\#$FreeLinkPattern\]\]\])/cg
|
||||||
or m/\G(\[\[$FreeLinkPattern\#$FreeLinkPattern\]\])/cog) {
|
or m/\G(\[\[$FreeLinkPattern\#$FreeLinkPattern\]\])/cg) {
|
||||||
# This one is not a dirty rule because the output is always a page
|
# This one is not a dirty rule because the output is always a page
|
||||||
# link, never an edit link (unlike normal free links).
|
# link, never an edit link (unlike normal free links).
|
||||||
my $bracket = (substr($1, 0, 3) eq '[[[');
|
my $bracket = (substr($1, 0, 3) eq '[[[');
|
||||||
@@ -46,7 +47,7 @@ sub AnchorsRule {
|
|||||||
$text = $id unless $text;
|
$text = $id unless $text;
|
||||||
$text =~ s/_/ /g;
|
$text =~ s/_/ /g;
|
||||||
return ScriptLink(UrlEncode($id), $text, $class, undef, $title);
|
return ScriptLink(UrlEncode($id), $text, $class, undef, $title);
|
||||||
} elsif (m/\G\[\:$FreeLinkPattern\]/gc) {
|
} elsif (m/\G\[\:$FreeLinkPattern\]/cg) {
|
||||||
return $q->a({-name=>FreeToNormal($1), -class=>'anchor'}, '');
|
return $q->a({-name=>FreeToNormal($1), -class=>'anchor'}, '');
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('antispam.pl', 'Antispam Module');
|
AddModuleDescription('antispam.pl', 'Antispam Module');
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ push(@MyRules, \&MaskEmailRule);
|
|||||||
|
|
||||||
sub MaskEmailRule {
|
sub MaskEmailRule {
|
||||||
# Allow [email@foo.bar Email Me] links
|
# Allow [email@foo.bar Email Me] links
|
||||||
if (m/\G\[($EmailRegExp(\s\w+)*\s*)\]/igc) {
|
if (m/\G\[($EmailRegExp(\s\w+)*\s*)\]/cgi) {
|
||||||
my $chunk = $1;
|
my $chunk = $1;
|
||||||
$chunk =~ s/($EmailRegExp)//i;
|
$chunk =~ s/($EmailRegExp)//i;
|
||||||
my $email = $1;
|
my $email = $1;
|
||||||
@@ -50,7 +51,7 @@ sub MaskEmailRule {
|
|||||||
return "<a href=\"mailto:$email\">$chunk</a>";
|
return "<a href=\"mailto:$email\">$chunk</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m/\G($EmailRegExp)/igc) {
|
if (m/\G($EmailRegExp)/cgi) {
|
||||||
my $email = $1;
|
my $email = $1;
|
||||||
if ($DoMaskEmail) {
|
if ($DoMaskEmail) {
|
||||||
my $masked="";
|
my $masked="";
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('archive.pl', 'Archive Extension');
|
AddModuleDescription('archive.pl', 'Archive Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('askpage.pl', 'Ask Page Extension');
|
AddModuleDescription('askpage.pl', 'Ask Page Extension');
|
||||||
|
|
||||||
@@ -50,12 +51,14 @@ sub NewAskPageDoPost {
|
|||||||
OldAskPageDoPost($id, @_); # keep original functionality for regular edits
|
OldAskPageDoPost($id, @_); # keep original functionality for regular edits
|
||||||
}
|
}
|
||||||
|
|
||||||
*OldAskPageGetCommentForm=\&GetCommentForm;
|
*OldAskPageGetTextArea=\&GetTextArea;
|
||||||
*GetCommentForm=\&NewAskPageGetCommentForm;
|
*GetTextArea=\&NewAskPageGetTextArea;
|
||||||
sub NewAskPageGetCommentForm {
|
sub NewAskPageGetTextArea {
|
||||||
my ($id, $rev, $comment) = @_;
|
my ($name, $text, @rest) = @_;
|
||||||
$comment = $NewQuestion if not $comment and $id eq $AskPage;
|
if ($name eq 'aftertext' and not $text and GetId() eq $AskPage) {
|
||||||
OldAskPageGetCommentForm(@_);
|
$text = $NewQuestion;
|
||||||
|
}
|
||||||
|
OldAskPageGetTextArea($name, $text, @rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
*OldAskPageJournalSort=\&JournalSort;
|
*OldAskPageJournalSort=\&JournalSort;
|
||||||
|
|||||||
@@ -14,7 +14,9 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
|
use XML::Atom;
|
||||||
use XML::Atom::Entry;
|
use XML::Atom::Entry;
|
||||||
use XML::Atom::Link;
|
use XML::Atom::Link;
|
||||||
use XML::Atom::Person;
|
use XML::Atom::Person;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
# ====================[ autolock.pl ]====================
|
# ====================[ autolock.pl ]====================
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ sub UserCanEditAutoLockFix {
|
|||||||
return 0 if $LockOnCreation{$id} and not -f GetPageFile($id); # new page
|
return 0 if $LockOnCreation{$id} and not -f GetPageFile($id); # new page
|
||||||
return 0 if !$EditAllowed or -f $NoEditFile;
|
return 0 if !$EditAllowed or -f $NoEditFile;
|
||||||
return 0 if $editing and UserIsBanned(); # this call is more expensive
|
return 0 if $editing and UserIsBanned(); # this call is more expensive
|
||||||
return 0 if $EditAllowed >= 2 and (not $CommentsPrefix or $id !~ /^$CommentsPrefix/o);
|
return 0 if $EditAllowed >= 2 and (not $CommentsPrefix or $id !~ /^$CommentsPrefix/);
|
||||||
return 1 if $EditAllowed >= 3 and ($comment or (GetParam('aftertext', '') and not GetParam('text', '')));
|
return 1 if $EditAllowed >= 3 and ($comment or (GetParam('aftertext', '') and not GetParam('text', '')));
|
||||||
return 0 if $EditAllowed >= 3;
|
return 0 if $EditAllowed >= 3;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
# ie: http://search.cpan.org/CPAN/authors/id/C/CH/CHAMAS/MLDBM-2.01.tar.gz
|
# ie: http://search.cpan.org/CPAN/authors/id/C/CH/CHAMAS/MLDBM-2.01.tar.gz
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
use Fcntl;
|
use Fcntl;
|
||||||
use MLDBM qw( DB_File Storable );
|
use MLDBM qw( DB_File Storable );
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Backlinks_Extension
|
# http://www.oddmuse.org/cgi-bin/oddmuse/Backlinks_Extension
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('backlinks.pl', 'Backlinks Extension');
|
AddModuleDescription('backlinks.pl', 'Backlinks Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ the IP or hostname will be added to the C<BannedHosts> page for you.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
our ($q, $Now, %Page, $OpenPageName, %Action, $UrlPattern, $BannedContent, $BannedHosts, @MyAdminCode);
|
our ($q, $Now, %Page, $OpenPageName, %Action, $UrlPattern, $BannedContent, $BannedHosts, @MyAdminCode);
|
||||||
|
|
||||||
AddModuleDescription('ban-contributors.pl', 'Ban Contributors Extension');
|
AddModuleDescription('ban-contributors.pl', 'Ban Contributors Extension');
|
||||||
@@ -123,10 +124,10 @@ sub NewBanContributorsWriteRcLog {
|
|||||||
and $OpenPageName eq $id and UserIsAdmin()) {
|
and $OpenPageName eq $id and UserIsAdmin()) {
|
||||||
# we currently have the clean page loaded, so we need to reload
|
# we currently have the clean page loaded, so we need to reload
|
||||||
# the spammed revision (there is a possible race condition here)
|
# the spammed revision (there is a possible race condition here)
|
||||||
my ($old) = GetTextRevision($Page{revision}-1, 1);
|
my $old = GetTextRevision($Page{revision} - 1, 1)->{text};
|
||||||
my %urls = map {$_ => 1 } $old =~ /$UrlPattern/og;
|
my %urls = map {$_ => 1 } $old =~ /$UrlPattern/g;
|
||||||
# we open the file again to force a load of the despammed page
|
# we open the file again to force a load of the despammed page
|
||||||
foreach my $url ($Page{text} =~ /$UrlPattern/og) {
|
foreach my $url ($Page{text} =~ /$UrlPattern/g) {
|
||||||
delete($urls{$url});
|
delete($urls{$url});
|
||||||
}
|
}
|
||||||
# we also remove any candidates that are already banned
|
# we also remove any candidates that are already banned
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
|
# Copyright (C) 2013–2015 Alex Schroeder <alex@gnu.org>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it under
|
# 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
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
@@ -16,10 +16,11 @@
|
|||||||
# editors will be logged.
|
# editors will be logged.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('ban-quick-editors.pl', 'Banning Quick Editors');
|
AddModuleDescription('ban-quick-editors.pl', 'Banning Quick Editors');
|
||||||
|
|
||||||
our ($Now, %RecentVisitors, $SurgeProtection);
|
our ($q, $Now, %RecentVisitors, $SurgeProtection);
|
||||||
|
|
||||||
*BanQuickOldUserIsBanned = \&UserIsBanned;
|
*BanQuickOldUserIsBanned = \&UserIsBanned;
|
||||||
*UserIsBanned = \&BanQuickNewUserIsBanned;
|
*UserIsBanned = \&BanQuickNewUserIsBanned;
|
||||||
@@ -29,7 +30,7 @@ sub BanQuickNewUserIsBanned {
|
|||||||
if (not $rule
|
if (not $rule
|
||||||
and $SurgeProtection # need surge protection
|
and $SurgeProtection # need surge protection
|
||||||
and GetParam('title')) {
|
and GetParam('title')) {
|
||||||
my $name = GetParam('username', GetRemoteHost());
|
my $name = GetParam('username', $q->remote_addr());
|
||||||
my @entries = @{$RecentVisitors{$name}};
|
my @entries = @{$RecentVisitors{$name}};
|
||||||
# $entry[0] is $Now after AddRecentVisitor
|
# $entry[0] is $Now after AddRecentVisitor
|
||||||
my $ts = $entries[1];
|
my $ts = $entries[1];
|
||||||
|
|||||||
@@ -13,14 +13,17 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('banned-regexps.pl', 'Banning Regular Expressions');
|
AddModuleDescription('banned-regexps.pl', 'Banning Regular Expressions');
|
||||||
|
|
||||||
=h1 Compatibility
|
=encoding utf8
|
||||||
|
|
||||||
|
=head1 Compatibility
|
||||||
|
|
||||||
This extension works with logbannedcontent.pl.
|
This extension works with logbannedcontent.pl.
|
||||||
|
|
||||||
=h1 Example content for the BannedRegexps page:
|
=head1 Example content for the BannedRegexps page:
|
||||||
|
|
||||||
# This page lists regular expressions that prevent the saving of a page.
|
# This page lists regular expressions that prevent the saving of a page.
|
||||||
# The regexps are matched against any page or comment submitted.
|
# The regexps are matched against any page or comment submitted.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('bbcode.pl', 'bbCode Extension');
|
AddModuleDescription('bbcode.pl', 'bbCode Extension');
|
||||||
|
|
||||||
@@ -60,12 +61,12 @@ sub bbCodeRule {
|
|||||||
return AddHtmlEnvironment('strong', qq{class="highlight"}); }
|
return AddHtmlEnvironment('strong', qq{class="highlight"}); }
|
||||||
elsif ($tag eq 'url') {
|
elsif ($tag eq 'url') {
|
||||||
if ($option) {
|
if ($option) {
|
||||||
$option =~ /^($UrlProtocols)/o;
|
$option =~ /^($UrlProtocols)/;
|
||||||
my $class = "url $1";
|
my $class = "url $1";
|
||||||
return AddHtmlEnvironment('a', qq{href="$option" class="$class"}); }
|
return AddHtmlEnvironment('a', qq{href="$option" class="$class"}); }
|
||||||
elsif (/\G$FullUrlPattern\s*\[\/url\]/cogi) {
|
elsif (/\G$FullUrlPattern\s*\[\/url\]/cgi) {
|
||||||
return GetUrl($1); }}
|
return GetUrl($1); }}
|
||||||
elsif ($tag eq 'img' and /\G$FullUrlPattern\s*\[\/img\]/cogi) {
|
elsif ($tag eq 'img' and /\G$FullUrlPattern\s*\[\/img\]/cgi) {
|
||||||
return GetUrl($1, undef, undef, 1); } # force image
|
return GetUrl($1, undef, undef, 1); } # force image
|
||||||
elsif ($tag eq 'quote') {
|
elsif ($tag eq 'quote') {
|
||||||
my $html = CloseHtmlEnvironments();
|
my $html = CloseHtmlEnvironments();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('big-brother.pl', 'Big Brother Extension');
|
AddModuleDescription('big-brother.pl', 'Big Brother Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('blockquote.pl', 'Comments on Text Formatting Rules');
|
AddModuleDescription('blockquote.pl', 'Comments on Text Formatting Rules');
|
||||||
|
|
||||||
@@ -27,10 +28,10 @@ push(@MyRules, \&BlockQuoteRule);
|
|||||||
sub BlockQuoteRule {
|
sub BlockQuoteRule {
|
||||||
# indented text using : with the option of spanning multiple text
|
# indented text using : with the option of spanning multiple text
|
||||||
# paragraphs (but not lists etc).
|
# paragraphs (but not lists etc).
|
||||||
if (InElement('blockquote') && m/\G(\s*\n)+:[ \t]*/cog) {
|
if (InElement('blockquote') && m/\G(\s*\n)+:[ \t]*/cg) {
|
||||||
return CloseHtmlEnvironmentUntil('blockquote')
|
return CloseHtmlEnvironmentUntil('blockquote')
|
||||||
. AddHtmlEnvironment('p');
|
. AddHtmlEnvironment('p');
|
||||||
} elsif ($bol && m/\G(\s*\n)*:[ \t]*/cog) {
|
} elsif ($bol && m/\G(\s*\n)*:[ \t]*/cg) {
|
||||||
return CloseHtmlEnvironments()
|
return CloseHtmlEnvironments()
|
||||||
. AddHtmlEnvironment('blockquote')
|
. AddHtmlEnvironment('blockquote')
|
||||||
. AddHtmlEnvironment('p');
|
. AddHtmlEnvironment('p');
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('calendar.pl', 'Calendar Extension');
|
AddModuleDescription('calendar.pl', 'Calendar Extension');
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ sub Cal {
|
|||||||
$link .= ScriptLink('action=collect;match=' . UrlEncode($re), $day, 'local collection' . $class);
|
$link .= ScriptLink('action=collect;match=' . UrlEncode($re), $day, 'local collection' . $class);
|
||||||
}
|
}
|
||||||
$link;
|
$link;
|
||||||
}}ge;
|
}}eg;
|
||||||
$cal =~ s{(\S+) (\d\d\d\d)}{{
|
$cal =~ s{(\S+) (\d\d\d\d)}{{
|
||||||
my ($month_text, $year_text) = ($1, $2);
|
my ($month_text, $year_text) = ($1, $2);
|
||||||
my $date = sprintf("%d-%02d", $year, $mon);
|
my $date = sprintf("%d-%02d", $year, $mon);
|
||||||
@@ -117,22 +118,22 @@ sub DoCollect {
|
|||||||
push(@MyRules, \&CalendarRule);
|
push(@MyRules, \&CalendarRule);
|
||||||
|
|
||||||
sub CalendarRule {
|
sub CalendarRule {
|
||||||
if (/\G(calendar:(\d\d\d\d))/gc) {
|
if (/\G(calendar:(\d\d\d\d))/cg) {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
PrintYearCalendar($2);
|
PrintYearCalendar($2);
|
||||||
pos = $oldpos;
|
pos = $oldpos;
|
||||||
return AddHtmlEnvironment('p');
|
return AddHtmlEnvironment('p');
|
||||||
} elsif (/\G(month:(\d\d\d\d)-(\d\d))/gc) {
|
} elsif (/\G(month:(\d\d\d\d)-(\d\d))/cg) {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
print Cal($2, $3);
|
print Cal($2, $3);
|
||||||
pos = $oldpos;
|
pos = $oldpos;
|
||||||
return AddHtmlEnvironment('p');
|
return AddHtmlEnvironment('p');
|
||||||
} elsif (/\G(month:([+-]\d\d?))/gc
|
} elsif (/\G(month:([+-]\d\d?))/cg
|
||||||
or /\G(\[\[month:([+-]\d\d?) $FreeLinkPattern\]\])/gc) {
|
or /\G(\[\[month:([+-]\d\d?) $FreeLinkPattern\]\])/cg) {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('canonical.pl', 'Canonical Names');
|
AddModuleDescription('canonical.pl', 'Canonical Names');
|
||||||
|
|
||||||
|
|||||||
180
modules/cart.pl
Normal file
180
modules/cart.pl
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
# 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,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('checkbox.pl', 'Checklist Extension');
|
AddModuleDescription('checkbox.pl', 'Checklist Extension');
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ sub DoCheckBox{
|
|||||||
$summary{$3} = 0 if $2 eq 'x' or $2 eq 'X';
|
$summary{$3} = 0 if $2 eq 'x' or $2 eq 'X';
|
||||||
"${1}[[ :${3}]]";
|
"${1}[[ :${3}]]";
|
||||||
}
|
}
|
||||||
}eig;
|
}egi;
|
||||||
SetParam('text', $text);
|
SetParam('text', $text);
|
||||||
SetParam('summary', join(', ', map {
|
SetParam('summary', join(', ', map {
|
||||||
if ($summary{$_}) {
|
if ($summary{$_}) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('clustermap.pl', 'ClusterMap Module');
|
AddModuleDescription('clustermap.pl', 'ClusterMap Module');
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ foreach (@ClusterMapAdminPages){
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub ClusterMapRule {
|
sub ClusterMapRule {
|
||||||
if (/\G^([\n\r]*\<\s*clustermap\s*\>\s*)$/mgc) {
|
if (/\G^([\n\r]*\<\s*clustermap\s*\>\s*)$/cgm) {
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
my $oldstr = $_;
|
my $oldstr = $_;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('comment-div-wrapper.pl', 'Comment Div Wrapper Extension');
|
AddModuleDescription('comment-div-wrapper.pl', 'Comment Div Wrapper Extension');
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ sub CommentDivWrapper {
|
|||||||
return $q->start_div({-class=>'userComment'});
|
return $q->start_div({-class=>'userComment'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($OpenPageName =~ /$CommentsPattern/o) {
|
if ($OpenPageName =~ /$CommentsPattern/) {
|
||||||
if ($bol and m/\G(\s*\n)*----+[ \t]*\n?/cg) {
|
if ($bol and m/\G(\s*\n)*----+[ \t]*\n?/cg) {
|
||||||
my $html = CloseHtmlEnvironments()
|
my $html = CloseHtmlEnvironments()
|
||||||
. ($CommentDiv++ > 0 ? $q->end_div() : $q->h2({-class=>'commentsHeading'}, T('Comments:'))) . $q->start_div({-class=>'userComment'})
|
. ($CommentDiv++ > 0 ? $q->end_div() : $q->h2({-class=>'commentsHeading'}, T('Comments:'))) . $q->start_div({-class=>'userComment'})
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('commentcount.pl', 'Comment Count Extension');
|
AddModuleDescription('commentcount.pl', 'Comment Count Extension');
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ sub NewCommentcountScriptLink {
|
|||||||
if ($CommentsPrefix && $action =~ /^$CommentsPrefix(.*)/) { # TODO use $CommentsPattern ?
|
if ($CommentsPrefix && $action =~ /^$CommentsPrefix(.*)/) { # TODO use $CommentsPattern ?
|
||||||
# Add the number of comments here
|
# Add the number of comments here
|
||||||
my $id = $action;
|
my $id = $action;
|
||||||
$id =~ s/%([0-9a-f][0-9a-f])/chr(hex($1))/ge; # undo urlencode
|
$id =~ s/%([0-9a-f][0-9a-f])/chr(hex($1))/eg; # undo urlencode
|
||||||
my $comments = GetPageContent($id);
|
my $comments = GetPageContent($id);
|
||||||
my $num = 0;
|
my $num = 0;
|
||||||
if($comments =~ /=== (\d+) Comments?\. ===/) {
|
if($comments =~ /=== (\d+) Comments?\. ===/) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('compilation.pl', 'Compilation Extension');
|
AddModuleDescription('compilation.pl', 'Compilation Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('context.pl', 'Calendar Extension');
|
AddModuleDescription('context.pl', 'Calendar Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
# Of course, you can customize this to store more information
|
# Of course, you can customize this to store more information
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('creationdate.pl', 'CreationDate Module');
|
AddModuleDescription('creationdate.pl', 'CreationDate Module');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
# ====================[ creole.pl ]====================
|
# ====================[ creole.pl ]====================
|
||||||
|
|
||||||
@@ -217,7 +218,7 @@ sub CreoleRule {
|
|||||||
}
|
}
|
||||||
# escape next char (and prevent // in URLs from enabling italics)
|
# escape next char (and prevent // in URLs from enabling italics)
|
||||||
# ~
|
# ~
|
||||||
elsif (m/\G(~($FullUrlPattern|\S))/cgo) {
|
elsif (m/\G(~($FullUrlPattern|\S))/cg) {
|
||||||
return
|
return
|
||||||
($CreoleTildeAlternative and
|
($CreoleTildeAlternative and
|
||||||
index( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
index( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
@@ -233,12 +234,12 @@ sub CreoleRule {
|
|||||||
# {{{preformatted code}}}
|
# {{{preformatted code}}}
|
||||||
elsif (m/\G\{\{\{(.*?}*)\}\}\}/cg) { return $q->code($1); }
|
elsif (m/\G\{\{\{(.*?}*)\}\}\}/cg) { return $q->code($1); }
|
||||||
# download: {{pic}} and {{pic|text}}
|
# download: {{pic}} and {{pic|text}}
|
||||||
elsif (m/\G(\{\{$FreeLinkPattern$CreoleLinkTextPattern\}\})/cgos) {
|
elsif (m/\G(\{\{$FreeLinkPattern$CreoleLinkTextPattern\}\})/cgs) {
|
||||||
my $text = $4 || $2;
|
my $text = $4 || $2;
|
||||||
return GetCreoleLinkHtml($1, GetDownloadLink(FreeToNormal($2), 1, undef, $text), $text);
|
return GetCreoleLinkHtml($1, GetDownloadLink(FreeToNormal($2), 1, undef, $text), $text);
|
||||||
}
|
}
|
||||||
# image link: {{url}} and {{url|text}}
|
# image link: {{url}} and {{url|text}}
|
||||||
elsif (m/\G\{\{$FullUrlPattern$CreoleLinkTextPattern\}\}/cgos) {
|
elsif (m/\G\{\{$FullUrlPattern$CreoleLinkTextPattern\}\}/cgs) {
|
||||||
return GetCreoleImageHtml(
|
return GetCreoleImageHtml(
|
||||||
$q->a({-href=> UnquoteHtml($1),
|
$q->a({-href=> UnquoteHtml($1),
|
||||||
-class=> 'image outside'},
|
-class=> 'image outside'},
|
||||||
@@ -249,7 +250,7 @@ sub CreoleRule {
|
|||||||
}
|
}
|
||||||
# image link: [[link|{{pic}}]] and [[link|{{pic|text}}]]
|
# image link: [[link|{{pic}}]] and [[link|{{pic|text}}]]
|
||||||
elsif (m/\G(\[\[$FreeLinkPattern$CreoleLinkPipePattern
|
elsif (m/\G(\[\[$FreeLinkPattern$CreoleLinkPipePattern
|
||||||
\{\{$FreeLinkPattern$CreoleLinkTextPattern\}\}\]\])/cgosx) {
|
\{\{$FreeLinkPattern$CreoleLinkTextPattern\}\}\]\])/cgsx) {
|
||||||
my $text = $5 || $2;
|
my $text = $5 || $2;
|
||||||
return GetCreoleLinkHtml($1, GetCreoleImageHtml(
|
return GetCreoleLinkHtml($1, GetCreoleImageHtml(
|
||||||
ScriptLink(UrlEncode(FreeToNormal($2)),
|
ScriptLink(UrlEncode(FreeToNormal($2)),
|
||||||
@@ -260,7 +261,7 @@ sub CreoleRule {
|
|||||||
}
|
}
|
||||||
# image link: [[link|{{url}}]] and [[link|{{url|text}}]]
|
# image link: [[link|{{url}}]] and [[link|{{url|text}}]]
|
||||||
elsif (m/\G(\[\[$FreeLinkPattern$CreoleLinkPipePattern
|
elsif (m/\G(\[\[$FreeLinkPattern$CreoleLinkPipePattern
|
||||||
\{\{$FullUrlPattern$CreoleLinkTextPattern\}\}\]\])/cgosx) {
|
\{\{$FullUrlPattern$CreoleLinkTextPattern\}\}\]\])/cgsx) {
|
||||||
my $text = $5 || $2;
|
my $text = $5 || $2;
|
||||||
return GetCreoleLinkHtml($1, GetCreoleImageHtml(
|
return GetCreoleLinkHtml($1, GetCreoleImageHtml(
|
||||||
ScriptLink(UrlEncode(FreeToNormal($2)),
|
ScriptLink(UrlEncode(FreeToNormal($2)),
|
||||||
@@ -271,7 +272,7 @@ sub CreoleRule {
|
|||||||
}
|
}
|
||||||
# image link: [[url|{{pic}}]] and [[url|{{pic|text}}]]
|
# image link: [[url|{{pic}}]] and [[url|{{pic|text}}]]
|
||||||
elsif (m/\G(\[\[$FullUrlPattern$CreoleLinkPipePattern
|
elsif (m/\G(\[\[$FullUrlPattern$CreoleLinkPipePattern
|
||||||
\{\{$FreeLinkPattern$CreoleLinkTextPattern\}\}\]\])/cgosx) {
|
\{\{$FreeLinkPattern$CreoleLinkTextPattern\}\}\]\])/cgsx) {
|
||||||
my $text = $5 || $2;
|
my $text = $5 || $2;
|
||||||
return GetCreoleLinkHtml($1, GetCreoleImageHtml(
|
return GetCreoleLinkHtml($1, GetCreoleImageHtml(
|
||||||
$q->a({-href=> UnquoteHtml($2), -class=> 'image outside'},
|
$q->a({-href=> UnquoteHtml($2), -class=> 'image outside'},
|
||||||
@@ -282,7 +283,7 @@ sub CreoleRule {
|
|||||||
}
|
}
|
||||||
# image link: [[url|{{url}}]] and [[url|{{url|text}}]]
|
# image link: [[url|{{url}}]] and [[url|{{url|text}}]]
|
||||||
elsif (m/\G\[\[$FullUrlPattern$CreoleLinkPipePattern
|
elsif (m/\G\[\[$FullUrlPattern$CreoleLinkPipePattern
|
||||||
\{\{$FullUrlPattern$CreoleLinkTextPattern\}\}\]\]/cgosx) {
|
\{\{$FullUrlPattern$CreoleLinkTextPattern\}\}\]\]/cgsx) {
|
||||||
return GetCreoleImageHtml(
|
return GetCreoleImageHtml(
|
||||||
$q->a({-href=> UnquoteHtml($1), -class=> 'image outside'},
|
$q->a({-href=> UnquoteHtml($1), -class=> 'image outside'},
|
||||||
$q->img({-src=> UnquoteHtml($2),
|
$q->img({-src=> UnquoteHtml($2),
|
||||||
@@ -291,7 +292,7 @@ sub CreoleRule {
|
|||||||
-class=> 'url outside'})));
|
-class=> 'url outside'})));
|
||||||
}
|
}
|
||||||
# link: [[url]] and [[url|text]]
|
# link: [[url]] and [[url|text]]
|
||||||
elsif (m/\G\[\[$FullUrlPattern$CreoleLinkTextPattern\]\]/cgos) {
|
elsif (m/\G\[\[$FullUrlPattern$CreoleLinkTextPattern\]\]/cgs) {
|
||||||
# Permit embedding of Creole syntax within link text. (Rather complicated,
|
# Permit embedding of Creole syntax within link text. (Rather complicated,
|
||||||
# but it does the job remarkably.)
|
# but it does the job remarkably.)
|
||||||
my $link_url = $1;
|
my $link_url = $1;
|
||||||
@@ -304,7 +305,7 @@ sub CreoleRule {
|
|||||||
return GetUrl($link_url, $link_text, 1);
|
return GetUrl($link_url, $link_text, 1);
|
||||||
}
|
}
|
||||||
# link: [[page]] and [[page|text]]
|
# link: [[page]] and [[page|text]]
|
||||||
elsif (m/\G(\[\[$FreeLinkPattern$CreoleLinkTextPattern\]\])/cgos) {
|
elsif (m/\G(\[\[$FreeLinkPattern$CreoleLinkTextPattern\]\])/cgs) {
|
||||||
my $markup = $1;
|
my $markup = $1;
|
||||||
my $page_name = $2;
|
my $page_name = $2;
|
||||||
my $link_text = $4 ? CreoleRuleRecursive($4, @_) : $page_name;
|
my $link_text = $4 ? CreoleRuleRecursive($4, @_) : $page_name;
|
||||||
@@ -314,7 +315,7 @@ sub CreoleRule {
|
|||||||
}
|
}
|
||||||
# interlink: [[Wiki:page]] and [[Wiki:page|text]]
|
# interlink: [[Wiki:page]] and [[Wiki:page|text]]
|
||||||
elsif ($is_interlinking and
|
elsif ($is_interlinking and
|
||||||
m/\G(\[\[$FreeInterLinkPattern$CreoleLinkTextPattern\]\])/cgos) {
|
m/\G(\[\[$FreeInterLinkPattern$CreoleLinkTextPattern\]\])/cgs) {
|
||||||
my $markup = $1;
|
my $markup = $1;
|
||||||
my $interlink = $2;
|
my $interlink = $2;
|
||||||
my $interlink_text = $4;
|
my $interlink_text = $4;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
# ====================[ creoleaddition.pl ]====================
|
# ====================[ creoleaddition.pl ]====================
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
# ====================[ crossbar.pl ]====================
|
# ====================[ crossbar.pl ]====================
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('crumbs.pl', 'List Parent Pages Extension');
|
AddModuleDescription('crumbs.pl', 'List Parent Pages Extension');
|
||||||
|
|
||||||
@@ -27,8 +28,8 @@ $RuleOrder{\&CrumbsRule} = -10; # run before default rules!
|
|||||||
|
|
||||||
sub CrumbsRule {
|
sub CrumbsRule {
|
||||||
if (not (pos) # first!
|
if (not (pos) # first!
|
||||||
and (($WikiLinks && /\G($LinkPattern\n)/cgo)
|
and (($WikiLinks && /\G($LinkPattern\n)/cg)
|
||||||
or ($FreeLinks && /\G(\[\[$FreeLinkPattern\]\]\n)/cgo))) {
|
or ($FreeLinks && /\G(\[\[$FreeLinkPattern\]\]\n)/cg))) {
|
||||||
my $oldpos = pos; # will be trashed below
|
my $oldpos = pos; # will be trashed below
|
||||||
my $cluster = FreeToNormal($2);
|
my $cluster = FreeToNormal($2);
|
||||||
my %seen = ($cluster => 1);
|
my %seen = ($cluster => 1);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('csv.pl', 'Comments on Long Table Markup Extension');
|
AddModuleDescription('csv.pl', 'Comments on Long Table Markup Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('dates.pl', 'Dates Extension');
|
AddModuleDescription('dates.pl', 'Dates Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('delete-all.pl');
|
AddModuleDescription('delete-all.pl');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
our ($q, $Now, %IndexHash, %Action, %Page, $OpenPageName, $FS, $BannedContent, $RcFile, $RcDefault, @MyAdminCode, $FullUrlPattern, $DeletedPage, $StrangeBannedContent);
|
our ($q, $Now, %IndexHash, %Action, %Page, $OpenPageName, $FS, $BannedContent, $RcFile, $RcDefault, @MyAdminCode, $FullUrlPattern, $DeletedPage, $StrangeBannedContent);
|
||||||
|
|
||||||
@@ -132,14 +133,14 @@ sub DespamPage {
|
|||||||
# from DoHistory()
|
# from DoHistory()
|
||||||
my @revisions = sort {$b <=> $a} map { m|/([0-9]+).kp$|; $1; } GetKeepFiles($OpenPageName);
|
my @revisions = sort {$b <=> $a} map { m|/([0-9]+).kp$|; $1; } GetKeepFiles($OpenPageName);
|
||||||
foreach my $revision (@revisions) {
|
foreach my $revision (@revisions) {
|
||||||
my ($text, $rev) = GetTextRevision($revision, 1); # quiet
|
my ($revisionPage, $rev) = GetTextRevision($revision, 1); # quiet
|
||||||
if (not $rev) {
|
if (not $rev) {
|
||||||
print ': ' . Ts('Cannot find revision %s.', $revision);
|
print ': ' . Ts('Cannot find revision %s.', $revision);
|
||||||
return;
|
return;
|
||||||
} elsif (not DespamBannedContent($text)) {
|
} elsif (not DespamBannedContent($revisionPage->{text})) {
|
||||||
my $summary = Tss('Revert to revision %1: %2', $revision, $rule);
|
my $summary = Tss('Revert to revision %1: %2', $revision, $rule);
|
||||||
print ': ' . $summary;
|
print ': ' . $summary;
|
||||||
Save($OpenPageName, $text, $summary) unless GetParam('debug', 0);
|
Save($OpenPageName, $revisionPage->{text}, $summary) unless GetParam('debug', 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('diff.pl', 'Diff Action Extension');
|
AddModuleDescription('diff.pl', 'Diff Action Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('div-foo.pl', 'Div Foo Extension');
|
AddModuleDescription('div-foo.pl', 'Div Foo Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('dojo.pl', 'Using Dojo Instead Of Wiki Markup');
|
AddModuleDescription('dojo.pl', 'Using Dojo Instead Of Wiki Markup');
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ $DojoTheme = 'tundra';
|
|||||||
push (@MyRules, \&WysiwygRule);
|
push (@MyRules, \&WysiwygRule);
|
||||||
|
|
||||||
sub WysiwygRule {
|
sub WysiwygRule {
|
||||||
if (m/\G(<.*?>)/gc) {
|
if (m/\G(<.*?>)/cg) {
|
||||||
return $1 if substr($1,5,6) eq 'script'
|
return $1 if substr($1,5,6) eq 'script'
|
||||||
or substr($1,4,6) eq 'script';
|
or substr($1,4,6) eq 'script';
|
||||||
return UnquoteHtml($1);
|
return UnquoteHtml($1);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
# JavaScript enabled for this to work.
|
# JavaScript enabled for this to work.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('doubleclick.pl', 'Doubleclick Extension');
|
AddModuleDescription('doubleclick.pl', 'Doubleclick Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('download.pl', 'Download Extension');
|
AddModuleDescription('download.pl', 'Download Extension');
|
||||||
|
|
||||||
@@ -27,8 +28,8 @@ push( @MyRules, \&DownloadSupportRule );
|
|||||||
# [[download:page name|alternate title]]
|
# [[download:page name|alternate title]]
|
||||||
|
|
||||||
sub DownloadSupportRule {
|
sub DownloadSupportRule {
|
||||||
if (m/\G(\[\[download:$FreeLinkPattern\|([^\]]+)\]\])/cog
|
if (m/\G(\[\[download:$FreeLinkPattern\|([^\]]+)\]\])/cg
|
||||||
or m!\G(\[\[download:$FreeLinkPattern\]\])!cog) {
|
or m!\G(\[\[download:$FreeLinkPattern\]\])!cg) {
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
print GetDownloadLink($2, undef, undef, $3);
|
print GetDownloadLink($2, undef, undef, $3);
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
use File::Glob ':glob';
|
use File::Glob ':glob';
|
||||||
our ($DraftDir);
|
our ($DraftDir);
|
||||||
@@ -28,7 +29,7 @@ push(@MyInitVariables, \&DraftInit);
|
|||||||
sub DraftInit {
|
sub DraftInit {
|
||||||
if (GetParam('Draft', '')) {
|
if (GetParam('Draft', '')) {
|
||||||
SetParam('action', 'draft') ; # Draft button used
|
SetParam('action', 'draft') ; # Draft button used
|
||||||
} elsif (-f "$DraftDir/" . GetParam('username', GetRemoteHost()) # draft exists
|
} elsif (-f "$DraftDir/" . GetParam('username', $q->remote_addr()) # draft exists
|
||||||
and $FooterNote !~ /action=draft/) { # take care of mod_perl persistence
|
and $FooterNote !~ /action=draft/) { # take care of mod_perl persistence
|
||||||
$FooterNote = $q->p(ScriptLink('action=draft', T('Recover Draft'))) . $FooterNote;
|
$FooterNote = $q->p(ScriptLink('action=draft', T('Recover Draft'))) . $FooterNote;
|
||||||
}
|
}
|
||||||
@@ -38,7 +39,7 @@ $Action{draft} = \&DoDraft;
|
|||||||
|
|
||||||
sub DoDraft {
|
sub DoDraft {
|
||||||
my $id = shift;
|
my $id = shift;
|
||||||
my $draft = $DraftDir . '/' . GetParam('username', GetRemoteHost());
|
my $draft = $DraftDir . '/' . GetParam('username', $q->remote_addr());
|
||||||
if ($id) {
|
if ($id) {
|
||||||
my $text = GetParam('text', '');
|
my $text = GetParam('text', '');
|
||||||
ReportError(T('No text to save'), '400 BAD REQUEST') unless $text;
|
ReportError(T('No text to save'), '400 BAD REQUEST') unless $text;
|
||||||
@@ -47,10 +48,10 @@ sub DoDraft {
|
|||||||
SetParam('msg', T('Draft saved')); # invalidate cache
|
SetParam('msg', T('Draft saved')); # invalidate cache
|
||||||
print GetHttpHeader('', T('Draft saved'), '204 NO CONTENT');
|
print GetHttpHeader('', T('Draft saved'), '204 NO CONTENT');
|
||||||
} elsif (-f $draft) {
|
} elsif (-f $draft) {
|
||||||
my %data = ParseData(ReadFileOrDie($draft));
|
my $data = ParseData(ReadFileOrDie($draft));
|
||||||
unlink ($draft);
|
unlink ($draft);
|
||||||
$Message .= $q->p(T('Draft recovered'));
|
$Message .= $q->p(T('Draft recovered'));
|
||||||
DoEdit($data{id}, $data{text}, 1);
|
DoEdit($data->{id}, $data->{text}, 1);
|
||||||
} else {
|
} else {
|
||||||
ReportError(T('No draft available to recover'), '404 NOT FOUND');
|
ReportError(T('No draft available to recover'), '404 NOT FOUND');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('duckduckgo-search.pl', 'Use DuckDuckGo For Searches');
|
AddModuleDescription('duckduckgo-search.pl', 'Use DuckDuckGo For Searches');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('dynamic-comments.pl', 'Dynamic Comments Extension');
|
AddModuleDescription('dynamic-comments.pl', 'Dynamic Comments Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('dynlogo.pl', 'Dynamic Logo');
|
AddModuleDescription('dynlogo.pl', 'Dynamic Logo');
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('edit-assist.pl', 'Edit Assist Extension');
|
AddModuleDescription('edit-assist.pl', 'Edit Assist Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('edit-cluster.pl', 'Edit Cluster Extension');
|
AddModuleDescription('edit-cluster.pl', 'Edit Cluster Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('edit-paragraphs.pl', 'Edit Paragraphs Extension');
|
AddModuleDescription('edit-paragraphs.pl', 'Edit Paragraphs Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Email_Quote_Extension
|
# http://www.oddmuse.org/cgi-bin/oddmuse/Email_Quote_Extension
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('emailquote.pl', 'Email Quote Extension');
|
AddModuleDescription('emailquote.pl', 'Email Quote Extension');
|
||||||
|
|
||||||
@@ -20,14 +21,14 @@ push(@MyRules, \&EmailQuoteRule);
|
|||||||
|
|
||||||
sub EmailQuoteRule {
|
sub EmailQuoteRule {
|
||||||
# > on a line of its own should work
|
# > on a line of its own should work
|
||||||
if ($bol && m/\G(\s*\n)*((\>))+\n/cog) {
|
if ($bol && m/\G(\s*\n)*((\>))+\n/cg) {
|
||||||
return $q->p();
|
return $q->p();
|
||||||
}
|
}
|
||||||
# > hi, you mentioned that:
|
# > hi, you mentioned that:
|
||||||
# >> I don't like Oddmuse.
|
# >> I don't like Oddmuse.
|
||||||
# > in last letter.
|
# > in last letter.
|
||||||
elsif ($bol && m/\G(\s*\n)*((\>)+)[ \t]/cog
|
elsif ($bol && m/\G(\s*\n)*((\>)+)[ \t]/cg
|
||||||
or InElement('dd') && m/\G(\s*\n)+((\>)+)[ \t]/cog) {
|
or InElement('dd') && m/\G(\s*\n)+((\>)+)[ \t]/cg) {
|
||||||
my $leng = length($2) / 4;
|
my $leng = length($2) / 4;
|
||||||
return CloseHtmlEnvironmentUntil('dd') . OpenHtmlEnvironment('dl',$leng, 'quote')
|
return CloseHtmlEnvironmentUntil('dd') . OpenHtmlEnvironment('dl',$leng, 'quote')
|
||||||
. $q->dt() . AddHtmlEnvironment('dd');
|
. $q->dt() . AddHtmlEnvironment('dd');
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('emoji.pl', 'Smilies');
|
AddModuleDescription('emoji.pl', 'Smilies');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('enclosure.pl', 'Podcasting');
|
AddModuleDescription('enclosure.pl', 'Podcasting');
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ push(@MyRules, \&EnclosureRule);
|
|||||||
# [[enclosure:url|size in bytes|mime type]]
|
# [[enclosure:url|size in bytes|mime type]]
|
||||||
|
|
||||||
sub EnclosureRule {
|
sub EnclosureRule {
|
||||||
if (m!\G\[\[enclosure:\s*$FreeLinkPattern(\|([^\]]+))?\]\]!ogci) {
|
if (m!\G\[\[enclosure:\s*$FreeLinkPattern(\|([^\]]+))?\]\]!cgi) {
|
||||||
my $id = FreeToNormal($1);
|
my $id = FreeToNormal($1);
|
||||||
# Make sure we don't add duplicates; we will add non-existing
|
# Make sure we don't add duplicates; we will add non-existing
|
||||||
# enclosures as well. We test for existence only when the RSS feed
|
# enclosures as well. We test for existence only when the RSS feed
|
||||||
@@ -55,8 +56,8 @@ sub NewEnclosureRssItem {
|
|||||||
my $id = shift;
|
my $id = shift;
|
||||||
my $rss = OldEnclosureRssItem($id, @_);
|
my $rss = OldEnclosureRssItem($id, @_);
|
||||||
require MIME::Base64;
|
require MIME::Base64;
|
||||||
my %data = ParseData(ReadFileOrDie(GetPageFile($id)));
|
my $data = ParseData(ReadFileOrDie(GetPageFile($id)));
|
||||||
my @enclosures = split(' ', $data{enclosures});
|
my @enclosures = split(' ', $data->{enclosures});
|
||||||
my $enclosures = '';
|
my $enclosures = '';
|
||||||
foreach my $enclosure (@enclosures) {
|
foreach my $enclosure (@enclosures) {
|
||||||
# Don't add the enclosure if the page has been deleted in the mean
|
# Don't add the enclosure if the page has been deleted in the mean
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
# the css classes div.question and div.answer.
|
# the css classes div.question and div.answer.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('faq.pl', 'FAQ Extension');
|
AddModuleDescription('faq.pl', 'FAQ Extension');
|
||||||
|
|
||||||
@@ -37,10 +38,10 @@ $FaqAnswerText = "Answer: " unless $FaqAnswerText;
|
|||||||
push(@MyRules, \&FaqRule);
|
push(@MyRules, \&FaqRule);
|
||||||
|
|
||||||
sub FaqRule {
|
sub FaqRule {
|
||||||
if ($bol && m/\GQ: (.+)/gc) {
|
if ($bol && m/\GQ: (.+)/cg) {
|
||||||
return $q->a({name=>'FAQ_' . UrlEncode($1)},'')
|
return $q->a({name=>'FAQ_' . UrlEncode($1)},'')
|
||||||
. $q->div({class=>'question'}, $FaqQuestionText . $1);
|
. $q->div({class=>'question'}, $FaqQuestionText . $1);
|
||||||
} elsif ($bol && m/\GA:[ \t]*/gc) {
|
} elsif ($bol && m/\GA:[ \t]*/cg) {
|
||||||
return CloseHtmlEnvironments()
|
return CloseHtmlEnvironments()
|
||||||
. AddHtmlEnvironment('div', "class='answer'") . $FaqAnswerText;
|
. AddHtmlEnvironment('div', "class='answer'") . $FaqAnswerText;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA,
|
# Boston, MA 02111-1307 USA,
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('fckeditor.pl', 'Using FCKeditor In Addition To Wiki Markup');
|
AddModuleDescription('fckeditor.pl', 'Using FCKeditor In Addition To Wiki Markup');
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ $FCKeditorHeight = 400; # Pixel
|
|||||||
push (@MyRules, \&WysiwygRule);
|
push (@MyRules, \&WysiwygRule);
|
||||||
|
|
||||||
sub WysiwygRule {
|
sub WysiwygRule {
|
||||||
if (m/\G(<.*?>)/gc) {
|
if (m/\G(<.*?>)/cg) {
|
||||||
return $1 if substr($1,5,6) eq 'script'
|
return $1 if substr($1,5,6) eq 'script'
|
||||||
or substr($1,4,6) eq 'script';
|
or substr($1,4,6) eq 'script';
|
||||||
return UnquoteHtml($1);
|
return UnquoteHtml($1);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Field_List_Extension
|
# http://www.oddmuse.org/cgi-bin/oddmuse/Field_List_Extension
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('fieldlist.pl', 'Field List Extension');
|
AddModuleDescription('fieldlist.pl', 'Field List Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('find.pl', 'Find Extension');
|
AddModuleDescription('find.pl', 'Find Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('fix-encoding.pl', 'Fix Encoding');
|
AddModuleDescription('fix-encoding.pl', 'Fix Encoding');
|
||||||
|
|
||||||
|
|||||||
@@ -1,257 +0,0 @@
|
|||||||
#!/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,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('flickrgallery.pl', 'FlickrGallery Module');
|
AddModuleDescription('flickrgallery.pl', 'FlickrGallery Module');
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ $RuleOrder{\&FlickrGalleryRule} = -10;
|
|||||||
|
|
||||||
sub FlickrGalleryRule {
|
sub FlickrGalleryRule {
|
||||||
# This code is used when Markdown is not available
|
# This code is used when Markdown is not available
|
||||||
if (/\G^([\n\r]*\<\s*FlickrSet:\s*(\d+)\s*\>\s*)$/mgci) {
|
if (/\G^([\n\r]*\<\s*FlickrSet:\s*(\d+)\s*\>\s*)$/cgim) {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
my $oldstr = $_;
|
my $oldstr = $_;
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ sub FlickrGalleryRule {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/\G^([\n\r]*\<\s*FlickrPhoto:\s*(\d+)\s*([a-z0-9]*?)\s*($size)?\s*\>\s*)$/mgci) {
|
if (/\G^([\n\r]*\<\s*FlickrPhoto:\s*(\d+)\s*([a-z0-9]*?)\s*($size)?\s*\>\s*)$/cgim) {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
my $oldstr = $_;
|
my $oldstr = $_;
|
||||||
|
|
||||||
@@ -102,13 +103,13 @@ sub MarkdownFlickrGalleryRule {
|
|||||||
^<FlickrSet:\s*(\d+)\s*\>
|
^<FlickrSet:\s*(\d+)\s*\>
|
||||||
}{
|
}{
|
||||||
FlickrGallery($1);
|
FlickrGallery($1);
|
||||||
}xmgei;
|
}egimx;
|
||||||
|
|
||||||
$text =~ s{
|
$text =~ s{
|
||||||
^<FlickrPhoto:\s*(\d+)\s*([a-z0-9]*?)\s*($size)?\s*\>
|
^<FlickrPhoto:\s*(\d+)\s*([a-z0-9]*?)\s*($size)?\s*\>
|
||||||
}{
|
}{
|
||||||
GetFlickrPhoto($1,$2,$3);
|
GetFlickrPhoto($1,$2,$3);
|
||||||
}xmgei;
|
}egimx;
|
||||||
|
|
||||||
return $text
|
return $text
|
||||||
}
|
}
|
||||||
@@ -134,7 +135,7 @@ sub FlickrGallery {
|
|||||||
|
|
||||||
$result = $FlickrHeaderTemplate;
|
$result = $FlickrHeaderTemplate;
|
||||||
|
|
||||||
$result =~ s/(\$[a-zA-Z\d]+)/"defined $1 ? $1 : ''"/gee;
|
$result =~ s/(\$[a-zA-Z\d]+)/"defined $1 ? $1 : ''"/eeg;
|
||||||
|
|
||||||
# Get list of photos and process them
|
# Get list of photos and process them
|
||||||
$url = $FlickrBaseUrl . "?method=flickr.photosets.getPhotos&api_key=" .
|
$url = $FlickrBaseUrl . "?method=flickr.photosets.getPhotos&api_key=" .
|
||||||
@@ -152,7 +153,7 @@ sub FlickrGallery {
|
|||||||
|
|
||||||
my $footer = $FlickrFooterTemplate;
|
my $footer = $FlickrFooterTemplate;
|
||||||
|
|
||||||
$footer =~ s/(\$[a-zA-Z\d]+)/"defined $1 ? $1 : ''"/gee;
|
$footer =~ s/(\$[a-zA-Z\d]+)/"defined $1 ? $1 : ''"/eeg;
|
||||||
$result .= $footer;
|
$result .= $footer;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -191,7 +192,7 @@ sub FlickrPhoto {
|
|||||||
|
|
||||||
|
|
||||||
my $output = $FlickrImageTemplate;
|
my $output = $FlickrImageTemplate;
|
||||||
$output =~ s/(\$[a-zA-Z\d]+)/"defined $1 ? $1 : ''"/gee;
|
$output =~ s/(\$[a-zA-Z\d]+)/"defined $1 ? $1 : ''"/eeg;
|
||||||
|
|
||||||
return $output
|
return $output
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
# ====================[ footnotes.pl ]====================
|
# ====================[ footnotes.pl ]====================
|
||||||
|
|
||||||
|
=encoding utf8
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
footnotes - An Oddmuse module for adding footnotes to Oddmuse Wiki pages.
|
footnotes - An Oddmuse module for adding footnotes to Oddmuse Wiki pages.
|
||||||
@@ -239,13 +242,13 @@ sub FootnotesRule {
|
|||||||
# Footnotes and the set of all footnotes must be marked so as to ensure their
|
# Footnotes and the set of all footnotes must be marked so as to ensure their
|
||||||
# reevaluation, as each of the footnotes might contain Wiki markup requiring
|
# reevaluation, as each of the footnotes might contain Wiki markup requiring
|
||||||
# reevaluation (like, say, free links).
|
# reevaluation (like, say, free links).
|
||||||
if (m/\G($FootnotePattern)(?=([ \t]*$FootnotePattern)?)/gcos) {
|
if (m/\G($FootnotePattern)(?=([ \t]*$FootnotePattern)?)/cgs) {
|
||||||
Dirty($1); # do not cache the prefixing "\G"
|
Dirty($1); # do not cache the prefixing "\G"
|
||||||
my $footnote_text = $2;
|
my $footnote_text = $2;
|
||||||
my $is_adjacent_footnote = defined $3;
|
my $is_adjacent_footnote = defined $3;
|
||||||
|
|
||||||
# A number range (e.g., "2-5") of references to other footnotes.
|
# A number range (e.g., "2-5") of references to other footnotes.
|
||||||
if ($footnote_text =~ m/^(\d+)-(\d+)$/o) {
|
if ($footnote_text =~ m/^(\d+)-(\d+)$/) {
|
||||||
my ($footnote_number_first, $footnote_number_last) = ($1, $2);
|
my ($footnote_number_first, $footnote_number_last) = ($1, $2);
|
||||||
# '–', below, is the HTML entity for a Unicode en-dash.
|
# '–', below, is the HTML entity for a Unicode en-dash.
|
||||||
print $q->a({-href=> '#footnotes' .$footnote_number_first,
|
print $q->a({-href=> '#footnotes' .$footnote_number_first,
|
||||||
@@ -258,7 +261,7 @@ sub FootnotesRule {
|
|||||||
}, $footnote_number_last.($is_adjacent_footnote ? ', ' : ''));
|
}, $footnote_number_last.($is_adjacent_footnote ? ', ' : ''));
|
||||||
}
|
}
|
||||||
# A number (e.g., "5") implying reference to another footnote.
|
# A number (e.g., "5") implying reference to another footnote.
|
||||||
elsif ($footnote_text =~ m/^(\d+)$/o) {
|
elsif ($footnote_text =~ m/^(\d+)$/) {
|
||||||
my $footnote_number = $1;
|
my $footnote_number = $1;
|
||||||
print $q->a({-href=> '#footnotes' .$footnote_number,
|
print $q->a({-href=> '#footnotes' .$footnote_number,
|
||||||
-title=> 'Footnote #'.$footnote_number,
|
-title=> 'Footnote #'.$footnote_number,
|
||||||
@@ -282,7 +285,7 @@ sub FootnotesRule {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
# The "<footnotes>" list of all footnotes at the foot of a page.
|
# The "<footnotes>" list of all footnotes at the foot of a page.
|
||||||
elsif ($bol && m/\G($FootnotesPattern)/gcios) {
|
elsif ($bol && m/\G($FootnotesPattern)/cgis) {
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1); # do not cache the prefixing "\G"
|
Dirty($1); # do not cache the prefixing "\G"
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('form_timeout.pl', 'Form Timeout Extension');
|
AddModuleDescription('form_timeout.pl', 'Form Timeout Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
# ====================[ forms.pl ]====================
|
# ====================[ forms.pl ]====================
|
||||||
|
|
||||||
@@ -18,9 +19,9 @@ sub FormsRule {
|
|||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($form);
|
Dirty($form);
|
||||||
$form =~ s/\%([a-z]+)\%/GetParam($1)/ge;
|
$form =~ s/\%([a-z]+)\%/GetParam($1)/eg;
|
||||||
$form =~ s/\$([a-z]+)\$/$q->span({-class=>'param'}, GetParam($1))
|
$form =~ s/\$([a-z]+)\$/$q->span({-class=>'param'}, GetParam($1))
|
||||||
.$q->input({-type=>'hidden', -name=>$1, -value=>GetParam($1)})/ge;
|
.$q->input({-type=>'hidden', -name=>$1, -value=>GetParam($1)})/eg;
|
||||||
print UnquoteHtml($form);
|
print UnquoteHtml($form);
|
||||||
pos = $oldpos;
|
pos = $oldpos;
|
||||||
return AddHtmlEnvironment('p');
|
return AddHtmlEnvironment('p');
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('fractions.pl', 'Fractions');
|
AddModuleDescription('fractions.pl', 'Fractions');
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# Codes reused from questionasker.pl for Oddmuse
|
# Codes reused from questionasker.pl for Oddmuse
|
||||||
# Copyright (C) 2004 Brock Wilcox <awwaiid@thelackthereof.org>
|
# Copyright (C) 2004 Brock Wilcox <awwaiid@thelackthereof.org>
|
||||||
# Copyright (C) 2006, 2007 Alex Schroeder <alex@gnu.org>
|
# Copyright (C) 2006–2015 Alex Schroeder <alex@gnu.org>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,10 +23,11 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('gd_security_image.pl', 'GD Security Image Extension');
|
AddModuleDescription('gd_security_image.pl', 'GD Security Image Extension');
|
||||||
|
|
||||||
our ($q, $Now, %Action, $FullUrl, $LinkPattern, $FreeLinks, $FreeLinkPattern, $WikiLinks, $DataDir, $ModuleDir, @MyInitVariables, %CookieParameters, %InvisibleCookieParameters);
|
our ($q, $Now, %Action, $FullUrl, $LinkPattern, $FreeLinks, $FreeLinkPattern, $WikiLinks, $DataDir, $ModuleDir, @MyInitVariables, %CookieParameters, @MyFormChanges);
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
@@ -239,9 +240,9 @@ sub GdSecurityImageCheck {
|
|||||||
if ($answer ne '' && GdSecurityImageIsValidId($id)) {
|
if ($answer ne '' && GdSecurityImageIsValidId($id)) {
|
||||||
my ($status, $data) = ReadFile(GdSecurityImageGetTicketFile($id));
|
my ($status, $data) = ReadFile(GdSecurityImageGetTicketFile($id));
|
||||||
if ($status) {
|
if ($status) {
|
||||||
my %page = ParseData($data);
|
my $page = ParseData($data);
|
||||||
if ($page{generation_time} + $GdSecurityImageDuration > $Now) {
|
if ($page->{generation_time} + $GdSecurityImageDuration > $Now) {
|
||||||
if ($answer eq $page{string}) {
|
if ($answer eq $page->{string}) {
|
||||||
$GdSecurityImageId = '';
|
$GdSecurityImageId = '';
|
||||||
if (!$GdSecurityImageRememberAnswer) {
|
if (!$GdSecurityImageRememberAnswer) {
|
||||||
SetParam('gd_security_image_id', '');
|
SetParam('gd_security_image_id', '');
|
||||||
@@ -324,22 +325,10 @@ sub NewGdSecurityImageDoPost {
|
|||||||
return (OldGdSecurityImageDoPost(@params));
|
return (OldGdSecurityImageDoPost(@params));
|
||||||
}
|
}
|
||||||
|
|
||||||
*OldGdSecurityImageGetEditForm = \&GetEditForm;
|
push(@MyFormChanges, \&GdSecurityImageAddTo);
|
||||||
*GetEditForm = \&NewGdSecurityImageGetEditForm;
|
|
||||||
|
|
||||||
sub NewGdSecurityImageGetEditForm {
|
|
||||||
return GdSecurityImageAddTo(OldGdSecurityImageGetEditForm(@_), $_[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*OldGdSecurityImageGetCommentForm = \&GetCommentForm;
|
|
||||||
*GetCommentForm = \&NewGdSecurityImageGetCommentForm;
|
|
||||||
|
|
||||||
sub NewGdSecurityImageGetCommentForm {
|
|
||||||
return GdSecurityImageAddTo(OldGdSecurityImageGetCommentForm(@_));
|
|
||||||
}
|
|
||||||
|
|
||||||
sub GdSecurityImageAddTo {
|
sub GdSecurityImageAddTo {
|
||||||
my ($form, $upload) = @_;
|
my ($form, $type, $upload) = @_;
|
||||||
if (not $upload
|
if (not $upload
|
||||||
and not GdSecurityImageException(GetId())
|
and not GdSecurityImageException(GetId())
|
||||||
and not UserIsEditor()) {
|
and not UserIsEditor()) {
|
||||||
@@ -396,7 +385,5 @@ sub GdSecurityImageInitVariables {
|
|||||||
$GdSecurityImagePngToAA = "$ModuleDir/pngtoaa";
|
$GdSecurityImagePngToAA = "$ModuleDir/pngtoaa";
|
||||||
|
|
||||||
$CookieParameters{'gd_security_image_id'} = '';
|
$CookieParameters{'gd_security_image_id'} = '';
|
||||||
$InvisibleCookieParameters{'gd_security_image_id'} = 1;
|
|
||||||
$CookieParameters{'gd_security_image_answer'} = '';
|
$CookieParameters{'gd_security_image_answer'} = '';
|
||||||
$InvisibleCookieParameters{'gd_security_image_answer'} = 1;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('git-another.pl', 'Another Git Extension');
|
AddModuleDescription('git-another.pl', 'Another Git Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
our ($q);
|
our ($q);
|
||||||
our ($GoogleCustomSearchEngine);
|
our ($GoogleCustomSearchEngine);
|
||||||
|
|||||||
@@ -18,41 +18,72 @@ use v5.10;
|
|||||||
|
|
||||||
AddModuleDescription('google-plus-one.pl', 'Google Plus One Module');
|
AddModuleDescription('google-plus-one.pl', 'Google Plus One Module');
|
||||||
|
|
||||||
our ($q, @MyAdminCode, %Action);
|
our ($q, $RCName, @MyFooters, @MyAdminCode, %Action, @MyInitVariables, $CommentsPrefix);
|
||||||
|
|
||||||
my $data_uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAAAYCAMAAABnVuv4AAAAhFBMVEUAAAD////MzMz5+fkWau+zs7Pg4OD39/fh4eHu7u7z8/Pk5OTm5ubX19fx8fHj4+N+fn5jY2Ojo6N/f3/r7Ov29vbq6ero6Oj19fUVau0XafC3zO3q6ulKie2dve89ge1yoexkmeyNsepZk+/T3u4weu4jcu7E1Ox9p+rExMTX4vLi6PBsAh6oAAAAAXRSTlMAQObYZgAAAWtJREFUOMvFldluwjAQRU24LgHTpAsEgglL2Nv//7/OeGLLqlTXD5V6HM/c2NJRMJGilClSGCW8DbwEXgPvA+QqRylKI66kLNiKUZri72X6OQOdKxtn8E+yCTMOjQdBhbvEbNkkA5EBoJKULdc0ltHksv447ZaM7JJMNO1PstLZ9Gw2W9PgSxJXe4V1QZZIxiIGI4AbWs5hso1lFY0BwLXzEcBnWK8qJ9uIDKxlMbjyKnex6SoCcO2CKy7xupxZG57GKSBBbsSmp56btYC1t+l5v9vhNI0QmZyZVC+DPKa4IlkHR8f5gD4hQyzb0AhntvAcuo5U3YHzvrWLCJZFmlZ+pp/Rv9k022a75do0ABWKHCTJ9e0923Bmn6ij92xOrAaA1YpvLPZzCrJO+yxLE2Rm7rnfpfc4UjV+x2TLzEBtAvURvYnIl9UDJU8qcsmSL9myMoNs2VMGWtVZHxT9+N310ErVRYpaCToD9QXtvTL0OWiBLQAAAABJRU5ErkJggg==';
|
my $data_uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAAAYCAMAAABnVuv4AAAAhFBMVEUAAAD////MzMz5+fkWau+zs7Pg4OD39/fh4eHu7u7z8/Pk5OTm5ubX19fx8fHj4+N+fn5jY2Ojo6N/f3/r7Ov29vbq6ero6Oj19fUVau0XafC3zO3q6ulKie2dve89ge1yoexkmeyNsepZk+/T3u4weu4jcu7E1Ox9p+rExMTX4vLi6PBsAh6oAAAAAXRSTlMAQObYZgAAAWtJREFUOMvFldluwjAQRU24LgHTpAsEgglL2Nv//7/OeGLLqlTXD5V6HM/c2NJRMJGilClSGCW8DbwEXgPvA+QqRylKI66kLNiKUZri72X6OQOdKxtn8E+yCTMOjQdBhbvEbNkkA5EBoJKULdc0ltHksv447ZaM7JJMNO1PstLZ9Gw2W9PgSxJXe4V1QZZIxiIGI4AbWs5hso1lFY0BwLXzEcBnWK8qJ9uIDKxlMbjyKnex6SoCcO2CKy7xupxZG57GKSBBbsSmp56btYC1t+l5v9vhNI0QmZyZVC+DPKa4IlkHR8f5gD4hQyzb0AhntvAcuo5U3YHzvrWLCJZFmlZ+pp/Rv9k022a75do0ABWKHCTJ9e0923Bmn6ij92xOrAaA1YpvLPZzCrJO+yxLE2Rm7rnfpfc4UjV+x2TLzEBtAvURvYnIl9UDJU8qcsmSL9myMoNs2VMGWtVZHxT9+N310ErVRYpaCToD9QXtvTL0OWiBLQAAAABJRU5ErkJggg==';
|
||||||
|
|
||||||
# Two step Google +1 button to protect your privacy: show this at the bottom
|
# Make sure journal pages set a global variable which we then use to
|
||||||
# of every form.
|
# hide the +1 button.
|
||||||
|
|
||||||
*MyOldGetCommentForm=*GetCommentForm;
|
*OldGooglePlusPrintJournal = \&PrintJournal;
|
||||||
*GetCommentForm=*MyNewGetCommentForm;
|
*PrintJournal = \&NewGooglePlusPrintJournal;
|
||||||
|
|
||||||
sub MyNewGetCommentForm {
|
my $GooglePlusThisPagePrintedJournal;
|
||||||
return MyOldGetCommentForm(@_) . qq{
|
|
||||||
|
push(@MyInitVariables, sub {
|
||||||
|
$GooglePlusThisPagePrintedJournal = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
sub NewGooglePlusPrintJournal {
|
||||||
|
$GooglePlusThisPagePrintedJournal = 1;
|
||||||
|
return OldGooglePlusPrintJournal(@_);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use a two step Google +1 button to protect your privacy: show this
|
||||||
|
# at the bottom of every page but not on comment pages, Recent
|
||||||
|
# changes, and pages that printed a journal.
|
||||||
|
|
||||||
|
unshift(@MyFooters, \&GooglePlusPrintFooter);
|
||||||
|
|
||||||
|
sub GooglePlusPrintFooter {
|
||||||
|
my ($id, $rev, $comment) = @_;
|
||||||
|
if (not $GooglePlusThisPagePrintedJournal
|
||||||
|
and (GetParam('action', 'browse') eq 'plusone'
|
||||||
|
or (GetParam('action', 'browse') eq 'browse'
|
||||||
|
and $id
|
||||||
|
and $id ne $RCName
|
||||||
|
and (not $CommentsPrefix or $id !~ /^$CommentsPrefix(.*)/)))) {
|
||||||
|
return q{
|
||||||
|
<!-- start of Google+ -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function loadScript(jssource,thelink) {
|
function loadScript(jssource,link_id) {
|
||||||
|
// add javascript
|
||||||
var jsnode = document.createElement('script');
|
var jsnode = document.createElement('script');
|
||||||
jsnode.setAttribute('type','text/javascript');
|
jsnode.setAttribute('type','text/javascript');
|
||||||
jsnode.setAttribute('src',jssource);
|
jsnode.setAttribute('src',jssource);
|
||||||
document.getElementsByTagName('head')[0].appendChild(jsnode);
|
document.getElementsByTagName('head')[0].appendChild(jsnode);
|
||||||
document.getElementById(thelink).innerHTML = "";
|
// add button
|
||||||
|
var butn = document.createElement('div');
|
||||||
|
butn.setAttribute('class', 'g-plusone');
|
||||||
|
butn.setAttribute('id', 'my_plusone');
|
||||||
|
var link = document.getElementById(link_id);
|
||||||
|
link.parentNode.insertBefore(butn, link);
|
||||||
|
// hide the link
|
||||||
|
link.innerHTML = "";
|
||||||
}
|
}
|
||||||
var plus1source = "https://apis.google.com/js/plusone.js";
|
var plus1source = "https://apis.google.com/js/plusone.js";
|
||||||
</script>
|
</script>
|
||||||
<a id="plus1" href="javascript:loadScript(plus1source,'plus1')">
|
<p id="plus1">
|
||||||
<img src="$data_uri" alt="Show Google +1" />
|
<a href="javascript:loadScript(plus1source,'plus1')">
|
||||||
</a>
|
<img src="/pics/plusone-h24.png" alt="Show Google +1" />
|
||||||
<!-- <g:plusone></g:plusone> -->
|
</a>
|
||||||
<div class="g-plusone" id="my_plusone"></div>
|
</p>
|
||||||
<script type="text/javascript">
|
<!-- end of Google+ -->
|
||||||
document.getElementById("my_plusone").setAttribute("data-size", "medium");
|
|
||||||
document.getElementById("my_plusone").setAttribute("data-href", document.location.href);
|
|
||||||
</script>
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Google +1 list
|
# Google +1 list
|
||||||
|
|
||||||
push(@MyAdminCode, sub {
|
push(@MyAdminCode, sub {
|
||||||
my ($id, $menuref, $restref) = @_;
|
my ($id, $menuref, $restref) = @_;
|
||||||
@@ -71,7 +102,7 @@ sub DoPlusOne {
|
|||||||
foreach my $id (AllPagesList()) {
|
foreach my $id (AllPagesList()) {
|
||||||
push(@pages, $id) if $id =~ /^\d\d\d\d-\d\d-\d\d/;
|
push(@pages, $id) if $id =~ /^\d\d\d\d-\d\d-\d\d/;
|
||||||
}
|
}
|
||||||
splice(@pages, 0, $#pages - 19); # last 20 items
|
splice(@pages, 0, $#pages - 19); # last 20 items
|
||||||
print "<ul>";
|
print "<ul>";
|
||||||
foreach my $id (@pages) {
|
foreach my $id (@pages) {
|
||||||
my $url = ScriptUrl(UrlEncode($id));
|
my $url = ScriptUrl(UrlEncode($id));
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('google-search.pl', 'Use Google For Searches');
|
AddModuleDescription('google-search.pl', 'Use Google For Searches');
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
our (%Page, %IndexHash, %AdminPages, $HomePage, $RCName, @MyInitVariables, $LinkPattern, $FreeLinkPattern, $FullUrlPattern, $InterLinkPattern, $UserGotoBar, @UserGotoBarPages);
|
our (%Page, %IndexHash, %AdminPages, $HomePage, $RCName, @MyInitVariables, $LinkPattern, $FreeLinkPattern, $FullUrlPattern, $InterLinkPattern, $UserGotoBar, @UserGotoBarPages);
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ sub GotobarInit {
|
|||||||
@UserGotoBarPages = ();
|
@UserGotoBarPages = ();
|
||||||
$UserGotoBar = '';
|
$UserGotoBar = '';
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while ($Page{text} =~ m/($LinkPattern|\[\[$FreeLinkPattern\]\]|\[\[$FreeLinkPattern\|([^\]]+)\]\]|\[$InterLinkPattern\s+([^\]]+?)\]|\[$FullUrlPattern[|[:space:]]([^\]]+?)\])/og) {
|
while ($Page{text} =~ m/($LinkPattern|\[\[$FreeLinkPattern\]\]|\[\[$FreeLinkPattern\|([^\]]+)\]\]|\[$InterLinkPattern\s+([^\]]+?)\]|\[$FullUrlPattern[|[:space:]]([^\]]+?)\])/g) {
|
||||||
my $page = $2||$3||$4||$6||$8;
|
my $page = $2||$3||$4||$6||$8;
|
||||||
my $text = $5||$7||$9;
|
my $text = $5||$7||$9;
|
||||||
$UserGotoBar .= ' ' if $UserGotoBar;
|
$UserGotoBar .= ' ' if $UserGotoBar;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2010 Alex Schroeder <alex@gnu.org>
|
# Copyright (C) 2010–2015 Alex Schroeder <alex@gnu.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it under
|
# 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
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
@@ -13,12 +13,13 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('gravatar.pl', 'Gravatar');
|
AddModuleDescription('gravatar.pl', 'Gravatar');
|
||||||
|
|
||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
our ($q, $bol, %CookieParameters, $FullUrlPattern, @MyRules, @MyInitVariables);
|
our ($q, $bol, %CookieParameters, $FullUrlPattern, @MyRules, @MyInitVariables, @MyFormChanges);
|
||||||
|
|
||||||
# Same as in mail.pl
|
# Same as in mail.pl
|
||||||
$CookieParameters{mail} = '';
|
$CookieParameters{mail} = '';
|
||||||
@@ -28,7 +29,7 @@ my $gravatar_regexp = "\\[\\[gravatar:(?:$FullUrlPattern )?([^\n:]+):([0-9a-f]+)
|
|||||||
push(@MyRules, \&GravatarRule);
|
push(@MyRules, \&GravatarRule);
|
||||||
|
|
||||||
sub GravatarRule {
|
sub GravatarRule {
|
||||||
if ($bol && m!\G$gravatar_regexp!cog) {
|
if ($bol && m!\G$gravatar_regexp!cg) {
|
||||||
my $url = $1;
|
my $url = $1;
|
||||||
my $gravatar = "https://secure.gravatar.com/avatar/$3";
|
my $gravatar = "https://secure.gravatar.com/avatar/$3";
|
||||||
my $name = FreeToNormal($2);
|
my $name = FreeToNormal($2);
|
||||||
@@ -45,13 +46,12 @@ sub GravatarRule {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*GravatarOldGetCommentForm = \&GetCommentForm;
|
sub GravatarFormAddition {
|
||||||
*GetCommentForm = \&GravatarNewGetCommentForm;
|
my ($html, $type) = @_;
|
||||||
|
|
||||||
|
# gravatars only make sense for comments
|
||||||
|
return $html unless $type eq 'comment';
|
||||||
|
|
||||||
sub GravatarNewGetCommentForm {
|
|
||||||
my $html = GravatarOldGetCommentForm(@_);
|
|
||||||
# the implementation in mail.pl takes precedence!
|
|
||||||
return $html if defined &MailNewGetCommentForm;
|
|
||||||
my $addition = $q->span({-class=>'mail'},
|
my $addition = $q->span({-class=>'mail'},
|
||||||
$q->label({-for=>'mail'}, T('Email: '))
|
$q->label({-for=>'mail'}, T('Email: '))
|
||||||
. ' ' . $q->textfield(-name=>'mail', -id=>'mail',
|
. ' ' . $q->textfield(-name=>'mail', -id=>'mail',
|
||||||
@@ -63,6 +63,12 @@ sub GravatarNewGetCommentForm {
|
|||||||
push(@MyInitVariables, \&AddGravatar);
|
push(@MyInitVariables, \&AddGravatar);
|
||||||
|
|
||||||
sub AddGravatar {
|
sub AddGravatar {
|
||||||
|
|
||||||
|
# the implementation in mail.pl takes precedence!
|
||||||
|
if (not grep { $_ == \&MailFormAddition } @MyFormChanges) {
|
||||||
|
push(@MyFormChanges, \&GravatarFormAddition);
|
||||||
|
}
|
||||||
|
|
||||||
my $aftertext = UnquoteHtml(GetParam('aftertext'));
|
my $aftertext = UnquoteHtml(GetParam('aftertext'));
|
||||||
my $mail = GetParam('mail');
|
my $mail = GetParam('mail');
|
||||||
$mail =~ s/^[ \t]+//;
|
$mail =~ s/^[ \t]+//;
|
||||||
@@ -84,6 +90,6 @@ sub AddGravatar {
|
|||||||
|
|
||||||
sub GravatarNewGetSummary {
|
sub GravatarNewGetSummary {
|
||||||
my $summary = GravatarOldGetSummary(@_);
|
my $summary = GravatarOldGetSummary(@_);
|
||||||
$summary =~ s/^$gravatar_regexp *//o;
|
$summary =~ s/^$gravatar_regexp *//;
|
||||||
return $summary;
|
return $summary;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('grep.pl');
|
AddModuleDescription('grep.pl');
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ sub PrintGrep {
|
|||||||
foreach my $id (AllPagesList()) {
|
foreach my $id (AllPagesList()) {
|
||||||
my $text = GetPageContent($id);
|
my $text = GetPageContent($id);
|
||||||
next if (TextIsFile($text)); # skip files
|
next if (TextIsFile($text)); # skip files
|
||||||
while ($text =~ m{($regexp)}ig) {
|
while ($text =~ m{($regexp)}gi) {
|
||||||
print $q->li(GetPageLink($id) . ': ' . $1);
|
print $q->li(GetPageLink($id) . ': ' . $1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('header-and-footer-templates.pl', 'Comments on HTML Templates');
|
AddModuleDescription('header-and-footer-templates.pl', 'Comments on HTML Templates');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('headers.pl', 'Header Markup Extension');
|
AddModuleDescription('headers.pl', 'Header Markup Extension');
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ $RuleOrder{\&HeadersRule} = 95;
|
|||||||
|
|
||||||
sub HeadersRule {
|
sub HeadersRule {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
if ($bol && (m/\G((.+?)[ \t]*\n(---+|===+)[ \t]*\n)/gc)) {
|
if ($bol && (m/\G((.+?)[ \t]*\n(---+|===+)[ \t]*\n)/cg)) {
|
||||||
my $html = CloseHtmlEnvironments() . ($PortraitSupportColorDiv ? '</div>' : '');
|
my $html = CloseHtmlEnvironments() . ($PortraitSupportColorDiv ? '</div>' : '');
|
||||||
if (substr($3,0,1) eq '=') {
|
if (substr($3,0,1) eq '=') {
|
||||||
$html .= $q->h2($2);
|
$html .= $q->h2($2);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('headlines.pl', 'Headlines Extension');
|
AddModuleDescription('headlines.pl', 'Headlines Extension');
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ push(@MyRules, \&HeadlinesRule);
|
|||||||
$HeadlineNumber = 20;
|
$HeadlineNumber = 20;
|
||||||
|
|
||||||
sub HeadlinesRule {
|
sub HeadlinesRule {
|
||||||
if (m/\G(\<headlines(:(\d+))?\>)/gci) {
|
if (m/\G(\<headlines(:(\d+))?\>)/cgi) {
|
||||||
if (($3) and ($3>0)) {$HeadlineNumber = $3;};
|
if (($3) and ($3>0)) {$HeadlineNumber = $3;};
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
use utf8;
|
||||||
|
|
||||||
# ====================[ hibernal.pl ]====================
|
# ====================[ hibernal.pl ]====================
|
||||||
|
|
||||||
|
=encoding utf8
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
hibernal - An Oddmuse module for improved multi- and single-blogging.
|
hibernal - An Oddmuse module for improved multi- and single-blogging.
|
||||||
@@ -1208,7 +1212,7 @@ sub GetHibernalArchiveMonth {
|
|||||||
~e;
|
~e;
|
||||||
$html_month =~ s~( {1,2})(\d{1,2})\b~
|
$html_month =~ s~( {1,2})(\d{1,2})\b~
|
||||||
$1.GetHibernalArchiveMonthDay($post_name_regexp, $year, $month, $2)
|
$1.GetHibernalArchiveMonthDay($post_name_regexp, $year, $month, $2)
|
||||||
~ge;
|
~eg;
|
||||||
|
|
||||||
# Float the HTML for each month horizontally past the month preceding it;
|
# Float the HTML for each month horizontally past the month preceding it;
|
||||||
# failure to float months in this manner causes these months to stack
|
# failure to float months in this manner causes these months to stack
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
# page cluster.
|
# page cluster.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('hiddenpages.pl', 'Hidden Pages Extension');
|
AddModuleDescription('hiddenpages.pl', 'Hidden Pages Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('html-template.pl', 'HTML Templates');
|
AddModuleDescription('html-template.pl', 'HTML Templates');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('html-uploads.pl', 'Restricted HTML Upload');
|
AddModuleDescription('html-uploads.pl', 'Restricted HTML Upload');
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
# http://www.oddmuse.org/cgi-bin/oddmuse/Html_Comment_Extension
|
# http://www.oddmuse.org/cgi-bin/oddmuse/Html_Comment_Extension
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('htmlcomment.pl', 'Html Comment Extension');
|
AddModuleDescription('htmlcomment.pl', 'Html Comment Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('htmllinks.pl', 'HtmlLinks Module');
|
AddModuleDescription('htmllinks.pl', 'HtmlLinks Module');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('image.pl', 'Image Extension');
|
AddModuleDescription('image.pl', 'Image Extension');
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ push(@MyRules, \&ImageSupportRule);
|
|||||||
|
|
||||||
sub ImageSupportRule {
|
sub ImageSupportRule {
|
||||||
my $result = undef;
|
my $result = undef;
|
||||||
if (m!\G\[\[image((/[a-z]+)*)( external)?:\s*([^]|]+?)\s*(\|[^]|]+?)?\s*(\|[^]|]*?)?\s*(\|[^]|]*?)?\s*(\|[^]|]*?)?\s*\]\](\{([^}]+)\})?!gc) {
|
if (m!\G\[\[image((/[a-z]+)*)( external)?:\s*([^]|]+?)\s*(\|[^]|]+?)?\s*(\|[^]|]*?)?\s*(\|[^]|]*?)?\s*(\|[^]|]*?)?\s*\]\](\{([^}]+)\})?!cg) {
|
||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
my $class = 'image' . $1;
|
my $class = 'image' . $1;
|
||||||
my $external = $3;
|
my $external = $3;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
use Digest::SHA qw(sha256_hex);
|
use Digest::SHA qw(sha256_hex);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('index.pl', 'Index Extension');
|
AddModuleDescription('index.pl', 'Index Extension');
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('irc.pl', 'IRC Log Extension');
|
AddModuleDescription('irc.pl', 'IRC Log Extension');
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ $IrcLinkNick = 0;
|
|||||||
# This adds an extra <br> at the beginning. Alternatively, add it to
|
# This adds an extra <br> at the beginning. Alternatively, add it to
|
||||||
# the last line, or only add it when required.
|
# the last line, or only add it when required.
|
||||||
sub IrcRule {
|
sub IrcRule {
|
||||||
if ($bol && m/\G(?:\[?(\d\d?:\d\d(?:am|pm)?)\]?)?\s*<($IrcNickRegexp)> ?/gc) {
|
if ($bol && m/\G(?:\[?(\d\d?:\d\d(?:am|pm)?)\]?)?\s*<($IrcNickRegexp)> ?/cg) {
|
||||||
my ($time, $nick) = ($1, $2);
|
my ($time, $nick) = ($1, $2);
|
||||||
my ($error) = ValidId($nick);
|
my ($error) = ValidId($nick);
|
||||||
# if we're in a dl, close the open dd but not the dl. (if we're
|
# if we're in a dl, close the open dd but not the dl. (if we're
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user