forked from github/kensanata.oddmuse
Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
# Copyright (C) 2007, 2008 Alex Schroeder <alex@gnu.org>
|
||||
# Copyright (C) 2007, 2008, 2013 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
# 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.
|
||||
# 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/>.
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/bbcode.pl">bbcode.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/bbCode_Extension">bbCode Extension</a></p>';
|
||||
|
||||
@@ -37,6 +36,10 @@ sub bbCodeRule {
|
||||
. qq{font-style: normal;"}); }
|
||||
elsif ($tag eq 's' or $tag eq 'strike') {
|
||||
return AddHtmlEnvironment('del'); }
|
||||
elsif ($tag eq 'sub') {
|
||||
return AddHtmlEnvironment('sub'); }
|
||||
elsif ($tag eq 'sup') {
|
||||
return AddHtmlEnvironment('sup'); }
|
||||
elsif ($tag eq 'color') {
|
||||
return AddHtmlEnvironment('em', qq{style="color: $option; }
|
||||
. qq{font-style: normal;"}); }
|
||||
@@ -96,7 +99,7 @@ sub bbCodeRule {
|
||||
%translate = qw{b b i i u em color em size em font span url a
|
||||
quote blockquote h1 h1 h2 h2 h3 h3 h4 h4 h5 h5
|
||||
h6 h6 center div left div right div list ul
|
||||
s del strike del highlight strong};
|
||||
s del strike del sub sub sup sup highlight strong};
|
||||
# closing a block level element closes all elements
|
||||
if ($bbBlock eq $translate{$tag}) {
|
||||
/\G([ \t]*\n)*/cg; # eat whitespace after closing block level element
|
||||
|
||||
60
modules/fractions.pl
Normal file
60
modules/fractions.pl
Normal file
@@ -0,0 +1,60 @@
|
||||
# Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software 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/>.
|
||||
|
||||
$ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/fractions.pl">fractions.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Fractions">Fractions</a></p>';
|
||||
|
||||
push(@MyRules, \&FractionsRule);
|
||||
|
||||
# usage: ^1/32
|
||||
sub FractionsRule {
|
||||
if (/\G\^([0-9]+)\/([0-9]+)/cg) {
|
||||
if ($1 == 1 and $2 == 4) { return "\¼"; }
|
||||
elsif ($1 == 1 and $2 == 2) { return "\½"; }
|
||||
elsif ($1 == 3 and $2 == 4) { return "\¾"; }
|
||||
elsif ($1 == 1 and $2 == 7) { return "\⅐"; }
|
||||
elsif ($1 == 1 and $2 == 9) { return "\⅑"; }
|
||||
elsif ($1 == 1 and $2 == 10) { return "\⅒"; }
|
||||
elsif ($1 == 1 and $2 == 3) { return "\⅓"; }
|
||||
elsif ($1 == 2 and $2 == 3) { return "\⅔"; }
|
||||
elsif ($1 == 1 and $2 == 5) { return "\⅕"; }
|
||||
elsif ($1 == 2 and $2 == 5) { return "\⅖"; }
|
||||
elsif ($1 == 3 and $2 == 5) { return "\⅗"; }
|
||||
elsif ($1 == 4 and $2 == 5) { return "\⅘"; }
|
||||
elsif ($1 == 1 and $2 == 6) { return "\⅙"; }
|
||||
elsif ($1 == 5 and $2 == 6) { return "\⅚"; }
|
||||
elsif ($1 == 1 and $2 == 8) { return "\⅛"; }
|
||||
elsif ($1 == 3 and $2 == 8) { return "\⅜"; }
|
||||
elsif ($1 == 5 and $2 == 8) { return "\⅝"; }
|
||||
elsif ($1 == 7 and $2 == 8) { return "\⅞"; }
|
||||
else {
|
||||
my $html;
|
||||
# superscripts
|
||||
for my $char (split(//, $1)) {
|
||||
if ($char eq '1') { $html .= "\¹"; }
|
||||
elsif ($char eq '2') { $html .= "\²"; }
|
||||
elsif ($char eq '3') { $html .= "\³"; }
|
||||
else { $html .= "\ȇ$char;"; }
|
||||
}
|
||||
# fraction slash
|
||||
$html .= '⁄';
|
||||
# subscripts
|
||||
for my $char (split(//, $2)) {
|
||||
$html .= "\Ȉ$char;";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
@@ -148,9 +148,12 @@ sub send_file {
|
||||
warn "No content for $title\n" unless $item->{description};
|
||||
my $link = $item->{link};
|
||||
my $sub = "$root?action=subscriptions";
|
||||
print $fh qq(<p>Visit <a href="$link">$title</a>)
|
||||
my $text = qq(<p>Visit <a href="$link">$title</a>)
|
||||
. qq( or <a href="$sub">manage your subscriptions</a>.</p><hr />)
|
||||
. $item->{description};
|
||||
# prevent 501 Syntax error - line too long
|
||||
$text =~ s/<(p|h[1-6]|[duo]l|pre|li|form|div|blockquote|hr|table|tr)>/\r\n<$1>/gi;
|
||||
print $fh $text;
|
||||
$fh->close;
|
||||
foreach my $subscriber (@subscribers) {
|
||||
send_mail($subscriber, $title, $fh);
|
||||
|
||||
3
wiki.pl
3
wiki.pl
@@ -1586,7 +1586,8 @@ sub GetRcLinesFor {
|
||||
rcclusteronly rcfilteronly match lang followup);
|
||||
# parsing and filtering
|
||||
my @result = ();
|
||||
open(F, '<:encoding(UTF-8)', $file) or return ();
|
||||
# using :utf8 instead of :encoding(utf-8) to avoid validation and warnings on corrupt files :(
|
||||
open(F, '<:utf8', $file) or return ();
|
||||
while (my $line = <F>) {
|
||||
chomp($line);
|
||||
my ($ts, $id, $minor, $summary, $host, $username, $revision,
|
||||
|
||||
Reference in New Issue
Block a user